org.pzgui.layout
Class PZLayoutManager

java.lang.Object
  extended by java.lang.Thread
      extended by org.pzgui.PZManager
          extended by org.pzgui.layout.PZLayoutManager
All Implemented Interfaces:
java.lang.Runnable

public class PZLayoutManager
extends PZManager

A simple extension of the PZManager which facilitates the automatic layout of objects.

Author:
David Underhill

Nested Class Summary
 
Nested classes/interfaces inherited from class org.pzgui.PZManager
PZManager.LayoutableInfo
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class org.pzgui.PZManager
layoutablePositions, windows, YAML
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PZLayoutManager()
           
 
Method Summary
 void addDrawable(Drawable d)
          Add a new entity to draw on the GUI.
 void attachWindow(PZWindow w)
          Calls attchWindow(w, true).
 void closeWindow(PZWindow w)
          Cleans up after a window which is closing.
 edu.uci.ics.jung.graph.Graph<Vertex,Edge> getGraph()
          gets the graph backing the layout manager
 edu.uci.ics.jung.algorithms.layout.Layout<Vertex,Edge> getLayout()
          gets the current layout, if any
 int getLayoutHeight()
          Get the maximum height the layout engine will use for laying out elements.
 java.awt.Dimension getLayoutSize()
          Get the maximum size the layout engine will use for laying out elements.
 int getLayoutWidth()
          Get the maximum width the layout engine will use for laying out elements.
 boolean isAutoRecomputeLayoutSize()
          If true, then the layout size will be recomputed when a window is added, removed, or resized.
 boolean isRelayoutAfterManualChange()
          Gets whether to relayout when a node is dragged
protected  void postRedraw()
          Update the position of vertices after each redraw and advance the layout engine if it is an incremental layout engine.
 void removeDrawable(Drawable d)
          Stop drawing the specified entity.
 void setAutoRecomputeLayoutSize(boolean autoRecomputeLayoutSize)
          Sets whether to automatically recompute layout size based on the window size
 void setLayout(edu.uci.ics.jung.algorithms.layout.Layout<Vertex,Edge> layout)
          sets the current layout
 void setLayoutSize(int width, int height)
          Set the maximum size the layout engine will use for laying out elements.
 void setLayoutSizeBasedOnVisibleArea()
          Sets the layout size to the size of the visible area.
 void setRelayoutAfterManualChange(boolean b)
          Sets whether to relayout when a node is dragged
 void windowResized(PZWindow window)
          Recomputes the layout size if isAutoRecomputeLayoutSize() is true
 
Methods inherited from class org.pzgui.PZManager
addClosingListener, addDrawableEventListener, addWindow, attachWindow, dehover, deselect, displayIcon, displayIcon, displayIcon, displayIcon, displayIcon, drawBeforeObject, drawObject, fireDrawableEvent, getHovered, getLastConfigFilename, getMouseDownTime, getMousePos, getMouseStartPos, getSelected, getTargetFPS, getWindowIndex, hover, loadDrawablePositionsFromFile, noteMouseUp, preRedraw, redraw, removeClosingListener, removeDrawableEventListener, run, saveDrawablePositionsToFile, select, select, selectFrom, selectFrom, setDrawOrder, setMousePos, setTargetFPS, wasDoubleClick
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PZLayoutManager

public PZLayoutManager()
Method Detail

addDrawable

public void addDrawable(Drawable d)
Description copied from class: PZManager
Add a new entity to draw on the GUI.

Overrides:
addDrawable in class PZManager
Parameters:
d - the entity to start drawing

removeDrawable

public void removeDrawable(Drawable d)
Description copied from class: PZManager
Stop drawing the specified entity.

Overrides:
removeDrawable in class PZManager
Parameters:
d - the entity to stop drawing

postRedraw

protected void postRedraw()
Update the position of vertices after each redraw and advance the layout engine if it is an incremental layout engine.

Overrides:
postRedraw in class PZManager

getGraph

public edu.uci.ics.jung.graph.Graph<Vertex,Edge> getGraph()
gets the graph backing the layout manager


getLayout

public edu.uci.ics.jung.algorithms.layout.Layout<Vertex,Edge> getLayout()
gets the current layout, if any


setLayout

public void setLayout(edu.uci.ics.jung.algorithms.layout.Layout<Vertex,Edge> layout)
sets the current layout

Parameters:
layout - the new layout, or null to turn off auto-layout

getLayoutSize

public java.awt.Dimension getLayoutSize()
Get the maximum size the layout engine will use for laying out elements.


getLayoutHeight

public int getLayoutHeight()
Get the maximum height the layout engine will use for laying out elements.


getLayoutWidth

public int getLayoutWidth()
Get the maximum width the layout engine will use for laying out elements.


setLayoutSize

public void setLayoutSize(int width,
                          int height)
Set the maximum size the layout engine will use for laying out elements.


setLayoutSizeBasedOnVisibleArea

public void setLayoutSizeBasedOnVisibleArea()
Sets the layout size to the size of the visible area. It determines the area to layout in based on the minimum and maximum x and y coordinates visible in all windows.


attachWindow

public void attachWindow(PZWindow w)
Description copied from class: PZManager
Calls attchWindow(w, true).

Overrides:
attachWindow in class PZManager

closeWindow

public void closeWindow(PZWindow w)
Description copied from class: PZManager
Cleans up after a window which is closing. Terminates the application if no windows are left.

Overrides:
closeWindow in class PZManager

windowResized

public void windowResized(PZWindow window)
Recomputes the layout size if isAutoRecomputeLayoutSize() is true

Overrides:
windowResized in class PZManager

isAutoRecomputeLayoutSize

public boolean isAutoRecomputeLayoutSize()
If true, then the layout size will be recomputed when a window is added, removed, or resized.

Returns:
whether to automatically recompute layout size based on the window size

setAutoRecomputeLayoutSize

public void setAutoRecomputeLayoutSize(boolean autoRecomputeLayoutSize)
Sets whether to automatically recompute layout size based on the window size


isRelayoutAfterManualChange

public boolean isRelayoutAfterManualChange()
Gets whether to relayout when a node is dragged


setRelayoutAfterManualChange

public void setRelayoutAfterManualChange(boolean b)
Sets whether to relayout when a node is dragged