com.tensegrity.gui.template
Interface TemplateDocument

All Superinterfaces:
AttributableOnSetListener, Container, Document, EventListenerTag, Observer
All Known Implementing Classes:
SwingTemplateDocument

public interface TemplateDocument
extends Document, AttributableOnSetListener

Interface TemplateDocument is responsible for creating templates of repository items and new composites.

This interface supports a grid, Primitive collections and plays the AttributableOnSet role.

Version:
$Id: TemplateDocument.java,v 1.23 2005/03/08 13:01:20 AndreasHensel Exp $
Author:
Gilles Iachelini

Field Summary
 
Fields inherited from interface com.tensegrity.gui.document.Document
GLUE_LEFTBOTTOM, GLUE_LEFTCENTEREXTEND, GLUE_LEFTTOP, GLUE_RIGHTBOTTOM, GLUE_RIGHTCENTEREXTEND, GLUE_RIGHTTOP, TYPE_FIXED_SIZE, TYPE_PACK_IS_OK, TYPE_TOOLDOCUMENT
 
Method Summary
 void addNodeForPrimitive(BaseComposite bcomposite, Primitive primitive)
          Adds a VisualNode, which wraps the given primitive, to this document.
 void addNodeForPrimitive(Primitive primitive)
          Adds a VisualNode, which wraps the given primitive, to this document.
 void addVisualGraphObject(VisualGraphObject visualgraphobject, int x, int y)
          Adds a VisualGraphObject to this document.
 void deselect()
          Method deselect delesects all currently selected elements of this document.
 java.util.Map getElementsMap()
          This method should create map, where either primitives of the document are mapped towards their enclosing composites, or container elements are mapped to a list composite-primitive tuple.
 GraphPanel getGraphPanel()
          Returns the graphpanel inside this graphdocument.
 java.util.List getSelection()
          Method getSelection returns a list with all currently selected elements.
 AttributableOnSet getTemplateAttributable()
          Method getTemplateAttributable returns an AttributableOnSet describing all the properties of this document.
 void init(TemplateAttributableOnSet attributable)
          Should be called whenever you create a TemplateDocument.
 boolean isInPointMode()
          Should return true, when the user activates the point mode, otherwise false.
 boolean isShowGrid()
          Method isShowGrid returns true, if a grid is shown, otherwise false.
 boolean isSnapToGrid()
          Method isSnapToGrid returns true, if the all elements within the document should snap to the nearest grid point or not.
 void removeAllPrimitives()
          Method removeAllPrimitives removes all Primitives from this document.
 void removePrimitive(Primitive primitive)
          Method removePrimitive removes a specific primitive from this document.
 void repaint()
          Method repaint triggers a repaint of the document.
 void selectAll()
          Method selectAll selects all Elements of this document.
 void setPopupMenuSource(JPopupMenuSourceWithUpdateUI popup)
          Allows users of this class to set an SwingPopupMenu for this document instance.
 void setShowGrid(boolean b)
          Method setShowGrid toggles whether a grid is shown or not.
 void setSnapToGrid(boolean b)
          Method setSnapToGrid toggles the snap-to-grid mode.
 void togglePointMode()
          Method togglePolygonMode toggles the edit-polygon mode.
 
Methods inherited from interface com.tensegrity.gui.document.Document
closeHandler, getCopyCounter, getDocumentDataProvider, getDocumentSetting, getDocumentSettings, getFile, getFlags, isModified, setDocumentSetting, setDocumentSettings, setFile, setModified, setUnmodified
 
Methods inherited from interface com.tensegrity.generic.util.Observer
update
 
Methods inherited from interface com.tensegrity.gui.container.Container
getApplicationFrame, getName, setName, setSelected
 
Methods inherited from interface com.tensegrity.generic.attribute.event.AttributableOnSetListener
attributesChanged
 

Method Detail

addVisualGraphObject

public void addVisualGraphObject(VisualGraphObject visualgraphobject,
                                 int x,
                                 int y)
Adds a VisualGraphObject to this document.

Parameters:
visualgraphobject - object to add.
x - x position
y - y position

addNodeForPrimitive

public void addNodeForPrimitive(Primitive primitive)
Adds a VisualNode, which wraps the given primitive, to this document.

Parameters:
primitive - the new primitive to add.

addNodeForPrimitive

public void addNodeForPrimitive(BaseComposite bcomposite,
                                Primitive primitive)
Adds a VisualNode, which wraps the given primitive, to this document. The composite is required to obtain the correct sizes, position and coordinates.

Parameters:
bcomposite - the composite to use to obtain sizes and positions.
primitive - the primitive to add.

deselect

public void deselect()
Method deselect delesects all currently selected elements of this document.


getElementsMap

public java.util.Map getElementsMap()
This method should create map, where either primitives of the document are mapped towards their enclosing composites, or container elements are mapped to a list composite-primitive tuple. This means: This map contains as key either a primitive or a container. A primitive is always map to a composite (its enclosing one), and a container is always mapped to a List, which is again a primitive-composites map, or container-list map.

Returns:
a Map where Primitive's are mapped to their enclosing Composite's.

getSelection

public java.util.List getSelection()
Method getSelection returns a list with all currently selected elements.

Returns:
List an instance of java.util.List with all selected elements.

getTemplateAttributable

public AttributableOnSet getTemplateAttributable()
Method getTemplateAttributable returns an AttributableOnSet describing all the properties of this document. This AttributableOnSet should structured in Categories which contain the category specific attributes.

Returns:
AttributableOnSet
See Also:
AttributeTable

init

public void init(TemplateAttributableOnSet attributable)
Should be called whenever you create a TemplateDocument. This method sets the associated TemplateAttributableOnSet.

Parameters:
attributable - instance of TemplateAttributableOnSet to use for initialization.

isShowGrid

public boolean isShowGrid()
Method isShowGrid returns true, if a grid is shown, otherwise false.

Returns:
boolean that indicates whether a grid is shown or not.

isSnapToGrid

public boolean isSnapToGrid()
Method isSnapToGrid returns true, if the all elements within the document should snap to the nearest grid point or not.

Returns:
boolean true, if snapToGrid is activated, otherwise false.

removeAllPrimitives

public void removeAllPrimitives()
Method removeAllPrimitives removes all Primitives from this document.


removePrimitive

public void removePrimitive(Primitive primitive)
Method removePrimitive removes a specific primitive from this document.

Parameters:
primitive - the instance of Primitive to remove.

repaint

public void repaint()
Method repaint triggers a repaint of the document.


selectAll

public void selectAll()
Method selectAll selects all Elements of this document.


setPopupMenuSource

public void setPopupMenuSource(JPopupMenuSourceWithUpdateUI popup)
Allows users of this class to set an SwingPopupMenu for this document instance.

Parameters:
popup - the new SwingPopupMenu for this document.

setShowGrid

public void setShowGrid(boolean b)
Method setShowGrid toggles whether a grid is shown or not.

Parameters:
b - if true, a grid is shown, otherwise false.

setSnapToGrid

public void setSnapToGrid(boolean b)
Method setSnapToGrid toggles the snap-to-grid mode.

Parameters:
b - if true, all objects are snapping to a grid when added or moved.

togglePointMode

public void togglePointMode()
Method togglePolygonMode toggles the edit-polygon mode. Such a mode allows users to add points to a given polygon.


isInPointMode

public boolean isInPointMode()
Should return true, when the user activates the point mode, otherwise false.

Returns:
true if the point mode is active on this document.

getGraphPanel

public GraphPanel getGraphPanel()
Returns the graphpanel inside this graphdocument.

Returns:
graphpanel inside this document.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.