com.tensegrity.gui.template
Class TemplateUtilities

java.lang.Object
  extended bycom.tensegrity.gui.template.TemplateUtilities

public class TemplateUtilities
extends java.lang.Object

The TemplateUtilities class contains a collection helper functions when dealing with templates.

Version:
$Id: TemplateUtilities.java,v 1.31 2006/03/02 11:42:01 BurkhardWick Exp $
Author:
Gilles Iachelini

Field Summary
static java.lang.String NAME
          String constants for the template relevant attributes.
static java.lang.String TEMPLATE
          String constants for the template relevant attributes.
static java.lang.String TEMPLATES
          String constants for the template relevant attributes.
static java.lang.String TEMPLATESTITLE
          String constants for the template relevant attributes.
 
Method Summary
static java.lang.String createUniqueName(java.util.List itemNames, java.lang.String itemName, boolean exclude)
          This creates a unique name by modifying the itemName parameter until it doesn't appear in the itemNames list.
static int[] getComponents(Coordinate[] coords, int direction)
          Method getComponents returns all the components of all the given Coordinates to a specific direction.
static GeometryItemCoordinates getCoordinates(BaseComposite composite)
          Returns the transformed Coordinates wrapped in an instance of GeomtryItemCoordinates.
static GeometryItemCoordinates getCoordinates(BaseComposite composite, Primitive primitive)
          Method getCoordinates returns the GeometryCoordinates for a given primitive.
static java.lang.String getFileLocation(java.lang.String directory, java.lang.String filename)
          Creates a proper path string from a given directory and filename.
static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite, Ellipse2D ellipse)
          Method getGeometryItemCoordinates returns the translated Coordinates of a Ellipse.
static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite, Label2D label)
          Method getGeometryItemCoordinates returns the translated Coordinates of a Label2D.
static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite, Line2D line)
          Returns the GeometryItemCoordinates for a given instance of Line2D.
static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite, Line2DModel line)
          Method getGeometryItemCoordinates returns the translated Coordinates of a Line2DModel.
static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite, Polygon2D polygon)
          Method getGeometryItemCoordinates returns the translated Coordinates of a Polygon2D.
static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite, Polyline2D polyline)
          Method getGeometryItemCoordinates returns the translated Coordinates of a Line2DModel.
static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite, Rect2D rect)
          Method getGeometryItemCoordinates returns the translated coordinates of a Rect2D.
static CoordinateSystem toCoordinateSystem(GeometryItemCoordinates geometryCoordinates)
          The method toCoordinateSystem converts a given GeometryItemCoordinate instance to a CoordinateSystem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATESTITLE

public static final java.lang.String TEMPLATESTITLE
String constants for the template relevant attributes.

See Also:
Constant Field Values

TEMPLATES

public static final java.lang.String TEMPLATES
String constants for the template relevant attributes.

See Also:
Constant Field Values

TEMPLATE

public static final java.lang.String TEMPLATE
String constants for the template relevant attributes.

See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
String constants for the template relevant attributes.

See Also:
Constant Field Values
Method Detail

createUniqueName

public static java.lang.String createUniqueName(java.util.List itemNames,
                                                java.lang.String itemName,
                                                boolean exclude)
This creates a unique name by modifying the itemName parameter until it doesn't appear in the itemNames list. A " ( number )" will be appended appended to the initial string. Assuming a list of existing names like "Document (1)", "Document (2)", "Document (4)" and an itemName Parameter "Document" will result in a new name "Document (3)". Use the exclude parameter to avoid, that the resulting name of the String will be equal to the itemName parameter. This is useful whenever you attempt to create similar "looking" names.

Parameters:
itemNames - the list of existing names.
itemName - the name you like to give your item.
exclude - flag to indicate whether to exclude the itemName parameter or not.
Returns:
a unique name.

toCoordinateSystem

public static CoordinateSystem toCoordinateSystem(GeometryItemCoordinates geometryCoordinates)
The method toCoordinateSystem converts a given GeometryItemCoordinate instance to a CoordinateSystem.

Parameters:
geometryCoordinates - the coordinates you want to convert.
Returns:
CoordinateSystem the CoordinateSystem

getCoordinates

public static GeometryItemCoordinates getCoordinates(BaseComposite composite)
Returns the transformed Coordinates wrapped in an instance of GeomtryItemCoordinates. The Coordinates are transformed whenever the BaseComposite.getBaseCompositeContainer() method returns something non-null and not of instance CompositeView.

Parameters:
composite - The composite to create the GeometryItemCoordinates for.
Returns:
an instance of GeometryItemCoordinates

getCoordinates

public static GeometryItemCoordinates getCoordinates(BaseComposite composite,
                                                     Primitive primitive)
Method getCoordinates returns the GeometryCoordinates for a given primitive.

Parameters:
composite - the enclosing composite of the primitive.
primitive - the primitive to you want to receive the GeometryItemCoordinates from.
Returns:
an instance of GeometryItemCoordinates

getGeometryItemCoordinates

public static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite,
                                                                 Line2D line)
Returns the GeometryItemCoordinates for a given instance of Line2D.

Parameters:
composite - the enclosing composite of the primitive.
line - the source Line2D instance.
Returns:
GeometryItemCoordinates for a Line2D instance.

getGeometryItemCoordinates

public static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite,
                                                                 Rect2D rect)
Method getGeometryItemCoordinates returns the translated coordinates of a Rect2D.

Parameters:
composite - the enclosing composite of the primitive.
rect - the source Rect2D instance.
Returns:
GeometryItemCoordinates

getGeometryItemCoordinates

public static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite,
                                                                 Polyline2D polyline)
Method getGeometryItemCoordinates returns the translated Coordinates of a Line2DModel.

Parameters:
composite - the enclosing composite of the primitive.
polyline - the source Polyline2D instance.
Returns:
GeometryItemCoordinates

getGeometryItemCoordinates

public static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite,
                                                                 Line2DModel line)
Method getGeometryItemCoordinates returns the translated Coordinates of a Line2DModel.

Parameters:
composite - the enclosing composite of the primitive.
line - the source Line2DModel instance.
Returns:
GeometryItemCoordinates

getGeometryItemCoordinates

public static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite,
                                                                 Label2D label)
Method getGeometryItemCoordinates returns the translated Coordinates of a Label2D.

Parameters:
composite - the enclosing composite of the primitive.
label - the source Label2D instance.
Returns:
GeometryItemCoordinates

getGeometryItemCoordinates

public static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite,
                                                                 Ellipse2D ellipse)
Method getGeometryItemCoordinates returns the translated Coordinates of a Ellipse.

Parameters:
composite - the enclosing composite of the primitive.
ellipse - the source Ellipse2D instance.
Returns:
GeometryItemCoordinates

getGeometryItemCoordinates

public static GeometryItemCoordinates getGeometryItemCoordinates(BaseComposite composite,
                                                                 Polygon2D polygon)
Method getGeometryItemCoordinates returns the translated Coordinates of a Polygon2D.

Parameters:
composite - the enclosing composite of the primitive.
polygon - source Polygon2D
Returns:
GeometryItemCoordinates

getComponents

public static int[] getComponents(Coordinate[] coords,
                                  int direction)
Method getComponents returns all the components of all the given Coordinates to a specific direction.

Parameters:
coords - Coordinates to collate in an array.
direction - the direction of the coordinates you wish to have in the array.
Returns:
int[] the int-array containing all the components from the coordinate array.

getFileLocation

public static java.lang.String getFileLocation(java.lang.String directory,
                                               java.lang.String filename)
Creates a proper path string from a given directory and filename.

Parameters:
directory - the directory as string
filename - the filename as string
Returns:
the full path (directory and filename) as String.


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