Module is.codion.swing.framework.ui
Class EntityComboBox
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
A UI component based on the
EntityComboBoxModel.- See Also:
-
EntityComboBoxModel- Serialized Form
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceBuilds aEntityComboBoxinstance.static enumThe available keyboard shortcuts.Nested classes/interfaces inherited from class javax.swing.JComboBox
JComboBox.AccessibleJComboBox, JComboBox.KeySelectionManagerNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final is.codion.swing.common.ui.key.KeyboardShortcuts<EntityComboBox.KeyboardShortcut>The default keyboard shortcut keyStrokes.Fields inherited from class javax.swing.JComboBox
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminderFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Method Summary
Modifier and TypeMethodDescriptionOptional<is.codion.swing.common.ui.control.Control>voidaddFocusListener(FocusListener listener) static EntityComboBox.Builderbuilder(is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel) Instantiates a newEntityComboBoxbuilderstatic EntityComboBox.Builderbuilder(is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel, is.codion.common.value.Value<is.codion.framework.domain.entity.Entity> linkedValue) Instantiates a newEntityComboBoxbuilder<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 aComboBoxBuilderreturning a combo box for filtering this combo box via a foreign keyis.codion.swing.common.ui.control.ControlcreateForeignKeyFilterControl(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey) Creates an Action which displays a dialog for filtering this combo box via a foreign keyOptional<is.codion.swing.common.ui.control.Control>is.codion.swing.framework.model.component.EntityComboBoxModelgetModel()<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 aTextFieldBuilderreturning aNumberFieldwhich value is bound to the selected value in this combo box<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 aTextFieldBuilderreturning aNumberFieldwhich value is bound to the selected value in this combo boxvoidremoveFocusListener(FocusListener listener) voidOverridden as a workaround for editable combo boxes as initial focus components on detail panels stealing the focus from the parent panel on initialization<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 aTextFieldBuilderreturning a text field which value is bound to the selected value in this combo box<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 aTextFieldBuilderreturning a text field which value is bound to the selected value in this combo boxMethods inherited from class javax.swing.JComboBox
actionPerformed, actionPropertyChanged, addActionListener, addItem, addItemListener, addPopupMenuListener, configureEditor, configurePropertiesFromAction, contentsChanged, createActionPropertyChangeListener, createDefaultKeySelectionManager, fireActionEvent, fireItemStateChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemAt, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getPopupMenuListeners, getPrototypeDisplayValue, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyBinding, processKeyEvent, removeActionListener, removeAllItems, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectedItemChanged, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setSelectedIndex, setSelectedItem, setUI, showPopup, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
KEYBOARD_SHORTCUTS
public static final is.codion.swing.common.ui.key.KeyboardShortcuts<EntityComboBox.KeyboardShortcut> KEYBOARD_SHORTCUTSThe default keyboard shortcut keyStrokes.
-
-
Method Details
-
getModel
public is.codion.swing.framework.model.component.EntityComboBoxModel getModel() -
addControl
- Returns:
- a Control for inserting a new record, if one is available
- See Also:
-
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:
requestFocusin classJComponent
-
addFocusListener
- Overrides:
addFocusListenerin classComponent
-
removeFocusListener
- Overrides:
removeFocusListenerin classComponent
-
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, is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<is.codion.framework.domain.entity.Entity,B>> EntityComboBox, createForeignKeyFilterComboBoxB> (is.codion.framework.domain.entity.attribute.ForeignKey foreignKey) Creates aComboBoxBuilderreturning 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
ComboBoxBuilderfor 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>, is.codion.swing.common.ui.component.text.TextFieldBuilder<Integer,B>> is.codion.swing.common.ui.component.text.NumberField<Integer>, integerSelectorFieldB> (is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute) Creates aTextFieldBuilderreturning aNumberFieldwhich value is bound to the selected value in this combo box- Type Parameters:
B- the builder type- Parameters:
attribute- the attribute- Returns:
- a
NumberFieldbuilder 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>, is.codion.swing.common.ui.component.text.TextFieldBuilder<Integer,B>> is.codion.swing.common.ui.component.text.NumberField<Integer>, integerSelectorFieldB> (is.codion.swing.common.model.component.combobox.FilteredComboBoxModel.ItemFinder<is.codion.framework.domain.entity.Entity, Integer> itemFinder) Creates aTextFieldBuilderreturning aNumberFieldwhich 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
NumberFieldbuilder bound to the selected value
-
stringSelectorField
public <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<String,JTextField, is.codion.swing.common.ui.component.text.TextFieldBuilder<String,B>> JTextField, stringSelectorFieldB> (is.codion.framework.domain.entity.attribute.Attribute<String> attribute) Creates aTextFieldBuilderreturning 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
JTextFieldbuilder bound to the selected value
-
stringSelectorField
public <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<String,JTextField, is.codion.swing.common.ui.component.text.TextFieldBuilder<String,B>> JTextField, stringSelectorFieldB> (is.codion.swing.common.model.component.combobox.FilteredComboBoxModel.ItemFinder<is.codion.framework.domain.entity.Entity, String> itemFinder) Creates aTextFieldBuilderreturning 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
JTextFieldbuilder bound to the selected value
-
builder
public static EntityComboBox.Builder builder(is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel) Instantiates a newEntityComboBoxbuilder- 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 newEntityComboBoxbuilder- Parameters:
comboBoxModel- the combo box modellinkedValue- the linked value- Returns:
- a builder for a
EntityComboBox
-