org.openstreetmap.josm.gui.dialogs
Class RelationListDialog

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.RelationListDialog
All Implemented Interfaces:
java.awt.event.AWTEventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, DataSetListener, Helpful, ShowHideButtonListener

public class RelationListDialog
extends ToggleDialog
implements DataSetListener

A dialog showing all known relations, with buttons to add, edit, and delete them. We don't have such dialogs for nodes, segments, and ways, because those objects are visible on the map and can be selected there. Relations are not.

See Also:
Serialized Form

Nested Class Summary
(package private)  class RelationListDialog.AddToRelation
           
(package private)  class RelationListDialog.DeleteAction
          The delete action
(package private)  class RelationListDialog.DownloadMembersAction
          The action for downloading members of all selected relations
(package private)  class RelationListDialog.DownloadSelectedIncompleteMembersAction
          Action for downloading incomplete members of selected relations
(package private)  class RelationListDialog.DuplicateAction
          Creates a new relation with a copy of the current editor state
(package private)  class RelationListDialog.EditAction
          The edit action
(package private)  class RelationListDialog.MouseEventHandler
           
(package private) static class RelationListDialog.NewAction
          The action for creating a new relation
(package private)  class RelationListDialog.RelationDialogPopupMenu
           
private  class RelationListDialog.RelationListModel
          The list model for the list of relations displayed in the relation list dialog.
(package private)  class RelationListDialog.SelectAction
          Sets the current selection to the list of relations selected in this dialog
(package private)  class RelationListDialog.SelectMembersAction
          Sets the current selection to the list of relations selected in this dialog
 
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  RelationListDialog.AddToRelation addToRelation
           
private  RelationListDialog.DeleteAction deleteAction
          the delete action
private  javax.swing.JList displaylist
          The display list.
private  RelationListDialog.EditAction editAction
          the edit action
private  RelationListDialog.RelationListModel model
          the list model used
private  RelationListDialog.NewAction newAction
           
private  RelationListDialog.RelationDialogPopupMenu popupMenu
          the popup menu
 
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
RelationListDialog()
          constructor
 
Method Summary
 void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
          Adds a selection listener to the relation list.
 javax.swing.JMenuItem addPopupMenuAction(javax.swing.Action a)
           
 void addPopupMenuListener(javax.swing.event.PopupMenuListener l)
           
 void addPopupMenuSeparator()
           
 void dataChanged(DataChangedEvent event)
          Called after big changes in dataset.
private  Relation getSelected()
           
 java.util.Collection<Relation> getSelectedRelations()
           
 void hideNotify()
          Called when toggle dialog is hidden (collapsed, removed, MapFrame is removed, ...).
protected  void initFromLayer(Layer layer)
          Initializes the relation list dialog from a layer.
 void nodeMoved(NodeMovedEvent event)
          A node's coordinates were modified.
 void otherDatasetChange(AbstractDatasetChangedEvent event)
          Minor dataset change, currently only changeset id changed is supported, but can be extended in future.
 void primitivesAdded(PrimitivesAddedEvent event)
          A bunch of primitives were added into the DataSet, or existing deleted/invisible primitives were resurrected.
 void primitivesRemoved(PrimitivesRemovedEvent event)
          A bunch of primitives were removed from the DataSet, or preexisting primitives were marked as deleted.
 void relationMembersChanged(RelationMembersChangedEvent event)
          A relation's members have changed.
 void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
          Removes a selection listener from the relation list.
 void removePopupMenuListener(javax.swing.event.PopupMenuListener l)
           
 void selectRelation(Relation relation)
          Selects the relation relation in the list of relations.
 void selectRelations(java.util.Collection<Relation> relations)
          Selects the relations in the list of relations.
 void showNotify()
          Called when toggle dialog is shown (after it was created or expanded).
 void tagsChanged(TagsChangedEvent event)
          There was some change in the tag set of a primitive.
 void wayNodesChanged(WayNodesChangedEvent event)
          A way's node list was changed.
 
Methods inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
buttonHidden, buttonShown, closeDetachedDialog, collapse, createLayout, createLayout, destroy, 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, 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, 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

displaylist

private javax.swing.JList displaylist
The display list.


model

private RelationListDialog.RelationListModel model
the list model used


editAction

private RelationListDialog.EditAction editAction
the edit action


deleteAction

private RelationListDialog.DeleteAction deleteAction
the delete action


newAction

private RelationListDialog.NewAction newAction

addToRelation

private RelationListDialog.AddToRelation addToRelation

popupMenu

private RelationListDialog.RelationDialogPopupMenu popupMenu
the popup menu

Constructor Detail

RelationListDialog

public RelationListDialog()
constructor

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

initFromLayer

protected void initFromLayer(Layer layer)
Initializes the relation list dialog from a layer. If layer is null or if it isn't an OsmDataLayer the dialog is reset to an empty dialog. Otherwise it is initialized with the list of non-deleted and visible relations in the layer's dataset.

Parameters:
layer - the layer. May be null.

addListSelectionListener

public void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Adds a selection listener to the relation list.

Parameters:
listener - the listener to add

removeListSelectionListener

public void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
Removes a selection listener from the relation list.

Parameters:
listener - the listener to remove

getSelected

private Relation getSelected()
Returns:
The selected relation in the list

selectRelation

public void selectRelation(Relation relation)
Selects the relation relation in the list of relations.

Parameters:
relation - the relation

selectRelations

public void selectRelations(java.util.Collection<Relation> relations)
Selects the relations in the list of relations.

Parameters:
relations - the relations to be selected

addPopupMenuSeparator

public void addPopupMenuSeparator()

addPopupMenuAction

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

addPopupMenuListener

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

removePopupMenuListener

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

getSelectedRelations

public java.util.Collection<Relation> getSelectedRelations()

nodeMoved

public void nodeMoved(NodeMovedEvent event)
Description copied from interface: DataSetListener
A node's coordinates were modified.

Specified by:
nodeMoved in interface DataSetListener

wayNodesChanged

public void wayNodesChanged(WayNodesChangedEvent event)
Description copied from interface: DataSetListener
A way's node list was changed.

Specified by:
wayNodesChanged in interface DataSetListener

primitivesAdded

public void primitivesAdded(PrimitivesAddedEvent event)
Description copied from interface: DataSetListener
A bunch of primitives were added into the DataSet, or existing deleted/invisible primitives were resurrected.

Specified by:
primitivesAdded in interface DataSetListener

primitivesRemoved

public void primitivesRemoved(PrimitivesRemovedEvent event)
Description copied from interface: DataSetListener
A bunch of primitives were removed from the DataSet, or preexisting primitives were marked as deleted.

Specified by:
primitivesRemoved in interface DataSetListener

relationMembersChanged

public void relationMembersChanged(RelationMembersChangedEvent event)
Description copied from interface: DataSetListener
A relation's members have changed.

Specified by:
relationMembersChanged in interface DataSetListener

tagsChanged

public void tagsChanged(TagsChangedEvent event)
Description copied from interface: DataSetListener
There was some change in the tag set of a primitive. It can have been a tag addition, tag removal or change in tag value.

Specified by:
tagsChanged in interface DataSetListener

dataChanged

public void dataChanged(DataChangedEvent event)
Description copied from interface: DataSetListener
Called after big changes in dataset. Usually other events are stopped using Dataset.beginUpdate() and after operation is completed (Dataset.endUpdate()), #dataChanged() is called.

Specified by:
dataChanged in interface DataSetListener

otherDatasetChange

public void otherDatasetChange(AbstractDatasetChangedEvent event)
Description copied from interface: DataSetListener
Minor dataset change, currently only changeset id changed is supported, but can be extended in future.

Specified by:
otherDatasetChange in interface DataSetListener


JOSM