Class MLItem
- All Implemented Interfaces:
IContentData<MLItemProp>
- Direct Known Subclasses:
MLCheckBox
,MLComboBox
,MLDateTime
,MLRadioButton
,MLSimple
,MLSlider
,MLSpinner
,MLSwitch
,MLText
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
First column index for subclasses.static final String
Property name: action support "action".static final String
Property name: animation value.static final String
Property name: description text "$descr".static final String
Property name: icon "$icon".static final String
Property name: icon margins.static final String
Property name: leading text "$text".static final String
Property name: leading width "cx".static final String
Property name: leading wrap "lw".static final String
Property name: VSField description text "V_$descr".static final String
Property name: VSField leading text "V_$text".static final String
Property name: VS focus reference.Method Summary
Modifier and TypeMethodDescriptionvoid
addMappings
(VSMappings mappings, String uiRef, MLItemProp item) Adds the mappings of a VirtualSpace to the panel components.protected boolean
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).Gets the context menu assigned to the list item.protected abstract int
Returns the column index for the description.getGroup()
Gets the group associated with this item.getIcon()
Gets the image assigned as the icon for the list item.GUnit[]
Gets the margins for the icon.Returns the item property assigned for this instance.Gets the leading text for the list item.protected abstract int
Returns the column index for the leading text.int
Gets option for leading text wrap.Gets the width of leading text.protected String
Returns the IntProp property name used to set the selection to.int
Gets the selection state.abstract MLItemType
getType()
Gets the type of the list item.getVSRow()
Gets the associated VSRow for this item.boolean
Returns if the list item has action support or not.boolean
Gets the enabled state.boolean
Gets the read-only state.boolean
Gets the selection state of the item.boolean
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
Sets the option for leading text to single line with ellipsis when text overflows.boolean
Sets the option for leading text to single line, truncated.boolean
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.setSelection
(boolean on) Sets the selection state of an item.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 Details
PN_ICON
Property name: icon "$icon".- See Also:
PN_LEADING_TEXT
Property name: leading text "$text".- See Also:
PN_V_LEADING_TEXT
Property name: VSField leading text "V_$text".- See Also:
PN_LEADING_WIDTH
Property name: leading width "cx".- See Also:
PN_LEADING_WRAP
Property name: leading wrap "lw".- See Also:
PN_DESCRIPTION
Property name: description text "$descr".- See Also:
PN_V_DESCRIPTION
Property name: VSField description text "V_$descr".- See Also:
PN_ACTION
Property name: action support "action".- See Also:
PN_ANIMATION
Property name: animation value.- See Also:
PN_VS_FOCUS
Property name: VS focus reference.- See Also:
PN_ICON_MARGINS
Property name: icon margins.- See Also:
FIRST_COLUMN_INDEX
protected static final int FIRST_COLUMN_INDEXFirst column index for subclasses.- See Also:
Method Details
getItemProp
Returns the item property assigned for this instance.If the property is disposed, it is unassigned.
- Specified by:
getItemProp
in interfaceIContentData<MLItemProp>
- Returns:
- The property instance.
getGroup
Gets the group associated with this item.- Returns:
- The group if a property item is associated and not disposed of, null otherwise.
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:
refreshFromVS
in interfaceIContentData<MLItemProp>
- Parameters:
columns
- The connected table columns indicies, -1 for none.
getVSRow
Gets the associated VSRow for this item.- Specified by:
getVSRow
in interfaceIContentData<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:
isSelected
in interfaceIContentData<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
Sets the selection state of an item.- Specified by:
setSelection
in interfaceIContentData<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:
IllegalArgumentException
- If the component doesn't support third state and state==2.
setSelectionInternal
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:
setSelectionInternal
in interfaceIContentData<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
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
Gets the leading text for the list item.- Returns:
- The text, or null if none is set.
setLeadingText
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
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
Gets the width of leading text.- Returns:
- The width, or null for none.
setLeadingWidth
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:
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:
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
Gets the image assigned as the icon for the list item.- Returns:
- The image instance, or null for none.
setIcon
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:
IllegalArgumentException
- If the image target is not valid.
setIconPadding
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
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:
IllegalArgumentException
- If the array is not of length 4.
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
Gets the context menu assigned to the list item.- Returns:
- The context menu, or null for none.
setContextMenu
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
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:
addMappings
in interfaceIContentData<MLItemProp>
- Parameters:
mappings
- The mappings instance to fill in.uiRef
- The reference.item
- The item property.