ConForM.CoopnTools.CoKer.Visual
Class GraphicalVisualElementGroup

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.Visual.GraphicalVisualElementGroup
All Implemented Interfaces:
GraphicalVisualEditable, javax.swing.undo.StateEditable

public class GraphicalVisualElementGroup
extends java.lang.Object
implements GraphicalVisualEditable

Groups of general graphical visual elements. Suchs groups are actually editables. Locations and sizes of elements are given in the so-called logical space, i.e. without zooming, and distances expressed in logical coordinates, like in Aspects (1 inch = 81,92 logical units). When drawing itself, a component may be obliged to transform its coordinates in the so-called PHYSICAL space; this transformation is actually a simple affine transformation (a multiplication by an integer constant and an offset).


Fields inherited from interface javax.swing.undo.StateEditable
RCSID
 
Constructor Summary
GraphicalVisualElementGroup()
          Creates a new empty group.
GraphicalVisualElementGroup(GraphicalVisualElement element)
          Creates a new group with an unique starting element.
GraphicalVisualElementGroup(GraphicalVisualElement[] elements)
          Creates a new group with an array of starting elements.
GraphicalVisualElementGroup(GraphicalVisualElement e1, GraphicalVisualElement e2)
          Creates a new group with two starting elements.
GraphicalVisualElementGroup(GraphicalVisualElementGroup g1, GraphicalVisualElementGroup g2)
          Creates a new group by the merging of two groups.
 
Method Summary
 void abortMove()
          Abort the move.
 void addElement(GraphicalVisualElement element)
          Add an element to the group.
 void commitMove()
          Commit the move.
 boolean contains(GraphicalVisualElement element)
          Look if an element is in the group.
 GraphicalVisualElement[] elements()
          Get the contained elements.
 boolean inChange()
          Look if a change of aspect is in progress.
 boolean isEmpty()
          Look if the group is empty.
 boolean move(java.awt.Dimension dim)
          Try to move all elements of the group.
 boolean move(java.awt.Dimension dim, java.awt.Dimension grid)
          Try to move all elements of the group in a grid
 boolean moveInfo(java.awt.Dimension dim)
          Try to move the info field of all elements of the group.
 boolean moveInfo(java.awt.Dimension dim, java.awt.Dimension grid)
          Try to move the info field of all elements of the group in a grid
 boolean moveLabel(java.awt.Dimension dim)
          Try to move the label of all elements of the group.
 boolean moveLabel(java.awt.Dimension dim, java.awt.Dimension grid)
          Try to move the label of all elements of the group in a grid
 void removeAllElements()
          Remove all elements in the group.
 void removeElement(GraphicalVisualElement element)
          Remove an element from the group, if it is a member of the group.
 void restoreCompleteState(java.util.Hashtable state)
          Restore the complete state, by delegating this op to the elements.
 void restoreState(java.util.Hashtable state)
          Restore the state, by delegating this op to the elements.
 void setColor(java.awt.Color color)
          Specifiy the color of the element.
 void setInfo(java.lang.String info)
          Set the information field.
 void setShown(boolean shown)
          Specifiy if the associated element is shown.
 void setShownInfo(boolean shown)
          Specifiy is the information field is shown.
 void setShownLabel(boolean shown)
          Specifiy is the label is shown.
 void storeCompleteState(java.util.Hashtable state)
          Store the complete state, by delegating this op to the elements.
 void storeState(java.util.Hashtable state)
          Store the state, by delegating this op to the elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicalVisualElementGroup

public GraphicalVisualElementGroup()
Creates a new empty group.

GraphicalVisualElementGroup

public GraphicalVisualElementGroup(GraphicalVisualElement element)
Creates a new group with an unique starting element.

GraphicalVisualElementGroup

public GraphicalVisualElementGroup(GraphicalVisualElement e1,
                                   GraphicalVisualElement e2)
Creates a new group with two starting elements.

GraphicalVisualElementGroup

public GraphicalVisualElementGroup(GraphicalVisualElementGroup g1,
                                   GraphicalVisualElementGroup g2)
Creates a new group by the merging of two groups.

GraphicalVisualElementGroup

public GraphicalVisualElementGroup(GraphicalVisualElement[] elements)
Creates a new group with an array of starting elements.
Method Detail

removeAllElements

public void removeAllElements()
Remove all elements in the group.

isEmpty

public boolean isEmpty()
Look if the group is empty.

addElement

public void addElement(GraphicalVisualElement element)
Add an element to the group. If the element is already in the group, it is not added.

removeElement

public void removeElement(GraphicalVisualElement element)
Remove an element from the group, if it is a member of the group.

contains

public boolean contains(GraphicalVisualElement element)
Look if an element is in the group.

elements

public GraphicalVisualElement[] elements()
Get the contained elements.
Returns:
an array, possibly empty, of the contained elements. Never null.

inChange

public boolean inChange()
Look if a change of aspect is in progress.
Specified by:
inChange in interface GraphicalVisualEditable
Returns:
true iff a change of aspect is in progress.

move

public boolean move(java.awt.Dimension dim)
Try to move all elements of the group.
Specified by:
move in interface GraphicalVisualEditable
Parameters:
dim - the difference of position
Returns:
true iff the move is possible (for all elements).

move

public boolean move(java.awt.Dimension dim,
                    java.awt.Dimension grid)
Try to move all elements of the group in a grid
Specified by:
move in interface GraphicalVisualEditable
Parameters:
dim - the difference of position
grid - the grid
Returns:
true iff the move is possible (for all elements).

moveLabel

public boolean moveLabel(java.awt.Dimension dim)
Try to move the label of all elements of the group.
Specified by:
moveLabel in interface GraphicalVisualEditable
Parameters:
dim - the difference of position
Returns:
true iff the move is possible (for all elements).

moveLabel

public boolean moveLabel(java.awt.Dimension dim,
                         java.awt.Dimension grid)
Try to move the label of all elements of the group in a grid
Specified by:
moveLabel in interface GraphicalVisualEditable
Parameters:
dim - the difference of position
grid - the grid
Returns:
true iff the move is possible (for all elements).

moveInfo

public boolean moveInfo(java.awt.Dimension dim)
Try to move the info field of all elements of the group.
Specified by:
moveInfo in interface GraphicalVisualEditable
Parameters:
dim - the difference of position
Returns:
true iff the move is possible (for all elements).

moveInfo

public boolean moveInfo(java.awt.Dimension dim,
                        java.awt.Dimension grid)
Try to move the info field of all elements of the group in a grid
Specified by:
moveInfo in interface GraphicalVisualEditable
Parameters:
dim - the difference of position
grid - the grid
Returns:
true iff the move is possible (for all elements).

commitMove

public void commitMove()
Commit the move.
Specified by:
commitMove in interface GraphicalVisualEditable

abortMove

public void abortMove()
Abort the move.
Specified by:
abortMove in interface GraphicalVisualEditable

setInfo

public void setInfo(java.lang.String info)
Set the information field.
Specified by:
setInfo in interface GraphicalVisualEditable
Parameters:
info - the information field as a String; if this parameter is null, an empty string is used as information field

setShown

public void setShown(boolean shown)
Specifiy if the associated element is shown.
Specified by:
setShown in interface GraphicalVisualEditable
Parameters:
shown - true iff the element must be shown

setShownLabel

public void setShownLabel(boolean shown)
Specifiy is the label is shown.
Specified by:
setShownLabel in interface GraphicalVisualEditable
Parameters:
shown - true iff the label must be shown

setShownInfo

public void setShownInfo(boolean shown)
Specifiy is the information field is shown.
Specified by:
setShownInfo in interface GraphicalVisualEditable
Parameters:
shown - true iff the information field must be shown

setColor

public void setColor(java.awt.Color color)
Specifiy the color of the element.
Specified by:
setColor in interface GraphicalVisualEditable
Parameters:
color - the color

storeState

public void storeState(java.util.Hashtable state)
Store the state, by delegating this op to the elements.
Specified by:
storeState in interface javax.swing.undo.StateEditable

restoreState

public void restoreState(java.util.Hashtable state)
Restore the state, by delegating this op to the elements.
Specified by:
restoreState in interface javax.swing.undo.StateEditable

storeCompleteState

public void storeCompleteState(java.util.Hashtable state)
Store the complete state, by delegating this op to the elements.
Specified by:
storeCompleteState in interface GraphicalVisualEditable
Following copied from interface: ConForM.CoopnTools.CoKer.Visual.GraphicalVisualEditable
Parameters:
state - an hashtable, storing states of elements

restoreCompleteState

public void restoreCompleteState(java.util.Hashtable state)
Restore the complete state, by delegating this op to the elements.
Specified by:
restoreCompleteState in interface GraphicalVisualEditable
Following copied from interface: ConForM.CoopnTools.CoKer.Visual.GraphicalVisualEditable
Parameters:
state - an hashtable, storing states of elements