|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
org.pzgui.PZManager
public class PZManager
Manages a GUI consisting of multiple windows which each may each view the scene from a different perspective.
| Nested Class Summary | |
|---|---|
static class |
PZManager.LayoutableInfo
Information used to describe a Layoutable when it is serialized. |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected java.util.concurrent.ConcurrentHashMap<java.lang.Long,PZManager.LayoutableInfo> |
layoutablePositions
where layout positions from a file is saved |
protected java.util.Vector<PZWindow> |
windows
windows which are displaying the scene |
static org.ho.yaml.YamlConfig |
YAML
the Yaml configuration |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
PZManager()
|
|
| Method Summary | |
|---|---|
void |
addClosingListener(PZClosing c)
adds a listener to be notified when the manager is terminating |
void |
addDrawable(Drawable d)
Add a new entity to draw on the GUI. |
void |
addDrawableEventListener(DrawableEventListener del)
adds a listener to be notified when the traffic matrix has changed |
void |
addWindow(int screenX,
int screenY,
int width,
int height,
int drawOffsetX,
int drawOffsetY,
float zoom)
adds a new display window in a thread-safe way |
void |
attachWindow(PZWindow w)
Calls attchWindow(w, true). |
void |
attachWindow(PZWindow w,
boolean addDefaultEventListener)
Attach an existing window to this manager. |
void |
closeWindow(PZWindow w)
Cleans up after a window which is closing. |
void |
dehover()
Clears any hovered state |
void |
deselect()
Clears any selection |
void |
displayIcon(Icon icon,
int duration_msec,
float scale)
Display icon for duration_msec scaled by scale at the curret mouse location. |
void |
displayIcon(Icon icon,
int duration_msec,
float scale,
int x,
int y)
Display icon for duration_msec scaled by scale at the specified location. |
void |
displayIcon(java.lang.String s,
int duration_msec)
Display text for duration_msec at the default size and the curret mouse location. |
void |
displayIcon(java.lang.String s,
int duration_msec,
int sz)
Display text for duration_msec at the specified size and the curret mouse location. |
void |
displayIcon(java.lang.String s,
int duration_msec,
int sz,
int x,
int y)
Display text for duration_msec scaled by scale at the specified location. |
protected void |
drawBeforeObject(java.awt.Graphics2D gfx,
Drawable d)
Calls the drawBeforeObject(gfx) method on d. |
protected void |
drawObject(java.awt.Graphics2D gfx,
Drawable d)
Calls the drawObject(gfx) method on d. |
void |
fireDrawableEvent(Drawable d,
java.awt.AWTEvent e,
java.lang.String event)
Updates the slider labels and notify those listening for traffic matrix changes. |
Drawable |
getHovered()
Returns the currently hovered object, if any |
java.lang.String |
getLastConfigFilename()
returns the last configuration file loaded or saved |
long |
getMouseDownTime()
Gets how long the mouse has been down |
Vector2i |
getMousePos()
Gets the current position of the mouse |
Vector2i |
getMouseStartPos()
Gets the position of the mouse when mouse down was depressed |
Drawable |
getSelected()
Returns the currently selected object, if any |
double |
getTargetFPS()
Returns the target FPS |
int |
getWindowIndex(PZWindow frame)
Returns the internal index of the frame specified. |
void |
hover(Drawable d)
Sets that the specified object is being hovered over |
void |
loadDrawablePositionsFromFile(java.lang.String file)
Loads positions for Layoutable objects from a file. |
void |
noteMouseUp()
Account for a mouse up event |
protected void |
postRedraw()
This method is called after each redraw. |
protected void |
preRedraw(PZWindow window)
This method is called before each redraw. |
void |
redraw(PZWindow window)
Redraw the scene on the specified display. |
void |
removeClosingListener(PZClosing c)
removes the specified closing listener |
void |
removeDrawable(Drawable d)
Stop drawing the specified entity. |
void |
removeDrawableEventListener(DrawableEventListener del)
removes the specified traffic matrix change listener |
void |
run()
Continuously redraws the windows at the desired interval. |
void |
saveDrawablePositionsToFile(java.lang.String file)
Saves positions for Layoutable objects to a file. |
void |
select(Drawable d)
Selects the specified object |
void |
select(int x,
int y)
Selects the object at the specified coordinates, if any |
Drawable |
selectFrom(int x,
int y)
Returns the Drawable which contains the location x, y. |
Drawable |
selectFrom(int x,
int y,
DrawableFilter filter)
Returns the object of type C which contains the location x, y. |
void |
setDrawOrder(java.util.Collection<java.lang.Class> newOrder)
Sets the default ordering of entity objects. |
void |
setMousePos(int x,
int y,
boolean dragging)
Sets the current position of the mouse and whether dragging is going on. |
void |
setTargetFPS(double fps)
Sets the target FPS |
boolean |
wasDoubleClick()
Get whether the last click was of a double-click |
void |
windowResized(PZWindow window)
This is called when a window is resized. |
| 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 |
| Field Detail |
|---|
protected final java.util.Vector<PZWindow> windows
public static final org.ho.yaml.YamlConfig YAML
protected java.util.concurrent.ConcurrentHashMap<java.lang.Long,PZManager.LayoutableInfo> layoutablePositions
| Constructor Detail |
|---|
public PZManager()
| Method Detail |
|---|
public void addWindow(int screenX,
int screenY,
int width,
int height,
int drawOffsetX,
int drawOffsetY,
float zoom)
public void attachWindow(PZWindow w)
public void attachWindow(PZWindow w,
boolean addDefaultEventListener)
public void closeWindow(PZWindow w)
public int getWindowIndex(PZWindow frame)
frame - the frame to get the index of (may change over time)public void windowResized(PZWindow window)
public void addClosingListener(PZClosing c)
public void removeClosingListener(PZClosing c)
public void addDrawable(Drawable d)
d - the entity to start drawingpublic void removeDrawable(Drawable d)
d - the entity to stop drawingpublic void setDrawOrder(java.util.Collection<java.lang.Class> newOrder)
newOrder - The new order, with the first class specified being the
class of objects drawn on top (e.g. drawn last).public java.lang.String getLastConfigFilename()
public void loadDrawablePositionsFromFile(java.lang.String file)
file - the filename to load frompublic void saveDrawablePositionsToFile(java.lang.String file)
file - the filename to save to
public void displayIcon(Icon icon,
int duration_msec,
float scale)
icon - the icon to drawduration_msec - how long to display itscale - scaling factor
public void displayIcon(Icon icon,
int duration_msec,
float scale,
int x,
int y)
icon - the icon to drawduration_msec - how long to display itscale - scaling factorx - x location of the icony - y location of the icon
public void displayIcon(java.lang.String s,
int duration_msec)
s - the string to drawduration_msec - how long to display it
public void displayIcon(java.lang.String s,
int duration_msec,
int sz)
s - the string to drawduration_msec - how long to display itsz - font size
public void displayIcon(java.lang.String s,
int duration_msec,
int sz,
int x,
int y)
s - the string to drawduration_msec - how long to display itsz - font sizepublic void run()
run in interface java.lang.Runnablerun in class java.lang.Threadprotected void preRedraw(PZWindow window)
protected void postRedraw()
public void redraw(PZWindow window)
window - the display which is to be redrawn
protected void drawBeforeObject(java.awt.Graphics2D gfx,
Drawable d)
protected void drawObject(java.awt.Graphics2D gfx,
Drawable d)
public double getTargetFPS()
public void setTargetFPS(double fps)
public Vector2i getMouseStartPos()
public Vector2i getMousePos()
public long getMouseDownTime()
public void noteMouseUp()
public void setMousePos(int x,
int y,
boolean dragging)
public boolean wasDoubleClick()
public Drawable getSelected()
public void deselect()
public void select(Drawable d)
public void select(int x,
int y)
public Drawable selectFrom(int x,
int y)
x - x position the drawable must containy - y position the drawable must contain
public Drawable selectFrom(int x,
int y,
DrawableFilter filter)
x - x position the Drawable must containy - y position the Drawable must containfilter - a Drawable filter; only nodes for which
filter.consider() returns true will be considered for
selection. If this filter is null, then all nodes will be
considered.
public Drawable getHovered()
public void dehover()
public void hover(Drawable d)
public void addDrawableEventListener(DrawableEventListener del)
public void removeDrawableEventListener(DrawableEventListener del)
public void fireDrawableEvent(Drawable d,
java.awt.AWTEvent e,
java.lang.String event)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||