- All Superinterfaces:
ComponentWrapper,Disposable
- All Known Implementing Classes:
AWTCanvas2D,CanvasAdapter,GLDisplay,GLDisplay,GLSLDisplay,SocketViewAdapter,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 intstatic final intBit mask forrepaint(int)indicating that a repaint is requested due to a change of scene or display size.static final intSmallest bit mask forrepaint(int)that can be used freely by implementations ofViewComponent.static final intBit mask forrepaint(int)indicating that the whole scene has to be repainted.static final intBit mask forrepaint(int)indicating that the selection state of objects has to be repainted.static final intBit mask forrepaint(int)indicating that the tools()have to be repainted. -
Method Summary
Modifier and TypeMethodDescriptionvoidintDetermines 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.intDetermines the global level-of-detail which should currently be used in this view component.voidinitFactory(Item factory) Sets the factory item which created this view component.voidinitView(View view, EventListener listener) Initializes this component.voidmakeSnapshot(ObjectConsumer<? super RenderedImage> callback) Instructs the view component to create a snapshot.voidInitiates a rendering of the graph using the specified renderer.voidvoidrepaint(int flags) Initiates a repaint of those parts of the view which are indicated by theflags, interpreted as a combination of bit masks.voidupdateResolution(int r) Methods inherited from interface de.grogra.pf.ui.ComponentWrapper
getComponentMethods 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 theviewwithin 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_MINandView.LOD_MAXinclusively.- 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 betweenandinvalid reference
Node#MIN_RESOLUTIONinclusively.invalid reference
Node#MAX_RESOLUTION- 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 providedcallbackas an instance ofRenderedImage. This may happen asynchronously, i.e., in an arbitrary thread.- Parameters:
callback- callback which asynchronously receives the snapshot
-