y.view.hierarchy
Class HierarchyHotSpotMode

java.lang.Object
  extended by y.view.ViewMode
      extended by y.view.HotSpotMode
          extended by y.view.hierarchy.HierarchyHotSpotMode
All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener, MouseInputListener

public class HierarchyHotSpotMode
extends HotSpotMode

A specialized HotSpotMode suitable for editing hierarchically organized graphs. This modes uses a special resize policy for NodeRealizers that represent group nodes and consequentially implement AutoBoundsFeature. Such nodes may be resized to a limited degree by changing their auto bounds insets.

 

Field Summary
static byte FIXED_AUTOBOUNDS_INSETS
          Group bounds policy specifier.
static byte FIXED_MINIMUM_GROUP_BOUNDS
          Group bounds policy specifier.
 
Fields inherited from class y.view.HotSpotMode
BLOCK_UPON_MINIMUM_SIZE, DISCRETE_BLOCK_POLICY, FLIP_SIDES_UPON_MINIMUM_SIZE, NODE_CENTER_RESIZING_MODIFIER_MASK_PROPERTY, SEMI_BLOCK_UPON_MINIMUM_SIZE
 
Fields inherited from class y.view.ViewMode
ACTIVE_PROPERTY, ACTIVE_VIEW_PROPERTY, CHILD_MODE_PROPERTY, EDITING_PROPERTY, GRAB_FOCUS_ENABLED_PROPERTY, lastClickEvent, lastDragEvent, lastMoveEvent, lastPressEvent, lastReleaseEvent, MODIFIER_MASK_PROPERTY, NAME_PROPERTY, originalX, originalY, PARENT_MODE_PROPERTY, view
 
Constructor Summary
HierarchyHotSpotMode()
          Instantiates a new HierarchyHotSportMode.
HierarchyHotSpotMode(ViewContainer vc)
          Instantiates a new HierarchyHotSpotMode for a given ViewContainer
 
Method Summary
 byte getGroupBoundsPolicy()
          Returns the group bounds policy used when resizing the child nodes of a group.
 void mousePressedLeft(double x, double y)
          Initiates resizing of selected nodes.
 void mouseReleased(MouseEvent ev)
          Perform additional cleanup.
 void setGroupBoundsPolicy(byte groupBoundsPolicy)
          Sets the group bounds policy used when resizing the child nodes of a group.
protected  void updateNodeRealizerBounds(NodeRealizer vr, double x, double y, double w, double h)
          Special handling of NodeRealizers that implement AutoBoundsFeature.
 
Methods inherited from class y.view.HotSpotMode
activate, adjustPortOffsets, cancelEditing, cancelNodeResize, getCancelKeyCode, getCursor, getKeepNodeCenterModifierMask, getResizePolicy, isKeepNodeCenterModifierPressed, isModifierPressed, isOrthogonalRouting, mouseDraggedLeft, mouseReleasedLeft, reactivateParent, setCancelKeyCode, setKeepNodeCenterModifierMask, setResizePolicy
 
Methods inherited from class y.view.ViewMode
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getChild, getGraph2D, getGridX, getGridY, getHitInfo, getHitInfo, getLastHitInfo, getModifierMask, getName, getParent, init, isActive, isEditing, isGrabFocusEnabled, isGridMode, mouseClicked, mouseClicked, mouseDragged, mouseDraggedMiddle, mouseDraggedRight, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressedMiddle, mousePressedRight, mouseReleased, mouseReleasedMiddle, mouseReleasedRight, mouseShiftPressedLeft, mouseShiftPressedMiddle, mouseShiftPressedRight, mouseShiftReleasedLeft, mouseShiftReleasedMiddle, mouseShiftReleasedRight, removePropertyChangeListener, removePropertyChangeListener, setActiveView, setChild, setChild, setEditing, setGrabFocusEnabled, setGridMode, setLastHitInfo, setModifierMask, setName, setParent, translateX, translateY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIXED_AUTOBOUNDS_INSETS

public static final byte FIXED_AUTOBOUNDS_INSETS
Group bounds policy specifier. When resizing a node that belongs to a group whose realizer implements AutoBoundsFeature, the group node's autoBoundsInsets will stay fixed. It's overall bounds can grow or shrink.

See Also:
Constant Field Values

FIXED_MINIMUM_GROUP_BOUNDS

public static final byte FIXED_MINIMUM_GROUP_BOUNDS
Group bounds policy specifier. When resizing a node that belongs to a group whose realizer implements AutoBoundsFeature, the group node's bounds can grow but not shrink. Before a group node starts to grow its autoBoundsInset will be reduced, first.

See Also:
Constant Field Values
Constructor Detail

HierarchyHotSpotMode

public HierarchyHotSpotMode(ViewContainer vc)
Instantiates a new HierarchyHotSpotMode for a given ViewContainer


HierarchyHotSpotMode

public HierarchyHotSpotMode()
Instantiates a new HierarchyHotSportMode.

Method Detail

mousePressedLeft

public void mousePressedLeft(double x,
                             double y)
Initiates resizing of selected nodes.

Overrides:
mousePressedLeft in class HotSpotMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mouseReleased

public void mouseReleased(MouseEvent ev)
Perform additional cleanup.

Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class ViewMode

updateNodeRealizerBounds

protected void updateNodeRealizerBounds(NodeRealizer vr,
                                        double x,
                                        double y,
                                        double w,
                                        double h)
Special handling of NodeRealizers that implement AutoBoundsFeature. The bounds of such realizers are modified by changing their autobounds insets.

Overrides:
updateNodeRealizerBounds in class HotSpotMode
Parameters:
vr - the realizer of the node whose bounds should change.
x - the desired x-coordinate of the node bounds.
y - the desired y-coordinate of the node bounds.
w - the desired width of the node.
h - the desired height of the node.
See Also:
Also checks if the realizer provides a {@link SizeConstraintProvider} and adjusts the resizing so that it will keep to the restrictions given by that provider., SizeConstraintProvider

getGroupBoundsPolicy

public byte getGroupBoundsPolicy()
Returns the group bounds policy used when resizing the child nodes of a group.

Returns:
Returns one of FIXED_AUTOBOUNDS_INSETS and FIXED_MINIMUM_GROUP_BOUNDS.

setGroupBoundsPolicy

public void setGroupBoundsPolicy(byte groupBoundsPolicy)
Sets the group bounds policy used when resizing the child nodes of a group. By default, FIXED_AUTOBOUNDS_INSETS is set.

Parameters:
groupBoundsPolicy - one of FIXED_AUTOBOUNDS_INSETS and FIXED_MINIMUM_GROUP_BOUNDS.

© Copyright 2000-2008,
yWorks GmbH.
All rights reserved.