ADAPTER - is the generic type of AbstractUiWidgetNative.getWidgetAdapter().VALUE - is the generic type of the value. Has to be either ITEM or
List<ITEM>.ITEM - is the generic type of the items contained in this widget.ITEM_CONTAINER - is the generic type of the container for the
<ITEM> objects. Typically a ItemContainer.public abstract class AbstractUiWidgetAbstractDataSet<ADAPTER extends UiWidgetAdapterAbstractDataSet<ITEM>,VALUE,ITEM,ITEM_CONTAINER> extends AbstractUiWidgetActive<ADAPTER,VALUE> implements UiWidgetAbstractDataSet<ITEM>
UiWidgetAbstractListTable.AbstractUiWidgetNative.SizeImplAbstractUiWidget.AccessHelper, AbstractUiWidget.EventSender, AbstractUiWidget.HandlerContainer| Modifier and Type | Field and Description |
|---|---|
private boolean |
editable |
private Set<ITEM_CONTAINER> |
newSelectedValues
Temporary
Set stored as instance for performance (as widgets are not really thread-safe anyways). |
private Set<ITEM_CONTAINER> |
selectedValues |
private SelectionMode |
selectionMode |
private String |
summary |
private String |
title |
private boolean |
titleVisible |
STYLE_HEADERHTML_ATTRIBUTE_ID, ID_SEPARATOR, PROPERTY_IDPROPERTY_STYLES, STYLE_PATTERN_MULTIPLE, STYLE_PATTERN_SINGLEWAI_ARIAPROPERTY_SUMMARYPROPERTY_TITLEACCESS_KEY_NONE, HTML_ATTRIBUTE_ACCESS_KEY| Constructor and Description |
|---|
AbstractUiWidgetAbstractDataSet(UiContext context,
ADAPTER widgetAdapter)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSelectionHandler(UiHandlerEventSelection<ITEM> handler)
This method adds the given
UiHandlerEventSelection to this object. |
UiFeatureSelectedValue<ITEM> |
asFeatureSelectedValue() |
protected void |
clearSelection(ITEM_CONTAINER exclusion)
Clears the
current selection except for the given exclusion. |
protected boolean |
doGetSelected(ITEM_CONTAINER container)
Internal method to get the selection status of the item in the given
container. |
protected abstract void |
doSetSelected(ITEM_CONTAINER container,
boolean selected)
Internal method to set the selection of the item in the given
container. |
abstract Collection<ITEM_CONTAINER> |
getAllAvailableItems()
Internal method to get the
Collection with all items (currently) available in this widget. |
protected ITEM_CONTAINER |
getFirstAvailableItem() |
protected abstract ITEM |
getItem(ITEM_CONTAINER container)
This method gets the item in the given
container. |
protected abstract ITEM_CONTAINER |
getItemContainer(ITEM item)
Gets the existing container for the given
item. |
protected abstract ITEM_CONTAINER |
getLastAvailableItem() |
ITEM |
getSelectedValue()
This method gets the currently selected value (item).
|
Collection<ITEM> |
getSelectedValues()
This method gets the currently selected values.
|
protected Collection<ITEM_CONTAINER> |
getSelectedValuesInternal()
Internal method to get the direct reference to the
selected values. |
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() |
protected void |
initializeWidgetAdapter(ADAPTER adapter)
This method is called from
AbstractUiWidgetNative.getWidgetAdapter() to initialize the UiWidgetAdapter. |
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()
|
void |
onItemSelection(ITEM_CONTAINER itemContainer,
boolean selected,
boolean programmatic)
Called from adapter if an item (<ITEM>) has been (de)selected.
|
boolean |
removeSelectionHandler(UiHandlerEventSelection<ITEM> handler)
This method removes the given
UiHandlerEventSelection from this object. |
void |
setEditable(boolean editableFlag)
This method set the
editable status. |
boolean |
setSelectedValue(ITEM selectedValue)
This method sets the value currently selected.
|
boolean |
setSelectedValues(Collection<ITEM> selectedItems)
This method sets the
values currently selected. |
boolean |
setSelectedValues(Collection<ITEM> selectedItems,
boolean programmatic) |
protected boolean |
setSelection(ITEM_CONTAINER itemContainer,
SelectionOperation operation)
Updates the selection of the given
itemContainer according to the given
operation. |
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. |
addFocusHandler, getAccessKey, isFocused, onAccessKeyPressed, removeFocusHandler, setAccessKey, setFocused, setFocusedaddChangeHandler, addStyle, clearMessages, clearValidity, createSize, createUniqueId, createWidgetAdapter, dispose, doGetValue, doSetMode, doSetValue, doValidate, getAriaRole, getAriaRoleFixedType, getChild, getChild, getChildCount, getChildIndex, getId, getIndexOfStyle, getMode, getModeFixed, getParent, getPrimaryStyle, getSize, getStyles, getTooltip, getVisibleFlag, getWidgetAdapter, getWidgetAdapter, hasStyle, hasWidgetAdapter, isDisposed, isEnabled, isModifiedRecursive, isVisible, isVisibleRecursive, removeChangeHandler, removeFromParent, removeStyle, setAriaRole, setEnabled, setId, setIdPrefix, setMode, setMode, setModeFixed, setParent, setPrimaryStyle, setStyles, setTooltip, setVisible, setVisible, toString, visibilityChangedaddEventHandler, addValidator, clearMessagesLocal, clearValidationFailure, convertValueToString, fireEvent, fireValueChange, getBasicUtil, getContext, getDataBinding, getDataBinding, getDataBindingForWidget, getEventSender, getFactory, getLogger, getObserverSource, getOriginalValue, getRecentValue, getSource, getValueClass, getValueDirect, getValueOrException, getWidgetAdapter, hasEventSender, isMandatory, isModified, removeEventHandler, removeFromParent, removeValidator, setMandatory, setModified, setParent, setValueaddValidatorMandatory, createValidationFailure, getValue, getValueAndValidate, handleGetValueError, resetValue, setValue, setValueForUser, validateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetContext, getParent, getSizeclearMessagesaddEventHandler, removeEventHandlersetModegetModesetModeFixedgetModeFixedsetIdgetIdsetTooltipgetTooltipgetVisibleFlag, isVisible, setVisible, setVisibleisVisibleRecursivesetEnabledisEnabledaddStyle, removeStylehasStylesetStylesgetStylessetPrimaryStylegetPrimaryStyledisposeisDisposedisModifiedgetAriaRolevalidateresetValue, setValue, setValueForUsergetValueprivate SelectionMode selectionMode
getSelectionMode()private final Set<ITEM_CONTAINER> selectedValues
getSelectedValues()private final Set<ITEM_CONTAINER> newSelectedValues
Set stored as instance for performance (as widgets are not really thread-safe anyways).setSelectedValues(Collection)private String summary
getSummary()private String title
getTitle()private boolean titleVisible
isTitleVisible()private boolean editable
isEditable()public AbstractUiWidgetAbstractDataSet(UiContext context, ADAPTER widgetAdapter)
context - is the context.widgetAdapter - is the widget adapter. Typically null for
lazy initialization.protected void initializeWidgetAdapter(ADAPTER adapter)
AbstractUiWidgetNative.getWidgetAdapter() to initialize the UiWidgetAdapter. All
attributes of this widget need to be set in the UiWidgetAdapter.initializeWidgetAdapter in class AbstractUiWidgetActive<ADAPTER extends UiWidgetAdapterAbstractDataSet<ITEM>,VALUE>adapter - is the UiWidgetAdapter to initialize.public String getSummary()
getSummary in interface AttributeReadSummarypublic void setSummary(String summary)
summary of this object.setSummary in interface AttributeWriteSummarysummary - is the new summary to set.public String getTitle()
getTitle in interface AttributeReadStringTitlegetTitle in interface UiWidgetAbstractDataSet<ITEM>getTitle in interface AttributeReadTitle<String>public void setTitle(String title)
setTitle in interface AttributeWriteStringTitlesetTitle in interface UiWidgetAbstractDataSet<ITEM>setTitle in interface AttributeWriteTitle<String>title - is the new title.AttributeWriteTitleVisible.setTitleVisible(boolean)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 AttributeReadTitleVisibletrue if visible, false if hidden.public void setTitleVisible(boolean titleVisible)
titleVisible flag of this object.setTitleVisible in interface AttributeWriteTitleVisibletitleVisible - is the new value for AttributeReadTitleVisible.isTitleVisible().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 AttributeReadEditabletrue if this object is editable, false otherwise.public void setEditable(boolean editableFlag)
editable status.setEditable in interface AttributeWriteEditableeditableFlag - if true the object will become editable, if false the
object will become un-editable.public SelectionMode getSelectionMode()
SelectionMode.getSelectionMode in interface AttributeReadSelectionModeSelectionMode. Must not be null.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 AttributeWriteSelectionModeselectionMode - is the new SelectionMode.public void addSelectionHandler(UiHandlerEventSelection<ITEM> handler)
UiHandlerEventSelection to this object.addSelectionHandler in interface UiFeatureSelectedValue<ITEM>handler - is the UiHandlerEventSelection to add.public boolean removeSelectionHandler(UiHandlerEventSelection<ITEM> handler)
UiHandlerEventSelection from this object.removeSelectionHandler in interface UiFeatureSelectedValue<ITEM>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 hasSelectedValue()
hasSelectedValue in interface AttributeReadSelectedValue<ITEM>true if at least one value is selected,
false otherwise.public int getSelectionCount()
AttributeReadSelectedValue.getSelectedValues().size() but more efficient.getSelectionCount in interface AttributeReadSelectedValue<ITEM>selected values.public ITEM getSelectedValue()
getSelectedValue in interface AttributeReadSelectedValue<ITEM>null if no value is selected.public Collection<ITEM> getSelectedValues()
Collection is
unspecified.getSelectedValues in interface AttributeReadSelectedValue<ITEM>Collection with all selected values. Will be empty if
nothing is selected.AttributeReadSelectedValue.getSelectedValue()protected Collection<ITEM_CONTAINER> getSelectedValuesInternal()
selected values.Collection with all currently selected item containers.public boolean setSelectedValue(ITEM selectedValue)
currently selected values
and select the given value.setSelectedValue in interface AttributeWriteSelectedValue<ITEM>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<ITEM> selectedItems)
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<ITEM>selectedItems - 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 setSelectedValues(Collection<ITEM> selectedItems, boolean programmatic)
selectedItems - is the Collection with the values to select.programmatic - - see UiEvent.isProgrammatic().setSelectedValues(Collection).setSelectedValues(Collection)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<ITEM>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.protected void clearSelection(ITEM_CONTAINER exclusion)
current selection except for the given exclusion.exclusion - is the itemContainer to exclude (keep its selection untouched) or null for
no exclusion.public boolean isSelected(SelectionChoice choice)
SelectionChoice is currently selected.isSelected in interface UiFeatureSelectedValue<ITEM>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).protected boolean setSelection(ITEM_CONTAINER itemContainer, SelectionOperation operation)
itemContainer according to the given
operation.itemContainer - is the container with the item to update.operation - is the SelectionOperation to perform.itemContainer.public void onItemSelection(ITEM_CONTAINER itemContainer, boolean selected, boolean programmatic)
itemContainer - is the container with the item to update.selected - - true if item has been selected, false if deselected.programmatic - - see UiEvent.isProgrammatic().protected boolean doGetSelected(ITEM_CONTAINER container)
container.container - is the container with the item to check.true if the item is selected, false otherwise.protected abstract void doSetSelected(ITEM_CONTAINER container, boolean selected)
container. Shall not do
anything else (e.g. firing event).container - is the container with the item to mark.selected - - true to select, false to deselect.public abstract Collection<ITEM_CONTAINER> getAllAvailableItems()
Collection with all items (currently) available in this widget. In
case of lazy loading only those that have already been loaded. Collection must NOT be modified if retrieved via this method. Implementations will provide
separate addItem and removeItem methods.Collection with all items (currently) available in this widget. In case of lazy
loading only those that have already been loaded.protected ITEM_CONTAINER getFirstAvailableItem()
first of the available items.protected abstract ITEM_CONTAINER getLastAvailableItem()
last of the available items.protected abstract ITEM_CONTAINER getItemContainer(ITEM item)
item. This method has to be very efficient. You
should use a Map for this purpose.item - is the item to lookup.item or null if no such container exists.protected abstract ITEM getItem(ITEM_CONTAINER container)
container.container - is the container of the requested item.public UiFeatureSelectedValue<ITEM> asFeatureSelectedValue()
asFeatureSelectedValue in interface UiWidgetWithSelectedValue<ITEM>UiFeatureSelectedValue. Either this object itself or a child object contained in this
widget.Copyright © 2001–2016 mmm-Team. All rights reserved.