|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
cz.cuni.jagrlib.DefaultGraphicsViewer
public abstract class DefaultGraphicsViewer
Default implementation of GraphicsViewer
.
Nested Class Summary | |
---|---|
protected static class |
DefaultGraphicsViewer.HudLine
Line for HUD drawing. |
protected static interface |
DefaultGraphicsViewer.HudPrimitive
Protocol for HUD drawable primitives. |
protected class |
DefaultGraphicsViewer.LocalComponentListener
|
protected class |
DefaultGraphicsViewer.LocalKeyListener
|
protected class |
DefaultGraphicsViewer.LocalMouseListener
|
protected class |
DefaultGraphicsViewer.LocalMouseMotionListener
|
protected class |
DefaultGraphicsViewer.LocalMouseWheelListener
|
protected class |
DefaultGraphicsViewer.LocalWindowListener
Inner class responsible for window-close event handling (by user interaction). |
Nested classes/interfaces inherited from interface cz.cuni.jagrlib.iface.GraphicsViewer |
---|
GraphicsViewer.PreviewThread |
Field Summary | |
---|---|
protected boolean |
autoStart
Force automatic start of preview window. |
protected javax.swing.JComponent |
canvas
Custom component - drawing target. |
protected static java.lang.String |
CATEGORY
Object category. |
protected boolean |
continueRepaintLoop
Breaks the repaint loop from outside the repaintLoop() call. |
protected javax.swing.JFrame |
frame
Swing frame window to show graphic output in. |
protected java.lang.String |
frameTitle
Frame title (in order that Frame.setTitle(java.lang.String) works every time). |
protected IntMap<DefaultGraphicsViewer.HudPrimitive> |
hudSet
Set of HUD primitives. |
protected InputListener |
listener
InputListener connected through "direct" plug. |
protected java.util.List<InputListener> |
listeners
Set of actual input listeners. |
protected int |
nextFreeId
Next free HUD id (or id from which a future search will start). |
protected java.util.List<Semaphore> |
semaphores
Semaphores that will be signaled after the viewer window is closed. |
protected boolean |
userBreak
Has the user-break occurred? |
protected int |
x1
Minimal X coordinate of actual invalid region. |
protected int |
x2
Maximal X coordinate (outer bound) of actual invalid region. |
protected int |
y1
Minimal Y coordinate of actual invalid region. |
protected int |
y2
Maximal Y coordinate (outer bound) of actual invalid region. |
Fields inherited from class cz.cuni.jagrlib.Piece |
---|
channels, info, pl, plugs, reg, TEMPLATE_TYPE |
Fields inherited from interface cz.cuni.jagrlib.iface.GraphicsViewer |
---|
BLACK_BACKGROUND, WINDOW_TITLE |
Fields inherited from interface cz.cuni.jagrlib.iface.Property |
---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
Constructor Summary | |
---|---|
DefaultGraphicsViewer()
|
Method Summary | |
---|---|
void |
addInputListener(InputListener list)
Adds input listener object. |
void |
addSemaphore(Semaphore s)
Adds a new semaphore - object which wants to be signaled after the viewer window is closed (by user interaction etc.). |
void |
destroy()
Destroys the preview window. |
protected void |
doRepaint()
Does the repaint job itself (according the invalid region). |
boolean |
fire(int type)
Triggers the (undetermined) action. |
protected abstract javax.swing.JComponent |
getCanvas()
Returns drawing component or null if failed. |
void |
hudClear()
Removes all HUD primitives. |
int |
hudGetFreeId()
Returns id of any free HUD slot. |
void |
hudRemove(int id)
Removes existing HUD primitive. |
void |
hudSetLine(int id,
int x1,
int y1,
int x2,
int y2)
Replaces the given HUD primitive slot with line from [x1,y1] to [x2,y2] . |
int |
init(int phase)
Module initialization - called before any Runnable.run() . |
void |
invalidate(int xMin,
int xMax,
int yMin,
int yMax)
Invalidates the given rectangular region of the graphics output. |
void |
removeInputListener(InputListener list)
Removes (previously added) input listener object. |
void |
removeSemaphore(Semaphore s)
Removes one of associated semaphores. |
void |
repaint()
Causes the instant repainting of actual invalid region of the graphic output. |
void |
repaintAll()
Causes the instant repainting of the whole graphic output (regardless of the actual invalid region). |
boolean |
repaintLoop()
Start (potentially) infinite repaint loop. |
boolean |
stopRepaintLoop()
Stops the running repaint loop. |
Methods inherited from class cz.cuni.jagrlib.Piece |
---|
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplate, setTemplateDynamic, stop |
Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, get, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, set, stringProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cz.cuni.jagrlib.iface.Property |
---|
commit, get, set |
Methods inherited from interface cz.cuni.jagrlib.Breakable |
---|
setProgressListener, stop |
Field Detail |
---|
protected boolean autoStart
protected int x1
protected int x2
protected int y1
protected int y2
protected java.lang.String frameTitle
Frame.setTitle(java.lang.String)
works every time).
protected javax.swing.JFrame frame
protected javax.swing.JComponent canvas
protected boolean continueRepaintLoop
repaintLoop()
call.
repaintLoop()
,
stopRepaintLoop()
protected boolean userBreak
protected java.util.List<Semaphore> semaphores
Semaphore
,
addSemaphore(cz.cuni.jagrlib.Semaphore)
,
removeSemaphore(cz.cuni.jagrlib.Semaphore)
protected java.util.List<InputListener> listeners
addInputListener(cz.cuni.jagrlib.iface.InputListener)
,
removeInputListener(cz.cuni.jagrlib.iface.InputListener)
protected InputListener listener
protected IntMap<DefaultGraphicsViewer.HudPrimitive> hudSet
protected int nextFreeId
protected static final java.lang.String CATEGORY
Constructor Detail |
---|
public DefaultGraphicsViewer()
Method Detail |
---|
protected void doRepaint()
repaintLoop()
protected abstract javax.swing.JComponent getCanvas()
null
if failed.
public boolean repaintLoop()
stopRepaintLoop()
call or by external user interaction (user break, window
close, ..).
repaintLoop
in interface GraphicsViewer
true
if the loop was terminated by a stopRepaintLoop()
call.stopRepaintLoop()
public boolean stopRepaintLoop()
stopRepaintLoop
in interface GraphicsViewer
true
if the loop was successfully stopped.repaintLoop()
public void destroy()
destroy
in interface GraphicsViewer
public void repaintAll()
Trigger.fire(int)
call has the same effect..
repaintAll
in interface GraphicsViewer
invalidate(int, int, int, int)
,
repaint()
,
Trigger.fire(int)
public void invalidate(int xMin, int xMax, int yMin, int yMax)
repaint()
call...
invalidate
in interface GraphicsViewer
xMin
- X coordinate of the upper left corner.xMax
- X coordinate of the lower right corner (outside pixel).yMin
- Y coordinate of the upper left corner.yMax
- Y coordinate of the upper left corner (outside pixel).repaint()
public void repaint()
repaint
in interface GraphicsViewer
repaintAll()
,
invalidate(int, int, int, int)
public void addSemaphore(Semaphore s)
addSemaphore
in interface GraphicsViewer
s
- A new semaphore instance.removeSemaphore(cz.cuni.jagrlib.Semaphore)
public void removeSemaphore(Semaphore s)
removeSemaphore
in interface GraphicsViewer
s
- Semaphore to be removed.addSemaphore(cz.cuni.jagrlib.Semaphore)
public void addInputListener(InputListener list)
addInputListener
in interface GraphicsViewer
public void removeInputListener(InputListener list)
removeInputListener
in interface GraphicsViewer
public void hudClear()
hudClear
in interface GraphicsViewer
public int hudGetFreeId()
hudGetFreeId
in interface GraphicsViewer
public void hudSetLine(int id, int x1, int y1, int x2, int y2)
[x1,y1]
to [x2,y2]
.
hudSetLine
in interface GraphicsViewer
public void hudRemove(int id)
hudRemove
in interface GraphicsViewer
public boolean fire(int type)
fire
in interface Trigger
type
- The action type (whatever it means..).
true
if the action was successful.public int init(int phase)
Runnable.run()
.
Individual phases (starting at 0
) will be called until maximum
requested phase number is reached.
init
in class Piece
phase
- Current phase number.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |