Class AbstractModalGraphMouse
java.lang.Object
edu.uci.ics.jung.visualization.control.PluggableGraphMouse
edu.uci.ics.jung.visualization.control.AbstractModalGraphMouse
- All Implemented Interfaces:
ModalGraphMouse
,VisualizationViewer.GraphMouse
,MouseListener
,MouseMotionListener
,MouseWheelListener
,ItemSelectable
,EventListener
- Direct Known Subclasses:
AnnotatingModalGraphMouse
,DefaultModalGraphMouse
,EditingModalGraphMouse
,ModalLensGraphMouse
public abstract class AbstractModalGraphMouse
extends PluggableGraphMouse
implements ModalGraphMouse, ItemSelectable
AbstractModalGraphMouse is a PluggableGraphMouse class that
manages a collection of plugins for picking and
transforming the graph. Additionally, it carries the notion
of a Mode: Picking or Translating. Switching between modes
allows for a more natural choice of mouse modifiers to
be used for the various plugins. The default modifiers are
intended to mimick those of mainstream software applications
in order to be intuitive to users.
To change between modes, two different controls are offered,
a combo box and a menu system. These controls are lazily created
in their respective 'getter' methods so they don't impact
code that does not intend to use them.
The menu control can be placed in an unused corner of the
GraphZoomScrollPane, which is a common location for mouse
mode selection menus in mainstream applications.
Users must implement the loadPlugins() method to create and
install the GraphMousePlugins. The order of the plugins is
important, as they are evaluated against the mask parameters
in the order that they are added.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
listener to set the mode from an external event sourceNested classes/interfaces inherited from interface edu.uci.ics.jung.visualization.control.ModalGraphMouse
ModalGraphMouse.Mode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GraphMousePlugin
protected float
used by the scaling plugins for zoom inprotected EventListenerList
listeners for mode changesprotected ModalGraphMouse.Mode
the current modeprotected JComboBox
<ModalGraphMouse.Mode> a JComboBox control available to set the modeprotected KeyListener
protected ItemListener
a listener for mode changesprotected JMenu
a menu available to set the modeprotected float
used by the scaling plugins for zoom outprotected GraphMousePlugin
protected GraphMousePlugin
protected GraphMousePlugin
protected GraphMousePlugin
protected GraphMousePlugin
Fields inherited from class edu.uci.ics.jung.visualization.control.PluggableGraphMouse
mouseListeners, mouseMotionListeners, mouseMotionPluginList, mousePluginList, mouseWheelListeners, mouseWheelPluginList
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addItemListener
(ItemListener aListener) add a listener for mode changesprotected void
Notifies all listeners that have registered interest for notification on this event type.Returns an array of all theItemListener
s added to this JComboBox with addItemListener().create (if necessary) and return a menu that will change the modeObject[]
protected abstract void
create the plugins, and load the plugins for TRANSFORMING modevoid
removeItemListener
(ItemListener aListener) remove a listener for mode changesvoid
setMode
(ModalGraphMouse.Mode mode) setter for the Mode.void
setModeKeyListener
(KeyListener modeKeyListener) protected void
protected void
void
setZoomAtMouse
(boolean zoomAtMouse) Methods inherited from class edu.uci.ics.jung.visualization.control.PluggableGraphMouse
add, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, remove
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
Methods inherited from interface java.awt.event.MouseMotionListener
mouseDragged, mouseMoved
Methods inherited from interface java.awt.event.MouseWheelListener
mouseWheelMoved
-
Field Details
-
in
protected float inused by the scaling plugins for zoom in -
out
protected float outused by the scaling plugins for zoom out -
modeListener
a listener for mode changes -
modeBox
a JComboBox control available to set the mode -
modeMenu
a menu available to set the mode -
mode
the current mode -
listenerList
listeners for mode changes -
pickingPlugin
-
translatingPlugin
-
animatedPickingPlugin
-
scalingPlugin
-
rotatingPlugin
-
shearingPlugin
-
modeKeyListener
-
-
Constructor Details
-
AbstractModalGraphMouse
protected AbstractModalGraphMouse(float in, float out)
-
-
Method Details
-
loadPlugins
protected abstract void loadPlugins()create the plugins, and load the plugins for TRANSFORMING mode -
setMode
setter for the Mode.- Specified by:
setMode
in interfaceModalGraphMouse
-
setPickingMode
protected void setPickingMode() -
setTransformingMode
protected void setTransformingMode() -
setZoomAtMouse
public void setZoomAtMouse(boolean zoomAtMouse) - Parameters:
zoomAtMouse
- The zoomAtMouse to set.
-
getModeListener
- Specified by:
getModeListener
in interfaceModalGraphMouse
- Returns:
- Returns the modeListener.
-
getModeKeyListener
- Returns:
- the modeKeyListener
-
setModeKeyListener
- Parameters:
modeKeyListener
- the modeKeyListener to set
-
getModeComboBox
- Returns:
- Returns the modeBox.
-
getModeMenu
create (if necessary) and return a menu that will change the mode- Returns:
- the menu
-
addItemListener
add a listener for mode changes- Specified by:
addItemListener
in interfaceItemSelectable
-
removeItemListener
remove a listener for mode changes- Specified by:
removeItemListener
in interfaceItemSelectable
-
getItemListeners
Returns an array of all theItemListener
s added to this JComboBox with addItemListener().- Returns:
- all of the
ItemListener
s added or an empty array if no listeners have been added - Since:
- 1.4
-
getSelectedObjects
- Specified by:
getSelectedObjects
in interfaceItemSelectable
-
fireItemStateChanged
Notifies all listeners that have registered interest for notification on this event type.- Parameters:
e
- the event of interest- See Also:
-