de.grogra.imp.awt
public abstract class ViewComponentAdapter extends java.lang.Object implements ViewComponent, java.lang.Runnable, Selectable
| Modifier and Type | Field and Description |
|---|---|
protected static int |
DISPOSED
Bit mask for
renderFlags indicating that this
view is disposed. |
protected static int |
DISPOSING
Bit mask for
renderFlags indicating that this
view is currently disposing. |
protected static int |
RENDERED_IMAGE |
protected static int |
RENDERING
Bit mask for
renderFlags indicating that this
view is currently rendering. |
protected static int |
REPAINT_MASK |
ALL, CHANGED, MIN_USER_FLAG, SCENE, SELECTION, TOOLS| Constructor and Description |
|---|
ViewComponentAdapter() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkRepaint() |
void |
checkRepaintWrapException() |
void |
dispose() |
void |
disposeRenderer(Renderer r) |
static java.awt.Color |
getColor(int argb,
java.awt.Color old) |
static java.awt.Color |
getColor(Tuple3f c,
java.awt.Color old) |
Item |
getFactory()
Returns the factory item which has been set by
ViewComponent.initFactory(Item), i.e., the item which
created this component. |
java.awt.FontMetrics |
getFontMetrics(java.awt.Font font) |
int |
getGlobalLOD()
Determines the global level-of-detail which should currently
be used in this view component.
|
static int |
getIntColor(Tuple3f c) |
java.lang.InterruptedException |
getInterruptedException() |
protected abstract java.awt.image.ImageObserver |
getObserverForRenderer()
Returns an observer which receives the information about the
rendered image from a
Renderer. |
java.lang.Object |
getOption(java.lang.String name,
java.lang.Object defaultValue) |
GraphState |
getRenderGraphState() |
View |
getView() |
void |
initFactory(Item factory)
Sets the factory item which created this view component.
|
protected abstract void |
initRender(int flags)
Performs initialization tasks in preparation for rendering.
|
void |
initView(View view,
EventListener listener)
Initializes this component.
|
protected void |
installListeners(java.awt.Component canvas) |
protected abstract void |
invokeRender(int flags)
Invoked to perform rendering.
|
protected void |
invokeRenderSync(int flags)
Invokes
render(int), ensuring that
Workbench.current() returns the correct workbench. |
protected void |
optionValueChanged(java.lang.String name,
java.lang.Object object) |
protected abstract void |
render(int flags)
Performs rendering.
|
void |
render(Renderer r)
Initiates a rendering of the graph using the specified
renderer.
|
void |
render(Renderer r,
int width,
int height) |
protected void |
renderUninterruptibly() |
void |
repaint(int flags)
Initiates a repaint of those parts of the view which are
indicated by the
flags, interpreted as a
combination of bit masks. |
void |
run()
Controls rendering and the global level of detail in an own thread.
|
Selection |
toSelection(Context ctx)
Converts this object into a
Selection. |
protected void |
uninstallListeners(java.awt.Component canvas) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmakeSnapshotgetComponentprotected static final int DISPOSED
renderFlags indicating that this
view is disposed.protected static final int DISPOSING
renderFlags indicating that this
view is currently disposing.protected static final int RENDERED_IMAGE
protected static final int RENDERING
renderFlags indicating that this
view is currently rendering.protected static final int REPAINT_MASK
public void checkRepaint()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void checkRepaintWrapException()
public void dispose()
dispose in interface Disposablepublic void disposeRenderer(Renderer r)
disposeRenderer in interface ViewComponentpublic static java.awt.Color getColor(int argb,
java.awt.Color old)
public static java.awt.Color getColor(Tuple3f c, java.awt.Color old)
public Item getFactory()
ViewComponentViewComponent.initFactory(Item), i.e., the item which
created this component.getFactory in interface ViewComponentpublic java.awt.FontMetrics getFontMetrics(java.awt.Font font)
public int getGlobalLOD()
ViewComponentView.LOD_MIN and View.LOD_MAX inclusively.getGlobalLOD in interface ViewComponentpublic static int getIntColor(Tuple3f c)
public java.lang.InterruptedException getInterruptedException()
protected abstract java.awt.image.ImageObserver getObserverForRenderer()
Renderer. The returned observer
has to manage the drawing of the (partially) rendered image
on the view component.null if
this is not supported by this componentpublic java.lang.Object getOption(java.lang.String name,
java.lang.Object defaultValue)
public GraphState getRenderGraphState()
public View getView()
public void initFactory(Item factory)
ViewComponentinitFactory in interface ViewComponentfactory - factory itemprotected abstract void initRender(int flags)
run() in this
ViewComponent's own thread.flags - combination of bit maskspublic void initView(View view, EventListener listener)
ViewComponentview
within which this view component is used to display the graph.
It also sets an event listener. this has to be informed of
mouse and keys events within the view component by implementations
of this method.initView in interface ViewComponentview - the containing viewlistener - mouse and key events will be reported to this listenerprotected void installListeners(java.awt.Component canvas)
protected abstract void invokeRender(int flags)
run() in this ViewComponent's own thread.
Its sole task is to invoke invokeRenderSync(int) in
the rendering thread (which may be this
ViewComponent's thread, the AWT-thread, or another
thread, depending on the implementation) in a write-protected
context. The invocation has to be
synchronously, i.e., if it is in another thread, the current thread
has to wait until invokeRenderSync(int) has completed.flags - the flags to pass to invokeRenderSync(int)protected void invokeRenderSync(int flags)
render(int), ensuring that
Workbench.current() returns the correct workbench.
If render(int) throws an InterruptedException,
a repaint is posted. The write-lock of this view's graph has to be
acquired by the invoker (see Lockable).flags - the flags to pass to render(int)protected void optionValueChanged(java.lang.String name,
java.lang.Object object)
protected abstract void render(int flags)
throws java.lang.InterruptedException
invokeRenderSync(int) in a context where
Workbench.current() returns the workbench of this
view.flags - combination of bit masksjava.lang.InterruptedException - if the rendering has been interruptedpublic void render(Renderer r)
ViewComponentrender in interface ViewComponentpublic void render(Renderer r, int width, int height)
render in interface ViewComponentprotected void renderUninterruptibly()
public void repaint(int flags)
ViewComponentflags, interpreted as a
combination of bit masks. This method may be invoked from
arbitrary threads.repaint in interface ViewComponentflags - the parts to be repaintedpublic final void run()
run in interface java.lang.Runnablepublic Selection toSelection(Context ctx)
SelectableSelection.toSelection in interface Selectablectx - the UI contextnull if this is not possibleprotected void uninstallListeners(java.awt.Component canvas)