org.tigris.gef.base
Class CmdDistribute

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.tigris.gef.base.Cmd
          extended by org.tigris.gef.base.CmdDistribute
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public class CmdDistribute
extends Cmd

A Cmd to align 2 or more objects relative to each other.

See Also:
Serialized Form

Field Summary
protected  java.awt.Rectangle _bbox
           
protected  int _request
          Specification of the type of distribution requested
static int H_CENTERS
           
static int H_PACK
           
static int H_SPACING
          Constants specifying the type of distribution requested.
static int V_CENTERS
           
static int V_PACK
           
static int V_SPACING
           
 
Fields inherited from class org.tigris.gef.base.Cmd
_args, _resource
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
CmdDistribute(int r)
          Construct a new CmdDistribute.
 
Method Summary
 void doIt()
          Perform whatever Cmd this Cmd is meant to do.
 java.awt.Rectangle getLastBBox()
           
protected  void swap(java.util.Vector v, int i, int j)
           
 void undoIt()
          Undo the Cmd using information stored during its execution.
protected static java.lang.String wordFor(int r)
           
 
Methods inherited from class org.tigris.gef.base.Cmd
about, actionPerformed, cmdAtIndex, containsArg, getArg, getArg, getName, getResource, register, registeredCmds, setArg, setName, setResource, shouldBeEnabled, updateEnabled
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

H_SPACING

public static final int H_SPACING
Constants specifying the type of distribution requested.

See Also:
Constant Field Values

H_CENTERS

public static final int H_CENTERS
See Also:
Constant Field Values

H_PACK

public static final int H_PACK
See Also:
Constant Field Values

V_SPACING

public static final int V_SPACING
See Also:
Constant Field Values

V_CENTERS

public static final int V_CENTERS
See Also:
Constant Field Values

V_PACK

public static final int V_PACK
See Also:
Constant Field Values

_request

protected int _request
Specification of the type of distribution requested


_bbox

protected java.awt.Rectangle _bbox
Constructor Detail

CmdDistribute

public CmdDistribute(int r)
Construct a new CmdDistribute.

Parameters:
r - The desired alignment direction, one of the constants listed above.
Method Detail

wordFor

protected static java.lang.String wordFor(int r)

doIt

public void doIt()
Description copied from class: Cmd
Perform whatever Cmd this Cmd is meant to do. Subclasses should override this to do whatever is intended. When the Cmd executes, it should store enough information to undo itself later if needed.

Specified by:
doIt in class Cmd

undoIt

public void undoIt()
Description copied from class: Cmd
Undo the Cmd using information stored during its execution.

TODO Abandon this. We need the memento pattern for undo

Specified by:
undoIt in class Cmd

swap

protected void swap(java.util.Vector v,
                    int i,
                    int j)

getLastBBox

public java.awt.Rectangle getLastBBox()