Package org.openstreetmap.josm.actions
Class ZoomToAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.actions.ZoomToAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.io.Serializable,java.lang.Cloneable,java.util.EventListener,javax.swing.Action,javax.swing.event.ListSelectionListener,LayerManager.LayerChangeListener,MainLayerManager.ActiveLayerChangeListener
public class ZoomToAction extends javax.swing.AbstractAction implements LayerManager.LayerChangeListener, MainLayerManager.ActiveLayerChangeListener, javax.swing.event.ListSelectionListener
An action that zooms to the selected OSM primitive in a table of primitives.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringdescriptionInactiveLayerprivate java.lang.StringdescriptionNominalprivate java.lang.StringdescriptionNoSelectionprivate OsmPrimitivesTabletable
-
Constructor Summary
Constructors Constructor Description ZoomToAction(NodeListTable table)Creates a new zoom to action for aNodeListTableusing the matching description stringsZoomToAction(RelationMemberTable table)Creates a new zoom to action for aRelationMemberTableusing the matching description stringsZoomToAction(MemberTable table)Creates a new zoom to action for aMemberTableusing the matching description stringsZoomToAction(OsmPrimitivesTable table, java.lang.String descriptionNominal, java.lang.String descriptionInactiveLayer, java.lang.String descriptionNoSelection)Creates a new, generic zoom to action
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)voidactiveOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)Called whenever the active or edit layer changed.voidlayerAdded(LayerManager.LayerAddEvent e)Notifies this listener that a layer has been added.voidlayerOrderChanged(LayerManager.LayerOrderChangeEvent e)Notifies this listener that the order of layers was changed.voidlayerRemoving(LayerManager.LayerRemoveEvent e)Notifies this listener that a layer was just removed.protected voidupdateEnabledState()voidvalueChanged(javax.swing.event.ListSelectionEvent e)-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
table
private final OsmPrimitivesTable table
-
descriptionNominal
private final java.lang.String descriptionNominal
-
descriptionInactiveLayer
private final java.lang.String descriptionInactiveLayer
-
descriptionNoSelection
private final java.lang.String descriptionNoSelection
-
-
Constructor Detail
-
ZoomToAction
public ZoomToAction(OsmPrimitivesTable table, java.lang.String descriptionNominal, java.lang.String descriptionInactiveLayer, java.lang.String descriptionNoSelection)
Creates a new, generic zoom to action- Parameters:
table- The table to get the selected element fromdescriptionNominal- The description to display if zooming is possibledescriptionInactiveLayer- The description to display if zooming is impossible because the layer is not activedescriptionNoSelection- The description to display if zooming is impossible because the table selection is empty
-
ZoomToAction
public ZoomToAction(MemberTable table)
Creates a new zoom to action for aMemberTableusing the matching description strings- Parameters:
table- The table to get the selected element from
-
ZoomToAction
public ZoomToAction(RelationMemberTable table)
Creates a new zoom to action for aRelationMemberTableusing the matching description strings- Parameters:
table- The table to get the selected element from
-
ZoomToAction
public ZoomToAction(NodeListTable table)
Creates a new zoom to action for aNodeListTableusing the matching description strings- Parameters:
table- The table to get the selected element from
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
updateEnabledState
protected final void updateEnabledState()
-
valueChanged
public void valueChanged(javax.swing.event.ListSelectionEvent e)
- Specified by:
valueChangedin interfacejavax.swing.event.ListSelectionListener
-
activeOrEditLayerChanged
public void activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)
Description copied from interface:MainLayerManager.ActiveLayerChangeListenerCalled whenever the active or edit layer changed.You can be sure that this layer is still contained in this set.
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
- Specified by:
activeOrEditLayerChangedin interfaceMainLayerManager.ActiveLayerChangeListener- Parameters:
e- The change event.
-
layerAdded
public void layerAdded(LayerManager.LayerAddEvent e)
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer has been added.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerAddedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The new added layer event
-
layerRemoving
public void layerRemoving(LayerManager.LayerRemoveEvent e)
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer was just removed.Listeners are called in the EDT thread after the layer was removed. Use
LayerManager.LayerRemoveEvent.scheduleRemoval(Collection)to remove more layers. You should not do blocking or long-running tasks in this method.- Specified by:
layerRemovingin interfaceLayerManager.LayerChangeListener- Parameters:
e- The layer to be removed (as event)
-
layerOrderChanged
public void layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that the order of layers was changed.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerOrderChangedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The order change event.
-
-