Class MLComboBox

  • All Implemented Interfaces:
    IContentData<MLItemProp>

    public class MLComboBox
    extends MLItem
    ComboBox is a value field that will show a overlay widget to select its value from.

    The combo-box 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 combo-box may have a fixed width and be trailing justified (i.e. right for LTR or left for RTL).

    An optional description text can be added to the bottom of the list item.

    Author:
    Mikael Andersson
    • 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_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_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_TEXT

        public static final java.lang.String PN_EF_TEXT
        Property name: field text "efText".
        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_SELECTED_ROW

        public static final java.lang.String PN_SELECTED_ROW
        The property name: selected row.
        See Also:
        Constant Field Values
      • PN_NULLABLE

        public static final java.lang.String PN_NULLABLE
        The property name: nullable.
        See Also:
        Constant Field Values
      • PN_VS_SELECTION

        public static final java.lang.String PN_VS_SELECTION
        The property name: VS selection.
        See Also:
        Constant Field Values
      • PN_VS_COLUMN

        public static final java.lang.String PN_VS_COLUMN
        The property name: VS column.
        See Also:
        Constant Field Values
      • PN_TABLE_SELECT

        public static final java.lang.String PN_TABLE_SELECT
        The property name: VS table select.
        See Also:
        Constant Field Values
      • PN_TRANSLATE

        public static final java.lang.String PN_TRANSLATE
        The property name: Column translation column.
        See Also:
        Constant Field Values
      • PN_COLUMN_SORT

        public static final java.lang.String PN_COLUMN_SORT
        The property name: Sort column items.
        See Also:
        Constant Field Values
      • PN_HTML_LIST

        public static final java.lang.String PN_HTML_LIST
        The property name: HTML list items.
        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

      • MLComboBox

        public MLComboBox​(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.
      • MLComboBox

        public MLComboBox​(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.
        Specified by:
        getType in class MLItem
        Returns:
        MLItemType.COMBOBOX.
      • getLeadingTextColumn

        protected int getLeadingTextColumn()
        Returns the column index for the leading text. Types supporting description text must override this method.
        Specified by:
        getLeadingTextColumn in 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:
        getDescriptionColumn in class MLItem
        Returns:
        The column index = 2.
      • refreshFromVS

        public void refreshFromVS​(int[] columns)
        Refreshes contents from VirtualSpace.
        Specified by:
        refreshFromVS in interface IContentData<MLItemProp>
        Specified by:
        refreshFromVS in 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).
        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 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:
        java.lang.IllegalArgumentException - If length is negative.
      • 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.
      • 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 is null.
      • 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.
      • 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.