ConForM.CoopnTools.CoKer.Visual
Class AbstractGraphicalArc

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

public abstract class AbstractGraphicalArc
extends AbstractGraphicalElement
implements GraphicalVisualArc

Abstract graphical arc.


Field Summary
protected  java.awt.Point centre
           
protected  GraphicalVisualShape end
           
protected  java.awt.Point endLoc
           
protected  java.awt.Point endPoint
           
protected  boolean endToBeShown
           
protected  java.util.List flatPath
           
protected  java.awt.Point[] IP
           
protected  boolean newCentre
           
protected  boolean newEndLoc
           
protected  boolean newStartLoc
           
protected  java.awt.Point oldCentre
           
protected  java.awt.Point oldEnd
           
protected  java.awt.Point oldStart
           
protected  java.awt.geom.GeneralPath path
           
protected  GraphicalVisualShape start
           
protected  java.awt.Point startLoc
           
protected  java.awt.Point startPoint
           
protected  boolean startToBeShown
           
protected  boolean validCentre
           
protected  boolean validEndLoc
           
protected  boolean validEndPoint
           
protected  boolean validIP
           
protected  boolean validPath
           
protected  boolean validStartLoc
           
protected  boolean validStartPoint
           
 
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
AbstractGraphicalArc(GraphicalVisualRenderableGroup parent, java.lang.Object element, AbstractGraphicalShape start, AbstractGraphicalShape end, java.lang.String label, java.lang.String description, ArcAspect aspect, java.lang.String aspectName, java.lang.String aspectModule, AspectMgr aspectMgr, CoopnEnv env)
          Complete constructor.
 
Method Summary
 void actionOnMultipleClick(java.awt.event.MouseEvent e, java.awt.Point location, GraphicalVisualEditor editor)
          Multiple click callback.
 void addIntermediaryPoint(java.awt.Point point)
          Add an intermediary point at the best index.
 void addIntermediaryPoint(java.awt.Point point, int index)
          Add an intermediary point at a specific index.
 void attachmentPointMoved(GraphicalVisualShape shape)
          Notification of the move of an attachment point.
 GraphicalVisualShape end()
          Get the ending shape of the element.
protected  java.awt.Point getCentre()
           
protected  java.awt.Point getEndLoc()
           
protected  java.awt.Point getEndPoint()
           
 java.awt.Point[] getIntermediaryPoints()
          Get the intermediary points.
protected  java.awt.Point[] getIP()
           
protected  java.awt.geom.GeneralPath getPath()
           
 boolean getShown()
          Look if the associated element is shown.
protected  java.awt.Point getStartLoc()
           
protected  java.awt.Point getStartPoint()
           
 int getType()
          Get the type of the arc.
 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()
          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).
protected abstract  void internalExp(GraphicalExporter g)
           
protected  void internalExport(GraphicalExporter g)
          Export an element, with regards to its parent location.
protected abstract  void internalG2D(java.awt.Graphics2D g)
           
protected  void internalPaint(java.awt.Graphics2D g)
          Paint an element, with regards to its center.
protected  void internalPrint(java.awt.Graphics2D g)
          Print an element, with regards to its center.
protected  void invalidateAbsLoc()
           
protected  void invalidateCentre()
           
protected  void invalidateEndLoc()
           
protected  void invalidateEndPoint()
           
protected  void invalidateIP()
           
protected  void invalidatePath()
           
protected  void invalidateRelLoc()
           
protected  void invalidateStartLoc()
           
protected  void invalidateStartPoint()
           
 void moveIntermediaryPoint(java.awt.Dimension dim, int index)
          Try to move an intermediary point.
 boolean partOfParent()
          Specify if the element is part of its parent or not.
 GraphicalVisualRenderable pointedElement(java.awt.Point here)
          Look if the renderable contains a point.
 void removeIntermediaryPoint(int index)
          Remove an intermediary point at a specific index.
 void removeIntermediaryPoint(java.awt.Point point)
          Remove an intermediary point at the best index.
protected  void reRendition()
           
protected  void setEndPoint()
           
protected  void setIP()
           
 void setLayoutIntermediaryPoints(java.awt.Point[] newIp)
          Set the intermediary points according to a layout.
 void setLayoutLocation(java.awt.Point newLocation)
          Set the location according to a layout.
protected  void setPath()
           
protected  void setRelElemBox()
           
protected  void setRelLoc()
           
protected  void setStartPoint()
           
 void setType(int type)
          Specifiy the type of the arc.
 GraphicalVisualShape start()
          Get the starting shape of the element.
protected  boolean verifyChange()
          Verify that the a change does not interfere with other elements.
 
Methods inherited from class ConForM.CoopnTools.CoKer.Visual.AbstractGraphicalElement
abortMove, acceptAspect, addPopupItem, aspectMgr, aspectName, attachToParent, boundingBox, clonedAspect, commitMove, description, deselect, export, externalBox, externalInfoBox, externalLabelBox, getAbsElemBox, getAbsInfoBox, getAbsLabelBox, getAbsLoc, getBoundingBox, getCol, getColor, getExternalBox, getExternalInfoBox, getExternalLabelBox, getInfo, getInfoLoc, getLabelLoc, getLocation, getRelElemBox, getRelInfoBox, getRelLabelBox, getRelLoc, getShownInfo, getShownLabel, getStringTransfer, getTransferable, inChange, inducedSelection, internalDrawInfo, internalDrawLabel, internalExportInfo, internalExportLabel, invalidateAbsElemBox, invalidateAbsInfoBox, invalidateAbsLabelBox, invalidateBoundingBox, invalidateColor, invalidateExternalBox, invalidateExternalInfoBox, invalidateExternalLabelBox, invalidateInfoLoc, invalidateLabelLoc, invalidateRelElemBox, invalidateRelInfoBox, invalidateRelLabelBox, label, move, move, moveInfo, moveInfo, moveLabel, moveLabel, objectElement, paint, parent, parentMoved, print, restoreAspect, restoreCompleteState, restoreState, saveAspect, saveAspectAs, saveAspectAsPossible, saveAspectPossible, saveIntAspect, selected, selectElement, selectInfo, selectLabel, setAbsElemBox, setAbsInfoBox, setAbsLabelBox, setAbsLoc, setBoundingBox, setColor, setColor, setExternalBox, setExternalInfoBox, setExternalLabelBox, setInfo, setInfoLoc, setLabelLoc, setRelInfoBox, setRelLabelBox, setShown, setShownInfo, setShownLabel, specificPopup, storeCompleteState, 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.GraphicalVisualElement
attachToParent, description, externalBox, externalInfoBox, externalLabelBox, getInfo, getLocation, getShownInfo, getShownLabel, getStringTransfer, getTransferable, inducedSelection, label, parent, parentMoved, selected
 
Methods inherited from interface ConForM.CoopnTools.CoKer.Visual.GraphicalVisualEditable
abortMove, commitMove, inChange, move, move, moveInfo, moveInfo, moveLabel, moveLabel, restoreCompleteState, setColor, setInfo, setShown, setShownInfo, setShownLabel, storeCompleteState
 
Methods inherited from interface javax.swing.undo.StateEditable
restoreState, storeState
 
Methods inherited from interface ConForM.CoopnTools.CoKer.Visual.GraphicalVisualRenderable
boundingBox, deselect, export, paint, print, saveAspect, saveAspectAs, saveAspectAsPossible, saveAspectPossible, selectElement, selectInfo, selectLabel, specificPopup
 

Field Detail

start

protected GraphicalVisualShape start

end

protected GraphicalVisualShape end

startToBeShown

protected boolean startToBeShown

endToBeShown

protected boolean endToBeShown

startLoc

protected java.awt.Point startLoc

endLoc

protected java.awt.Point endLoc

oldStart

protected java.awt.Point oldStart

oldEnd

protected java.awt.Point oldEnd

centre

protected java.awt.Point centre

oldCentre

protected java.awt.Point oldCentre

IP

protected java.awt.Point[] IP

startPoint

protected java.awt.Point startPoint

endPoint

protected java.awt.Point endPoint

path

protected java.awt.geom.GeneralPath path

flatPath

protected java.util.List flatPath

newStartLoc

protected boolean newStartLoc

newEndLoc

protected boolean newEndLoc

newCentre

protected boolean newCentre

validStartLoc

protected boolean validStartLoc

validEndLoc

protected boolean validEndLoc

validCentre

protected boolean validCentre

validIP

protected boolean validIP

validStartPoint

protected boolean validStartPoint

validEndPoint

protected boolean validEndPoint

validPath

protected boolean validPath
Constructor Detail

AbstractGraphicalArc

public AbstractGraphicalArc(GraphicalVisualRenderableGroup parent,
                            java.lang.Object element,
                            AbstractGraphicalShape start,
                            AbstractGraphicalShape end,
                            java.lang.String label,
                            java.lang.String description,
                            ArcAspect 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 AbstractGraphicalElement

reRendition

protected void reRendition()
Overrides:
reRendition in class AbstractGraphicalElement

attachmentPointMoved

public void attachmentPointMoved(GraphicalVisualShape shape)
Notification of the move of an attachment point.
Specified by:
attachmentPointMoved in interface GraphicalVisualArc
Parameters:
shape - the shape involved in the move

invalidateStartLoc

protected void invalidateStartLoc()

getStartLoc

protected final java.awt.Point getStartLoc()

invalidateEndLoc

protected void invalidateEndLoc()

getEndLoc

protected final java.awt.Point getEndLoc()

invalidateRelLoc

protected void invalidateRelLoc()
Overrides:
invalidateRelLoc in class AbstractGraphicalElement

setRelLoc

protected void setRelLoc()
Overrides:
setRelLoc in class AbstractGraphicalElement

invalidateAbsLoc

protected void invalidateAbsLoc()
Overrides:
invalidateAbsLoc in class AbstractGraphicalElement

invalidateCentre

protected void invalidateCentre()

getCentre

protected final java.awt.Point getCentre()

invalidateIP

protected void invalidateIP()

getIP

protected final java.awt.Point[] getIP()

setIP

protected void setIP()

invalidateStartPoint

protected void invalidateStartPoint()

getStartPoint

protected final java.awt.Point getStartPoint()

setStartPoint

protected void setStartPoint()

invalidateEndPoint

protected void invalidateEndPoint()

getEndPoint

protected final java.awt.Point getEndPoint()

setEndPoint

protected void setEndPoint()

invalidatePath

protected void invalidatePath()

getPath

protected final java.awt.geom.GeneralPath getPath()

setPath

protected void setPath()

setRelElemBox

protected void setRelElemBox()
Overrides:
setRelElemBox in class AbstractGraphicalElement

partOfParent

public boolean partOfParent()
Specify if the element is part of its parent or not. An element which is part of its parent must be phisically enclosed in its parent, and cannot intersect its brothers.
Specified by:
partOfParent in interface GraphicalVisualElement
Returns:
false, as coopn arcs are not part of their parents.

start

public GraphicalVisualShape start()
Get the starting shape of the element. Every arc element in a graphics has exactly 1 starting shape.
Specified by:
start in interface GraphicalVisualArc
Returns:
the starting shape of this arc; never null

end

public GraphicalVisualShape end()
Get the ending shape of the element. Every arc element in a graphics has exactly 1 ending shape.
Specified by:
end in interface GraphicalVisualArc
Returns:
the ending shape of this arc; never null

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
Overrides:
setLayoutLocation in class AbstractGraphicalElement
Parameters:
newLocation - the new location, in absolute coordinates

getIntermediaryPoints

public java.awt.Point[] getIntermediaryPoints()
Get the intermediary points.
Specified by:
getIntermediaryPoints in interface GraphicalVisualArc
Returns:
The intermediary points, as an array of points, never null. If no intermediary points are defined, it returns an array of size 0.

setLayoutIntermediaryPoints

public void setLayoutIntermediaryPoints(java.awt.Point[] newIp)
Set the intermediary points according to a layout. This method is intended to be used by layouters only; it should not be called by external objects.
Specified by:
setLayoutIntermediaryPoints in interface GraphicalVisualArc
Parameters:
newIp - the new ip, in absolute coordinates

addIntermediaryPoint

public void addIntermediaryPoint(java.awt.Point point,
                                 int index)
Add an intermediary point at a specific index.
Specified by:
addIntermediaryPoint in interface GraphicalVisualArc
Parameters:
point - the location of the new point; cannot be null
index - the index; must be valid
Throws:
java.lang.IllegalArgumentException - The index is not valid, or the point is null.

addIntermediaryPoint

public void addIntermediaryPoint(java.awt.Point point)
Add an intermediary point at the best index. The index is determined such that the closest path segment is broken.
Specified by:
addIntermediaryPoint in interface GraphicalVisualArc
Parameters:
point - the location of the new point; cannot be null
Throws:
java.lang.IllegalArgumentException - The point is null.

removeIntermediaryPoint

public void removeIntermediaryPoint(int index)
Remove an intermediary point at a specific index.
Specified by:
removeIntermediaryPoint in interface GraphicalVisualArc
Parameters:
index - the index; must be valid
Throws:
java.lang.IllegalArgumentException - The index is not valid.

removeIntermediaryPoint

public void removeIntermediaryPoint(java.awt.Point point)
Remove an intermediary point at the best index. The index is determined such that the closest intermediary point to the parameter point is removed.
Specified by:
removeIntermediaryPoint in interface GraphicalVisualArc
Parameters:
point - the approximative location of the point to remove; cannot be null
Throws:
java.lang.IllegalArgumentException - The point is null.

moveIntermediaryPoint

public void moveIntermediaryPoint(java.awt.Dimension dim,
                                  int index)
Try to move an intermediary point.
Specified by:
moveIntermediaryPoint in interface GraphicalVisualArc
Parameters:
dim - the difference of position
index - the index; must be valid
Throws:
java.lang.IllegalArgumentException - The index is not valid.

getType

public int getType()
Get the type of the arc.
Specified by:
getType in interface GraphicalVisualArc
Returns:
the type of the arc.

setType

public void setType(int type)
Specifiy the type of the arc.
Specified by:
setType in interface GraphicalVisualArc
Parameters:
type - the type of the arc

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
Overrides:
induceSelection in class AbstractGraphicalElement

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.

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
Overrides:
actionOnMultipleClick in class AbstractGraphicalElement
Parameters:
e - the mouse event
location - the location of the event, in logical space
editor - the associated editor

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
Overrides:
getShown in class AbstractGraphicalElement
Returns:
true iff the associated element is shown.

verifyChange

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

internalG2D

protected abstract void internalG2D(java.awt.Graphics2D g)

internalExp

protected abstract void internalExp(GraphicalExporter g)

internalPaint

protected void internalPaint(java.awt.Graphics2D g)
Paint an element, with regards to its center.
Overrides:
internalPaint in class AbstractGraphicalElement

internalPrint

protected void internalPrint(java.awt.Graphics2D g)
Print an element, with regards to its center.
Overrides:
internalPrint in class AbstractGraphicalElement

internalExport

protected void internalExport(GraphicalExporter g)
Export an element, with regards to its parent location.
Overrides:
internalExport in class AbstractGraphicalElement