Class MLItem
- java.lang.Object
- com.iizix.prop.ui.mlist.MLItem
 
- All Implemented Interfaces:
- IContentData<MLItemProp>
 - Direct Known Subclasses:
- MLCheckBox,- MLComboBox,- MLDateTime,- MLRadioButton,- MLSimple,- MLSlider,- MLSpinner,- MLSwitch,- MLText
 - public abstract class MLItem extends java.lang.Object implements IContentData<MLItemProp> The list item for the mobile list.- Author:
- Christopher Mindus
 
- Field Summary- Fields - Modifier and Type - Field - Description - protected static int- FIRST_COLUMN_INDEXFirst column index for subclasses.- static java.lang.String- PN_ACTIONProperty name: action support "action".- static java.lang.String- PN_ANIMATIONProperty name: animation value.- static java.lang.String- PN_DESCRIPTIONProperty name: description text "$descr".- static java.lang.String- PN_ICONProperty name: icon "$icon".- static java.lang.String- PN_ICON_MARGINSProperty name: icon margins.- static java.lang.String- PN_LEADING_TEXTProperty name: leading text "$text".- static java.lang.String- PN_LEADING_WIDTHProperty name: leading width "cx".- static java.lang.String- PN_LEADING_WRAPProperty name: leading wrap "lw".- static java.lang.String- PN_V_DESCRIPTIONProperty name: VSField description text "V_$descr".- static java.lang.String- PN_V_LEADING_TEXTProperty name: VSField leading text "V_$text".- static java.lang.String- PN_VS_FOCUSProperty name: VS focus reference.
 - Method Summary- All Methods Instance Methods Abstract Methods Concrete Methods - Modifier and Type - Method - Description - void- addMappings(VSMappings mappings, java.lang.String uiRef, MLItemProp item)Adds the mappings of a VirtualSpace to the panel components.- protected boolean- doBooleanSelectionOnly()Returns if the selection property is a boolean value and a BoolProp is used to set the selection state that can be on/off or 1/0 only (2 = third state is not allowed).- UIContextMenu- getContextMenu()Gets the context menu assigned to the list item.- protected abstract int- getDescriptionColumn()Returns the column index for the description.- MLGroup- getGroup()Gets the group associated with this item.- IImageTarget- getIcon()Gets the image assigned as the icon for the list item.- GUnit[]- getIconMargins()Gets the margins for the icon.- MLItemProp- getItemProp()Returns the item property assigned for this instance.- KString- getLeadingText()Gets the leading text for the list item.- protected abstract int- getLeadingTextColumn()Returns the column index for the leading text.- int- getLeadingTextWrap()Gets option for leading text wrap.- GUnit- getLeadingWidth()Gets the width of leading text.- protected java.lang.String- getSelectionPropName()Returns the IntProp property name used to set the selection to.- int- getSelectionState()Gets the selection state.- abstract MLItemType- getType()Gets the type of the list item.- VSRow- getVSRow()Gets the associated VSRow for this item.- boolean- hasActionSupport()Returns if the list item has action support or not.- boolean- isEnabled()Gets the enabled state.- boolean- isReadOnly()Gets the read-only state.- boolean- isSelected()Gets the selection state of the item.- boolean- isVisible()Gets the visibility state.- abstract void- refreshFromVS(int[] columns)Refreshes contents from VirtualSpace.- boolean- setActionSupport(boolean newState)Sets the action support state, i.e.- boolean- setContextMenu(UIContextMenu contextMenu)Sets the context menu to use for the item.- boolean- setDescription(KString descr)Sets the text for the list item.- boolean- setEnabled(boolean newState)Gets the enabled state.- boolean- setIcon(IImageTarget image)Sets the image assigned as the icon for the list item.- boolean- setIconMargins(GUnit[] margins)Sets the icon margins.- boolean- setIconPadding(GUnit margin)Sets the icon margin.- boolean- setLeadingText(KString text)Sets the leading text for the list item.- boolean- setLeadingTextEllipsis()Sets the option for leading text to single line with ellipsis when text overflows.- boolean- setLeadingTextSingleLine()Sets the option for leading text to single line, truncated.- boolean- setLeadingTextWrap()Sets the option for leading text to wrap over multiple line.- boolean- setLeadingTextWrap(int opt)Sets the option for leading text wrap.- boolean- setLeadingWidth(GUnit width)Gets the width of leading text.- boolean- setReadOnly(boolean newState)Gets the read-only state.- boolean- setSelected(int state)Sets the selection state: 0=unselected, 1=selected, 2=third state.- java.lang.String- setSelection(boolean on)Sets the selection state of an item.- java.lang.String- setSelectionInternal(boolean on)Internal method to sets the selection state of an item.- boolean- setVisible(boolean newState)Gets the visibility state.- Methods inherited from class java.lang.Object- clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - Methods inherited from interface com.iizix.prop.content.IContentData- initialize
 
 
- Field Detail- PN_ICON- public static final java.lang.String PN_ICON Property name: icon "$icon".- See Also:
- Constant Field Values
 
 - PN_LEADING_TEXT- public static final java.lang.String PN_LEADING_TEXT Property name: leading text "$text".- See Also:
- Constant Field Values
 
 - PN_V_LEADING_TEXT- public static final java.lang.String PN_V_LEADING_TEXT Property name: VSField leading text "V_$text".- See Also:
- Constant Field Values
 
 - PN_LEADING_WIDTH- public static final java.lang.String PN_LEADING_WIDTH Property name: leading width "cx".- See Also:
- Constant Field Values
 
 - PN_LEADING_WRAP- public static final java.lang.String PN_LEADING_WRAP Property name: leading wrap "lw".- See Also:
- Constant Field Values
 
 - PN_DESCRIPTION- public static final java.lang.String PN_DESCRIPTION Property name: description text "$descr".- See Also:
- Constant Field Values
 
 - PN_V_DESCRIPTION- public static final java.lang.String PN_V_DESCRIPTION Property name: VSField description text "V_$descr".- See Also:
- Constant Field Values
 
 - PN_ACTION- public static final java.lang.String PN_ACTION Property name: action support "action".- See Also:
- Constant Field Values
 
 - PN_ANIMATION- public static final java.lang.String PN_ANIMATION Property name: animation value.- See Also:
- Constant Field Values
 
 - PN_VS_FOCUS- public static final java.lang.String PN_VS_FOCUS Property name: VS focus reference.- See Also:
- Constant Field Values
 
 - PN_ICON_MARGINS- public static final java.lang.String PN_ICON_MARGINS Property name: icon margins.- See Also:
- Constant Field Values
 
 - FIRST_COLUMN_INDEX- protected static final int FIRST_COLUMN_INDEX First column index for subclasses.- See Also:
- Constant Field Values
 
 
 - Method Detail- getItemProp- public MLItemProp getItemProp() Returns the item property assigned for this instance.- If the property is disposed, it is unassigned. - Specified by:
- getItemPropin interface- IContentData<MLItemProp>
- Returns:
- The property instance.
 
 - getGroup- public MLGroup getGroup() Gets the group associated with this item.- Returns:
- The group if a property item is associated and not disposed of, null otherwise.
 
 - getType- public abstract MLItemType getType() Gets the type of the list item.- Returns:
- The type.
 
 - getLeadingTextColumn- protected abstract int getLeadingTextColumn() Returns the column index for the leading text. Types supporting description text must override this method.- Returns:
- The column index, or -1 for none.
 
 - getDescriptionColumn- protected abstract int getDescriptionColumn() Returns the column index for the description. Types supporting description text must override this method.- Returns:
- The column index, or -1 for none.
 
 - refreshFromVS- public abstract void refreshFromVS(int[] columns) Refreshes contents from VirtualSpace.- Specified by:
- refreshFromVSin interface- IContentData<MLItemProp>
- Parameters:
- columns- The connected table columns indicies, -1 for none.
 
 - getVSRow- public VSRow getVSRow() Gets the associated VSRow for this item.- Specified by:
- getVSRowin interface- IContentData<MLItemProp>
- Returns:
- The row, or null if not associated with VirtualSpace.
 
 - isVisible- public boolean isVisible() Gets the visibility state.- This is the items individual state and does not take parent states into account. - Returns:
- true for visible, false for hidden.
 
 - isEnabled- public boolean isEnabled() Gets the enabled state.- This is the items individual state and does not take parent states into account. - Returns:
- true for enabled, false for disabled.
 
 - isReadOnly- public boolean isReadOnly() Gets the read-only state.- This is the items individual state and does not take parent states into account. - Returns:
- true for read-only, false otherwise.
 
 - isSelected- public boolean isSelected() Gets the selection state of the item.- Specified by:
- isSelectedin interface- IContentData<MLItemProp>
- Returns:
- The selected state.
 
 - hasActionSupport- public boolean hasActionSupport() Returns if the list item has action support or not.- Returns:
- true for action support (default) or not.
 
 - getSelectionState- public int getSelectionState() Gets the selection state.- Returns:
- 0=unselected, 1=selected, 2=third state (when applicable).
 
 - setVisible- public boolean setVisible(boolean newState) Gets the visibility state.- This is the items individual state and does not take parent states into account. - Parameters:
- newState- The new state: true for visible, false for hidden.
- Returns:
- true for changed state, false for no change.
 
 - setEnabled- public boolean setEnabled(boolean newState) Gets the enabled state.- This is the items individual state and does not take parent states into account. - Parameters:
- newState- The new state: true for enabled, false for disabled.
- Returns:
- true for changed state, false for no change.
 
 - setReadOnly- public boolean setReadOnly(boolean newState) Gets the read-only state.- This is the items individual state and does not take parent states into account. - Parameters:
- newState- The new state: true for read-only, false otherwise.
- Returns:
- true for changed state, false for no change.
 
 - setActionSupport- public boolean setActionSupport(boolean newState) Sets the action support state, i.e. if the user can touch-click the item and cause an action even when no arrows are present.- Parameters:
- newState- The new action enabled state.
- Returns:
- true for changed state, false for no change.
 
 - setSelection- public java.lang.String setSelection(boolean on) Sets the selection state of an item.- Specified by:
- setSelectionin interface- IContentData<MLItemProp>
- Parameters:
- on- The new selection state.
- Returns:
- null for success, otherwise an error message why the selection failed.
 
 - setSelected- public boolean setSelected(int state) Sets the selection state: 0=unselected, 1=selected, 2=third state.- Parameters:
- state- The state.
- Returns:
- true for state changed, false for no change.
- Throws:
- java.lang.IllegalArgumentException- If the component doesn't support third state and state==2.
 
 - setSelectionInternal- public java.lang.String setSelectionInternal(boolean on) Internal method to sets the selection state of an item. This method is not intended to be called as it is used by the framework and will not cause a callback or event notification of selection changes.- Specified by:
- setSelectionInternalin interface- IContentData<MLItemProp>
- Parameters:
- on- The new selection state.
- Returns:
- null for success, empty string for no change, otherwise an error message why the selection failed.
 
 - getSelectionPropName- protected java.lang.String getSelectionPropName() Returns the IntProp property name used to set the selection to.- Returns:
- The selection property name, or null if not supported (default). Override this method to return the appropriate name when supported.
 
 - doBooleanSelectionOnly- protected boolean doBooleanSelectionOnly() Returns if the selection property is a boolean value and a BoolProp is used to set the selection state that can be on/off or 1/0 only (2 = third state is not allowed).- Returns:
- true To use BoolProp for selection and throw error for third state (2) selection value, false for checkboxes that use an IntProp for selection and supports third state.
 
 - getLeadingText- public KString getLeadingText() Gets the leading text for the list item.- Returns:
- The text, or null if none is set.
 
 - setLeadingText- public boolean setLeadingText(KString text) Sets the leading text for the list item.- Parameters:
- text- The new text, or null for none.
- Returns:
- true for changed, false for no change.
 
 - setDescription- public boolean setDescription(KString descr) Sets the text for the list item.- Parameters:
- descr- The new description string, or null for none.
- Returns:
- true for changed, false for no change.
 
 - getLeadingWidth- public GUnit getLeadingWidth() Gets the width of leading text.- Returns:
- The width, or null for none.
 
 - setLeadingWidth- public boolean setLeadingWidth(GUnit width) Gets the width of leading text. The width must be Strict CSS and may not be a percent value or a formula.- Parameters:
- width- The width, or null for to clear it.
- Returns:
- true for changed, false for no change.
- Throws:
- java.lang.IllegalArgumentException- If the width is a formula or percent value.
 
 - getLeadingTextWrap- public int getLeadingTextWrap() Gets option for leading text wrap.- Returns:
- The leading text wrap, multiple(0), single line(1), ellipsis(2).
 
 - setLeadingTextWrap- public boolean setLeadingTextWrap(int opt) Sets the option for leading text wrap.- Parameters:
- opt- The wrap option:
 0 = wrap over multiple lines,
 1 = truncated to single line, or
 2 = ellipsis when single line overflows.
- Returns:
- true for changed, false for no change.
- Throws:
- java.lang.IllegalArgumentException- If opt is not 0-2.
 
 - setLeadingTextWrap- public boolean setLeadingTextWrap() Sets the option for leading text to wrap over multiple line.- Returns:
- true for changed, false for no change.
 
 - setLeadingTextSingleLine- public boolean setLeadingTextSingleLine() Sets the option for leading text to single line, truncated.- Returns:
- true for changed, false for no change.
 
 - setLeadingTextEllipsis- public boolean setLeadingTextEllipsis() Sets the option for leading text to single line with ellipsis when text overflows.- Returns:
- true for changed, false for no change.
 
 - getIcon- public IImageTarget getIcon() Gets the image assigned as the icon for the list item.- Returns:
- The image instance, or null for none.
 
 - setIcon- public boolean setIcon(IImageTarget image) Sets the image assigned as the icon for the list item.- Parameters:
- image- The image instance, or null for none.
- Returns:
- true for changed, false for no changes.
- Throws:
- java.lang.IllegalArgumentException- If the image target is not valid.
 
 - setIconPadding- public boolean setIconPadding(GUnit margin) Sets the icon margin. All margins top/right/bottom/left are affected and set or cleared.- Parameters:
- margin- The margin, null to remove it.
- Returns:
- true for changed, false for no change.
 
 - setIconMargins- public boolean setIconMargins(GUnit[] margins) Sets the icon margins.- Parameters:
- margins- The margins, null to remove them.- The indicies in the array are: - [0] top
- [1] right
- [2] bottom
- [3] left
 - Any entry may be null where this means it is not defined. All entries set to null is the same as passing null as parameter. 
- Returns:
- true for changed, false for no change.
- Throws:
- java.lang.IllegalArgumentException- If the array is not of length 4.
 
 - getIconMargins- public GUnit[] getIconMargins() Gets the margins for the icon.- Returns:
- The margins, null for none, otherwise an array of 4 values where a null value means it is not set.The indicies in the array are: - [0] top
- [1] right
- [2] bottom
- [3] left
 
 
 - getContextMenu- public UIContextMenu getContextMenu() Gets the context menu assigned to the list item.- Returns:
- The context menu, or null for none.
 
 - setContextMenu- public boolean setContextMenu(UIContextMenu contextMenu) Sets the context menu to use for the item.- Parameters:
- contextMenu- The context menu, or null to remove it.
- Returns:
- true for changed, false for no change.
 
 - addMappings- public void addMappings(VSMappings mappings, java.lang.String uiRef, MLItemProp item) Adds the mappings of a VirtualSpace to the panel components.- The default is to find the relative references to VS and add those references. Override to provide other functionality. - Specified by:
- addMappingsin interface- IContentData<MLItemProp>
- Parameters:
- mappings- The mappings instance to fill in.
- uiRef- The reference.
- item- The item property.