org.openstreetmap.josm.gui.dialogs.properties
Class PropertiesDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.openstreetmap.josm.gui.dialogs.ToggleDialog
                      extended by org.openstreetmap.josm.gui.dialogs.properties.PropertiesDialog
All Implemented Interfaces:
java.awt.event.AWTEventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, DataSetListenerAdapter.Listener, SelectionChangedListener, Helpful, MapView.EditLayerChangeListener, ShowHideButtonListener

public class PropertiesDialog
extends ToggleDialog
implements SelectionChangedListener, MapView.EditLayerChangeListener, DataSetListenerAdapter.Listener

This dialog displays the properties of the current selected primitives. If no object is selected, the dialog list is empty. If only one is selected, all properties of this object are selected. If more than one object are selected, the sum of all properties are displayed. If the different objects share the same property, the shared value is displayed. If they have different values, all of them are put in a combo box and the string "<different>" is displayed in italic. Below the list, the user can click on an add, modify and delete property button to edit the table selection value. The command is applied to all selected entries.

See Also:
Serialized Form

Nested Class Summary
(package private)  class PropertiesDialog.AbstractCopyAction
           
(package private) static class PropertiesDialog.AbstractRelationAction
           
(package private)  class PropertiesDialog.AddAction
          Action handling add button press in properties dialog.
(package private)  class PropertiesDialog.CopyAllKeyValueAction
           
(package private)  class PropertiesDialog.CopyKeyValueAction
           
(package private)  class PropertiesDialog.CopyValueAction
           
(package private)  class PropertiesDialog.DeleteAction
          Action handling delete button press in properties dialog.
(package private)  class PropertiesDialog.DownloadIncompleteMembersAction
          Action for downloading incomplete members of selected relation
(package private)  class PropertiesDialog.EditAction
          Action handling edit button press in properties dialog.
(package private)  class PropertiesDialog.HelpAction
           
(package private) static class PropertiesDialog.MemberInfo
           
 class PropertiesDialog.MouseClickWatch
          Watches for mouse clicks
static interface PropertiesDialog.RelationRelated
           
(package private)  class PropertiesDialog.SearchAction
           
(package private) static class PropertiesDialog.SelectRelationAction
           
(package private)  class PropertiesDialog.SelectRelationMembersAction
          Sets the current selection to the members of selected relation
 
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
ToggleDialog.ButtonHiddingType, ToggleDialog.TitleBar, ToggleDialog.ToggleDialogAction
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  PropertiesDialog.AddAction addAction
           
private  SideButton btnAdd
          The Add button (needed to be able to disable it)
private  SideButton btnDel
          The Delete button (needed to be able to disable it)
private  SideButton btnEdit
          The Edit button (needed to be able to disable it)
private  PropertiesDialog.CopyAllKeyValueAction copyAllKeyValueAction
           
private  PropertiesDialog.CopyKeyValueAction copyKeyValueAction
           
private  PropertiesDialog.CopyValueAction copyValueAction
           
private  DataSetListenerAdapter dataChangedAdapter
           
static int DEFAULT_LRU_TAGS_NUMBER
           
(package private)  java.util.Comparator<AutoCompletionListItem> defaultACItemComparator
           
private  PropertiesDialog.DeleteAction deleteAction
           
private  PropertiesDialog.EditAction editAction
           
private  PropertiesDialog.HelpAction helpAction
           
private  JosmAction[] josmActions
           
private static java.lang.String lastAddKey
           
private static java.lang.String lastAddValue
           
static int MAX_LRU_TAGS_NUMBER
           
private  javax.swing.table.DefaultTableModel membershipData
          The membership data of selected objects.
private  javax.swing.JPopupMenu membershipMenu
           
private  javax.swing.JTable membershipTable
          The membership table.
private  java.lang.String objKey
           
static javax.swing.JPanel pluginHook
           
private  PresetListPanel.PresetHandler presetHandler
           
private  PresetListPanel presets
          Matching preset display class
private  javax.swing.table.DefaultTableModel propertyData
          The property data of selected objects.
private  javax.swing.JPopupMenu propertyMenu
           
private  javax.swing.JTable propertyTable
          The properties table.
private static java.util.Map<Tag,java.lang.Void> recentTags
           
private  PropertiesDialog.SearchAction searchActionAny
           
private  PropertiesDialog.SearchAction searchActionSame
           
private  javax.swing.JLabel selectSth
          Text to display when nothing selected.
private  java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> valueCount
           
 
Fields inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
button, buttonHiding, detachedDialog, dialogsPanel, isCollapsed, isDocked, isShowing, name, preferencePrefix, titleBar, toggleAction, windowMenuItem
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
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
PropertiesDialog(MapFrame mapFrame)
          Create a new PropertiesDialog
 
Method Summary
private  java.awt.event.FocusAdapter addFocusAdapter(AutoCompletingComboBox keys, AutoCompletingComboBox values, AutoCompletionManager autocomplete, java.util.Comparator<AutoCompletionListItem> comparator)
          Create a focus handling adapter and apply in to the editor component of value autocompletion box.
 javax.swing.JMenuItem addMembershipPopupMenuAction(javax.swing.Action a)
           
 void addMembershipPopupMenuListener(javax.swing.event.PopupMenuListener l)
           
 void addMembershipPopupMenuSeparator()
           
private  void addProperty()
          Open the add selection dialog and add a new key/value to the table (and to the dataset, of course).
 javax.swing.JMenuItem addPropertyPopupMenuAction(javax.swing.Action a)
           
 void addPropertyPopupMenuListener(javax.swing.event.PopupMenuListener l)
           
 void addPropertyPopupMenuSeparator()
           
 void destroy()
           
 void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer)
           
private  void editMembership(int row)
          This simply fires up an RelationEditor for the relation shown; everything else is the editor's business.
private  void editProperty(int row)
          Edit the value in the properties table row
private  int findRow(javax.swing.table.TableModel model, java.lang.Object value)
           
private static java.util.List<java.lang.String> getAutocompletionKeys(java.lang.String key)
          For a given key k, return a list of keys which are used as keys for auto-completing values to increase the search space.
 IRelation getSelectedMembershipRelation()
           
 Tag getSelectedProperty()
           
 void hideNotify()
          Called when toggle dialog is hidden (collapsed, removed, MapFrame is removed, ...).
 void processDatasetEvent(AbstractDatasetChangedEvent event)
           
 void removeMembershipPopupMenuListener(javax.swing.event.PopupMenuListener l)
           
 void removePropertyPopupMenuListener(javax.swing.event.PopupMenuListener l)
           
 void selectionChanged(java.util.Collection<? extends OsmPrimitive> newSelection)
          Informs the listener that the selection in the dataset has changed.
 void setVisible(boolean b)
           
 void showNotify()
          Called when toggle dialog is shown (after it was created or expanded).
private  void suggestRecentlyAddedTags(javax.swing.JPanel p, AutoCompletingComboBox keys, AutoCompletingComboBox values, java.util.List<JosmAction> tagsActions, int tagsToShow, java.awt.event.FocusAdapter focus)
           
private  void updateSelection()
          Update selection status, call @{link #selectionChanged} function.
 
Methods inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
buttonHidden, buttonShown, closeDetachedDialog, collapse, createLayout, createLayout, detach, dock, dockWhenClosingDetachedDlg, eventDispatched, expand, getButton, getDefaultDetachedSize, getDetachedGeometry, getName, getPreferencePrefix, getPreferredHeight, getToggleAction, helpTopic, hideDialog, isDialogInCollapsedView, isDialogInDefaultView, isDialogShowing, setButton, setContentVisible, setDialogsPanel, setIsButtonHiding, setIsCollapsed, setIsDocked, setIsShowing, setTitle, showDialog, stateChanged, toggleButtonHook, toString, unfurlDialog
 
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, 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, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pluginHook

public static final javax.swing.JPanel pluginHook

propertyMenu

private javax.swing.JPopupMenu propertyMenu

membershipMenu

private javax.swing.JPopupMenu membershipMenu

valueCount

private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> valueCount

defaultACItemComparator

java.util.Comparator<AutoCompletionListItem> defaultACItemComparator

dataChangedAdapter

private final DataSetListenerAdapter dataChangedAdapter

helpAction

private final PropertiesDialog.HelpAction helpAction

copyValueAction

private final PropertiesDialog.CopyValueAction copyValueAction

copyKeyValueAction

private final PropertiesDialog.CopyKeyValueAction copyKeyValueAction

copyAllKeyValueAction

private final PropertiesDialog.CopyAllKeyValueAction copyAllKeyValueAction

searchActionSame

private final PropertiesDialog.SearchAction searchActionSame

searchActionAny

private final PropertiesDialog.SearchAction searchActionAny

addAction

private final PropertiesDialog.AddAction addAction

editAction

private final PropertiesDialog.EditAction editAction

deleteAction

private final PropertiesDialog.DeleteAction deleteAction

josmActions

private final JosmAction[] josmActions

lastAddKey

private static java.lang.String lastAddKey

lastAddValue

private static java.lang.String lastAddValue

DEFAULT_LRU_TAGS_NUMBER

public static final int DEFAULT_LRU_TAGS_NUMBER
See Also:
Constant Field Values

MAX_LRU_TAGS_NUMBER

public static final int MAX_LRU_TAGS_NUMBER
See Also:
Constant Field Values

recentTags

private static final java.util.Map<Tag,java.lang.Void> recentTags

objKey

private java.lang.String objKey

propertyData

private final javax.swing.table.DefaultTableModel propertyData
The property data of selected objects.


membershipData

private final javax.swing.table.DefaultTableModel membershipData
The membership data of selected objects.


propertyTable

private final javax.swing.JTable propertyTable
The properties table.


membershipTable

private final javax.swing.JTable membershipTable
The membership table.


btnAdd

private final SideButton btnAdd
The Add button (needed to be able to disable it)


btnEdit

private final SideButton btnEdit
The Edit button (needed to be able to disable it)


btnDel

private final SideButton btnDel
The Delete button (needed to be able to disable it)


presets

private final PresetListPanel presets
Matching preset display class


selectSth

private final javax.swing.JLabel selectSth
Text to display when nothing selected.


presetHandler

private PresetListPanel.PresetHandler presetHandler
Constructor Detail

PropertiesDialog

public PropertiesDialog(MapFrame mapFrame)
Create a new PropertiesDialog

Method Detail

showNotify

public void showNotify()
Description copied from class: ToggleDialog
Called when toggle dialog is shown (after it was created or expanded). Descendants may overwrite this method, it's a good place to register listeners needed to keep dialog updated

Overrides:
showNotify in class ToggleDialog

hideNotify

public void hideNotify()
Description copied from class: ToggleDialog
Called when toggle dialog is hidden (collapsed, removed, MapFrame is removed, ...). Good place to unregister listeners

Overrides:
hideNotify in class ToggleDialog

editProperty

private void editProperty(int row)
Edit the value in the properties table row

Parameters:
row - The row of the table from which the value is edited.

getAutocompletionKeys

private static java.util.List<java.lang.String> getAutocompletionKeys(java.lang.String key)
For a given key k, return a list of keys which are used as keys for auto-completing values to increase the search space.

Parameters:
key - the key k
Returns:
a list of keys

editMembership

private void editMembership(int row)
This simply fires up an RelationEditor for the relation shown; everything else is the editor's business.

Parameters:
row -

addProperty

private void addProperty()
Open the add selection dialog and add a new key/value to the table (and to the dataset, of course).


suggestRecentlyAddedTags

private void suggestRecentlyAddedTags(javax.swing.JPanel p,
                                      AutoCompletingComboBox keys,
                                      AutoCompletingComboBox values,
                                      java.util.List<JosmAction> tagsActions,
                                      int tagsToShow,
                                      java.awt.event.FocusAdapter focus)

addFocusAdapter

private java.awt.event.FocusAdapter addFocusAdapter(AutoCompletingComboBox keys,
                                                    AutoCompletingComboBox values,
                                                    AutoCompletionManager autocomplete,
                                                    java.util.Comparator<AutoCompletionListItem> comparator)
Create a focus handling adapter and apply in to the editor component of value autocompletion box.

Parameters:
keys - Box for keys entering and autocompletion
values - Box for values entering and autocompletion
autocomplete - Manager handling the autocompletion
comparator - Class to decide what values are offered on autocompletion
Returns:
The created adapter

setVisible

public void setVisible(boolean b)
Overrides:
setVisible in class javax.swing.JComponent

findRow

private int findRow(javax.swing.table.TableModel model,
                    java.lang.Object value)

selectionChanged

public void selectionChanged(java.util.Collection<? extends OsmPrimitive> newSelection)
Description copied from interface: SelectionChangedListener
Informs the listener that the selection in the dataset has changed.

Specified by:
selectionChanged in interface SelectionChangedListener
Parameters:
newSelection - The new selection.

updateSelection

private void updateSelection()
Update selection status, call @{link #selectionChanged} function.


editLayerChanged

public void editLayerChanged(OsmDataLayer oldLayer,
                             OsmDataLayer newLayer)
Specified by:
editLayerChanged in interface MapView.EditLayerChangeListener

processDatasetEvent

public void processDatasetEvent(AbstractDatasetChangedEvent event)
Specified by:
processDatasetEvent in interface DataSetListenerAdapter.Listener

addPropertyPopupMenuSeparator

public void addPropertyPopupMenuSeparator()

addPropertyPopupMenuAction

public javax.swing.JMenuItem addPropertyPopupMenuAction(javax.swing.Action a)

addPropertyPopupMenuListener

public void addPropertyPopupMenuListener(javax.swing.event.PopupMenuListener l)

removePropertyPopupMenuListener

public void removePropertyPopupMenuListener(javax.swing.event.PopupMenuListener l)

getSelectedProperty

public Tag getSelectedProperty()

addMembershipPopupMenuSeparator

public void addMembershipPopupMenuSeparator()

addMembershipPopupMenuAction

public javax.swing.JMenuItem addMembershipPopupMenuAction(javax.swing.Action a)

addMembershipPopupMenuListener

public void addMembershipPopupMenuListener(javax.swing.event.PopupMenuListener l)

removeMembershipPopupMenuListener

public void removeMembershipPopupMenuListener(javax.swing.event.PopupMenuListener l)

getSelectedMembershipRelation

public IRelation getSelectedMembershipRelation()

destroy

public void destroy()
Overrides:
destroy in class ToggleDialog


JOSM