Class TaggingPresetSelector
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.openstreetmap.josm.gui.widgets.SearchTextResultListPanel<TaggingPreset>
-
- org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSelector
-
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,DataSelectionListener
,TaggingPresetListener
,Destroyable
public class TaggingPresetSelector extends SearchTextResultListPanel<TaggingPreset> implements DataSelectionListener, TaggingPresetListener, Destroyable
GUI component to select tagging preset: the list with filter and two checkboxes- Since:
- 6068
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TaggingPresetSelector.PresetClassification
Computes the match ration of aTaggingPreset
wrt.static class
TaggingPresetSelector.PresetClassifications
A collection ofTaggingPresetSelector.PresetClassification
s with the functionality of filtering wrt.private static class
TaggingPresetSelector.ResultListCellRenderer
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.widgets.SearchTextResultListPanel
SearchTextResultListPanel.ResultListModel<T>
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
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
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.data.osm.DataSelectionListener
DataSelectionListener.AbstractSelectionEvent, DataSelectionListener.SelectionAddEvent, DataSelectionListener.SelectionChangeEvent, DataSelectionListener.SelectionRemoveEvent, DataSelectionListener.SelectionReplaceEvent, DataSelectionListener.SelectionToggleEvent
-
-
Field Summary
Fields Modifier and Type Field Description private JCheckBox
ckOnlyApplicable
private JCheckBox
ckSearchInTags
private static int
CLASSIFICATION_GROUP_MATCH
private static int
CLASSIFICATION_IN_FAVORITES
private static int
CLASSIFICATION_NAME_MATCH
private static int
CLASSIFICATION_TAGS_MATCH
private TaggingPresetSelector.PresetClassifications
classifications
private static BooleanProperty
ONLY_APPLICABLE
private static BooleanProperty
SEARCH_IN_TAGS
private Set<TaggingPresetType>
typesInSelection
private boolean
typesInSelectionDirty
-
Fields inherited from class org.openstreetmap.josm.gui.widgets.SearchTextResultListPanel
edSearchText, listSelectionListeners, lsResult, lsResultModel
-
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 TaggingPresetSelector(boolean displayOnlyApplicable, boolean displaySearchInTags)
Constructs a newTaggingPresetSelector
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Called when the object has been destroyed.protected void
filterItems()
Search expression can be in form: "group1/group2/name" where names can contain multiple wordsTaggingPreset
getSelectedPreset()
Determines, which preset is selected at the moment.TaggingPreset
getSelectedPresetAndUpdateClassification()
Determines, which preset is selected at the moment.private Set<TaggingPresetType>
getTypesInSelection()
void
init()
Initializes and clears the panel.void
init(Collection<TaggingPreset> presets)
Initializes the selector with a given collection of presets.void
savePreferences()
Save checkbox values in preferences for future reusevoid
selectionChanged(DataSelectionListener.SelectionChangeEvent event)
Called whenever the selection is changed.void
setSelectedPreset(TaggingPreset p)
Selects a given preset.void
taggingPresetsModified()
Called after list of tagging presets has been modified.-
Methods inherited from class org.openstreetmap.josm.gui.widgets.SearchTextResultListPanel
addSelectionListener, clearSelection, getItemCount, getSearchText, removeSelectionListener, setClickListener, setDblClickListener
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, processKeyBinding, processKeyEvent, 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, setEnabled, 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, 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, removeFocusListener, 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 Detail
-
CLASSIFICATION_IN_FAVORITES
private static final int CLASSIFICATION_IN_FAVORITES
- See Also:
- Constant Field Values
-
CLASSIFICATION_NAME_MATCH
private static final int CLASSIFICATION_NAME_MATCH
- See Also:
- Constant Field Values
-
CLASSIFICATION_GROUP_MATCH
private static final int CLASSIFICATION_GROUP_MATCH
- See Also:
- Constant Field Values
-
CLASSIFICATION_TAGS_MATCH
private static final int CLASSIFICATION_TAGS_MATCH
- See Also:
- Constant Field Values
-
SEARCH_IN_TAGS
private static final BooleanProperty SEARCH_IN_TAGS
-
ONLY_APPLICABLE
private static final BooleanProperty ONLY_APPLICABLE
-
ckOnlyApplicable
private final JCheckBox ckOnlyApplicable
-
ckSearchInTags
private final JCheckBox ckSearchInTags
-
typesInSelection
private final Set<TaggingPresetType> typesInSelection
-
typesInSelectionDirty
private boolean typesInSelectionDirty
-
classifications
private final transient TaggingPresetSelector.PresetClassifications classifications
-
-
Constructor Detail
-
TaggingPresetSelector
public TaggingPresetSelector(boolean displayOnlyApplicable, boolean displaySearchInTags)
Constructs a newTaggingPresetSelector
.- Parameters:
displayOnlyApplicable
- iftrue
display "Show only applicable to selection" checkboxdisplaySearchInTags
- iftrue
display "Search in tags" checkbox
-
-
Method Detail
-
filterItems
protected void filterItems()
Search expression can be in form: "group1/group2/name" where names can contain multiple words- Specified by:
filterItems
in classSearchTextResultListPanel<TaggingPreset>
-
getTypesInSelection
private Set<TaggingPresetType> getTypesInSelection()
-
selectionChanged
public void selectionChanged(DataSelectionListener.SelectionChangeEvent event)
Description copied from interface:DataSelectionListener
Called whenever the selection is changed. You get notified about the new selection, the elements that were added and removed and the layer that triggered the event.- Specified by:
selectionChanged
in interfaceDataSelectionListener
- Parameters:
event
- The selection change event.- See Also:
DataSelectionListener.SelectionChangeEvent
-
init
public void init()
Description copied from class:SearchTextResultListPanel
Initializes and clears the panel.- Overrides:
init
in classSearchTextResultListPanel<TaggingPreset>
-
init
public void init(Collection<TaggingPreset> presets)
Initializes the selector with a given collection of presets.- Parameters:
presets
- presets collection
-
savePreferences
public void savePreferences()
Save checkbox values in preferences for future reuse
-
getSelectedPreset
public TaggingPreset getSelectedPreset()
Determines, which preset is selected at the moment.- Returns:
- selected preset (as action)
-
getSelectedPresetAndUpdateClassification
public TaggingPreset getSelectedPresetAndUpdateClassification()
Determines, which preset is selected at the moment. UpdatesTaggingPresetSelector.PresetClassification.favoriteIndex
!- Returns:
- selected preset (as action)
-
setSelectedPreset
public void setSelectedPreset(TaggingPreset p)
Selects a given preset.- Parameters:
p
- preset to select
-
taggingPresetsModified
public void taggingPresetsModified()
Description copied from interface:TaggingPresetListener
Called after list of tagging presets has been modified.- Specified by:
taggingPresetsModified
in interfaceTaggingPresetListener
-
destroy
public void destroy()
Description copied from interface:Destroyable
Called when the object has been destroyed.- Specified by:
destroy
in interfaceDestroyable
-
-