Class ScalingGraphMousePlugin
- java.lang.Object
- 
- org.jungrapht.visualization.control.AbstractGraphMousePlugin
- 
- org.jungrapht.visualization.control.ScalingGraphMousePlugin
 
 
- 
- All Implemented Interfaces:
- MouseListener,- MouseWheelListener,- EventListener,- GraphMousePlugin
 - Direct Known Subclasses:
- SatelliteScalingGraphMousePlugin
 
 public class ScalingGraphMousePlugin extends AbstractGraphMousePlugin implements MouseWheelListener, MouseListener ScalingGraphMouse applies a scaling transformation to the graph layout. The Vertices get closer or farther apart, but do not themselves change size. ScalingGraphMouse uses MouseWheelEvents to apply the scaling.
- Using only the mouse wheel, both the X-axis and Y-axis are scaled equally.
- If the CTRL key is pressed while the mouse wheel is turned, only the X-axis is scaled
- If the ALT key is pressed while the mouse wheel is turned, only the Y-axis is scaled
- Author:
- Tom Nelson
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classScalingGraphMousePlugin.Builder- 
Nested classes/interfaces inherited from class org.jungrapht.visualization.control.AbstractGraphMousePluginAbstractGraphMousePlugin.Selecting
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected booleanenableDoubleClickScaleResetprotected booleanenableMiddleMouseButtonScaleResetprotected floatinthe amount to zoom in byprotected ScalingControllayoutScalingControlprotected floatoutthe amount to zoom out byprotected intpickSizeprotected ScalingControlscalercontrols scaling operationsprotected intscalingMaskprotected intxAxisScalingMaskprotected intyAxisScalingMaskprotected booleanzoomAtMousewhether to center the zoom at the current mouse position- 
Fields inherited from class org.jungrapht.visualization.control.AbstractGraphMousePlugincursor, down, modifiers
 
- 
 - 
Constructor SummaryConstructors Constructor Description ScalingGraphMousePlugin()ScalingGraphMousePlugin(ScalingControl scaler, int scalingMask, int xAxisScalingMask, int yAxisScalingMask)ScalingGraphMousePlugin(ScalingControl scaler, int scalingMask, int xAxisScalingMask, int yAxisScalingMask, float in, float out)ScalingGraphMousePlugin(ScalingGraphMousePlugin.Builder builder)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ScalingGraphMousePlugin.Builderbuilder()booleancheckModifiers(MouseEvent e)check the mouse event modifiers against the instance member modifiers.floatgetIn()floatgetOut()ScalingControlgetScaler()voidmouseClicked(MouseEvent e)Invoked when the mouse button has been clicked (pressed and released) on a component.voidmouseEntered(MouseEvent e)Invoked when the mouse enters a component.voidmouseExited(MouseEvent e)Invoked when the mouse exits a component.voidmousePressed(MouseEvent e)Invoked when a mouse button has been pressed on a component.voidmouseReleased(MouseEvent e)Invoked when a mouse button has been released on a component.voidmouseWheelMoved(MouseWheelEvent e)zoom the display in or out, depending on the direction of the mouse wheel motion.voidsetIn(float in)voidsetOut(float out)voidsetScaler(ScalingControl scaler)voidsetZoomAtMouse(boolean zoomAtMouse)protected <V,E>
 booleansingleEdgeSelection(MouseEvent e)protected <V,E>
 booleansingleVertexSelection(MouseEvent e)- 
Methods inherited from class org.jungrapht.visualization.control.AbstractGraphMousePlugingetCursor, getModifiersEx, setCursor, setModifiers
 
- 
 
- 
- 
- 
Field Detail- 
pickSizeprotected int pickSize 
 - 
inprotected float in the amount to zoom in by
 - 
outprotected float out the amount to zoom out by
 - 
scalingMaskprotected int scalingMask 
 - 
xAxisScalingMaskprotected int xAxisScalingMask 
 - 
yAxisScalingMaskprotected int yAxisScalingMask 
 - 
zoomAtMouseprotected boolean zoomAtMouse whether to center the zoom at the current mouse position
 - 
scalerprotected ScalingControl scaler controls scaling operations
 - 
layoutScalingControlprotected ScalingControl layoutScalingControl 
 - 
enableMiddleMouseButtonScaleResetprotected boolean enableMiddleMouseButtonScaleReset 
 - 
enableDoubleClickScaleResetprotected boolean enableDoubleClickScaleReset 
 
- 
 - 
Constructor Detail- 
ScalingGraphMousePluginpublic ScalingGraphMousePlugin() 
 - 
ScalingGraphMousePluginpublic ScalingGraphMousePlugin(ScalingGraphMousePlugin.Builder builder) 
 - 
ScalingGraphMousePluginpublic ScalingGraphMousePlugin(ScalingControl scaler, int scalingMask, int xAxisScalingMask, int yAxisScalingMask) 
 - 
ScalingGraphMousePluginpublic ScalingGraphMousePlugin(ScalingControl scaler, int scalingMask, int xAxisScalingMask, int yAxisScalingMask, float in, float out) 
 
- 
 - 
Method Detail- 
builderpublic static ScalingGraphMousePlugin.Builder builder() 
 - 
setZoomAtMousepublic void setZoomAtMouse(boolean zoomAtMouse) - Parameters:
- zoomAtMouse- The zoomAtMouse to set.
 
 - 
checkModifierspublic boolean checkModifiers(MouseEvent e) Description copied from class:AbstractGraphMousePlugincheck the mouse event modifiers against the instance member modifiers. Default implementation checks equality. Can be overridden to test with a mask- Specified by:
- checkModifiersin interface- GraphMousePlugin
- Overrides:
- checkModifiersin class- AbstractGraphMousePlugin
- Parameters:
- e- an event to compare to
- Returns:
- whether the member modifiers match the event modifiers
 
 - 
mouseWheelMovedpublic void mouseWheelMoved(MouseWheelEvent e) zoom the display in or out, depending on the direction of the mouse wheel motion.- Specified by:
- mouseWheelMovedin interface- MouseWheelListener
 
 - 
getInpublic float getIn() - Returns:
- Returns the zoom in value.
 
 - 
setInpublic void setIn(float in) - Parameters:
- in- The zoom in value to set.
 
 - 
getOutpublic float getOut() - Returns:
- Returns the zoom out value.
 
 - 
setOutpublic void setOut(float out) - Parameters:
- out- The zoom out value to set.
 
 - 
getScalerpublic ScalingControl getScaler() 
 - 
setScalerpublic void setScaler(ScalingControl scaler) 
 - 
mouseClickedpublic void mouseClicked(MouseEvent e) Invoked when the mouse button has been clicked (pressed and released) on a component.- Specified by:
- mouseClickedin interface- MouseListener
- Parameters:
- e- the event to be processed
 
 - 
singleVertexSelectionprotected <V,E> boolean singleVertexSelection(MouseEvent e) 
 - 
singleEdgeSelectionprotected <V,E> boolean singleEdgeSelection(MouseEvent e) 
 - 
mousePressedpublic void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component.- Specified by:
- mousePressedin interface- MouseListener
- Parameters:
- e- the event to be processed
 
 - 
mouseReleasedpublic void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component.- Specified by:
- mouseReleasedin interface- MouseListener
- Parameters:
- e- the event to be processed
 
 - 
mouseEnteredpublic void mouseEntered(MouseEvent e) Invoked when the mouse enters a component.- Specified by:
- mouseEnteredin interface- MouseListener
- Parameters:
- e- the event to be processed
 
 - 
mouseExitedpublic void mouseExited(MouseEvent e) Invoked when the mouse exits a component.- Specified by:
- mouseExitedin interface- MouseListener
- Parameters:
- e- the event to be processed
 
 
- 
 
-