uk.ac.ic.doc.automed.editor.autolayout
Class AutoLayoutPositionable

java.lang.Object
  extended by uk.ac.ic.doc.automed.editor.autolayout.AutoLayoutPositionable
Direct Known Subclasses:
AutoLayoutSchemaObject

public class AutoLayoutPositionable
extends java.lang.Object

Base class for ale others AutoLayout* classes.

Author:
Marcin Olawski

Field Summary
static ExpandedHashMap autoLayoutPositionablesTable
          HashMap which map SchemaObjects to AutoLayput* objects.
static Schema currentSchema
           
protected  Positionable myPositionableObj
          Positionable object connected to this AutoLayoutPositionable.
protected static int newObjectsClass
           
protected  java.awt.Point pos
          While doing algorithms iterations (method doLayout) objects position is stored in this variable and GUI isn't updated
 
Constructor Summary
AutoLayoutPositionable(Positionable positionableObject)
          Creates a new instance of AutoLayoutPositionable
 
Method Summary
 void doLayout()
          Perform layout process on whole graph starting from this object.
static AutoLayoutPositionable findAutoLayoutPositionableFor(Positionable positionable)
          Find AutoLayout* object that represent SchemaObject.
protected  Drawable getDrawable()
           
 java.lang.String getLabel()
          Get the text used to label this SchemaObject.
 java.awt.Point getPosition()
           
static void initAutoLayoutPositionablesTable(Schema schema)
          Initialize internal HashMap.
 boolean isHide()
          Method return true when object is hidden.
protected static int round(double x)
          Convert double to int.
 void setPosition(int x, int y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newObjectsClass

protected static int newObjectsClass

pos

protected java.awt.Point pos
While doing algorithms iterations (method doLayout) objects position is stored in this variable and GUI isn't updated


currentSchema

public static Schema currentSchema

myPositionableObj

protected Positionable myPositionableObj
Positionable object connected to this AutoLayoutPositionable.


autoLayoutPositionablesTable

public static ExpandedHashMap autoLayoutPositionablesTable
HashMap which map SchemaObjects to AutoLayput* objects.

See Also:
findAutoLayoutPositionableFor(Positionable)
Constructor Detail

AutoLayoutPositionable

public AutoLayoutPositionable(Positionable positionableObject)
Creates a new instance of AutoLayoutPositionable

Method Detail

findAutoLayoutPositionableFor

public static AutoLayoutPositionable findAutoLayoutPositionableFor(Positionable positionable)
Find AutoLayout* object that represent SchemaObject.

AutoLayout* objects represent SchemaObjects. To find AutoLayout* object that represent SchemaObject use this function. Important: after initAutoLayoutPositionablesTable() don't create new AutoLayout* objects (e.g. new AutoLayoutSpringObject(positionable)) because there will be two different object referencing one SchemaObject.


getDrawable

protected final Drawable getDrawable()
                              throws NotFoundException
Throws:
NotFoundException

initAutoLayoutPositionablesTable

public static void initAutoLayoutPositionablesTable(Schema schema)
Initialize internal HashMap. Important: Run this method before do anything else!

HashMap connect SchemaObjects with AutoLayout* objects.

Parameters:
schema - Initialize all object on this Schema. Parameter schema is remembered in internal field currentSchema.
See Also:
findAutoLayoutPositionableFor(Positionable)

getLabel

public final java.lang.String getLabel()
Get the text used to label this SchemaObject.


isHide

public boolean isHide()
Method return true when object is hidden.


setPosition

public void setPosition(int x,
                        int y)

getPosition

public java.awt.Point getPosition()

round

protected static final int round(double x)
Convert double to int.


doLayout

public void doLayout()
Perform layout process on whole graph starting from this object.