Package org.eclipse.gef.mvc.fx.viewer
Class InfiniteCanvasViewer
- java.lang.Object
-
- org.eclipse.gef.mvc.fx.viewer.InfiniteCanvasViewer
-
- All Implemented Interfaces:
IActivatable
,IAdaptable
,IAdaptable.Bound<IDomain>
,IDisposable
,IViewer
public class InfiniteCanvasViewer extends java.lang.Object implements IViewer
TheInfiniteCanvasViewer
is anIViewer
that manages anInfiniteCanvas
to display the viewer's contents.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable
IAdaptable.Bound<A extends IAdaptable>
-
Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
IAdaptable.Bound.Impl<T extends IAdaptable>
-
-
Field Summary
-
Fields inherited from interface org.eclipse.gef.common.activate.IActivatable
ACTIVE_PROPERTY
-
Fields inherited from interface org.eclipse.gef.common.adapt.IAdaptable
ADAPTERS_PROPERTY
-
Fields inherited from interface org.eclipse.gef.mvc.fx.viewer.IViewer
CONTENT_PART_MAP_PROPERTY, CONTENTS_PROPERTY, VISUAL_PART_MAP_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description InfiniteCanvasViewer()
Creates a newInfiniteCanvasViewer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
protected void
activateAdapters()
Activates the adapters registered at thisInfiniteCanvasViewer
.javafx.beans.property.ReadOnlyBooleanProperty
activeProperty()
javafx.beans.property.ReadOnlyObjectProperty<IDomain>
adaptableProperty()
javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,java.lang.Object>
adaptersProperty()
javafx.beans.property.ReadOnlyMapProperty<java.lang.Object,IContentPart<? extends javafx.scene.Node>>
contentPartMapProperty()
Returns an unmodifiable read-only map property that contains the registeredIContentPart
s mapped to their respective content.javafx.beans.property.ReadOnlyListProperty<java.lang.Object>
contentsProperty()
A read-only property containing the current content objects.void
deactivate()
protected void
deactivateAdapters()
Deactivates the adapters registered at thisInfiniteCanvasViewer
.void
dispose()
protected void
doActivate()
Activates thisInfiniteCanvasViewer
, which activates its adapters.protected void
doDeactivate()
Deactivates thisInfiniteCanvasViewer
, which deactivates its adapters.IDomain
getAdaptable()
<T> T
getAdapter(TypeToken<T> key)
<T> T
getAdapter(java.lang.Class<T> classKey)
<T> T
getAdapter(AdapterKey<T> key)
<T> AdapterKey<T>
getAdapterKey(T adapter)
javafx.collections.ObservableMap<AdapterKey<?>,java.lang.Object>
getAdapters()
<T> java.util.Map<AdapterKey<? extends T>,T>
getAdapters(TypeToken<? super T> key)
<T> java.util.Map<AdapterKey<? extends T>,T>
getAdapters(java.lang.Class<? super T> classKey)
InfiniteCanvas
getCanvas()
Returns theInfiniteCanvas
that is managed by thisInfiniteCanvasViewer
.java.util.Map<java.lang.Object,IContentPart<? extends javafx.scene.Node>>
getContentPartMap()
Returns theMap
for registeringIContentPart
s by their content.javafx.collections.ObservableList<java.lang.Object>
getContents()
Returns anObservableList
containing the content objects.IDomain
getDomain()
IRootPart<? extends javafx.scene.Node>
getRootPart()
Returns theIRootPart
of this viewer.javafx.scene.Scene
getScene()
java.util.Map<javafx.scene.Node,IVisualPart<? extends javafx.scene.Node>>
getVisualPartMap()
Returns theMap
for registeringIVisualPart
s by their visual.boolean
isActive()
boolean
isViewerFocused()
Returns the value of the propertyIViewer.viewerFocusedProperty()
.void
reveal(IVisualPart<? extends javafx.scene.Node> visualPart)
Ensure that the visual of the givenIVisualPart
is visible in this viewer.void
setAdaptable(IDomain domain)
<T> void
setAdapter(TypeToken<T> adapterType, T adapter)
<T> void
setAdapter(TypeToken<T> adapterType, T adapter, java.lang.String role)
<T> void
setAdapter(T adapter)
<T> void
setAdapter(T adapter, java.lang.String role)
<T> void
unsetAdapter(T adapter)
javafx.beans.property.ReadOnlyBooleanProperty
viewerFocusedProperty()
Returns aReadOnlyBooleanProperty
that represents the "focused" state of thisIViewer
.javafx.beans.property.ReadOnlyMapProperty<javafx.scene.Node,IVisualPart<? extends javafx.scene.Node>>
visualPartMapProperty()
Returns an unmodifiable read-only map property that contains the registeredIVisualPart
s mapped to their respective visual.
-
-
-
Constructor Detail
-
InfiniteCanvasViewer
public InfiniteCanvasViewer()
Creates a newInfiniteCanvasViewer
.
-
-
Method Detail
-
activate
public final void activate()
- Specified by:
activate
in interfaceIActivatable
-
activateAdapters
protected void activateAdapters()
Activates the adapters registered at thisInfiniteCanvasViewer
.
-
activeProperty
public final javafx.beans.property.ReadOnlyBooleanProperty activeProperty()
- Specified by:
activeProperty
in interfaceIActivatable
-
adaptableProperty
public javafx.beans.property.ReadOnlyObjectProperty<IDomain> adaptableProperty()
- Specified by:
adaptableProperty
in interfaceIAdaptable.Bound<IDomain>
-
adaptersProperty
public javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,java.lang.Object> adaptersProperty()
- Specified by:
adaptersProperty
in interfaceIAdaptable
-
contentPartMapProperty
public javafx.beans.property.ReadOnlyMapProperty<java.lang.Object,IContentPart<? extends javafx.scene.Node>> contentPartMapProperty()
Description copied from interface:IViewer
Returns an unmodifiable read-only map property that contains the registeredIContentPart
s mapped to their respective content.- Specified by:
contentPartMapProperty
in interfaceIViewer
- Returns:
- An unmodifiable read-only map property.
-
contentsProperty
public javafx.beans.property.ReadOnlyListProperty<java.lang.Object> contentsProperty()
Description copied from interface:IViewer
A read-only property containing the current content objects.- Specified by:
contentsProperty
in interfaceIViewer
- Returns:
- A read-only list property named
IViewer.CONTENTS_PROPERTY
.
-
deactivate
public final void deactivate()
- Specified by:
deactivate
in interfaceIActivatable
-
deactivateAdapters
protected void deactivateAdapters()
Deactivates the adapters registered at thisInfiniteCanvasViewer
.
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceIDisposable
-
doActivate
protected void doActivate()
Activates thisInfiniteCanvasViewer
, which activates its adapters.
-
doDeactivate
protected void doDeactivate()
Deactivates thisInfiniteCanvasViewer
, which deactivates its adapters.
-
getAdaptable
public IDomain getAdaptable()
- Specified by:
getAdaptable
in interfaceIAdaptable.Bound<IDomain>
-
getAdapter
public <T> T getAdapter(AdapterKey<T> key)
- Specified by:
getAdapter
in interfaceIAdaptable
-
getAdapter
public <T> T getAdapter(java.lang.Class<T> classKey)
- Specified by:
getAdapter
in interfaceIAdaptable
-
getAdapter
public <T> T getAdapter(TypeToken<T> key)
- Specified by:
getAdapter
in interfaceIAdaptable
-
getAdapterKey
public <T> AdapterKey<T> getAdapterKey(T adapter)
- Specified by:
getAdapterKey
in interfaceIAdaptable
-
getAdapters
public javafx.collections.ObservableMap<AdapterKey<?>,java.lang.Object> getAdapters()
- Specified by:
getAdapters
in interfaceIAdaptable
-
getAdapters
public <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(java.lang.Class<? super T> classKey)
- Specified by:
getAdapters
in interfaceIAdaptable
-
getAdapters
public <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(TypeToken<? super T> key)
- Specified by:
getAdapters
in interfaceIAdaptable
-
getCanvas
public InfiniteCanvas getCanvas()
Returns theInfiniteCanvas
that is managed by thisInfiniteCanvasViewer
.- Specified by:
getCanvas
in interfaceIViewer
- Returns:
- The
InfiniteCanvas
that is managed by thisInfiniteCanvasViewer
.
-
getContentPartMap
public java.util.Map<java.lang.Object,IContentPart<? extends javafx.scene.Node>> getContentPartMap()
Description copied from interface:IViewer
Returns theMap
for registeringIContentPart
s by their content.- Specified by:
getContentPartMap
in interfaceIViewer
- Returns:
- The content part map
- See Also:
IViewer.getContentPartMap()
-
getContents
public javafx.collections.ObservableList<java.lang.Object> getContents()
Description copied from interface:IViewer
Returns anObservableList
containing the content objects.- Specified by:
getContents
in interfaceIViewer
- Returns:
- An
ObservableList
.
-
getRootPart
public IRootPart<? extends javafx.scene.Node> getRootPart()
Description copied from interface:IViewer
Returns theIRootPart
of this viewer. TheIRootPart
is a specialIVisualPart
that serves as the parent to all containedIContentPart
s,IHandlePart
s, andIFeedbackPart
s.- Specified by:
getRootPart
in interfaceIViewer
- Returns:
- The
IRootPart
of this viewer.
-
getScene
public javafx.scene.Scene getScene()
- Returns:
- The
Scene
in which theInfiniteCanvas
of thisInfiniteCanvasViewer
is displayed.
-
getVisualPartMap
public java.util.Map<javafx.scene.Node,IVisualPart<? extends javafx.scene.Node>> getVisualPartMap()
Description copied from interface:IViewer
Returns theMap
for registeringIVisualPart
s by their visual. This map is used for hit-testing. Hit testing is performed by first determining which visual is hit, and then mapping that to anIVisualPart
.Note, that when looking up an
IVisualPart
for a given visual in the map, it is required to walk up the visual hierarchy until a registered visual is found, because anIVisualPart
only has to register its "main" visual (i.e. the one returned byIVisualPart.getVisual()
) at the visual-part-map, but potential children visuals do not have to be registered.- Specified by:
getVisualPartMap
in interfaceIViewer
- Returns:
- The visual-to-visual-part map.
- See Also:
IViewer.getVisualPartMap()
-
isActive
public final boolean isActive()
- Specified by:
isActive
in interfaceIActivatable
-
isViewerFocused
public boolean isViewerFocused()
Description copied from interface:IViewer
Returns the value of the propertyIViewer.viewerFocusedProperty()
.- Specified by:
isViewerFocused
in interfaceIViewer
- Returns:
- The value of the property
IViewer.viewerFocusedProperty()
.
-
reveal
public void reveal(IVisualPart<? extends javafx.scene.Node> visualPart)
Description copied from interface:IViewer
Ensure that the visual of the givenIVisualPart
is visible in this viewer.- Specified by:
reveal
in interfaceIViewer
- Parameters:
visualPart
- TheIVisualPart
that is to be revealed.
-
setAdaptable
public void setAdaptable(IDomain domain)
- Specified by:
setAdaptable
in interfaceIAdaptable.Bound<IDomain>
-
setAdapter
public <T> void setAdapter(T adapter)
- Specified by:
setAdapter
in interfaceIAdaptable
-
setAdapter
public <T> void setAdapter(T adapter, java.lang.String role)
- Specified by:
setAdapter
in interfaceIAdaptable
-
setAdapter
public <T> void setAdapter(TypeToken<T> adapterType, T adapter)
- Specified by:
setAdapter
in interfaceIAdaptable
-
setAdapter
@InjectAdapters public <T> void setAdapter(TypeToken<T> adapterType, T adapter, java.lang.String role)
- Specified by:
setAdapter
in interfaceIAdaptable
-
unsetAdapter
public <T> void unsetAdapter(T adapter)
- Specified by:
unsetAdapter
in interfaceIAdaptable
-
viewerFocusedProperty
public javafx.beans.property.ReadOnlyBooleanProperty viewerFocusedProperty()
Description copied from interface:IViewer
Returns aReadOnlyBooleanProperty
that represents the "focused" state of thisIViewer
. AnIViewer
is focused when its visualization has keyboard focus and its window is active, i.e. it is focused if it will receive keyboard events.- Specified by:
viewerFocusedProperty
in interfaceIViewer
- Returns:
- A
ReadOnlyBooleanProperty
that represents the "focused" state of thisIViewer
.
-
visualPartMapProperty
public javafx.beans.property.ReadOnlyMapProperty<javafx.scene.Node,IVisualPart<? extends javafx.scene.Node>> visualPartMapProperty()
Description copied from interface:IViewer
Returns an unmodifiable read-only map property that contains the registeredIVisualPart
s mapped to their respective visual.- Specified by:
visualPartMapProperty
in interfaceIViewer
- Returns:
- An unmodifiable read-only map property.
-
-