Package com.iizix.prop.ui.mlist
Class MLSpinner
java.lang.Object
com.iizix.prop.ui.mlist.MLItem
com.iizix.prop.ui.mlist.MLSpinner
- All Implemented Interfaces:
IContentData<MLItemProp>
,IMLActionButtonListener
,IMLArrowActionListener
Spinner is a value field that will show a drop-down widget to select its value from.
The spinner value can be preceded with a leading text with an optional fixed width, and the text entry will take up the remaining space in the list item.
The spinner may have a fixed width and be trailing justified (i.e. right for LTR or left for RTL).
An action button can be added to the trailing side.
An optional description text can be added to the bottom of the list item.
- Author:
- Mikael Andersson
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Property name: display trailing arrow "arrow".static final String
The property name: Sort column items.static final String
Property name: entry field align trailing (right) "efAlign".static final String
Property name: entry field character case "ccase".static final String
Property name: entry field character update "$charUpdate".static final String
Property name: entry field hint "hint".static final String
Property name: maximum entry field input length "maxlen".static final String
Property name: field text "efText".static final String
Property name: entry field type (soft keyboard, etc: text, password number, tel, email, url) "fldType".static final String
Property name: maximum entry field visual length "sLen".static final String
The property name: HTML list items.static final String
The property name: nullable.static final String
The property name: selected row.static final String
The property name: Spinner type.static final String
The property name: VS table select.static final String
The property name: Column translation column.static final String
The property name: maximal value.static final String
The property name: minimal value.static final String
The property name: value step.static final String
The property name: VS column.static final String
The property name: VS selection.static Object[]
The table column atoms or property names used.static Value.Type[]
Best value types for the columns.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
Method Summary
Modifier and TypeMethodDescriptionboolean
addListener
(IMLActionButtonListener listener) Adds an action button listener.boolean
addListener
(IMLArrowActionListener listener) Adds an action listener for the arrow.int
Gets the character case conversion in entry field.Gets the entry field character update flag.protected int
Returns the column index for the description.Gets the entry field text for the list item.Gets the entry field type defined.getHint()
Gets the entry field hint for the list item.protected int
Returns the column index for the leading text.int
Gets the entry field text for the list item.getType()
Returns the type.void
initialize
(MLItemProp item) Initializes the item property from the content data.boolean
Returns if the trailing arrow is displayed or not.void
onActionButtonInvoked
(MLItem item) Called when the action button is invoked by the user.void
onArrowInvoked
(MLItem item) Called when the arrow action is invoked.void
refreshFromVS
(int[] columns) Refreshes contents from VirtualSpace.boolean
removeListener
(IMLActionButtonListener listener) Removes an action button listener.boolean
removeListener
(IMLArrowActionListener listener) Removes an action listener for the arrow.boolean
setArrowDisplayed
(boolean on) Sets if the trailing arrow should be displayed or not.boolean
setCharCase
(int value) Gets the character case conversion in entry field.boolean
setCharUpdate
(boolean on) Sets the entry field character update flag.boolean
setEntryFieldText
(String text) Sets the entry field text for the list item.boolean
Sets the entry field type.boolean
Sets the entry field hint for the list item.boolean
Sets the entry field hint for the list item.boolean
setMaximumLength
(int length) Sets the maximum length of the number of input characters in entry field.Methods inherited from class com.iizix.prop.ui.mlist.MLItem
addMappings, doBooleanSelectionOnly, getContextMenu, getGroup, getIcon, getIconMargins, getItemProp, getLeadingText, getLeadingTextWrap, getLeadingWidth, getSelectionPropName, 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 Details
PN_EF_HINT
Property name: entry field hint "hint".- See Also:
PN_EF_VISUAL_LENGTH
Property name: maximum entry field visual length "sLen".- See Also:
PN_EF_MAXIMUM_LENGTH
Property name: maximum entry field input length "maxlen".- See Also:
PN_EF_ALIGN
Property name: entry field align trailing (right) "efAlign".- See Also:
PN_EF_CHAR_UPDATE
Property name: entry field character update "$charUpdate".- See Also:
PN_EF_CHAR_CASE
Property name: entry field character case "ccase".- See Also:
PN_EF_TEXT
Property name: field text "efText".- See Also:
PN_EF_TYPE
Property name: entry field type (soft keyboard, etc: text, password number, tel, email, url) "fldType".- See Also:
PN_SELECTED_ROW
The property name: selected row.- See Also:
PN_VALUE_MINIMUM
The property name: minimal value.- See Also:
PN_VALUE_MAXIMUM
The property name: maximal value.- See Also:
PN_VALUE_STEP
The property name: value step.- See Also:
PN_NULLABLE
The property name: nullable.- See Also:
PN_VS_SELECTION
The property name: VS selection.- See Also:
PN_VS_COLUMN
The property name: VS column.- See Also:
PN_TABLE_SELECT
The property name: VS table select.- See Also:
PN_TRANSLATE
The property name: Column translation column.- See Also:
PN_COLUMN_SORT
The property name: Sort column items.- See Also:
PN_HTML_LIST
The property name: HTML list items.- See Also:
PN_SPIN_TYPE
The property name: Spinner type.- See Also:
PN_ARROW
Property name: display trailing arrow "arrow".- See Also:
TABLE_COLUMN_NAME_OR_ATOMS
The table column atoms or property names used.TABLE_COLUMN_VALUE_TYPES
Best value types for the columns.
Constructor Details
MLSpinner
Constructor for a simple item without trailing text that is to be added into a list.- Parameters:
text
- The leading text, null for none.isArrowDisplayed
- Flag for arrow display.
MLSpinner
Constructor for a simple item that is to be added into a list.- Parameters:
text
- The leading text, null for none.isArrowDisplayed
- Flag for arrow display.
Method Details
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:
getLeadingTextColumn
in classMLItem
- 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:
getDescriptionColumn
in classMLItem
- Returns:
- The column index = 2.
refreshFromVS
public void refreshFromVS(int[] columns) Refreshes contents from VirtualSpace.- Specified by:
refreshFromVS
in interfaceIContentData<MLItemProp>
- Specified by:
refreshFromVS
in classMLItem
- Parameters:
columns
- The connected table columns indicies, -1 for none.
initialize
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:
initialize
in interfaceIContentData<MLItemProp>
- Parameters:
item
- The item.
getHint
Gets the entry field hint for the list item. It defines a hint to help users fill out the input field (also called place holder in HTML).- Returns:
- The text, or null if none is set.
setHint
Sets the entry field hint for the list item. It defines a hint to help users fill out the input field (also called place holder in HTML).- Parameters:
text
- The new text, or null for none.- Returns:
- true for changed, false for no change.
setHint
Sets the entry field hint for the list item. It defines a hint to help users fill out the input field (also called place holder in HTML).- Parameters:
text
- The new text, or null for none.- Returns:
- true for changed, false for no change.
- Throws:
IllegalArgumentException
- If the KString is not in PLAIN text format.
getMaximumLength
public int getMaximumLength()Gets the entry field text for the list item.- Returns:
- The maximum character input length, zero for no limit.
setMaximumLength
public boolean setMaximumLength(int length) Sets the maximum length of the number of input characters in entry field.- Parameters:
length
- The new length, or zero for no limit.- Returns:
- true for changed, false for no change.
- Throws:
IllegalArgumentException
- If length is negative.
getCharUpdate
Gets the entry field character update flag.- Returns:
- false (default) means entry updates server when user leaves the field, true means upon every change.
setCharUpdate
public boolean setCharUpdate(boolean on) Sets the entry field character update flag.- Parameters:
on
- false (default) means entry updates server when user leaves the field, true means upon every change.- Returns:
- true for changed, false for no change.
getCharCase
public int getCharCase()Gets the character case conversion in entry field.- Returns:
- The value as:
- 0 = Normal: no conversion (default),
- 1 = Upper: converts all characters to upper case,
- 2 = Lower: converts all characters to lower case,
- 3 = Proper: converts the first character of each word to upper case (typically used by names).
setCharCase
public boolean setCharCase(int value) Gets the character case conversion in entry field.- Parameters:
value
- A value between 0 and 3 as:- 0 = Normal: no conversion (default),
- 1 = Upper: converts all characters to upper case,
- 2 = Lower: converts all characters to lower case,
- 3 = Proper: converts the first character of each word to upper case (typically used by names).
- Returns:
- true for changed, false for no change.
- Throws:
IllegalArgumentException
- If value is not 0 to 3.
getEntryFieldType
Gets the entry field type defined.- Returns:
- The entry field type.
setEntryFieldType
Sets the entry field type.- Parameters:
type
- The new type.- Returns:
- true for value changed, false for no change.
getEntryFieldText
Gets the entry field text for the list item.- Returns:
- The text, or null if none is set.
setEntryFieldText
Sets the entry field text for the list item.- Parameters:
text
- The new text, or null for none.- 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
Adds an action button listener. 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:
NullPointerException
- If the listener isnull
.
removeListener
Removes an action button listener.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
onActionButtonInvoked
Called when the action button is invoked by the user. By default, this method will invoke all potential action listeners. A subclass might override this method instead of adding a listener. This subclass should then call thesuper.onActionButtonInvoked(item)
method in case listeners are added by others.- Specified by:
onActionButtonInvoked
in interfaceIMLActionButtonListener
- Parameters:
item
- "this" item.
addListener
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:
NullPointerException
- If the listener isnull
.
removeListener
Removes an action listener for the arrow.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
onArrowInvoked
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 thesuper.onArrowInvoked(item)
method in case listeners are added by others.- Specified by:
onArrowInvoked
in interfaceIMLArrowActionListener
- Parameters:
item
- "this" item.