Class AutoCompComboBox<E>
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JComboBox<E>
-
- org.openstreetmap.josm.gui.widgets.JosmComboBox<E>
-
- org.openstreetmap.josm.gui.tagging.ac.AutoCompComboBox<E>
-
- Type Parameters:
E
- the type of the combobox entries
- All Implemented Interfaces:
ActionListener
,ImageObserver
,ItemSelectable
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
,ListDataListener
,PopupMenuListener
,AutoCompListener
- Direct Known Subclasses:
AutoCompletingComboBox
,HistoryComboBox
public class AutoCompComboBox<E> extends JosmComboBox<E> implements AutoCompListener
An auto-completing ComboBox.When the user starts typing, this combobox will suggest the
best matching item
from its list. The items can be of any type while the items'toString
values are shown in the combobox and editor.- Since:
- 18173
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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 Modifier and Type Field Description private InputContext
privateInputContext
private boolean
useFixedLocale
force a different keyboard input locale for the editor-
Fields inherited from class org.openstreetmap.josm.gui.widgets.JosmComboBox
PROP_MAXIMUM_ROW_COUNT
-
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
-
-
Constructor Summary
Constructors Constructor Description AutoCompComboBox()
Constructs anAutoCompletingComboBox
.AutoCompComboBox(AutoCompComboBoxModel<E> model)
Constructs anAutoCompletingComboBox
with a suppliedAutoCompComboBoxModel
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
autoCompBefore(AutoCompEvent e)
AutoCompListener Interfaceprivate void
autocomplete(Object item)
Selects the autocompleted item in the dropdown.void
autoCompPerformed(AutoCompEvent e)
Invoked after an autocomplete happened.AutoCompTextField<E>
getEditorComponent()
Returns the editor componentInputContext
getInputContext()
AutoCompComboBoxModel<E>
getModel()
Returns theAutoCompComboBoxModel
currently used.boolean
setAutocompleteEnabled(boolean enabled)
Enables or disables the autocompletion.void
setEditor(ComboBoxEditor newEditor)
void
setFixedLocale(boolean f)
Fixes the locale for keyboard input to US-English.-
Methods inherited from class org.openstreetmap.josm.gui.widgets.JosmComboBox
discardAllUndoableEdits, displayHint, getEditorItemAsString, getHint, getList, getPreferredSize, getText, paintComponent, popupMenuCanceled, popupMenuWillBecomeInvisible, popupMenuWillBecomeVisible, propertyChange, setComponentOrientation, setHint, setPreferredHeight, setSelectedItemText, setText
-
Methods 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, 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, 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, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, 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, addFocusListener, 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, 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, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
useFixedLocale
private boolean useFixedLocale
force a different keyboard input locale for the editor
-
privateInputContext
private final transient InputContext privateInputContext
-
-
Constructor Detail
-
AutoCompComboBox
public AutoCompComboBox()
Constructs anAutoCompletingComboBox
.
-
AutoCompComboBox
public AutoCompComboBox(AutoCompComboBoxModel<E> model)
Constructs anAutoCompletingComboBox
with a suppliedAutoCompComboBoxModel
.- Parameters:
model
- the model
-
-
Method Detail
-
getModel
public AutoCompComboBoxModel<E> getModel()
Returns theAutoCompComboBoxModel
currently used.- Overrides:
getModel
in classJosmComboBox<E>
- Returns:
- the model or null
-
setEditor
public void setEditor(ComboBoxEditor newEditor)
- Overrides:
setEditor
in classJosmComboBox<E>
-
getEditorComponent
public AutoCompTextField<E> getEditorComponent()
Returns the editor component- Overrides:
getEditorComponent
in classJosmComboBox<E>
- Returns:
- the editor component
- Since:
- 18221
- See Also:
ComboBoxEditor.getEditorComponent()
-
autocomplete
private void autocomplete(Object item)
Selects the autocompleted item in the dropdown.- Parameters:
item
- the item selected for autocomplete
-
setAutocompleteEnabled
public boolean setAutocompleteEnabled(boolean enabled)
Enables or disables the autocompletion.- Parameters:
enabled
-true
to enable autocompletion- Returns:
true
if autocomplete was enabled before calling this- Since:
- 18173 (signature)
-
setFixedLocale
public void setFixedLocale(boolean f)
Fixes the locale for keyboard input to US-English.If the locale is fixed, English keyboard layout will be used by default for this combobox. All other components can still have different keyboard layout selected.
- Parameters:
f
- iftrue
use fixed locale
-
getInputContext
public InputContext getInputContext()
- Overrides:
getInputContext
in classComponent
-
autoCompBefore
public void autoCompBefore(AutoCompEvent e)
AutoCompListener Interface- Specified by:
autoCompBefore
in interfaceAutoCompListener
- Parameters:
e
- anAutoCompEvent
-
autoCompPerformed
public void autoCompPerformed(AutoCompEvent e)
Description copied from interface:AutoCompListener
Invoked after an autocomplete happened.- Specified by:
autoCompPerformed
in interfaceAutoCompListener
- Parameters:
e
- anAutoCompEvent
-
-