- All Superinterfaces:
ComponentWrapper
,Disposable
- All Known Implementing Classes:
AWTCanvas2D
,CanvasAdapter
,GLDisplay
,GLDisplay
,GLSLDisplay
,ViewComponentAdapter
,WireframeCanvas
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
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
Bit mask forrepaint(int)
indicating that a repaint is requested due to a change of scene or display size.static final int
Smallest bit mask forrepaint(int)
that can be used freely by implementations ofViewComponent
.static final int
Bit mask forrepaint(int)
indicating that the whole scene has to be repainted.static final int
Bit mask forrepaint(int)
indicating that the selection state of objects has to be repainted.static final int
Bit mask forrepaint(int)
indicating that the tools()
have to be repainted. -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
Determines the level of resolution which should currently be used in this view component.Returns the factory item which has been set byinitFactory(Item)
, i.e., the item which created this component.int
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 RenderedImage> callback) Instructs the view component to create a snapshot.void
Initiates a rendering of the graph using the specified renderer.void
void
repaint
(int flags) Initiates a repaint of those parts of the view which are indicated by theflags
, interpreted as a combination of bit masks.void
updateResolution
(int r) Methods inherited from interface de.grogra.pf.ui.ComponentWrapper
getComponent
Methods inherited from interface de.grogra.util.Disposable
dispose
-
Field Details
-
SCENE
static final int SCENEBit mask forrepaint(int)
indicating that the whole scene has to be repainted.- See Also:
-
SELECTION
static final int SELECTIONBit mask forrepaint(int)
indicating that the selection state of objects has to be repainted.- See Also:
-
TOOLS
static final int TOOLSBit mask forrepaint(int)
indicating that the tools()
have to be repainted.- See Also:
-
CHANGED
static final int CHANGEDBit mask forrepaint(int)
indicating that a repaint is requested due to a change of scene or display size.- See Also:
-
MIN_USER_FLAG
static final int MIN_USER_FLAGSmallest bit mask forrepaint(int)
that can be used freely by implementations ofViewComponent
. It is guaranteed that there is no conflict with the other bit masks.- See Also:
-
ALL
static final int ALL- See Also:
-
-
Method Details
-
initFactory
Sets the factory item which created this view component.- Parameters:
factory
- factory item
-
getFactory
Item getFactory()Returns the factory item which has been set byinitFactory(Item)
, i.e., the item which created this component.- Returns:
- factory item of this component
-
initView
Initializes this component. This method sets theview
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 viewlistener
- mouse and key events will be reported to this listener
-
repaint
void repaint(int flags) Initiates a repaint of those parts of the view which are indicated by theflags
, interpreted as a combination of bit masks. This method may be invoked from arbitrary threads.- Parameters:
flags
- the parts to be repainted
-
getGlobalLOD
int getGlobalLOD()Determines the global level-of-detail which should currently be used in this view component. The value lies betweenView.LOD_MIN
andView.LOD_MAX
inclusively.- Returns:
- global level-of-detail
-
getDisplayResolution
int getDisplayResolution()Determines the level of resolution which should currently be used in this view component. The value lies betweenNode#MIN_RESOLUTION
andNode#MAX_RESOLUTION
inclusively.- Returns:
- The resolution level used for the display
-
updateResolution
void updateResolution(int r) -
render
Initiates a rendering of the graph using the specified renderer.- Parameters:
r
-
-
render
-
disposeRenderer
-
makeSnapshot
Instructs the view component to create a snapshot. The created snapshot has to be delivered to the providedcallback
as an instance ofRenderedImage
. This may happen asynchronously, i.e., in an arbitrary thread.- Parameters:
callback
- callback which asynchronously receives the snapshot
-