ConForM.CoopnTools.CoKer.Visual
Class AbstractGraphicalElement

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

public abstract class AbstractGraphicalElement
extends java.lang.Object
implements GraphicalVisualElement

abstract graphical element.


Field Summary
protected  java.awt.Rectangle absElemBox
           
protected  java.awt.Rectangle absInfoBox
           
protected  java.awt.Rectangle absLabelBox
           
protected  java.awt.Point absLoc
           
protected  Aspect aspect
           
protected  AspectMgr aspectMgr
           
protected  java.awt.Rectangle boundingBox
           
protected  int delta
           
protected  java.lang.String description
           
protected  CoopnEnv env
           
protected  java.awt.Rectangle externalBox
           
protected  java.awt.Rectangle externalInfoBox
           
protected  java.awt.Rectangle externalLabelBox
           
protected  java.awt.font.FontRenderContext fontRenderContext
           
protected  boolean inducedSelection
           
protected  java.awt.Color inducedSelectionColor
           
protected  java.awt.Font infoFont
           
protected  java.awt.font.TextLayout infoLayout
           
protected  java.awt.Point infoLoc
           
protected  java.lang.String label
           
protected  java.awt.Color labelColor
           
protected  java.awt.Font labelFont
           
protected  java.awt.font.TextLayout labelLayout
           
protected  java.awt.Point labelLoc
           
protected  java.awt.Color normalColor
           
protected  java.lang.Object objectElement
           
protected  GraphicalVisualRenderableGroup parent
           
protected  java.awt.Rectangle relElemBox
           
protected  java.awt.Rectangle relInfoBox
           
protected  java.awt.Rectangle relLabelBox
           
protected  java.awt.Point relLoc
           
protected  Aspect savedAspect
           
protected  java.awt.Color selectedColor
           
protected  boolean selectedElem
           
protected  boolean selectedInfo
           
protected  java.awt.Color selectedInfoColor
           
protected  boolean selectedLabel
           
protected  java.awt.Color selectedLabelColor
           
protected  boolean unconstrained
           
protected  boolean validAbsElemBox
           
protected  boolean validAbsInfoBox
           
protected  boolean validAbsLabelBox
           
protected  boolean validAbsLoc
           
protected  boolean validBoundingBox
           
protected  boolean validColor
           
protected  boolean validExternalBox
           
protected  boolean validExternalInfoBox
           
protected  boolean validExternalLabelBox
           
protected  boolean validInfoLoc
           
protected  boolean validLabelLoc
           
protected  boolean validRelElemBox
           
protected  boolean validRelInfoBox
           
protected  boolean validRelLabelBox
           
protected  boolean validRelLoc
           
 
Fields inherited from interface javax.swing.undo.StateEditable
RCSID
 
Constructor Summary
AbstractGraphicalElement(GraphicalVisualRenderableGroup parent, java.lang.String label, java.lang.String description, java.lang.Object element, Aspect aspect, java.lang.String aspectName, java.lang.String aspectModule, AspectMgr aspectMgr, CoopnEnv env)
          Complete constructor.
 
Method Summary
 void abortMove()
          Abort the move.
protected  void acceptAspect()
           
 void actionOnMultipleClick(java.awt.event.MouseEvent e, java.awt.Point location, GraphicalVisualEditor editor)
          Multiple click callback.
protected  void addPopupItem(javax.swing.JMenuItem item)
          Add a specific item in the popup
 AspectMgr aspectMgr()
           
 java.lang.String aspectName()
           
 void attachToParent(GraphicalVisualRenderableGroup parent)
          Set the parent group if this element.
 java.awt.Rectangle boundingBox()
          Get the bounding box.
 Aspect clonedAspect()
           
 void commitMove()
          Commit the move.
 java.lang.String description()
          Description of the element.
 void deselect()
          Deselect the element, along with its label and information field.
 void export(GraphicalExporter g)
          Exporting method.
 java.awt.Rectangle externalBox()
          Get the external box.
 java.awt.Rectangle externalInfoBox()
          Get the external info box.
 java.awt.Rectangle externalLabelBox()
          Get the external label box.
protected  java.awt.Rectangle getAbsElemBox()
           
protected  java.awt.Rectangle getAbsInfoBox()
           
protected  java.awt.Rectangle getAbsLabelBox()
           
protected  java.awt.Point getAbsLoc()
           
protected  java.awt.Rectangle getBoundingBox()
           
protected  java.awt.Color getCol()
           
 java.awt.Color getColor()
          Get the color of the element.
protected  java.awt.Rectangle getExternalBox()
           
protected  java.awt.Rectangle getExternalInfoBox()
           
protected  java.awt.Rectangle getExternalLabelBox()
           
 java.lang.String getInfo()
          Get the information field.
protected  java.awt.Point getInfoLoc()
           
protected  java.awt.Point getLabelLoc()
           
 java.awt.Point getLocation()
          Get the location.
protected  java.awt.Rectangle getRelElemBox()
           
protected  java.awt.Rectangle getRelInfoBox()
           
protected  java.awt.Rectangle getRelLabelBox()
           
protected  java.awt.Point getRelLoc()
           
 boolean getShown()
          Look if the associated element is shown.
 boolean getShownInfo()
          Look if the information field is shown.
 boolean getShownLabel()
          Look if the label is shown.
 java.lang.String getStringTransfer()
          Get the String image of this element used in textual transfers.
 java.awt.datatransfer.Transferable getTransferable()
          Get a transferable representing the element.
 boolean inChange()
          Look if a change is in progress.
 boolean inducedSelection()
          Look if the element is selected, or if it is selected by induction.
 void induceSelection()
          Set the induced selection of this element; when this method is called, this element must retrieve its induced selection state from its closely related elements.
protected  void initElement()
           
 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).
protected  void internalDrawInfo(java.awt.Graphics2D g)
           
protected  void internalDrawLabel(java.awt.Graphics2D g)
           
protected abstract  void internalExport(GraphicalExporter g)
          Export the internal of an element, with regards to its parent location.
protected  void internalExportInfo(GraphicalExporter g)
           
protected  void internalExportLabel(GraphicalExporter g)
           
protected abstract  void internalPaint(java.awt.Graphics2D g)
          Paint the internal of an element, with regards to its center.
protected abstract  void internalPrint(java.awt.Graphics2D g)
          Print the internal of an element, with regards to its center.
protected  void invalidateAbsElemBox()
           
protected  void invalidateAbsInfoBox()
           
protected  void invalidateAbsLabelBox()
           
protected  void invalidateAbsLoc()
           
protected  void invalidateBoundingBox()
           
protected  void invalidateColor()
           
protected  void invalidateExternalBox()
           
protected  void invalidateExternalInfoBox()
           
protected  void invalidateExternalLabelBox()
           
protected  void invalidateInfoLoc()
           
protected  void invalidateLabelLoc()
           
protected  void invalidateRelElemBox()
           
protected  void invalidateRelInfoBox()
           
protected  void invalidateRelLabelBox()
           
protected  void invalidateRelLoc()
           
 java.lang.String label()
          Label of the element.
 boolean move(java.awt.Dimension dim)
          Try to move the element.
 boolean move(java.awt.Dimension dim, java.awt.Dimension grid)
          Try to move the element on a grid.
 boolean moveInfo(java.awt.Dimension dim)
          Try to move the info field of the element.
 boolean moveInfo(java.awt.Dimension dim, java.awt.Dimension grid)
          Try to move the info field of the element on a grid.
 boolean moveLabel(java.awt.Dimension dim)
          Try to move the label of the element.
 boolean moveLabel(java.awt.Dimension dim, java.awt.Dimension grid)
          Try to move the label of the element on a grid.
 java.lang.Object objectElement()
          Get the original object element.
 void paint(java.awt.Graphics2D g, boolean paintSelection)
          Painting method.
 GraphicalVisualRenderableGroup parent()
          Get the parent node of the element.
 void parentMoved()
          Notification of the modification of location of the parent.
 GraphicalVisualRenderable pointedElement(java.awt.Point here)
          Look if the renderable contains a point.
 void print(java.awt.Graphics2D g)
          Printing method.
protected  void reRendition()
           
protected  void restoreAspect()
           
 void restoreCompleteState(java.util.Hashtable state)
          Restore the aspect.
 void restoreState(java.util.Hashtable state)
          Retore the aspect.
 void saveAspect()
          Start a save process.
 void saveAspectAs(java.lang.String aspectName)
          Save the aspect of the renderable as a specified name.
 boolean saveAspectAsPossible()
          look if this renderable is able to save itself as a specified name.
 boolean saveAspectPossible()
          look if this renderable is able to save itself.
protected  void saveIntAspect()
           
 boolean selected()
          Look if the element if selected or not.
 void selectElement()
          Select the element.
 void selectInfo()
          Select the information field of the element.
 void selectLabel()
          Select the label of the element.
protected  void setAbsElemBox()
           
protected  void setAbsInfoBox()
           
protected  void setAbsLabelBox()
           
protected  void setAbsLoc()
           
protected  void setBoundingBox()
           
protected  void setColor()
           
 void setColor(java.awt.Color color)
          Specifiy the color of the element.
protected  void setExternalBox()
           
protected  void setExternalInfoBox()
           
protected  void setExternalLabelBox()
           
 void setInfo(java.lang.String info)
          Set the information field.
protected  void setInfoLoc()
           
protected  void setLabelLoc()
           
 void setLayoutLocation(java.awt.Point newLocation)
          Set the location according to a layout.
protected  void setRelElemBox()
           
protected  void setRelInfoBox()
           
protected  void setRelLabelBox()
           
protected  void setRelLoc()
           
 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.
 javax.swing.JMenuItem[] specificPopup()
          Get the specific items of the popup menu of this element.
 void storeCompleteState(java.util.Hashtable state)
          Store the aspect.
 void storeState(java.util.Hashtable state)
          Store the aspect.
protected  void toAbsolute(java.awt.Point here)
           
protected  void toRelative(java.awt.Point here)
           
protected abstract  boolean verifyChange()
          Verify that the a change does not interfere with other elements.
 
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.GraphicalVisualElement
partOfParent
 

Field Detail

parent

protected GraphicalVisualRenderableGroup parent

label

protected java.lang.String label

description

protected java.lang.String description

objectElement

protected java.lang.Object objectElement

aspect

protected Aspect aspect

aspectMgr

protected AspectMgr aspectMgr

env

protected CoopnEnv env

unconstrained

protected boolean unconstrained

delta

protected int delta

fontRenderContext

protected java.awt.font.FontRenderContext fontRenderContext

labelFont

protected java.awt.Font labelFont

infoFont

protected java.awt.Font infoFont

relLoc

protected java.awt.Point relLoc

absLoc

protected java.awt.Point absLoc

relElemBox

protected java.awt.Rectangle relElemBox

absElemBox

protected java.awt.Rectangle absElemBox

externalBox

protected java.awt.Rectangle externalBox

boundingBox

protected java.awt.Rectangle boundingBox

labelLoc

protected java.awt.Point labelLoc

relLabelBox

protected java.awt.Rectangle relLabelBox

absLabelBox

protected java.awt.Rectangle absLabelBox

externalLabelBox

protected java.awt.Rectangle externalLabelBox

infoLoc

protected java.awt.Point infoLoc

relInfoBox

protected java.awt.Rectangle relInfoBox

absInfoBox

protected java.awt.Rectangle absInfoBox

externalInfoBox

protected java.awt.Rectangle externalInfoBox

labelLayout

protected java.awt.font.TextLayout labelLayout

infoLayout

protected java.awt.font.TextLayout infoLayout

normalColor

protected java.awt.Color normalColor

labelColor

protected java.awt.Color labelColor

selectedColor

protected java.awt.Color selectedColor

selectedLabelColor

protected java.awt.Color selectedLabelColor

selectedInfoColor

protected java.awt.Color selectedInfoColor

inducedSelectionColor

protected java.awt.Color inducedSelectionColor

validRelLoc

protected boolean validRelLoc

validAbsLoc

protected boolean validAbsLoc

validRelElemBox

protected boolean validRelElemBox

validAbsElemBox

protected boolean validAbsElemBox

validExternalBox

protected boolean validExternalBox

validBoundingBox

protected boolean validBoundingBox

validLabelLoc

protected boolean validLabelLoc

validRelLabelBox

protected boolean validRelLabelBox

validAbsLabelBox

protected boolean validAbsLabelBox

validExternalLabelBox

protected boolean validExternalLabelBox

validInfoLoc

protected boolean validInfoLoc

validRelInfoBox

protected boolean validRelInfoBox

validAbsInfoBox

protected boolean validAbsInfoBox

validExternalInfoBox

protected boolean validExternalInfoBox

validColor

protected boolean validColor

savedAspect

protected Aspect savedAspect

selectedElem

protected boolean selectedElem

selectedLabel

protected boolean selectedLabel

selectedInfo

protected boolean selectedInfo

inducedSelection

protected boolean inducedSelection
Constructor Detail

AbstractGraphicalElement

public AbstractGraphicalElement(GraphicalVisualRenderableGroup parent,
                                java.lang.String label,
                                java.lang.String description,
                                java.lang.Object element,
                                Aspect aspect,
                                java.lang.String aspectName,
                                java.lang.String aspectModule,
                                AspectMgr aspectMgr,
                                CoopnEnv env)
Complete constructor. The element is initialised, but not rendered.
Method Detail

saveIntAspect

protected void saveIntAspect()

acceptAspect

protected void acceptAspect()

restoreAspect

protected void restoreAspect()

initElement

protected void initElement()

clonedAspect

public Aspect clonedAspect()

aspectMgr

public AspectMgr aspectMgr()

aspectName

public java.lang.String aspectName()

reRendition

protected void reRendition()

invalidateRelLoc

protected void invalidateRelLoc()

getRelLoc

protected final java.awt.Point getRelLoc()

setRelLoc

protected void setRelLoc()

invalidateAbsLoc

protected void invalidateAbsLoc()

getAbsLoc

protected final java.awt.Point getAbsLoc()

setAbsLoc

protected void setAbsLoc()

invalidateRelElemBox

protected void invalidateRelElemBox()

getRelElemBox

protected final java.awt.Rectangle getRelElemBox()

setRelElemBox

protected void setRelElemBox()

invalidateAbsElemBox

protected void invalidateAbsElemBox()

getAbsElemBox

protected final java.awt.Rectangle getAbsElemBox()

setAbsElemBox

protected void setAbsElemBox()

invalidateExternalBox

protected void invalidateExternalBox()

getExternalBox

protected final java.awt.Rectangle getExternalBox()

setExternalBox

protected void setExternalBox()

invalidateBoundingBox

protected void invalidateBoundingBox()

getBoundingBox

protected final java.awt.Rectangle getBoundingBox()

setBoundingBox

protected void setBoundingBox()

invalidateLabelLoc

protected final void invalidateLabelLoc()

getLabelLoc

protected final java.awt.Point getLabelLoc()

setLabelLoc

protected void setLabelLoc()

invalidateRelLabelBox

protected final void invalidateRelLabelBox()

getRelLabelBox

protected final java.awt.Rectangle getRelLabelBox()

setRelLabelBox

protected final void setRelLabelBox()

invalidateAbsLabelBox

protected final void invalidateAbsLabelBox()

getAbsLabelBox

protected final java.awt.Rectangle getAbsLabelBox()

setAbsLabelBox

protected final void setAbsLabelBox()

invalidateExternalLabelBox

protected void invalidateExternalLabelBox()

getExternalLabelBox

protected final java.awt.Rectangle getExternalLabelBox()

setExternalLabelBox

protected void setExternalLabelBox()

invalidateInfoLoc

protected final void invalidateInfoLoc()

getInfoLoc

protected final java.awt.Point getInfoLoc()

setInfoLoc

protected void setInfoLoc()

invalidateRelInfoBox

protected final void invalidateRelInfoBox()

getRelInfoBox

protected final java.awt.Rectangle getRelInfoBox()

setRelInfoBox

protected final void setRelInfoBox()

invalidateAbsInfoBox

protected final void invalidateAbsInfoBox()

getAbsInfoBox

protected final java.awt.Rectangle getAbsInfoBox()

setAbsInfoBox

protected final void setAbsInfoBox()

invalidateExternalInfoBox

protected void invalidateExternalInfoBox()

getExternalInfoBox

protected final java.awt.Rectangle getExternalInfoBox()

setExternalInfoBox

protected void setExternalInfoBox()

invalidateColor

protected void invalidateColor()

getCol

protected final java.awt.Color getCol()

setColor

protected void setColor()

addPopupItem

protected void addPopupItem(javax.swing.JMenuItem item)
Add a specific item in the popup

parent

public GraphicalVisualRenderableGroup parent()
Get the parent node of the element. Every elements in a graphics has exactly 1 or 0 parent. If it has 0 parent, it is not included in a picture.
Specified by:
parent in interface GraphicalVisualElement
Returns:
the parent of this element, or null

attachToParent

public void attachToParent(GraphicalVisualRenderableGroup parent)
Set the parent group if this element.
Specified by:
attachToParent in interface GraphicalVisualElement
Parameters:
parent - the parent group, or null if the element should be dettached from its parent

parentMoved

public void parentMoved()
Notification of the modification of location of the parent.
Specified by:
parentMoved in interface GraphicalVisualElement

label

public java.lang.String label()
Label of the element. The label usually identifies the element, in a short way.
Specified by:
label in interface GraphicalVisualElement
Returns:
a String, the label. Nevel null.

objectElement

public java.lang.Object objectElement()
Get the original object element.
Returns:
original coopn element. Nevel null.

description

public java.lang.String description()
Description of the element. This description typically contains the profile of an element, and may be used by graphical visuals to display additionnal information.
Specified by:
description in interface GraphicalVisualElement
Returns:
a String, the description. A null value indicates no description, while an empty string indicates an empty description.

getStringTransfer

public java.lang.String getStringTransfer()
Get the String image of this element used in textual transfers.
Specified by:
getStringTransfer in interface GraphicalVisualElement
Returns:
a String image, or null if this element cannot participate in data transfer.

getTransferable

public java.awt.datatransfer.Transferable getTransferable()
Get a transferable representing the element.
Specified by:
getTransferable in interface GraphicalVisualElement
Returns:
a transferable, as rich as possible, representing the element, or null if this element cannot participate in data transfer. Should at least deliver a stringFlavor DataFlavor, encompassing the String returned by getStringTranfer().

toRelative

protected void toRelative(java.awt.Point here)

toAbsolute

protected void toAbsolute(java.awt.Point here)

getLocation

public java.awt.Point getLocation()
Get the location.
Specified by:
getLocation in interface GraphicalVisualElement
Returns:
The location as a new Point.

setLayoutLocation

public void setLayoutLocation(java.awt.Point newLocation)
Set the location according to a layout. This method is intended to be used by layouters only; it should not be called by external objects.
Specified by:
setLayoutLocation in interface GraphicalVisualElement
Parameters:
newLocation - the new location, in absolute coordinates

inChange

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

move

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

move

public boolean move(java.awt.Dimension dim,
                    java.awt.Dimension grid)
Try to move the element on a grid.
Specified by:
move in interface GraphicalVisualEditable
Parameters:
dim - the difference of position
grid - grid size
Returns:
true iff the move is possible (for this element point of view).

moveLabel

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

moveLabel

public boolean moveLabel(java.awt.Dimension dim,
                         java.awt.Dimension grid)
Try to move the label of the element on a grid.
Specified by:
moveLabel in interface GraphicalVisualEditable
Parameters:
dim - the difference of position
grid - grid size
Returns:
true iff the move is possible (for this element point of view).

moveInfo

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

moveInfo

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

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

getInfo

public java.lang.String getInfo()
Get the information field. This field is never null, but may be an empty string.
Specified by:
getInfo in interface GraphicalVisualElement
Returns:
The information field as a String

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

getShown

public boolean getShown()
Look if the associated element is shown. If the element is not shown, nothing of its components must be shown, and in particular the label must not be shown.
Specified by:
getShown in interface GraphicalVisualElement
Returns:
true iff the associated element is shown.

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

getShownLabel

public boolean getShownLabel()
Look if the label is shown.
Specified by:
getShownLabel in interface GraphicalVisualElement
Returns:
true iff the label is 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

getShownInfo

public boolean getShownInfo()
Look if the information field is shown.
Specified by:
getShownInfo in interface GraphicalVisualElement
Returns:
true iff the information field is 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

getColor

public java.awt.Color getColor()
Get the color of the element.
Returns:
the color of the element.

setColor

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

saveAspectPossible

public boolean saveAspectPossible()
look if this renderable is able to save itself. If true, such an object is able to contact the correct aspect manager for saving its aspect.
Specified by:
saveAspectPossible in interface GraphicalVisualRenderable
Returns:
true iff this renderable is able to save itself.

saveAspect

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

saveAspectAsPossible

public boolean saveAspectAsPossible()
look if this renderable is able to save itself as a specified name. If true, such an object is able to changes its aspect name, and to contact the correct aspect manager for saving its aspect under that name.
Specified by:
saveAspectAsPossible in interface GraphicalVisualRenderable
Returns:
true iff this renderable is able to save itself.

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
Parameters:
aspectName - the new aspect name to use

storeState

public void storeState(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:
storeState in interface javax.swing.undo.StateEditable
Parameters:
state - an hashtable, storing states of elements

restoreState

public void restoreState(java.util.Hashtable state)
Retore the aspect. Upon receiving this message, the receiver should retrieve its aspect from state. This method is used to undo/redo edits.
Specified by:
restoreState in interface javax.swing.undo.StateEditable
Parameters:
state - an hashtable, storing states of elements

storeCompleteState

public void storeCompleteState(java.util.Hashtable state)
Store the aspect. Upon receiving this message, the receiver should place its aspect into state. In addition, if the receiver represents a group of editable, these must (recursively) store there state too. This method is used to undo/redo edits.
Specified by:
storeCompleteState in interface GraphicalVisualEditable
Parameters:
state - an hashtable, storing states of elements

restoreCompleteState

public void restoreCompleteState(java.util.Hashtable state)
Restore the aspect. Upon receiving this message, the receiver should retrieve its aspect from state. In addition, if the receiver represents a group of editable, these must (recursively) restore there state too. This method is used to undo/redo edits.
Specified by:
restoreCompleteState in interface GraphicalVisualEditable
Parameters:
state - an hashtable, storing states of elements

selectElement

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

selected

public boolean selected()
Look if the element if selected or not. Do not look at the selection state of the label or info.
Specified by:
selected in interface GraphicalVisualElement
Returns:
true iff the element itself is selected

selectLabel

public void selectLabel()
Select the label of the element.
Specified by:
selectLabel in interface GraphicalVisualRenderable

selectInfo

public void selectInfo()
Select the information field of the element.
Specified by:
selectInfo in interface GraphicalVisualRenderable

deselect

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

induceSelection

public void induceSelection()
Set the induced selection of this element; when this method is called, this element must retrieve its induced selection state from its closely related elements. The induced selection of an element is a selection state induced by closely related elements; typically, the selection of an arc is induced by the selection of one of its ending node, or the selection of a shape is induced by the selection of its parent. The induced selection of an element does not affect the selection state of this element. From a paint's point of view, the behaviour of an element with a set induced selection is the same as the behaviour of a selected element; it is painted only if the selected argument is true.
Specified by:
induceSelection in interface GraphicalVisualElement

inducedSelection

public boolean inducedSelection()
Look if the element is selected, or if it is selected by induction.
Specified by:
inducedSelection in interface GraphicalVisualElement

externalBox

public java.awt.Rectangle externalBox()
Get the external box. The external box is the rectangle containing the element, with a small inset.
Specified by:
externalBox in interface GraphicalVisualElement
Returns:
the external box of the element, as a rectangle in the logical coordinate space. An empty rectangle means that the element has no external box.

externalLabelBox

public java.awt.Rectangle externalLabelBox()
Get the external label box. The box is the rectangle containing the label, with a small inset.
Specified by:
externalLabelBox in interface GraphicalVisualElement
Returns:
the external label box of the element, as a rectangle in the logical coordinate space. An empty rectangle means that the element has no external label box.

externalInfoBox

public java.awt.Rectangle externalInfoBox()
Get the external info box. The box is the rectangle containing the info field, with a small inset.
Specified by:
externalInfoBox in interface GraphicalVisualElement
Returns:
the external info box of the element, as a rectangle in the logical coordinate space. An empty rectangle means that the element has no external info box.

boundingBox

public java.awt.Rectangle boundingBox()
Get the bounding box. The bounding box is the total rectangle containing the element, its label and its information field.
Specified by:
boundingBox in interface GraphicalVisualRenderable
Returns:
the bounding box of the element, as a rectangle in the logical coordinate space. An empty rectangle means that the element has no bounding box.

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
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
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.

specificPopup

public javax.swing.JMenuItem[] specificPopup()
Get the specific items of the popup menu of this element.
Specified by:
specificPopup in interface GraphicalVisualRenderable
Returns:
an array of GraphicalVisualMenuItem. A null value or an empty array mean that the element as no specific popup elements.

actionOnMultipleClick

public void actionOnMultipleClick(java.awt.event.MouseEvent e,
                                  java.awt.Point location,
                                  GraphicalVisualEditor editor)
Multiple click callback. This routine is called by the graphical visual when it detects a multiple click on this element.
Specified by:
actionOnMultipleClick in interface GraphicalVisualRenderable
Parameters:
e - the mouse event
location - the location of the event, in logical space
editor - the associated editor

verifyChange

protected abstract boolean verifyChange()
Verify that the a change does not interfere with other elements.

internalPaint

protected abstract void internalPaint(java.awt.Graphics2D g)
Paint the internal of an element, with regards to its center.

internalPrint

protected abstract void internalPrint(java.awt.Graphics2D g)
Print the internal of an element, with regards to its center.

internalExport

protected abstract void internalExport(GraphicalExporter g)
Export the internal of an element, with regards to its parent location.

internalDrawLabel

protected void internalDrawLabel(java.awt.Graphics2D g)

internalDrawInfo

protected void internalDrawInfo(java.awt.Graphics2D g)

internalExportLabel

protected void internalExportLabel(GraphicalExporter g)

internalExportInfo

protected void internalExportInfo(GraphicalExporter g)

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
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)
Printing method. This routine is called when the component must paint itself inside the graphics. The element 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
Parameters:
g - the graphics 2D; cannot be null

export

public void export(GraphicalExporter g)
Exporting method. This routine is called when the component must export itself in a given format. The element exports itself by writing apposite text in a Writer stream, and integer scale factor and offset are provided for transforming logical to physical coordinates (with the assertion that pysical = logical * factor).
Specified by:
export in interface GraphicalVisualRenderable
Parameters:
stream - the output stream; cannot be null
format - the format, as an integer code as mentionned in the class Export; callers have the guarantee that any value returned by the exportableFormats method is a valid value
scale - the scale factor
offset - the offset
Throws:
java.lang.IllegalArgumentException - An argument is illegal
java.lang.IllegalAccessException - the format is not supported by this element.
See Also:
Export