ConForM.CoopnTools.CoKer.Visual
Interface GraphicalVisualRenderable

All Known Subinterfaces:
CoopnGraphicalElement, GraphicalVisualArc, GraphicalVisualContainer, GraphicalVisualElement, GraphicalVisualNode, GraphicalVisualRenderableGroup, GraphicalVisualRotatableNode, GraphicalVisualShape

public interface GraphicalVisualRenderable

General graphical visual elements. This interfaceclass defines the common components of graphical visual elements. Such elements are used and managed by the graphical visuals of CoopnTools. 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). This class must be extended for coping with the different kinds of visual elements.


Method Summary
 void actionOnMultipleClick(java.awt.event.MouseEvent e, java.awt.Point location, GraphicalVisualEditor editor)
          Multiple click callback.
 java.awt.Rectangle boundingBox()
          Get the bounding box.
 void deselect()
          Deselect the element, along with its label and information field.
 void export(GraphicalExporter g)
          Exporting method.
 void paint(java.awt.Graphics2D g, boolean selected)
          Painting method.
 GraphicalVisualRenderable pointedElement(java.awt.Point p)
          Look if the renderable contains a point.
 void print(java.awt.Graphics2D g)
          Printing method.
 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.
 void selectElement()
          Select the element.
 void selectInfo()
          Select the information field of the element.
 void selectLabel()
          Select the label of the element.
 javax.swing.JMenuItem[] specificPopup()
          Get the specific items of the popup menu of this renderable.
 

Method Detail

selectElement

public void selectElement()
Select the element.

selectLabel

public void selectLabel()
Select the label of the element.

selectInfo

public void selectInfo()
Select the information field of the element.

deselect

public void deselect()
Deselect the element, along with its label and information field.

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.
Returns:
true iff this renderable is able to save itself.

saveAspect

public void saveAspect()
Start a save process.

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

boundingBox

public java.awt.Rectangle boundingBox()
Get the bounding box. The bounding box is the total rectangle containing the renderable, its label and its information field.
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 p)
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".
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.

specificPopup

public javax.swing.JMenuItem[] specificPopup()
Get the specific items of the popup menu of this renderable.
Returns:
an array of JMenuItem. A null value or an empty array mean that the renderable as no specific popup elements. Any element member of the interface GraphicalVisualEditoredMenuItem has its editor set by the editor associated to this renderable.

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 renderable.
Parameters:
e - the mouse event
location - the location of the event, in logical space
editor - the associated editor

paint

public void paint(java.awt.Graphics2D g,
                  boolean selected)
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.
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 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.
Parameters:
g - the graphics 2D; cannot be null

export

public void export(GraphicalExporter g)
Exporting method. This routine is called when the renderable must export itself through a graphical exporter.
Parameters:
g - the graphical exporter; cannot be null
See Also:
GraphicalExporter