de.grogra.imp
Interface ViewComponent

All Superinterfaces:
ComponentWrapper, Disposable
All Known Implementing Classes:
CanvasAdapter, GL20Display, GLDisplay, GLDisplay, GLSLDisplay, ViewComponentAdapter, WireframeCanvas

public interface ViewComponent
extends ComponentWrapper

A ViewComponent represents the actual visualization component of a View. A View typically contains menu components and a single ViewComponent.

Author:
Ole Kniemeyer

Field Summary
static int ALL
          Bit mask combining SCENE, SELECTION, and TOOLS.
static int CHANGED
          Bit mask for repaint(int) indicating that a repaint is requested due to a change of scene or display size.
static int MIN_USER_FLAG
          Smallest bit mask for repaint(int) that can be used freely by implementations of ViewComponent.
static int SCENE
          Bit mask for repaint(int) indicating that the whole scene has to be repainted.
static int SELECTION
          Bit mask for repaint(int) indicating that the selection state of objects has to be repainted.
static int TOOLS
          Bit mask for repaint(int) indicating that the tools () have to be repainted.
 
Method Summary
 void disposeRenderer(Renderer r)
           
 Item getFactory()
          Returns the factory item which has been set by initFactory(Item), i.e., the item which created this component.
 int getGlobalLOD()
          Determines the global level-of-detail which should currently be used in this view component.
 void initFactory(Item factory)
          Sets the factory item which created this view component.
 void initView(View view, EventListener listener)
          Initializes this component.
 void makeSnapshot(ObjectConsumer<? super java.awt.image.RenderedImage> callback)
          Instructs the view component to create a snapshot.
 void render(Renderer r)
          Initiates a rendering of the graph using the specified renderer.
 void render(Renderer r, int widht, int height)
           
 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.
 
Methods inherited from interface de.grogra.pf.ui.ComponentWrapper
getComponent
 
Methods inherited from interface de.grogra.util.Disposable
dispose
 

Field Detail

ALL

static final int ALL
Bit mask combining SCENE, SELECTION, and TOOLS.

See Also:
Constant Field Values

CHANGED

static final int CHANGED
Bit mask for repaint(int) indicating that a repaint is requested due to a change of scene or display size.

See Also:
Constant Field Values

MIN_USER_FLAG

static final int MIN_USER_FLAG
Smallest bit mask for repaint(int) that can be used freely by implementations of ViewComponent. It is guaranteed that there is no conflict with the other bit masks.

See Also:
Constant Field Values

SCENE

static final int SCENE
Bit mask for repaint(int) indicating that the whole scene has to be repainted.

See Also:
Constant Field Values

SELECTION

static final int SELECTION
Bit mask for repaint(int) indicating that the selection state of objects has to be repainted.

See Also:
Constant Field Values

TOOLS

static final int TOOLS
Bit mask for repaint(int) indicating that the tools () have to be repainted.

See Also:
Constant Field Values
Method Detail

disposeRenderer

void disposeRenderer(Renderer r)

getFactory

Item getFactory()
Returns the factory item which has been set by initFactory(Item), i.e., the item which created this component.

Returns:
factory item of this component

getGlobalLOD

int getGlobalLOD()
Determines the global level-of-detail which should currently be used in this view component. The value lies between View.LOD_MIN and View.LOD_MAX inclusively.

Returns:
global level-of-detail

initFactory

void initFactory(Item factory)
Sets the factory item which created this view component.

Parameters:
factory - factory item

initView

void initView(View view,
              EventListener listener)
Initializes this component. This method sets the view 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.

Parameters:
view - the containing view
listener - mouse and key events will be reported to this listener

makeSnapshot

void makeSnapshot(ObjectConsumer<? super java.awt.image.RenderedImage> callback)
Instructs the view component to create a snapshot. The created snapshot has to be delivered to the provided callback as an instance of RenderedImage. This may happen asynchronously, i.e., in an arbitrary thread.

Parameters:
callback - callback which asynchronously receives the snapshot

render

void render(Renderer r)
Initiates a rendering of the graph using the specified renderer.

Parameters:
r -

render

void render(Renderer r,
            int widht,
            int height)

repaint

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. This method may be invoked from arbitrary threads.

Parameters:
flags - the parts to be repainted