prefuse.controls
Class ZoomToFitControl

java.lang.Object
  extended by prefuse.controls.ControlAdapter
      extended by prefuse.controls.ZoomToFitControl
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener, Control

public class ZoomToFitControl
extends ControlAdapter

Zooms a display such that all items within a given group will fit within the display bounds. By default, this achieved by clicking the right mouse button once, with no dragging.

Author:
jeffrey heer

Field Summary
 
Fields inherited from interface prefuse.controls.Control
LEFT_MOUSE_BUTTON, MIDDLE_MOUSE_BUTTON, RIGHT_MOUSE_BUTTON
 
Constructor Summary
ZoomToFitControl()
          Create a new ZoomToFitControl.
ZoomToFitControl(int button)
          Create a new ZoomToFitControl.
ZoomToFitControl(java.lang.String group)
          Create a new ZoomToFitControl.
ZoomToFitControl(java.lang.String group, int button)
          Create a new ZoomToFitControl.
ZoomToFitControl(java.lang.String group, int margin, long duration, int button)
          Create a new ZoomToFitControl.
 
Method Summary
 int getMargin()
          Get the display margin to include within the "zoomed-to-fit" bounds.
 boolean isZoomOverItem()
          Indicates if the zoom control will work while the mouse is over a VisualItem.
 void itemClicked(VisualItem item, java.awt.event.MouseEvent e)
          Invoked when the mouse button has been clicked (pressed and released) on a VisualItem.
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse button has been clicked (pressed and released) on the Display, but NOT on a VisualItem.
 void setMargin(int margin)
          Set the display margin to include within the "zoomed-to-fit" bounds.
 void setZoomOverItem(boolean zoomOverItem)
          Determines if the zoom control will work while the mouse is over a VisualItem
 
Methods inherited from class prefuse.controls.ControlAdapter
isEnabled, itemDragged, itemEntered, itemExited, itemKeyPressed, itemKeyReleased, itemKeyTyped, itemMoved, itemPressed, itemReleased, itemWheelMoved, keyPressed, keyReleased, keyTyped, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZoomToFitControl

public ZoomToFitControl()
Create a new ZoomToFitControl.


ZoomToFitControl

public ZoomToFitControl(java.lang.String group)
Create a new ZoomToFitControl.

Parameters:
group - the data group that should fit the Display

ZoomToFitControl

public ZoomToFitControl(int button)
Create a new ZoomToFitControl.

Parameters:
button - the mouse button used to initiate the zoom-to-fit. One of Control.LEFT_MOUSE_BUTTON, Control.MIDDLE_MOUSE_BUTTON, or Control.RIGHT_MOUSE_BUTTON.

ZoomToFitControl

public ZoomToFitControl(java.lang.String group,
                        int button)
Create a new ZoomToFitControl.

Parameters:
group - the data group that should fit the Display
button - the mouse button used to initiate the zoom-to-fit. One of Control.LEFT_MOUSE_BUTTON, Control.MIDDLE_MOUSE_BUTTON, or Control.RIGHT_MOUSE_BUTTON.

ZoomToFitControl

public ZoomToFitControl(java.lang.String group,
                        int margin,
                        long duration,
                        int button)
Create a new ZoomToFitControl.

Parameters:
group - the data group that should fit the Display
margin - the margin, in pixels, desired between the group and the edge of the display
duration - the duration of the animated zoom
button - the mouse button used to initiate the zoom-to-fit. One of Control.LEFT_MOUSE_BUTTON, Control.MIDDLE_MOUSE_BUTTON, or Control.RIGHT_MOUSE_BUTTON.
Method Detail

itemClicked

public void itemClicked(VisualItem item,
                        java.awt.event.MouseEvent e)
Description copied from interface: Control
Invoked when the mouse button has been clicked (pressed and released) on a VisualItem.

Specified by:
itemClicked in interface Control
Overrides:
itemClicked in class ControlAdapter
See Also:
Control.itemClicked(prefuse.visual.VisualItem, java.awt.event.MouseEvent)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Description copied from interface: Control
Invoked when the mouse button has been clicked (pressed and released) on the Display, but NOT on a VisualItem.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Specified by:
mouseClicked in interface Control
Overrides:
mouseClicked in class ControlAdapter
See Also:
MouseListener.mouseClicked(java.awt.event.MouseEvent)

isZoomOverItem

public boolean isZoomOverItem()
Indicates if the zoom control will work while the mouse is over a VisualItem.

Returns:
true if the control still operates over a VisualItem

setZoomOverItem

public void setZoomOverItem(boolean zoomOverItem)
Determines if the zoom control will work while the mouse is over a VisualItem

Parameters:
zoomOverItem - true to indicate the control operates over VisualItems, false otherwise

getMargin

public int getMargin()
Get the display margin to include within the "zoomed-to-fit" bounds.

Returns:
Display margin currently in use

setMargin

public void setMargin(int margin)
Set the display margin to include within the "zoomed-to-fit" bounds.

Parameters:
margin - Display margin to use


Copyright © 2007 Regents of the University of California