Class OfficeFloorContentPartFactory<R extends Model,O>
- java.lang.Object
-
- net.officefloor.gef.editor.internal.parts.OfficeFloorContentPartFactory<R,O>
-
- All Implemented Interfaces:
AdaptedBuilderContext
,AdaptedRootBuilder<R,O>
,EditorStyler
,PaletteIndicatorStyler
,PaletteStyler
,org.eclipse.gef.mvc.fx.parts.IContentPartFactory
@Singleton public class OfficeFloorContentPartFactory<R extends Model,O> extends java.lang.Object implements org.eclipse.gef.mvc.fx.parts.IContentPartFactory, AdaptedRootBuilder<R,O>, AdaptedBuilderContext, PaletteIndicatorStyler, PaletteStyler
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_DRAG_LATENCY
Default drag latency.
-
Constructor Summary
Constructors Constructor Description OfficeFloorContentPartFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <S extends Model,T extends Model,C extends ConnectionModel>
voidaddConnection(S source, T target, AdaptedConnectionManagementBuilder.ConnectionFactory<R,O,S,C,T> createConnection)
Adds theConnectionModel
to theModel
structure.<M extends Model>
AdaptedModel<M>createAdaptedModel(M model, AdaptedModel<?> parentAdaptedModel)
Creates the wrapper for theModel
.org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node>
createContentPart(java.lang.Object content, java.util.Map<java.lang.Object,java.lang.Object> contextMap)
static java.util.List<org.eclipse.gef.mvc.fx.parts.IFeedbackPart<? extends javafx.scene.Node>>
createFeedbackParts(java.util.List<? extends org.eclipse.gef.mvc.fx.parts.IVisualPart<? extends javafx.scene.Node>> targets, java.util.function.Function<java.util.List<org.eclipse.gef.mvc.fx.parts.IVisualPart<? extends javafx.scene.Node>>,java.util.List<org.eclipse.gef.mvc.fx.parts.IFeedbackPart<? extends javafx.scene.Node>>> createFeedbackParts)
Indicates if contains anConnectionModel
.javafx.beans.property.Property<java.lang.String>
editorStyle()
Obtains theProperty
to the style sheet rules for theScene
.ChangeExecutor
getChangeExecutor()
Obtains theChangeExecutor
.int
getDragLatency()
Obtains the drag latency.javafx.scene.Parent
getEditor()
Obtains the rootParent
for the editor.AdaptedErrorHandler
getErrorHandler()
Obtains theAdaptedErrorHandler
.org.eclipse.gef.mvc.fx.models.GridModel
getGridModel()
Obtains theGridModel
to configure the content grid.javafx.scene.Node
getPalette()
Obtains the palette.javafx.scene.Node
getPaletteIndicator()
Obtains the palette indicator.SelectOnly
getSelectOnly()
Obtains theSelectOnly
.StyleRegistry
getStyleRegistry()
Obtains theStyleRegistry
.void
init(com.google.inject.Injector injector, javafx.scene.layout.Pane editorPane, org.eclipse.gef.mvc.fx.viewer.IViewer content, javafx.scene.layout.Pane paletteIndicator, org.eclipse.gef.mvc.fx.viewer.IViewer palette, AdaptedErrorHandler errorHandler, ChangeExecutor changeExecutor, StyleRegistry styleRegistry, int dragLatency, SelectOnly selectOnly)
Initialises.boolean
isCreateParent()
Indicates if able to create anAdaptedParent
.void
loadContentModels()
Loads the contentModel
instances into the contentIViewer
.javafx.beans.property.Property<R>
loadRootModel(R rootModel)
Loads the rootModel
.void
overlay(double x, double y, OverlayVisualFactory overlayVisualFactory)
Allows adding an overlay.javafx.beans.property.Property<java.lang.String>
paletteIndicatorStyle()
Obtains theProperty
to the style sheet rules for the palette indicator.javafx.beans.property.Property<java.lang.String>
paletteStyle()
Obtains theProperty
to the style sheet rules for the palette.<M extends Model,E extends java.lang.Enum<E>,RE extends java.lang.Enum<RE>>
AdaptedParentBuilder<R,O,M,E>parent(M modelPrototype, java.util.function.Function<R,java.util.List<M>> getParents, AdaptedChildVisualFactory<M> viewFactory, RE... changeParentEvents)
Adds anAdaptedParent
.<M extends Model,E extends java.lang.Enum<E>>
voidregisterModel(AbstractAdaptedFactory<R,O,M,E,?> builder)
Registers theAbstractAdaptedFactory
.<r extends Model,o>
AdaptedRootBuilder<r,o>root(java.lang.Class<r> rootModelClass, java.util.function.Function<r,o> createOperations)
Specifies the rootModel
.
-
-
-
Field Detail
-
DEFAULT_DRAG_LATENCY
public static final int DEFAULT_DRAG_LATENCY
Default drag latency.- See Also:
- Constant Field Values
-
-
Method Detail
-
createFeedbackParts
public static java.util.List<org.eclipse.gef.mvc.fx.parts.IFeedbackPart<? extends javafx.scene.Node>> createFeedbackParts(java.util.List<? extends org.eclipse.gef.mvc.fx.parts.IVisualPart<? extends javafx.scene.Node>> targets, java.util.function.Function<java.util.List<org.eclipse.gef.mvc.fx.parts.IVisualPart<? extends javafx.scene.Node>>,java.util.List<org.eclipse.gef.mvc.fx.parts.IFeedbackPart<? extends javafx.scene.Node>>> createFeedbackParts)
Indicates if contains anConnectionModel
.- Parameters:
targets
- TargetIVisualPart
instances.createFeedbackParts
-Function
to create theIFeedbackPart
instances from the filtered list of targets.- Returns:
- Filtered targets.
-
init
public void init(com.google.inject.Injector injector, javafx.scene.layout.Pane editorPane, org.eclipse.gef.mvc.fx.viewer.IViewer content, javafx.scene.layout.Pane paletteIndicator, org.eclipse.gef.mvc.fx.viewer.IViewer palette, AdaptedErrorHandler errorHandler, ChangeExecutor changeExecutor, StyleRegistry styleRegistry, int dragLatency, SelectOnly selectOnly)
Initialises.- Parameters:
injector
-Injector
.editorPane
- EditorPane
.content
-IViewer
content.paletteIndicator
- Palette indicatorPane
.palette
-IViewer
palette.errorHandler
-AdaptedErrorHandler
.changeExecutor
-ChangeExecutor
.styleRegistry
-StyleRegistry
.dragLatency
- Drag latency. Higher provides better drag performance, while lower provides better responsiveness.selectOnly
-SelectOnly
.
-
registerModel
public <M extends Model,E extends java.lang.Enum<E>> void registerModel(AbstractAdaptedFactory<R,O,M,E,?> builder)
Registers theAbstractAdaptedFactory
.- Type Parameters:
M
-Model
type.E
-Model
event type.- Parameters:
builder
-AbstractAdaptedFactory
.
-
getStyleRegistry
public StyleRegistry getStyleRegistry()
Obtains theStyleRegistry
.- Returns:
StyleRegistry
.
-
isCreateParent
public boolean isCreateParent()
Indicates if able to create anAdaptedParent
.- Returns:
true
if able to create anAdaptedParent
.
-
loadRootModel
public javafx.beans.property.Property<R> loadRootModel(R rootModel)
Loads the rootModel
.- Parameters:
rootModel
- RootModel
.
-
loadContentModels
public void loadContentModels()
Loads the contentModel
instances into the contentIViewer
.
-
createAdaptedModel
public <M extends Model> AdaptedModel<M> createAdaptedModel(M model, AdaptedModel<?> parentAdaptedModel)
Creates the wrapper for theModel
.- Type Parameters:
M
-Model
type.- Parameters:
model
-Model
.parentAdaptedModel
- ParentAdaptedModel
.- Returns:
AbstractAdaptedFactory
for theModel
.
-
addConnection
public <S extends Model,T extends Model,C extends ConnectionModel> void addConnection(S source, T target, AdaptedConnectionManagementBuilder.ConnectionFactory<R,O,S,C,T> createConnection)
Adds theConnectionModel
to theModel
structure.- Type Parameters:
S
- SourceModel
type.T
- TargetModel
type.C
-ConnectionModel
type.- Parameters:
source
- SourceModel
.target
- TargetModel
.createConnection
-AdaptedConnectionManagementBuilder.ConnectionFactory
.
-
getDragLatency
public int getDragLatency()
Obtains the drag latency.- Returns:
- Drag latency.
-
getSelectOnly
public SelectOnly getSelectOnly()
Obtains theSelectOnly
.- Returns:
SelectOnly
ornull
if noSelectOnly
.
-
root
public <r extends Model,o> AdaptedRootBuilder<r,o> root(java.lang.Class<r> rootModelClass, java.util.function.Function<r,o> createOperations)
Description copied from interface:AdaptedBuilderContext
Specifies the rootModel
.- Specified by:
root
in interfaceAdaptedBuilderContext
- Type Parameters:
r
- RootModel
type.o
- Operations type.- Parameters:
rootModelClass
-Class
of the rootModel
.createOperations
-Function
to create the operations object to wrap the rootModel
.- Returns:
AdaptedRootBuilder
.
-
parent
public <M extends Model,E extends java.lang.Enum<E>,RE extends java.lang.Enum<RE>> AdaptedParentBuilder<R,O,M,E> parent(M modelPrototype, java.util.function.Function<R,java.util.List<M>> getParents, AdaptedChildVisualFactory<M> viewFactory, RE... changeParentEvents)
Description copied from interface:AdaptedRootBuilder
Adds anAdaptedParent
.- Specified by:
parent
in interfaceAdaptedRootBuilder<R extends Model,O>
- Type Parameters:
M
-Model
type.E
-Model
event type.RE
- RootModel
event type.- Parameters:
modelPrototype
-Model
prototype used in view validation, creation prototype and to obtain theClass
of theModel
.getParents
-Function
to obtain the parentModel
instances.viewFactory
-AdaptedChildVisualFactory
to create the view for theAdaptedParent
.changeParentEvents
-Enum
events on rootModel
about change in parentModel
listing.- Returns:
AdaptedParentBuilder
to build theAdaptedParent
over theModel
.
-
overlay
public void overlay(double x, double y, OverlayVisualFactory overlayVisualFactory)
Description copied from interface:AdaptedRootBuilder
Allows adding an overlay.
Co-ordinates used rather than Point to avoid importing libraries.
- Specified by:
overlay
in interfaceAdaptedRootBuilder<R extends Model,O>
- Parameters:
x
- X co-ordinate.y
- Y co-ordintate.overlayVisualFactory
-OverlayVisualFactory
.
-
getErrorHandler
public AdaptedErrorHandler getErrorHandler()
Description copied from interface:AdaptedRootBuilder
Obtains theAdaptedErrorHandler
.- Specified by:
getErrorHandler
in interfaceAdaptedRootBuilder<R extends Model,O>
- Returns:
AdaptedErrorHandler
.
-
getChangeExecutor
public ChangeExecutor getChangeExecutor()
Description copied from interface:AdaptedRootBuilder
Obtains theChangeExecutor
.- Specified by:
getChangeExecutor
in interfaceAdaptedRootBuilder<R extends Model,O>
- Returns:
ChangeExecutor
.
-
getEditor
public javafx.scene.Parent getEditor()
Description copied from interface:EditorStyler
Obtains the root
Parent
for the editor.This allows for interrogating the structure of the editor.
- Specified by:
getEditor
in interfaceEditorStyler
- Returns:
- Editor
Parent
.
-
getGridModel
public org.eclipse.gef.mvc.fx.models.GridModel getGridModel()
Description copied from interface:EditorStyler
Obtains theGridModel
to configure the content grid.- Specified by:
getGridModel
in interfaceEditorStyler
- Returns:
GridModel
to configure the content grid.
-
editorStyle
public javafx.beans.property.Property<java.lang.String> editorStyle()
Description copied from interface:EditorStyler
Obtains theProperty
to the style sheet rules for theScene
.- Specified by:
editorStyle
in interfaceEditorStyler
- Returns:
Property
to specify the style sheet rules for theScene
.
-
getPaletteIndicator
public javafx.scene.Node getPaletteIndicator()
Description copied from interface:PaletteIndicatorStyler
Obtains the palette indicator.
This allows for interrogating the structure of the palette indicator.
- Specified by:
getPaletteIndicator
in interfacePaletteIndicatorStyler
- Returns:
- Palette indicator.
-
paletteIndicatorStyle
public javafx.beans.property.Property<java.lang.String> paletteIndicatorStyle()
Description copied from interface:AdaptedRootBuilder
Obtains theProperty
to the style sheet rules for the palette indicator.- Specified by:
paletteIndicatorStyle
in interfaceAdaptedRootBuilder<R extends Model,O>
- Specified by:
paletteIndicatorStyle
in interfacePaletteIndicatorStyler
- Returns:
Property
to specify the style sheet rules for the palette indicator.
-
getPalette
public javafx.scene.Node getPalette()
Description copied from interface:PaletteStyler
Obtains the palette.
This allows for interrogating the structure of the palette.
- Specified by:
getPalette
in interfacePaletteStyler
- Returns:
- Palette.
-
paletteStyle
public javafx.beans.property.Property<java.lang.String> paletteStyle()
Description copied from interface:AdaptedRootBuilder
Obtains theProperty
to the style sheet rules for the palette.- Specified by:
paletteStyle
in interfaceAdaptedRootBuilder<R extends Model,O>
- Specified by:
paletteStyle
in interfacePaletteStyler
- Returns:
Property
to specify the style sheet rules for the palette.
-
createContentPart
public org.eclipse.gef.mvc.fx.parts.IContentPart<? extends javafx.scene.Node> createContentPart(java.lang.Object content, java.util.Map<java.lang.Object,java.lang.Object> contextMap)
- Specified by:
createContentPart
in interfaceorg.eclipse.gef.mvc.fx.parts.IContentPartFactory
-
-