Package com.iizix.prop.ui.mlist
Class MLText
- java.lang.Object
- com.iizix.prop.ui.mlist.MLItem
- com.iizix.prop.ui.mlist.MLText
- All Implemented Interfaces:
IContentData<MLItemProp>,IMLActionButtonListener,IMLArrowActionListener
public class MLText extends MLItem implements IMLArrowActionListener, IMLActionButtonListener
Text entry is a text box that accepts any user input, with the additional specification of text type to show a special keyboard (e.g. URL, Phone Number, Numeric).The text entry 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 text entry 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:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPN_ARROWProperty name: display trailing arrow "arrow".static java.lang.StringPN_EF_ALIGNProperty name: entry field align trailing (right) "efAlign".static java.lang.StringPN_EF_CHAR_CASEProperty name: entry field character case "ccase".static java.lang.StringPN_EF_CHAR_UPDATEProperty name: entry field character update "$charUpdate".static java.lang.StringPN_EF_HINTProperty name: entry field hint "hint".static java.lang.StringPN_EF_MAXIMUM_LENGTHProperty name: maximum entry field input length "maxlen".static java.lang.StringPN_EF_MULTI_LINEProperty name: multiple-line input field "multi".static java.lang.StringPN_EF_TEXTProperty name: entry field text "efText".static java.lang.StringPN_EF_TYPEProperty name: entry field type (soft keyboard, etc: text, password number, tel, email, url) "fldType".static java.lang.StringPN_EF_VISUAL_LENGTHProperty name: maximum entry field visual length "sLen".static java.lang.Object[]TABLE_COLUMN_NAME_OR_ATOMSThe table column atoms or property names used.static Value.Type[]TABLE_COLUMN_VALUE_TYPESBest 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
Constructors Constructor Description MLText(KString text, boolean isArrowDisplayed)Constructor for a simple item that is to be added into a list.MLText(java.lang.String text, boolean isArrowDisplayed)Constructor for a simple item without trailing text that is to be added into a list.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddListener(IMLActionButtonListener listener)Adds an action button listener.booleanaddListener(IMLArrowActionListener listener)Adds an action listener for the arrow.intgetCharCase()Gets the character case conversion in entry field.java.lang.StringgetCharUpdate()Gets the entry field character update flag.protected intgetDescriptionColumn()Returns the column index for the description.java.lang.StringgetEntryFieldText()Gets the entry field text for the list item.booleangetEntryFieldTrailingAlign()Gets the entry field trailing align flag.EntryFieldTypegetEntryFieldType()Gets the entry field type defined.KStringgetHint()Gets the entry field hint for the list item.protected intgetLeadingTextColumn()Returns the column index for the leading text.intgetMaximumLength()Gets the maximum length of the number of input characters in entry field.booleangetMultipleLine()Gets the entry field multiple-line option.MLItemTypegetType()Returns the type.voidinitialize(MLItemProp item)Initializes the item property from the content data.booleanisArrowDisplayed()Returns if the trailing arrow is displayed or not.voidonActionButtonInvoked(MLItem item)Called when the action button is invoked by the user.voidonArrowInvoked(MLItem item)Called when the arrow action is invoked.voidrefreshFromVS(int[] columns)Refreshes contents from VirtualSpace.booleanremoveListener(IMLActionButtonListener listener)Removes an action button listener.booleanremoveListener(IMLArrowActionListener listener)Removes an action listener for the arrow.booleansetArrowDisplayed(boolean on)Sets if the trailing arrow should be displayed or not.booleansetCharCase(int value)Gets the character case conversion in entry field.booleansetCharUpdate(boolean on)Sets the entry field character update flag.booleansetEntryFieldText(java.lang.String text)Sets the entry field text for the list item.booleansetEntryFieldTrailingAlign(boolean on)Sets the entry field trailing align flag.booleansetEntryFieldType(EntryFieldType type)Sets the entry field type.booleansetHint(KString text)Sets the entry field hint for the list item.booleansetHint(java.lang.String text)Sets the entry field hint for the list item.booleansetMaximumLength(int length)Sets the maximum length of the number of input characters in entry field.booleansetMUltipleLine(boolean on)Sets the entry field multiple-line option.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 Detail
PN_EF_HINT
public static final java.lang.String PN_EF_HINT
Property name: entry field hint "hint".- See Also:
- Constant Field Values
PN_EF_VISUAL_LENGTH
public static final java.lang.String PN_EF_VISUAL_LENGTH
Property name: maximum entry field visual length "sLen".- See Also:
- Constant Field Values
PN_EF_MAXIMUM_LENGTH
public static final java.lang.String PN_EF_MAXIMUM_LENGTH
Property name: maximum entry field input length "maxlen".- See Also:
- Constant Field Values
PN_EF_MULTI_LINE
public static final java.lang.String PN_EF_MULTI_LINE
Property name: multiple-line input field "multi".- See Also:
- Constant Field Values
PN_EF_ALIGN
public static final java.lang.String PN_EF_ALIGN
Property name: entry field align trailing (right) "efAlign".- See Also:
- Constant Field Values
PN_EF_CHAR_UPDATE
public static final java.lang.String PN_EF_CHAR_UPDATE
Property name: entry field character update "$charUpdate".- See Also:
- Constant Field Values
PN_EF_CHAR_CASE
public static final java.lang.String PN_EF_CHAR_CASE
Property name: entry field character case "ccase".- See Also:
- Constant Field Values
PN_EF_TYPE
public static final java.lang.String PN_EF_TYPE
Property name: entry field type (soft keyboard, etc: text, password number, tel, email, url) "fldType".- See Also:
- Constant Field Values
PN_EF_TEXT
public static final java.lang.String PN_EF_TEXT
Property name: entry field text "efText".- 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
TABLE_COLUMN_NAME_OR_ATOMS
public static java.lang.Object[] TABLE_COLUMN_NAME_OR_ATOMS
The table column atoms or property names used.
TABLE_COLUMN_VALUE_TYPES
public static Value.Type[] TABLE_COLUMN_VALUE_TYPES
Best value types for the columns.
Constructor Detail
MLText
public MLText(java.lang.String text, boolean isArrowDisplayed)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.
MLText
public MLText(KString text, boolean isArrowDisplayed)
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 Detail
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 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:
getDescriptionColumnin classMLItem- Returns:
- The column index = 2.
refreshFromVS
public void refreshFromVS(int[] columns)
Refreshes contents from VirtualSpace.- Specified by:
refreshFromVSin interfaceIContentData<MLItemProp>- Specified by:
refreshFromVSin classMLItem- 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 interfaceIContentData<MLItemProp>- Parameters:
item- The item.
getHint
public KString 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
public boolean setHint(java.lang.String text)
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
public boolean setHint(KString text)
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:
java.lang.IllegalArgumentException- If the KString is not in PLAIN text format.
getMaximumLength
public int getMaximumLength()
Gets the maximum length of the number of input characters in entry field.- 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:
java.lang.IllegalArgumentException- If length is negative.
getMultipleLine
public boolean getMultipleLine()
Gets the entry field multiple-line option.- Returns:
- The multiple-line option.
setMUltipleLine
public boolean setMUltipleLine(boolean on)
Sets the entry field multiple-line option.- Parameters:
on- The new option state, true for use multiple-line.- Returns:
- true for changed, false for no change.
getEntryFieldTrailingAlign
public boolean getEntryFieldTrailingAlign()
Gets the entry field trailing align flag.- Returns:
- false (default) means left (LTR) or right (RTL), true means right (LTR) or left (RTL).
setEntryFieldTrailingAlign
public boolean setEntryFieldTrailingAlign(boolean on)
Sets the entry field trailing align flag.- Parameters:
on- false (default) means left (LTR) or right (RTL), true means right (LTR) or left (RTL).- Returns:
- true for changed, false for no change.
getCharUpdate
public java.lang.String 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:
java.lang.IllegalArgumentException- If value is not 0 to 3.
getEntryFieldType
public EntryFieldType getEntryFieldType()
Gets the entry field type defined.- Returns:
- The entry field type.
setEntryFieldType
public boolean setEntryFieldType(EntryFieldType type)
Sets the entry field type.- Parameters:
type- The new type.- Returns:
- true for value changed, false for no change.
getEntryFieldText
public java.lang.String getEntryFieldText()
Gets the entry field text for the list item.- Returns:
- The text, or null if none is set.
setEntryFieldText
public boolean setEntryFieldText(java.lang.String text)
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
public boolean addListener(IMLActionButtonListener listener)
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:
java.lang.NullPointerException- If the listener isnull.
removeListener
public boolean removeListener(IMLActionButtonListener listener)
Removes an action button listener.- Parameters:
listener- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
onActionButtonInvoked
public void onActionButtonInvoked(MLItem item)
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:
onActionButtonInvokedin interfaceIMLActionButtonListener- Parameters:
item- "this" item.
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 isnull.
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 thesuper.onArrowInvoked(item)method in case listeners are added by others.- Specified by:
onArrowInvokedin interfaceIMLArrowActionListener- Parameters:
item- "this" item.