Package com.iizix.prop.ui.mlist
Class MLCheckBox
- java.lang.Object
- com.iizix.prop.ui.mlist.MLItem
- com.iizix.prop.ui.mlist.MLCheckBox
 
 
- All Implemented Interfaces:
- IContentData<MLItemProp>,- IMLArrowActionListener
 - public class MLCheckBox extends MLItem implements IMLArrowActionListener The checkbox list item class.- The checkbox has a text on leading/trailing sides and a description. On the trailing side, a checkbox is shown. - The trailing text can be left adjusted after the leading text that may have a fixed width in order to have an additional column of text. - The selection state is independent of other components, support for third state exists. - An optional description text can be added to the bottom of the list item. - Author:
- Christopher Mindus
 
- Field Summary- Fields - Modifier and Type - Field - Description - static java.lang.String- PN_ALIGN_OPPOSITEProperty name: trailing align opposite "ao".- static java.lang.String- PN_ARROWProperty name: display trailing arrow "arrow".- static java.lang.String- PN_TRAILING_TEXTProperty name: trailing text "tt".- static java.lang.String- PN_V_TRAILING_TEXTProperty name: trailing text virtual column reference "V_tt".- Fields inherited from class com.iizix.prop.ui.mlist.MLItem- FIRST_COLUMN_INDEX, PN_ACTION, PN_ANIMATION, PN_DESCRIPTION, PN_ICON, PN_ICON_MARGINS, PN_LEADING_TEXT, PN_LEADING_WIDTH, PN_LEADING_WRAP, PN_V_DESCRIPTION, PN_V_LEADING_TEXT, PN_VS_FOCUS
 
 - Constructor Summary- Constructors - Constructor - Description - MLCheckBox(boolean isChecked)Creates a new checkbox list item.- MLCheckBox(int state)Creates a new checkbox list item.
 - Method Summary- All Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - boolean- addListener(IMLArrowActionListener listener)Adds an action listener for the arrow.- boolean- addListener(IMLCheckBoxStateListener listener)Adds an checkbox listener for the arrow.- 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).- int- getCheckState()Gets the check state with support for third state.- protected int- getDescriptionColumn()Returns the column index for the description.- protected int- getLeadingTextColumn()Returns the column index for the leading text.- protected java.lang.String- getSelectionPropName()Returns the IntProp property name used to set the selection to.- KString- getTrailingText()Gets the trailing text for the list item.- MLItemType- getType()Returns the type.- protected java.lang.String[]- getUpdatePropertyNames()Returns the property names for which the- from(PropCnr, MLItemProp)- void- initialize(MLItemProp item)Initializes the item property from the content data.- boolean- isArrowDisplayed()Returns if the trailing arrow is displayed or not.- boolean- isTrailingTextOppositeAligned()Returns if the trailing text is aligned to the opposite side, i.e.- boolean- isTrailingTextOppositeAligned(boolean opposite)Sets if the trailing text is aligned to the opposite side, i.e.- void- onArrowInvoked(MLItem item)Called when the arrow action is invoked.- void- refreshFromVS(int[] columns)Refreshes contents from VirtualSpace.- boolean- removeListener(IMLArrowActionListener listener)Removes an action listener for the arrow.- boolean- removeListener(IMLCheckBoxStateListener listener)Removes a checkbox listener for the arrow.- boolean- setArrowDisplayed(boolean on)Sets if the trailing arrow should be displayed or not.- java.lang.String- setChecked(boolean on)Sets the check state of an item.- java.lang.String- setChecked(int state)Sets the check state of an item.- boolean- setTrailingText(KString text)Sets the trailing text for the list item.- Methods inherited from class com.iizix.prop.ui.mlist.MLItem- addMappings, getContextMenu, getGroup, getIcon, getIconMargins, getItemProp, getLeadingText, getLeadingTextWrap, getLeadingWidth, getSelectionState, getVSRow, hasActionSupport, isEnabled, isReadOnly, isSelected, isVisible, setActionSupport, setContextMenu, setDescription, setEnabled, setIcon, setIconMargins, setIconPadding, setLeadingText, setLeadingTextEllipsis, setLeadingTextSingleLine, setLeadingTextWrap, setLeadingTextWrap, setLeadingWidth, setReadOnly, setSelected, setSelection, setSelectionInternal, setVisible
 
 
- Field Detail- PN_TRAILING_TEXT- public static final java.lang.String PN_TRAILING_TEXT Property name: trailing text "tt".- See Also:
- Constant Field Values
 
 - PN_V_TRAILING_TEXT- public static final java.lang.String PN_V_TRAILING_TEXT Property name: trailing text virtual column reference "V_tt".- See Also:
- Constant Field Values
 
 - PN_ALIGN_OPPOSITE- public static final java.lang.String PN_ALIGN_OPPOSITE Property name: trailing align opposite "ao".- See Also:
- Constant Field Values
 
 - PN_ARROW- public static final java.lang.String PN_ARROW Property name: display trailing arrow "arrow".- See Also:
- Constant Field Values
 
 
 - Constructor Detail- MLCheckBox- public MLCheckBox(boolean isChecked) Creates a new checkbox list item.- Parameters:
- isChecked- The check state.
 
 - MLCheckBox- public MLCheckBox(int state) Creates a new checkbox list item.- Parameters:
- state- The check state: 0=unchecked, 1=checked, 2=third state.
- Throws:
- java.lang.IllegalArgumentException- If check state is not 0-2.
 
 
 - Method Detail- getSelectionPropName- protected java.lang.String getSelectionPropName() Returns the IntProp property name used to set the selection to.- Overrides:
- getSelectionPropNamein class- MLItem
- Returns:
- The selection property name "checked".
 
 - 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).- Overrides:
- doBooleanSelectionOnlyin class- MLItem
- 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.
 
 - getType- public MLItemType getType() Returns the type.
 - getLeadingTextColumn- protected int getLeadingTextColumn() Returns the column index for the leading text. Types supporting description text must override this method.- Specified by:
- getLeadingTextColumnin class- MLItem
- Returns:
- The column index, or -1 for none.
 
 - getDescriptionColumn- protected int getDescriptionColumn() Returns the column index for the description. Types supporting description text must override this method.- Specified by:
- getDescriptionColumnin class- MLItem
- Returns:
- The column index = 3.
 
 - refreshFromVS- public void refreshFromVS(int[] columns) Refreshes contents from VirtualSpace.- Specified by:
- refreshFromVSin interface- IContentData<MLItemProp>
- Specified by:
- refreshFromVSin class- MLItem
- Parameters:
- columns- The connected table columns indicies, -1 for none.
 
 - initialize- public void initialize(MLItemProp item) Initializes the item property from the content data. Each list item must implement this method to provider initialization of its own and call- initialize(MLItemProp)- Specified by:
- initializein interface- IContentData<MLItemProp>
- Parameters:
- item- The item.
 
 - getUpdatePropertyNames- protected java.lang.String[] getUpdatePropertyNames() Returns the property names for which the- from(PropCnr, MLItemProp)- Returns:
- The array of update properties, never null.
 
 - getCheckState- public int getCheckState() Gets the check state with support for third state.- Returns:
- The state as: 0=unchecked, 1=checked, 2=third state.
 
 - setChecked- public java.lang.String setChecked(boolean on) Sets the check state of an item.- Parameters:
- on- The new check state.
- Returns:
- null for success.
 
 - setChecked- public java.lang.String setChecked(int state) Sets the check state of an item.- Parameters:
- state- The new check state: 0=unchecked, 1=checked, 2=third state.
- Returns:
- null for success.
- Throws:
- java.lang.IllegalArgumentException- If the state is not 0, 1 or 2.
 
 - getTrailingText- public KString getTrailingText() Gets the trailing text for the list item.- Returns:
- The text, or null if none is set.
 
 - setTrailingText- public boolean setTrailingText(KString text) Sets the trailing text for the list item.- Parameters:
- text- The new text, or null for none.
- Returns:
- true for changed, false for no change.
 
 - isTrailingTextOppositeAligned- public boolean isTrailingTextOppositeAligned() Returns if the trailing text is aligned to the opposite side, i.e. leading instead of trailing.- Returns:
- true if trailing text is aligned to leading side, false for aligned to the trailing side.
 
 - isTrailingTextOppositeAligned- public boolean isTrailingTextOppositeAligned(boolean opposite) Sets if the trailing text is aligned to the opposite side, i.e. leading instead of trailing.- Parameters:
- opposite- Alignment flag: true if trailing text is aligned to leading side, false for aligned to the trailing side.
- Returns:
- true for changed, false for no change.
 
 - isArrowDisplayed- public boolean isArrowDisplayed() Returns if the trailing arrow is displayed or not.- Returns:
- true to display arrow, false not to display arrow.
 
 - setArrowDisplayed- public boolean setArrowDisplayed(boolean on) Sets if the trailing arrow should be displayed or not.- Parameters:
- on- The display flag: true to display arrow, false not to display arrow.
- Returns:
- true for changed, false for no change.
 
 - addListener- public boolean addListener(IMLCheckBoxStateListener listener) Adds an checkbox listener for the arrow. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
- listener- The listener to add.
- Returns:
- true if the listener was added, false otherwise.
- Throws:
- java.lang.NullPointerException- If the listener is- null.
 
 - removeListener- public boolean removeListener(IMLCheckBoxStateListener listener) Removes a checkbox listener for the arrow.- Parameters:
- listener- The listener to remove.
- Returns:
- true if listener is successfully removed, false otherwise.
 
 - addListener- public boolean addListener(IMLArrowActionListener listener) Adds an action listener for the arrow. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
- listener- The listener to add.
- Returns:
- true if the listener was added, false otherwise.
- Throws:
- java.lang.NullPointerException- If the listener is- null.
 
 - removeListener- public boolean removeListener(IMLArrowActionListener listener) Removes an action listener for the arrow.- Parameters:
- listener- The listener to remove.
- Returns:
- true if listener is successfully removed, false otherwise.
 
 - onArrowInvoked- public void onArrowInvoked(MLItem item) Called when the arrow action is invoked. By default, this method will invoke all potential arrow action listeners. A subclass might override this method instead of adding a listener. This subclass should then call the- super.onArrowInvoked(item)method in case listeners are added by others.- Specified by:
- onArrowInvokedin interface- IMLArrowActionListener
- Parameters:
- item- "this" item.