Module is.codion.swing.framework.ui
Class EntityComboBox
- All Implemented Interfaces:
ActionListener
,ImageObserver
,ItemSelectable
,MenuContainer
,Serializable
,EventListener
,Accessible
,ListDataListener
A UI component based on the
EntityComboBoxModel
.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Builds aEntityComboBox
instance.static final class
The available controls.static interface
Provides builders for creating a combo box filtering this combo box instance, either by filter predicate or query condition.Nested classes/interfaces inherited from class javax.swing.JComboBox
JComboBox.AccessibleJComboBox, JComboBox.KeySelectionManager
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class javax.swing.JComboBox
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminder
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFocusListener
(FocusListener listener) static EntityComboBox.Builder
builder
(EntityComboBoxModel comboBoxModel) Instantiates a newEntityComboBox
builderstatic EntityComboBox.Builder
builder
(EntityComboBoxModel comboBoxModel, Value<Entity> linkedValue) Instantiates a newEntityComboBox
buildercreateForeignKeyFilterControl
(ForeignKey foreignKey) Creates aControl
displaying a dialog for filtering this combo box via a foreign keyforeignKeyComboBox
(ForeignKey foreignKey) getModel()
<B extends TextFieldBuilder<Integer,
NumberField<Integer>, B>>
TextFieldBuilder<Integer,NumberField<Integer>, B> integerSelectorField
(Attribute<Integer> attribute) Creates aTextFieldBuilder
returning aNumberField
which value is bound to the selected value in this combo box<B extends TextFieldBuilder<Integer,
NumberField<Integer>, B>>
TextFieldBuilder<Integer,NumberField<Integer>, B> integerSelectorField
(FilterComboBoxModel.ItemFinder<Entity, Integer> itemFinder) Creates aTextFieldBuilder
returning aNumberField
which value is bound to the selected value in this combo boxvoid
removeFocusListener
(FocusListener listener) void
Overridden 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 TextFieldBuilder<String,
JTextField, B>>
TextFieldBuilder<String,JTextField, B> stringSelectorField
(Attribute<String> attribute) Creates aTextFieldBuilder
returning a text field which value is bound to the selected value in this combo box<B extends TextFieldBuilder<String,
JTextField, B>>
TextFieldBuilder<String,JTextField, B> stringSelectorField
(FilterComboBoxModel.ItemFinder<Entity, String> itemFinder) Creates aTextFieldBuilder
returning 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, updateUI
Methods 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, update
Methods 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, validateTree
Methods 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
-
Method Details
-
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:
requestFocus
in classJComponent
-
addFocusListener
- Overrides:
addFocusListener
in classComponent
-
removeFocusListener
- Overrides:
removeFocusListener
in classComponent
-
createForeignKeyFilterControl
Creates aControl
displaying 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
-
foreignKeyComboBox
- Parameters:
foreignKey
- the foreign key- Returns:
- a new
EntityComboBox.ForeignKeyComboBoxFactory
-
integerSelectorField
public <B extends TextFieldBuilder<Integer,NumberField<Integer>, TextFieldBuilder<Integer,B>> NumberField<Integer>, integerSelectorFieldB> (Attribute<Integer> attribute) Creates aTextFieldBuilder
returning aNumberField
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 TextFieldBuilder<Integer,NumberField<Integer>, TextFieldBuilder<Integer,B>> NumberField<Integer>, integerSelectorFieldB> (FilterComboBoxModel.ItemFinder<Entity, Integer> itemFinder) Creates aTextFieldBuilder
returning aNumberField
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 TextFieldBuilder<String,JTextField, TextFieldBuilder<String,B>> JTextField, stringSelectorFieldB> (Attribute<String> attribute) Creates aTextFieldBuilder
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 TextFieldBuilder<String,JTextField, TextFieldBuilder<String,B>> JTextField, stringSelectorFieldB> (FilterComboBoxModel.ItemFinder<Entity, String> itemFinder) Creates aTextFieldBuilder
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
Instantiates a newEntityComboBox
builder- Parameters:
comboBoxModel
- the combo box model- Returns:
- a builder for a
EntityComboBox
-
builder
public static EntityComboBox.Builder builder(EntityComboBoxModel comboBoxModel, Value<Entity> linkedValue) Instantiates a newEntityComboBox
builder- Parameters:
comboBoxModel
- the combo box modellinkedValue
- the linked value- Returns:
- a builder for a
EntityComboBox
-