Class CComboBox<E>

    • Field Detail

      • FIELD_HIGHT

        public static int FIELD_HIGHT
        Field Height
      • AUTO_REDUCIBLE_PROPERTY

        public static final String AUTO_REDUCIBLE_PROPERTY
        Property key for auto-reduction.
        See Also:
        Constant Field Values
      • CASE_SENSITIVE_PROPERTY

        public static final String CASE_SENSITIVE_PROPERTY
        Property key for case sensitive auto-reduction.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CComboBox

        public CComboBox​(ComboBoxModel<E> aModel)
        Creates a JComboBox that takes it's items from an existing ComboBoxModel. Since the ComboBoxModel is provided, a combo box created using this constructor does not create a default combo box model and may impact how the insert, remove and add methods behave.
        Parameters:
        aModel - the ComboBoxModel that provides the displayed list of items
        See Also:
        DefaultComboBoxModel
      • CComboBox

        public CComboBox​(E[] items)
        Creates a JComboBox that contains the elements in the specified array. By default the first item in the array (and therefore the data model) becomes selected.
        Parameters:
        items - an array of objects to insert into the combo box
        See Also:
        DefaultComboBoxModel
      • CComboBox

        public CComboBox​(E[] items,
                         String key)
        Creates a JComboBox that contains the elements in the specified array. By default the first item in the array (and therefore the data model) becomes selected.
        Parameters:
        items - an array of objects to insert into the combo box
        key - set selected if exists
        See Also:
        DefaultComboBoxModel
      • CComboBox

        public CComboBox​(Vector<E> items)
        Creates a JComboBox that contains the elements in the specified Vector. By default the first item in the vector and therefore the data model) becomes selected.
        Parameters:
        items - an array of vectors to insert into the combo box
        See Also:
        DefaultComboBoxModel
      • CComboBox

        public CComboBox()
        Creates a JComboBox with a default data model. The default data model is an empty list of objects. Use addItem to add items. By default the first item in the data model becomes selected.
        See Also:
        DefaultComboBoxModel
    • Method Detail

      • setIcon

        public void setIcon​(Icon defaultIcon)
        Set Icon of arrow button to icon
        Parameters:
        defaultIcon - Icon to be displayed
      • getCompleteComboBoxModel

        public ComboBoxModel<E> getCompleteComboBoxModel()
      • setUI

        public void setUI​(ComboBoxUI ui)
        Set UI and re-set Icon for arrow button
        Overrides:
        setUI in class JComboBox<E>
        Parameters:
        ui -
      • displayPopup

        public boolean displayPopup()
        Display Popup. Called from AdempiereComboPopup and allows to implement alternative actions than showing the popup
        Returns:
        if true, the popup should be displayed
      • setMandatory

        public void setMandatory​(boolean mandatory)
        Set Editor Mandatory
        Specified by:
        setMandatory in interface CEditor
        Parameters:
        mandatory - true, if you have to enter data
      • isMandatory

        public boolean isMandatory()
        Is Field mandatory
        Specified by:
        isMandatory in interface CEditor
        Returns:
        true, if mandatory
      • setReadWrite

        public void setReadWrite​(boolean rw)
        Enable Editor
        Specified by:
        setReadWrite in interface CEditor
        Parameters:
        rw - true, if you can enter/select data
      • isReadWrite

        public boolean isReadWrite()
        Is it possible to edit
        Specified by:
        isReadWrite in interface CEditor
        Returns:
        true, if editable
      • setBackground

        public void setBackground​(boolean error)
        Set Background based on editable / mandatory / error
        Specified by:
        setBackground in interface CEditor
        Parameters:
        error - if true, set background to error color, otherwise mandatory/editable
      • setValue

        public void setValue​(Object value)
        Set Editor to value
        Specified by:
        setValue in interface CEditor
        Parameters:
        value - value of the editor
      • getValue

        public Object getValue()
        Return Editor value
        Specified by:
        getValue in interface CEditor
        Returns:
        current value
      • getDisplay

        public String getDisplay()
        Return Display Value
        Specified by:
        getDisplay in interface CEditor
        Returns:
        displayed String value
      • setActionCommand

        public void setActionCommand​(String actionCommand)
        Set Action Command
        Overrides:
        setActionCommand in class JComboBox<E>
        Parameters:
        actionCommand - command
      • isMatchingFilter

        protected boolean isMatchingFilter​(Object element)
        Called only when auto-reducing. By default, does a case insensitive string search for a match in the string representation of the given element.
        Parameters:
        element - an element in the combo box model
        Returns:
        true if the choice is to be displayed in the popup menu
      • isAutoReducible

        public boolean isAutoReducible()
        Is the combo box auto-reducible?
        Returns:
        true if isAutoReducible()
      • setAutoReducible

        public void setAutoReducible​(boolean autoreducible)
        Set whether the combo box is auto-reducible. The combo box must also be editable for auto-reduction to fully functional. Auto-reduction of data will preclude the ability for users to enter in their own choices.
        Parameters:
        autoreducible - true will activate auto-reduction of choices when user enters text
      • isCaseSensitive

        public boolean isCaseSensitive()
        Is the auto-reduction case sensitive?
        Returns:
        true if case sensitive
      • setCaseSensitive

        public void setCaseSensitive​(boolean caseSensitive)
        Set whether auto-reduction is case sensitive.
        Parameters:
        caseSensitive - true will make auto-reduction is case sensitive
      • setShortListSearch

        public void setShortListSearch​(boolean shortList)
        set the editor to return only short list items
      • isShortListSearch

        public boolean isShortListSearch()
        does the search should return only short list items ?