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.String
descriptionInactiveLayer
private java.lang.String
descriptionNominal
private java.lang.String
descriptionNoSelection
private OsmPrimitivesTable
table
-
Constructor Summary
Constructors Constructor Description ZoomToAction(NodeListTable table)
Creates a new zoom to action for aNodeListTable
using the matching description stringsZoomToAction(RelationMemberTable table)
Creates a new zoom to action for aRelationMemberTable
using the matching description stringsZoomToAction(MemberTable table)
Creates a new zoom to action for aMemberTable
using 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 void
actionPerformed(java.awt.event.ActionEvent e)
void
activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)
Called whenever the active or edit layer changed.void
layerAdded(LayerManager.LayerAddEvent e)
Notifies this listener that a layer has been added.void
layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Notifies this listener that the order of layers was changed.void
layerRemoving(LayerManager.LayerRemoveEvent e)
Notifies this listener that a layer was just removed.protected void
updateEnabledState()
void
valueChanged(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 aMemberTable
using 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 aRelationMemberTable
using 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 aNodeListTable
using 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:
actionPerformed
in interfacejava.awt.event.ActionListener
-
updateEnabledState
protected final void updateEnabledState()
-
valueChanged
public void valueChanged(javax.swing.event.ListSelectionEvent e)
- Specified by:
valueChanged
in interfacejavax.swing.event.ListSelectionListener
-
activeOrEditLayerChanged
public void activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)
Description copied from interface:MainLayerManager.ActiveLayerChangeListener
Called 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:
activeOrEditLayerChanged
in interfaceMainLayerManager.ActiveLayerChangeListener
- Parameters:
e
- The change event.
-
layerAdded
public void layerAdded(LayerManager.LayerAddEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies 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:
layerAdded
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The new added layer event
-
layerRemoving
public void layerRemoving(LayerManager.LayerRemoveEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies 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:
layerRemoving
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The layer to be removed (as event)
-
layerOrderChanged
public void layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies 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:
layerOrderChanged
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The order change event.
-
-