ConForM.CoopnTools.CoKer.Visual
Class AbstractGraphicalContainer

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.Visual.AbstractGraphicalElement
        |
        +--ConForM.CoopnTools.CoKer.Visual.AbstractGraphicalShape
              |
              +--ConForM.CoopnTools.CoKer.Visual.AbstractGraphicalContainer
All Implemented Interfaces:
GraphicalVisualContainer, GraphicalVisualEditable, GraphicalVisualElement, GraphicalVisualRenderable, GraphicalVisualRenderableGroup, GraphicalVisualShape, javax.swing.undo.StateEditable
Direct Known Subclasses:
CoopnGraphicalContainer

public abstract class AbstractGraphicalContainer
extends AbstractGraphicalShape
implements GraphicalVisualContainer

Abstract graphical container.


Field Summary
protected  java.awt.Point absCentre
           
protected  java.awt.Rectangle borderBox
           
protected  java.awt.Shape internalShape
           
protected static int minimalHeight
           
protected static int minimalWidth
           
protected  java.awt.Point relCentre
           
protected static int resizeGap
           
protected  java.awt.Rectangle size
           
protected  boolean validAbsCentre
           
protected  boolean validBorderBox
           
protected  boolean validInternalShape
           
protected  boolean validRelCentre
           
protected  boolean validSize
           
 
Fields inherited from class ConForM.CoopnTools.CoKer.Visual.AbstractGraphicalShape
elementShape, endingArcs, neighbours, precomputedRelElemBox, startingArcs, validElementShape
 
Fields inherited from class ConForM.CoopnTools.CoKer.Visual.AbstractGraphicalElement
absElemBox, absInfoBox, absLabelBox, absLoc, aspect, aspectMgr, boundingBox, delta, description, env, externalBox, externalInfoBox, externalLabelBox, fontRenderContext, inducedSelection, inducedSelectionColor, infoFont, infoLayout, infoLoc, label, labelColor, labelFont, labelLayout, labelLoc, normalColor, objectElement, parent, relElemBox, relInfoBox, relLabelBox, relLoc, savedAspect, selectedColor, selectedElem, selectedInfo, selectedInfoColor, selectedLabel, selectedLabelColor, unconstrained, validAbsElemBox, validAbsInfoBox, validAbsLabelBox, validAbsLoc, validBoundingBox, validColor, validExternalBox, validExternalInfoBox, validExternalLabelBox, validInfoLoc, validLabelLoc, validRelElemBox, validRelInfoBox, validRelLabelBox, validRelLoc
 
Fields inherited from interface javax.swing.undo.StateEditable
RCSID
 
Constructor Summary
AbstractGraphicalContainer(GraphicalVisualRenderableGroup parent, java.lang.String label, java.lang.String description, java.lang.Object element, ContainerAspect aspect, java.lang.String aspectName, java.lang.String aspectModule, AspectMgr aspectMgr, CoopnEnv env)
          Complete constructor.
 
Method Summary
 void abortResize()
          Abort the resize.
 void addComponent(GraphicalVisualElement component)
          Add a component.
 java.awt.Point centre()
          Get a representation of the centre of the container.
 void commitResize()
          Commit the resize.
 void componentChanged(GraphicalVisualElement component)
          Notification of the modification of a component BoundingBox.
 GraphicalVisualElement[] components()
          Get the contained elements.
 void deselect()
          Deselect the element, along with its label and information field.
 void export(GraphicalExporter g)
          Exporting method.
abstract  void exportShapeInLightGray(GraphicalExporter g)
           
protected  java.awt.Point getAbsCentre()
           
protected  java.awt.Rectangle getBorderBox()
           
protected  java.awt.Shape getInternalShape()
           
protected  java.awt.Point getRelCentre()
           
 boolean getShownInternal()
          Look if the internal part of the associated element is shown.
 java.awt.Rectangle getSize()
          Get the size.
 void induceSelection()
          Induce the selection of the element.
protected  void initElement()
          Initisalisation of the element, before computing the boxes, before any rendering.
 int inside(java.awt.Point here)
          Look if a point is "inside" the element, and if the case arises, how the point is "inside" (border, angle, middle, and so on).
 java.awt.Shape internalShape()
          Get the internal shape.
protected  void invalidateAbsCentre()
           
protected  void invalidateAbsElemBox()
           
protected  void invalidateAbsLoc()
           
protected  void invalidateBorderBox()
           
protected  void invalidateElementShape()
           
protected  void invalidateInternalShape()
           
protected  void invalidateRelCentre()
           
protected  void invalidateSize()
           
 void paint(java.awt.Graphics2D g, boolean paintSelection)
          Painting method.
 GraphicalVisualRenderable pointedElement(java.awt.Point here)
          Look if the renderable contains a point.
 void print(java.awt.Graphics2D g)
          Printing method.
 void removeComponent(GraphicalVisualElement component)
          Remove a component.
protected  void reRendition()
           
 boolean resize(java.awt.Dimension dim, int h, int v)
          Try to resize the container.
 boolean resize(java.awt.Dimension dim, int h, int v, java.awt.Dimension grid)
          Try to resize the container on a grid.
 void restoreCompleteState(java.util.Hashtable state)
          Store the aspect.
 void saveAspect()
          Start a save process.
 void saveAspectAs(java.lang.String aspectName)
          Save the aspect of the renderable as a specified name.
 void selectElement()
          Select the element.
protected  void setAbsCentre()
           
protected  void setBorderBox()
           
protected  void setBoundingBox()
           
protected  void setExternalBox()
           
protected  void setInternalShape()
           
 void setLayoutSize(java.awt.Rectangle newSize)
          Set the size according to a layout.
protected  void setRelCentre()
           
 void setShownInternal(boolean shown)
          Specifiy if the internal part of the associated element is shown.
protected  void setSize()
           
 void storeCompleteState(java.util.Hashtable state)
          Store the aspect.
protected  boolean verifyChange()
          Verify that the a change does not interfere with other elements.
protected  boolean verifyResize()
          Verify that the a resize does not interfere with other elements.
 
Methods inherited from class ConForM.CoopnTools.CoKer.Visual.AbstractGraphicalShape
addEndingArc, addNeighbour, addStartingArc, endingArcs, getElementShape, neighbours, partOfParent, removeNeighbour, setElementShape, setRelElemBox, shape, startingArcs
 
Methods inherited from class ConForM.CoopnTools.CoKer.Visual.AbstractGraphicalElement
abortMove, acceptAspect, actionOnMultipleClick, addPopupItem, aspectMgr, aspectName, attachToParent, boundingBox, clonedAspect, commitMove, description, externalBox, externalInfoBox, externalLabelBox, getAbsElemBox, getAbsInfoBox, getAbsLabelBox, getAbsLoc, getBoundingBox, getCol, getColor, getExternalBox, getExternalInfoBox, getExternalLabelBox, getInfo, getInfoLoc, getLabelLoc, getLocation, getRelElemBox, getRelInfoBox, getRelLabelBox, getRelLoc, getShown, getShownInfo, getShownLabel, getStringTransfer, getTransferable, inChange, inducedSelection, internalDrawInfo, internalDrawLabel, internalExport, internalExportInfo, internalExportLabel, internalPaint, internalPrint, invalidateAbsInfoBox, invalidateAbsLabelBox, invalidateBoundingBox, invalidateColor, invalidateExternalBox, invalidateExternalInfoBox, invalidateExternalLabelBox, invalidateInfoLoc, invalidateLabelLoc, invalidateRelElemBox, invalidateRelInfoBox, invalidateRelLabelBox, invalidateRelLoc, label, move, move, moveInfo, moveInfo, moveLabel, moveLabel, objectElement, parent, parentMoved, restoreAspect, restoreState, saveAspectAsPossible, saveAspectPossible, saveIntAspect, selected, selectInfo, selectLabel, setAbsElemBox, setAbsInfoBox, setAbsLabelBox, setAbsLoc, setColor, setColor, setExternalInfoBox, setExternalLabelBox, setInfo, setInfoLoc, setLabelLoc, setLayoutLocation, setRelInfoBox, setRelLabelBox, setRelLoc, setShown, setShownInfo, setShownLabel, specificPopup, storeState, toAbsolute, toRelative
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ConForM.CoopnTools.CoKer.Visual.GraphicalVisualContainer
findInterfacePointNear
 
Methods inherited from interface ConForM.CoopnTools.CoKer.Visual.GraphicalVisualShape
addEndingArc, addNeighbour, addStartingArc, endingArcs, findEndingAttachementPointNear, findStartingAttachementPointNear, neighbours, removeNeighbour, shape, startingArcs
 
Methods inherited from interface ConForM.CoopnTools.CoKer.Visual.GraphicalVisualElement
attachToParent, description, externalBox, externalInfoBox, externalLabelBox, getInfo, getLocation, getShown, getShownInfo, getShownLabel, getStringTransfer, getTransferable, inducedSelection, label, parent, parentMoved, partOfParent, selected, setLayoutLocation
 
Methods inherited from interface ConForM.CoopnTools.CoKer.Visual.GraphicalVisualEditable
abortMove, commitMove, inChange, move, move, moveInfo, moveInfo, moveLabel, moveLabel, setColor, setInfo, setShown, setShownInfo, setShownLabel
 
Methods inherited from interface javax.swing.undo.StateEditable
restoreState, storeState
 
Methods inherited from interface ConForM.CoopnTools.CoKer.Visual.GraphicalVisualRenderable
actionOnMultipleClick, boundingBox, saveAspectAsPossible, saveAspectPossible, selectInfo, selectLabel, specificPopup
 

Field Detail

resizeGap

protected static final int resizeGap

minimalWidth

protected static final int minimalWidth

minimalHeight

protected static final int minimalHeight

size

protected java.awt.Rectangle size

relCentre

protected java.awt.Point relCentre

absCentre

protected java.awt.Point absCentre

borderBox

protected java.awt.Rectangle borderBox

internalShape

protected java.awt.Shape internalShape

validSize

protected boolean validSize

validRelCentre

protected boolean validRelCentre

validAbsCentre

protected boolean validAbsCentre

validBorderBox

protected boolean validBorderBox

validInternalShape

protected boolean validInternalShape
Constructor Detail

AbstractGraphicalContainer

public AbstractGraphicalContainer(GraphicalVisualRenderableGroup parent,
                                  java.lang.String label,
                                  java.lang.String description,
                                  java.lang.Object element,
                                  ContainerAspect aspect,
                                  java.lang.String aspectName,
                                  java.lang.String aspectModule,
                                  AspectMgr aspectMgr,
                                  CoopnEnv env)
Complete constructor.
Method Detail

initElement

protected void initElement()
Initisalisation of the element, before computing the boxes, before any rendering.
Overrides:
initElement in class AbstractGraphicalShape

reRendition

protected void reRendition()
Overrides:
reRendition in class AbstractGraphicalShape

invalidateAbsLoc

protected void invalidateAbsLoc()
Overrides:
invalidateAbsLoc in class AbstractGraphicalShape

invalidateElementShape

protected void invalidateElementShape()
Overrides:
invalidateElementShape in class AbstractGraphicalShape

invalidateAbsElemBox

protected void invalidateAbsElemBox()
Overrides:
invalidateAbsElemBox in class AbstractGraphicalElement

setExternalBox

protected void setExternalBox()
Overrides:
setExternalBox in class AbstractGraphicalElement

componentChanged

public void componentChanged(GraphicalVisualElement component)
Notification of the modification of a component BoundingBox.
Specified by:
componentChanged in interface GraphicalVisualRenderableGroup

setBoundingBox

protected void setBoundingBox()
Overrides:
setBoundingBox in class AbstractGraphicalElement

invalidateSize

protected void invalidateSize()

getSize

public final java.awt.Rectangle getSize()
Description copied from interface: GraphicalVisualContainer
Get the size.
Specified by:
getSize in interface GraphicalVisualContainer
Following copied from interface: ConForM.CoopnTools.CoKer.Visual.GraphicalVisualContainer
Returns:
The size as a Rectangle.

setSize

protected void setSize()

invalidateRelCentre

protected void invalidateRelCentre()

getRelCentre

protected final java.awt.Point getRelCentre()

setRelCentre

protected void setRelCentre()

invalidateAbsCentre

protected void invalidateAbsCentre()

getAbsCentre

protected final java.awt.Point getAbsCentre()

setAbsCentre

protected void setAbsCentre()

invalidateBorderBox

protected void invalidateBorderBox()

getBorderBox

protected final java.awt.Rectangle getBorderBox()

setBorderBox

protected void setBorderBox()

invalidateInternalShape

protected void invalidateInternalShape()

getInternalShape

protected final java.awt.Shape getInternalShape()

setInternalShape

protected void setInternalShape()

addComponent

public void addComponent(GraphicalVisualElement component)
Add a component.
Specified by:
addComponent in interface GraphicalVisualRenderableGroup

removeComponent

public void removeComponent(GraphicalVisualElement component)
Remove a component.
Specified by:
removeComponent in interface GraphicalVisualRenderableGroup

components

public GraphicalVisualElement[] components()
Get the contained elements.
Specified by:
components in interface GraphicalVisualRenderableGroup
Returns:
an array, possibly empty, of the contained elements. Never null.

storeCompleteState

public void storeCompleteState(java.util.Hashtable state)
Store the aspect. Upon receiving this message, the receiver should place its aspect into state. This method is used to undo/redo edits.
Specified by:
storeCompleteState in interface GraphicalVisualEditable
Overrides:
storeCompleteState in class AbstractGraphicalElement
Parameters:
state - an hashtable, storing states of elements

restoreCompleteState

public void restoreCompleteState(java.util.Hashtable state)
Store the aspect. Upon receiving this message, the receiver should retrieve its aspect from state. This method is used to undo/redo edits.
Specified by:
restoreCompleteState in interface GraphicalVisualEditable
Overrides:
restoreCompleteState in class AbstractGraphicalElement
Parameters:
state - an hashtable, storing states of elements

selectElement

public void selectElement()
Select the element.
Specified by:
selectElement in interface GraphicalVisualRenderable
Overrides:
selectElement in class AbstractGraphicalShape

induceSelection

public void induceSelection()
Induce the selection of the element.
Specified by:
induceSelection in interface GraphicalVisualElement
Overrides:
induceSelection in class AbstractGraphicalShape

deselect

public void deselect()
Deselect the element, along with its label and information field.
Specified by:
deselect in interface GraphicalVisualRenderable
Overrides:
deselect in class AbstractGraphicalShape

getShownInternal

public boolean getShownInternal()
Look if the internal part of the associated element is shown. If it is not shown, only the external part is shown, including the label (provided that this one is not explicitely stated as not shown).
Specified by:
getShownInternal in interface GraphicalVisualContainer
Returns:
true iff the internal part of the element is shown.

setShownInternal

public void setShownInternal(boolean shown)
Specifiy if the internal part of the associated element is shown.
Specified by:
setShownInternal in interface GraphicalVisualContainer
Parameters:
shown - true iff the element must be shown

setLayoutSize

public void setLayoutSize(java.awt.Rectangle newSize)
Set the size according to a layout. This method is intended to be used by layouters only; it should not be called by external objects.
Specified by:
setLayoutSize in interface GraphicalVisualContainer
Parameters:
newSize - the new size, in absolute coordinates

resize

public boolean resize(java.awt.Dimension dim,
                      int h,
                      int v)
Try to resize the container.
Specified by:
resize in interface GraphicalVisualContainer
Parameters:
dim - the increment in width and height; a positive value means an inflation of the container, while a negative value means a compression of the container
h - specify if resize at left, right or both part of component; one of GraphicalVisualEditor.LEFT, GraphicalVisualEditor.MIDDLE or GraphicalVisualEditor.RIGHT
v - specify if resize at top, bottom or both part of component one of GraphicalVisualEditor.TOP, GraphicalVisualEditor.MIDDLE or GraphicalVisualEditor.BOTTOM
Returns:
true iff the resize is possible.

resize

public boolean resize(java.awt.Dimension dim,
                      int h,
                      int v,
                      java.awt.Dimension grid)
Try to resize the container on a grid.
Specified by:
resize in interface GraphicalVisualContainer
Parameters:
dim - the increment in width and height; a positive value means an inflation of the container, while a negative value means a compression of the container
h - specify if resize at left, right or both part of component; one of GraphicalVisualEditor.LEFT, GraphicalVisualEditor.MIDDLE or GraphicalVisualEditor.RIGHT
v - specify if resize at top, bottom or both part of component one of GraphicalVisualEditor.TOP, GraphicalVisualEditor.MIDDLE or GraphicalVisualEditor.BOTTOM
grid - grid size
Returns:
true iff the resize is possible.

commitResize

public void commitResize()
Commit the resize.
Specified by:
commitResize in interface GraphicalVisualContainer

abortResize

public void abortResize()
Abort the resize.
Specified by:
abortResize in interface GraphicalVisualContainer

centre

public java.awt.Point centre()
Get a representation of the centre of the container.
Specified by:
centre in interface GraphicalVisualContainer
Returns:
a point, giving the centre of the container; both coordinates are actually the double of the coordinates of the centre.

internalShape

public java.awt.Shape internalShape()
Get the internal shape.
Specified by:
internalShape in interface GraphicalVisualContainer
Returns:
the shape in which its internal elements must be included, as a shape in the logical coordinate space. The shape is located on the origin of this element.

saveAspect

public void saveAspect()
Start a save process.
Specified by:
saveAspect in interface GraphicalVisualRenderable
Overrides:
saveAspect in class AbstractGraphicalElement

saveAspectAs

public void saveAspectAs(java.lang.String aspectName)
Save the aspect of the renderable as a specified name. When receiving this event, the renderable must adopt its new aspect name, and try to save its aspect under that name.
Specified by:
saveAspectAs in interface GraphicalVisualRenderable
Overrides:
saveAspectAs in class AbstractGraphicalElement
Parameters:
aspectName - the new aspect name to use

pointedElement

public GraphicalVisualRenderable pointedElement(java.awt.Point here)
Look if the renderable contains a point. If the renderable has components, this routine should return the most accurate component in which this point is "inside".
Specified by:
pointedElement in interface GraphicalVisualRenderable
Overrides:
pointedElement in class AbstractGraphicalElement
Parameters:
point - the point in logicial coordinates; cannot be null
Returns:
null if the point is not contained in this renderable, the identifier of the smallest included renderable containing the point else.

inside

public int inside(java.awt.Point here)
Look if a point is "inside" the element, and if the case arises, how the point is "inside" (border, angle, middle, and so on).
Specified by:
inside in interface GraphicalVisualElement
Overrides:
inside in class AbstractGraphicalElement
Parameters:
point - the point in logicial coordinates; cannot be null
Returns:
an integer, with following meaning: Cursor.DEFAULT_CURSOR: point not in element; Cursor.HAND_CURSOR: point "inside" element; Cursor.TEXT_CURSOR: point "inside" info; Cursor.WAIT_CURSOR: point "inside" label; Cursor.N_RESIZE_CURSOR: point on upper side; Cursor.NE_RESIZE_CURSOR: point on up-right corner; Cursor.E_RESIZE_CURSOR: point on right side; Cursor.SE_RESIZE_CURSOR: point on down-right corner; Cursor.S_RESIZE_CURSOR: point on down side; Cursor.SW_RESIZE_CURSOR: point on down-left corner; Cursor.W_RESIZE_CURSOR: point on left side; Cursor.NW_RESIZE_CURSOR: point on up-left corner; a negative value n: point on the (-1-n)th intermediary point;
Throws:
java.lang.IllegalArgumentException - the argument is null.

paint

public void paint(java.awt.Graphics2D g,
                  boolean paintSelection)
Description copied from interface: GraphicalVisualRenderable
Painting method. This routine is called when the renderable must paint itself inside the graphics. The renderable paint either its selected parts or its un-selected parts on the graphics. The renderable draws on the graphics in logical coordinates. It is the responsability of the caller to initialise this Graphics2D object with the correct affine transformation for getting the physical space.
Specified by:
paint in interface GraphicalVisualRenderable
Overrides:
paint in class AbstractGraphicalElement
Following copied from interface: ConForM.CoopnTools.CoKer.Visual.GraphicalVisualRenderable
Parameters:
g - the graphics 2D; cannot be null
selected - if true, the renderable paints only its selected parts on the graphics; if false, the renderable paints only its unselected part on the graphics

print

public void print(java.awt.Graphics2D g)
Description copied from interface: GraphicalVisualRenderable
Printing method. This routine is called when the renderable must paint itself inside the graphics. The renderable draws inside the graphics in logical coordinates. It is the responsability of the caller to initialise this Graphics2D object with the correct affine transformation for getting the physical space.
Specified by:
print in interface GraphicalVisualRenderable
Overrides:
print in class AbstractGraphicalElement
Following copied from interface: ConForM.CoopnTools.CoKer.Visual.GraphicalVisualRenderable
Parameters:
g - the graphics 2D; cannot be null

exportShapeInLightGray

public abstract void exportShapeInLightGray(GraphicalExporter g)

export

public void export(GraphicalExporter g)
Description copied from interface: GraphicalVisualRenderable
Exporting method. This routine is called when the renderable must export itself through a graphical exporter.
Specified by:
export in interface GraphicalVisualRenderable
Overrides:
export in class AbstractGraphicalElement
Following copied from interface: ConForM.CoopnTools.CoKer.Visual.GraphicalVisualRenderable
Parameters:
g - the graphical exporter; cannot be null
See Also:
GraphicalExporter

verifyChange

protected boolean verifyChange()
Verify that the a change does not interfere with other elements.
Overrides:
verifyChange in class AbstractGraphicalShape

verifyResize

protected boolean verifyResize()
Verify that the a resize does not interfere with other elements.