ROW
- is the generic type of a row in the value list
.DELEGATE
- is the generic type of the delegate
.public abstract class UiWidgetCustomAbstractListTable<ROW,DELEGATE extends UiWidgetAbstractListTable<ROW>> extends UiWidgetCustom<List<ROW>,DELEGATE> implements UiWidgetAbstractListTable<ROW>
custom widget
implementing
UiWidgetAbstractListTable
.AbstractUiWidget.AccessHelper, AbstractUiWidget.EventSender, AbstractUiWidget.HandlerContainer
STYLE_DATA_TABLE
PROPERTY_SUMMARY
PROPERTY_TITLE
STYLE_HEADER
HTML_ATTRIBUTE_ID, ID_SEPARATOR, PROPERTY_ID
PROPERTY_STYLES, STYLE_PATTERN_MULTIPLE, STYLE_PATTERN_SINGLE
WAI_ARIA
Constructor and Description |
---|
UiWidgetCustomAbstractListTable(UiContext context,
DELEGATE delegate)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(ROW row)
Adds the given row at the end of this list table.
|
void |
addRow(ROW row,
int index)
Adds the given row to this list table.
|
void |
addSelectionHandler(UiHandlerEventSelection<ROW> handler)
This method adds the given
UiHandlerEventSelection to this object. |
UiFeatureSelectedValue<ROW> |
asFeatureSelectedValue() |
<CELL> UiWidgetTableColumn<ROW,CELL> |
createColumn(PropertyAccessor<ROW,CELL> rowAccessor,
UiSingleWidgetFactory<? extends UiWidgetWithValue<CELL>> widgetFactory,
Comparator<CELL> sortComparator)
This method creates a new
column for this table. |
<CELL> UiWidgetTableColumn<ROW,CELL> |
createColumn(TypedProperty<CELL> rowProperty,
UiSingleWidgetFactory<? extends UiWidgetWithValue<CELL>> widgetFactory,
Comparator<CELL> sortComparator)
This method creates a new
column for this table. |
UiWidgetTableColumn<ROW,?> |
getColumn(int index)
This method gets the
column at the given index . |
UiWidgetTableColumn<ROW,?> |
getColumnById(String columnId,
boolean required)
This method gets the
column with the given columnId . |
int |
getColumnCount() |
protected UiDataBinding<List<ROW>> |
getDataBinding(List<ROW> example) |
int |
getRowIndex(ROW row)
Gets the index of the given
row . |
UiWidgetTableColumn<?,Integer> |
getRowNumberColumn()
Gets implicit
column that shows the row-numbers. |
ROW |
getSelectedValue()
This method gets the currently selected value (item).
|
Collection<ROW> |
getSelectedValues()
This method gets the currently selected values.
|
UiWidgetTableColumn<?,Boolean> |
getSelectionColumn()
Gets implicit
column that shows the checkboxes or radios for the selection of
a row. |
int |
getSelectionCount()
Logically the same as
AttributeReadSelectedValue.getSelectedValues() .size() but more efficient. |
SelectionMode |
getSelectionMode()
This method gets the
SelectionMode . |
String |
getSummary()
This method gets the summary of this object.
|
String |
getTitle()
This method gets the title of this object.
|
boolean |
hasSelectedValue() |
boolean |
isEditable()
This method gets the editable status of this object.
|
boolean |
isSelected(SelectionChoice choice)
This method determines if the given logical
SelectionChoice is currently selected. |
boolean |
isTitleVisible()
|
boolean |
removeRow(ROW row)
This method removes the given
row . |
boolean |
removeSelectionHandler(UiHandlerEventSelection<ROW> handler)
This method removes the given
UiHandlerEventSelection from this object. |
boolean |
replaceRow(ROW oldRow,
ROW newRow)
This method replaces a <ROW> in this list table.
|
void |
setColumns(List<? extends UiWidgetTableColumn<ROW,?>> columns)
This method sets the
columns for the table of this model. |
void |
setEditable(boolean editableFlag)
This method set the
editable status. |
boolean |
setSelectedValue(ROW selectedValue)
This method sets the value currently selected.
|
boolean |
setSelectedValues(Collection<ROW> selectedValues)
This method sets the
values currently selected . |
boolean |
setSelection(SelectionChoice choice,
SelectionOperation operation)
This method allows to change the selection of a logical
SelectionChoice in a generic way. |
void |
setSelectionMode(SelectionMode selectionMode)
This method sets the
selection mode . |
void |
setSummary(String summary)
This method sets the
summary of this object. |
void |
setTitle(String title)
This method sets the title of this object.
|
void |
setTitleVisible(boolean titleVisible)
This method sets the
titleVisible flag of this object. |
addStyle, clearMessages, clearValidity, dispose, doInitialize, doSetMode, doValidate, getAriaRole, getDelegate, getDelegate, getId, getMode, getModeFixed, getParent, getPrimaryStyle, getSize, getSource, getStyles, getTooltip, getValueClass, getVisibleFlag, getWidgetAdapter, hasStyle, hasWidgetAdapter, initialize, isDisposed, isEnabled, isModifiedRecursive, isVisible, isVisibleRecursive, removeFromParent, removeStyle, setEnabled, setFocused, setId, setMode, setMode, setModeFixed, setParent, setPrimaryStyle, setStyles, setTooltip, setVisible, setVisible
addChangeHandler, addEventHandler, addValidator, clearMessagesLocal, clearValidationFailure, convertValueToString, doGetValue, doSetValue, fireEvent, fireValueChange, getBasicUtil, getContext, getDataBinding, getDataBindingForWidget, getEventSender, getFactory, getLogger, getObserverSource, getOriginalValue, getRecentValue, getValueDirect, getValueOrException, getWidgetAdapter, hasEventSender, isMandatory, isModified, removeChangeHandler, removeEventHandler, removeFromParent, removeValidator, setMandatory, setModified, setParent, setValue, toString
addValidatorMandatory, createValidationFailure, getValue, getValueAndValidate, handleGetValueError, resetValue, setValue, setValueForUser, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getValue
getValueAndValidate, getValueDirect
addChangeHandler, removeChangeHandler
resetValue, setValue, setValue, setValueForUser
getOriginalValue, getValueOrException
addValidatorMandatory, isMandatory
addValidator, removeValidator
validate
getContext, getParent, getSize
clearMessages
addEventHandler, removeEventHandler
setMode
getMode
setModeFixed
getModeFixed
setId
getId
setTooltip
getTooltip
getVisibleFlag, isVisible, setVisible, setVisible
isVisibleRecursive
setEnabled
isEnabled
addStyle, removeStyle
hasStyle
setStyles
getStyles
setPrimaryStyle
getPrimaryStyle
dispose
isDisposed
isModified
getAriaRole
protected UiDataBinding<List<ROW>> getDataBinding(List<ROW> example)
getDataBinding
in class AbstractUiWidget<List<ROW>>
example
- is an example value that may be used to determine the value class
if not available. May be null
.AbstractUiWidget.getDataBinding()
public <CELL> UiWidgetTableColumn<ROW,CELL> createColumn(TypedProperty<CELL> rowProperty, UiSingleWidgetFactory<? extends UiWidgetWithValue<CELL>> widgetFactory, Comparator<CELL> sortComparator)
column
for this table. UiWidgetAbstractDataTable.setColumns(List)
for all
columns that should appear in the UI.createColumn
in interface UiWidgetAbstractDataTable<ROW>
CELL
- is the generic type of the property type
.rowProperty
- is the TypedProperty
identifying which property
of <ROW> to show in the column.widgetFactory
- is the factory to
create
widgets for this
column. ATTENTION: These widgets might be reused for performance-reasons for a different
row just by setting its value
. They should NOT contain
additional state information (what is generally a bad idea). This parameter may be
null
to fall back to
datatype based
creation
.sortComparator
- is the sort-comparator to
set
.UiWidgetTableColumn
.public <CELL> UiWidgetTableColumn<ROW,CELL> createColumn(PropertyAccessor<ROW,CELL> rowAccessor, UiSingleWidgetFactory<? extends UiWidgetWithValue<CELL>> widgetFactory, Comparator<CELL> sortComparator)
column
for this table. UiWidgetAbstractDataTable.setColumns(List)
for all
columns that should appear in the UI.createColumn
in interface UiWidgetAbstractDataTable<ROW>
CELL
- is the generic type of the property value
.rowAccessor
- is the PropertyAccessor
to access
the property of <ROW> to show in the column.widgetFactory
- is the factory to
create
widgets for this
column. ATTENTION: These widgets might be reused for performance-reasons for a different
row just by setting its value
. They should NOT contain
additional state information (what is generally a bad idea). This parameter may be
null
to fall back to
datatype based
creation
.sortComparator
- is the sort-comparator to
set
.UiWidgetTableColumn
.public void setColumns(List<? extends UiWidgetTableColumn<ROW,?>> columns)
columns
for the table of this model. list.setColumns(Arrays.asList(column1, column2, column3))Unfortunately varargs with generics cause trouble in interfaces.
AttributeWriteVisibleAdvanced.setVisible(boolean)
instead if possible.setColumns
in interface UiWidgetAbstractDataTable<ROW>
columns
- are the columns
to set. Use createColumn
to
create before.UiWidgetAbstractDataTable.createColumn(TypedProperty, UiSingleWidgetFactory, Comparator)
,
UiWidgetAbstractDataTable.createColumn(PropertyAccessor, UiSingleWidgetFactory, Comparator)
public int getColumnCount()
getColumnCount
in interface UiWidgetAbstractDataTable<ROW>
columns
that are currently set
.List.size()
public UiWidgetTableColumn<ROW,?> getColumn(int index)
column
at the given index
.getColumn
in interface UiWidgetAbstractDataTable<ROW>
index
- is the index of the requested column
. The index corresponds to
the index when the columns have been set
. Reordering or hiding columns
in the UI has no effect on the index. The value has to be in the range from 0
to
UiWidgetAbstractDataTable.getColumnCount()
- 1
.column
.List.get(int)
public UiWidgetTableColumn<?,Boolean> getSelectionColumn()
column
that shows the checkboxes or radios for the selection of
a row. title
, reorderable
, resizable
, or
sortable
.getSelectionColumn
in interface UiWidgetAbstractDataTable<ROW>
column
that shows the checkboxes or radios for the
selection of a row.public UiWidgetTableColumn<?,Integer> getRowNumberColumn()
column
that shows the row-numbers. title
, reorderable
, resizable
, or
sortable
. make it visible
.getRowNumberColumn
in interface UiWidgetAbstractDataTable<ROW>
column
that shows the row-numbers.public UiWidgetTableColumn<ROW,?> getColumnById(String columnId, boolean required) throws ObjectNotFoundException
column
with the given columnId
.getColumnById
in interface UiWidgetAbstractDataTable<ROW>
columnId
- is the ID
of the requested column.required
- - if true
and the requested column does not exist, an exception is thrown,
false
otherwise (null
will be returned for non existent columns).column
or null
if no such column exists
and required
is false
.ObjectNotFoundException
- if no column exists with the given columnId
and
required
is true
.public String getTitle()
getTitle
in interface AttributeReadStringTitle
getTitle
in interface UiWidgetAbstractDataSet<ROW>
getTitle
in interface AttributeReadTitle<String>
public void setTitle(String title)
setTitle
in interface AttributeWriteStringTitle
setTitle
in interface UiWidgetAbstractDataSet<ROW>
setTitle
in interface AttributeWriteTitle<String>
title
- is the new title.AttributeWriteTitleVisible.setTitleVisible(boolean)
public void addSelectionHandler(UiHandlerEventSelection<ROW> handler)
UiHandlerEventSelection
to this object.addSelectionHandler
in interface UiFeatureSelectedValue<ROW>
handler
- is the UiHandlerEventSelection
to add.public boolean removeSelectionHandler(UiHandlerEventSelection<ROW> handler)
UiHandlerEventSelection
from this object.removeSelectionHandler
in interface UiFeatureSelectedValue<ROW>
handler
- is the UiHandlerEventSelection
to remove.true
if the handler
has been removed successfully, false
if it was NOT registered
and nothing has
changed.public boolean setSelection(SelectionChoice choice, SelectionOperation operation)
SelectionChoice
in a generic way. The
following table shows the combinations and their effect:
choice | operation | setSelection(choice, operation) | multi selection only |
---|---|---|---|
SelectionChoice.ALL |
SelectionOperation.SET |
selects all items. | yes |
SelectionChoice.ALL |
SelectionOperation.ADD |
same effect as above. | yes |
SelectionChoice.ALL |
SelectionOperation.REMOVE |
de-selects all items so none is selected. | yes |
SelectionChoice.ALL |
SelectionOperation.TOGGLE |
toggles the selection of all items so the selection gets inverted. | yes |
SelectionChoice.FIRST |
SelectionOperation.SET |
clears the selection and then selects the first item. | no |
SelectionChoice.FIRST |
SelectionOperation.ADD |
Adds the first item to the current selection . |
yes |
SelectionChoice.FIRST |
SelectionOperation.REMOVE |
Removes the first item from the current selection . |
no |
SelectionChoice.FIRST |
SelectionOperation.TOGGLE |
Toggles the selection of the first item. | no |
SelectionChoice.LAST |
SelectionOperation.SET |
clears the selection and then selects the last item. | no |
SelectionChoice.LAST |
SelectionOperation.ADD |
Adds the last item to the current selection . |
yes |
SelectionChoice.LAST |
SelectionOperation.REMOVE |
Removes the last item from the current selection . |
no |
SelectionChoice.LAST |
SelectionOperation.TOGGLE |
Toggles the selection of the last item. | no |
setSelection
in interface UiFeatureSelectedValue<ROW>
choice
- is the SelectionChoice
indicating the items to select or deselect.operation
- is the SelectionOperation
indicating what to do with the choice
.true
if the operation was successful, false
otherwise. If there are no
items at all true
is returned in case of SelectionChoice.ALL
and
false
otherwise.public boolean isSelected(SelectionChoice choice)
SelectionChoice
is currently selected.isSelected
in interface UiFeatureSelectedValue<ROW>
choice
- is the SelectionChoice
to check.true
if the items identified by the given choice
are currently
selected, false
otherwise (if at least one of them is NOT selected).public boolean setSelectedValue(ROW selectedValue)
currently selected values
and select the given value.setSelectedValue
in interface AttributeWriteSelectedValue<ROW>
selectedValue
- is the value to select
.true
if the operation was successful, false
otherwise (the given
selectedValue
is not contained in this object and cannot be selected).public boolean setSelectedValues(Collection<ROW> selectedValues)
values currently selected
. All values that are NOT
available, will be ignored. SelectionMode.SINGLE_SELECTION
you shall not provide a
Collection
with more than one element. So you should then use AttributeWriteSelectedValue.setSelectedValue(Object)
instead. AttributeReadSelectedValue.getSelectedValues()
after this method the items may be in a different
order. Additionally the result of AttributeReadSelectedValue.getSelectedValue()
will contain elements that are actually
items available in this object. So e.g. if you have a list of items and call this method to select two
items but only one of them is actually available in the list, then only that one is selected and
therefore returned by AttributeReadSelectedValue.getSelectedValues()
.setSelectedValues
in interface AttributeWriteSelectedValue<ROW>
selectedValues
- is the Collection
with the values to select
.true
if the operation was successful and all selectedValues
have been
selected, false
otherwise (at least one item out of selectedValues
is
not contained in this object and cannot be selected).public boolean hasSelectedValue()
hasSelectedValue
in interface AttributeReadSelectedValue<ROW>
true
if at least one value is selected
,
false
otherwise.public ROW getSelectedValue()
getSelectedValue
in interface AttributeReadSelectedValue<ROW>
null
if no value is selected.public Collection<ROW> getSelectedValues()
Collection
is
unspecified.getSelectedValues
in interface AttributeReadSelectedValue<ROW>
Collection
with all selected values. Will be empty
if
nothing is selected.AttributeReadSelectedValue.getSelectedValue()
public int getSelectionCount()
AttributeReadSelectedValue.getSelectedValues()
.size() but more efficient.getSelectionCount
in interface AttributeReadSelectedValue<ROW>
selected values
.public void setSelectionMode(SelectionMode selectionMode)
selection mode
. SelectionMode
immediately after creating the object. The initial
default is always SelectionMode.SINGLE_SELECTION
. Dynamically changing the SelectionMode
may be expensive or not be supported (in exotic implementations) and should therefore be avoided.setSelectionMode
in interface AttributeWriteSelectionMode
selectionMode
- is the new SelectionMode
.public SelectionMode getSelectionMode()
SelectionMode
.getSelectionMode
in interface AttributeReadSelectionMode
SelectionMode
. Must not be null
.public void setSummary(String summary)
summary
of this object.setSummary
in interface AttributeWriteSummary
summary
- is the new summary
to set.public String getSummary()
getSummary
in interface AttributeReadSummary
public void setTitleVisible(boolean titleVisible)
titleVisible flag
of this object.setTitleVisible
in interface AttributeWriteTitleVisible
titleVisible
- is the new value for AttributeReadTitleVisible.isTitleVisible()
.public boolean isTitleVisible()
title
of this object is
visible
. For Accessibility
reasons you should always
set the title
of a titled object. However in specific
cases you want to save space on the screen and may not require the title to be displayed for seeing
users. Then you can hide the title while it is still recognized by assistive technology such as screen
readers.isTitleVisible
in interface AttributeReadTitleVisible
true
if visible, false
if hidden.public void setEditable(boolean editableFlag)
editable
status.setEditable
in interface AttributeWriteEditable
editableFlag
- if true
the object will become editable, if false
the
object will become un-editable.public boolean isEditable()
edit mode
(e.g. a data table that allows inline editing). If the editable
feature is turned
off, the user can no longer edit the data. AttributeReadEnabled.isEnabled()
. However turning off the
editable-flag
is weaker than disabling
a UI object. An enabled
but NOT editable
object may still allow user-interaction (e.g. a combobox that still allows selection out of a
predefined list but no editing of the text). Further the visualization is softer (no grey out of the
entire object). mode
or enabled flag
. This
method only returns the editable flag (as set via AttributeWriteEditable.setEditable(boolean)
)
and therefore only tells if the object is potentially editable.isEditable
in interface AttributeReadEditable
true
if this object is editable, false
otherwise.public int getRowIndex(ROW row)
row
. UiWidgetAbstractListTable.addRow(Object, int)
to insert a row before
or after a given row such as the selected row
. Please avoid storing such
index and use it later as this can cause fatal bugs.getRowIndex
in interface UiWidgetAbstractListTable<ROW>
row
- is the <ROW> to locate.-1
if not found.List.indexOf(Object)
public void addRow(ROW row)
addRow
in interface UiWidgetAbstractListTable<ROW>
row
- is the <ROW> to add.UiWidgetAbstractListTable.addRow(Object, int)
public void addRow(ROW row, int index)
UiWidgetAbstractListTable.getRowIndex(Object)
.addRow
in interface UiWidgetAbstractListTable<ROW>
row
- is the <ROW> to add.index
- is the index where to add the given row
.public boolean replaceRow(ROW oldRow, ROW newRow)
replaceRow
in interface UiWidgetAbstractListTable<ROW>
oldRow
- is the old <ROW> to replace.newRow
- is the new <ROW> to insert in place of the old one.true
if oldRow
was found and replaced, false
otherwise (if
this list table does not contain oldRow
and nothing was changed).public boolean removeRow(ROW row)
row
.removeRow
in interface UiWidgetAbstractListTable<ROW>
row
- is the <ROW> to remove.true
if the row
was found and removed, false
otherwise (if
this list table does not contain oldRow
and nothing was changed).public UiFeatureSelectedValue<ROW> asFeatureSelectedValue()
asFeatureSelectedValue
in interface UiWidgetWithSelectedValue<ROW>
UiFeatureSelectedValue
. Either this object itself or a child object contained in this
widget.Copyright © 2001–2016 mmm-Team. All rights reserved.