java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JComboBox<is.codion.framework.domain.entity.Entity>
is.codion.swing.framework.ui.component.EntityComboBox
All Implemented Interfaces:
ActionListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, ListDataListener

public final class EntityComboBox extends JComboBox<is.codion.framework.domain.entity.Entity>
A UI component based on the EntityComboBoxModel.
See Also:
  • Field Details

    • KEYBOARD_SHORTCUTS

      public static final is.codion.swing.common.ui.key.KeyboardShortcuts<EntityComboBox.KeyboardShortcut> KEYBOARD_SHORTCUTS
      The default keyboard shortcut keyStrokes.
  • Method Details

    • getModel

      public is.codion.swing.framework.model.component.EntityComboBoxModel getModel()
      Overrides:
      getModel in class JComboBox<is.codion.framework.domain.entity.Entity>
    • addControl

      public Optional<is.codion.swing.common.ui.control.Control> addControl()
      Returns:
      a Control for inserting a new record, if one is available
      See Also:
    • editControl

      public Optional<is.codion.swing.common.ui.control.Control> editControl()
      Returns:
      a Control for editing the selected record, if one is available
      See Also:
    • requestFocus

      public void requestFocus()
      Overridden as a workaround for editable combo boxes as initial focus components on detail panels stealing the focus from the parent panel on initialization
      Overrides:
      requestFocus in class JComponent
    • addFocusListener

      public void addFocusListener(FocusListener listener)
      Overrides:
      addFocusListener in class Component
    • removeFocusListener

      public void removeFocusListener(FocusListener listener)
      Overrides:
      removeFocusListener in class Component
    • createForeignKeyFilterControl

      public is.codion.swing.common.ui.control.Control createForeignKeyFilterControl(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
      Creates an Action which displays a dialog for filtering this combo box via a foreign key
      Parameters:
      foreignKey - the foreign key on which to filter
      Returns:
      a Control for filtering this combo box
    • createForeignKeyFilterComboBox

      public <B extends is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<is.codion.framework.domain.entity.Entity, EntityComboBox, B>> is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<is.codion.framework.domain.entity.Entity,EntityComboBox,B> createForeignKeyFilterComboBox(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
      Creates a ComboBoxBuilder returning a combo box for filtering this combo box via a foreign key
      Type Parameters:
      B - the builder type
      Parameters:
      foreignKey - the foreign key on which to filter
      Returns:
      a ComboBoxBuilder for a foreign key filter combo box
    • integerSelectorField

      public <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<Integer, is.codion.swing.common.ui.component.text.NumberField<Integer>, B>> is.codion.swing.common.ui.component.text.TextFieldBuilder<Integer,is.codion.swing.common.ui.component.text.NumberField<Integer>,B> integerSelectorField(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute)
      Creates a TextFieldBuilder returning a NumberField which value is bound to the selected value in this combo box
      Type Parameters:
      B - the builder type
      Parameters:
      attribute - the attribute
      Returns:
      a NumberField builder bound to the selected value
    • integerSelectorField

      public <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<Integer, is.codion.swing.common.ui.component.text.NumberField<Integer>, B>> is.codion.swing.common.ui.component.text.TextFieldBuilder<Integer,is.codion.swing.common.ui.component.text.NumberField<Integer>,B> integerSelectorField(is.codion.swing.common.model.component.combobox.FilteredComboBoxModel.ItemFinder<is.codion.framework.domain.entity.Entity,Integer> itemFinder)
      Creates a TextFieldBuilder returning a NumberField which value is bound to the selected value in this combo box
      Type Parameters:
      B - the builder type
      Parameters:
      itemFinder - responsible for finding the item to select by value
      Returns:
      a NumberField builder bound to the selected value
    • stringSelectorField

      public <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<String, JTextField, B>> is.codion.swing.common.ui.component.text.TextFieldBuilder<String,JTextField,B> stringSelectorField(is.codion.framework.domain.entity.attribute.Attribute<String> attribute)
      Creates a TextFieldBuilder returning a text field which value is bound to the selected value in this combo box
      Type Parameters:
      B - the builder type
      Parameters:
      attribute - the attribute
      Returns:
      a JTextField builder bound to the selected value
    • stringSelectorField

      public <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<String, JTextField, B>> is.codion.swing.common.ui.component.text.TextFieldBuilder<String,JTextField,B> stringSelectorField(is.codion.swing.common.model.component.combobox.FilteredComboBoxModel.ItemFinder<is.codion.framework.domain.entity.Entity,String> itemFinder)
      Creates a TextFieldBuilder returning a text field which value is bound to the selected value in this combo box
      Type Parameters:
      B - the builder type
      Parameters:
      itemFinder - responsible for finding the item to select by value
      Returns:
      a JTextField builder bound to the selected value
    • builder

      public static EntityComboBox.Builder builder(is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel)
      Instantiates a new EntityComboBox builder
      Parameters:
      comboBoxModel - the combo box model
      Returns:
      a builder for a EntityComboBox
    • builder

      public static EntityComboBox.Builder builder(is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel, is.codion.common.value.Value<is.codion.framework.domain.entity.Entity> linkedValue)
      Instantiates a new EntityComboBox builder
      Parameters:
      comboBoxModel - the combo box model
      linkedValue - the linked value
      Returns:
      a builder for a EntityComboBox