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 intDEFAULT_DRAG_LATENCYDefault 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 theConnectionModelto theModelstructure.<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 thePropertyto the style sheet rules for theScene.ChangeExecutorgetChangeExecutor()Obtains theChangeExecutor.intgetDragLatency()Obtains the drag latency.javafx.scene.ParentgetEditor()Obtains the rootParentfor the editor.AdaptedErrorHandlergetErrorHandler()Obtains theAdaptedErrorHandler.org.eclipse.gef.mvc.fx.models.GridModelgetGridModel()Obtains theGridModelto configure the content grid.javafx.scene.NodegetPalette()Obtains the palette.javafx.scene.NodegetPaletteIndicator()Obtains the palette indicator.SelectOnlygetSelectOnly()Obtains theSelectOnly.StyleRegistrygetStyleRegistry()Obtains theStyleRegistry.voidinit(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.booleanisCreateParent()Indicates if able to create anAdaptedParent.voidloadContentModels()Loads the contentModelinstances into the contentIViewer.javafx.beans.property.Property<R>loadRootModel(R rootModel)Loads the rootModel.voidoverlay(double x, double y, OverlayVisualFactory overlayVisualFactory)Allows adding an overlay.javafx.beans.property.Property<java.lang.String>paletteIndicatorStyle()Obtains thePropertyto the style sheet rules for the palette indicator.javafx.beans.property.Property<java.lang.String>paletteStyle()Obtains thePropertyto 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- TargetIVisualPartinstances.createFeedbackParts-Functionto create theIFeedbackPartinstances 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-IViewercontent.paletteIndicator- Palette indicatorPane.palette-IViewerpalette.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-Modeltype.E-Modelevent type.- Parameters:
builder-AbstractAdaptedFactory.
-
getStyleRegistry
public StyleRegistry getStyleRegistry()
Obtains theStyleRegistry.- Returns:
StyleRegistry.
-
isCreateParent
public boolean isCreateParent()
Indicates if able to create anAdaptedParent.- Returns:
trueif 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 contentModelinstances into the contentIViewer.
-
createAdaptedModel
public <M extends Model> AdaptedModel<M> createAdaptedModel(M model, AdaptedModel<?> parentAdaptedModel)
Creates the wrapper for theModel.- Type Parameters:
M-Modeltype.- Parameters:
model-Model.parentAdaptedModel- ParentAdaptedModel.- Returns:
AbstractAdaptedFactoryfor 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 theConnectionModelto theModelstructure.- Type Parameters:
S- SourceModeltype.T- TargetModeltype.C-ConnectionModeltype.- 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:
SelectOnlyornullif 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:AdaptedBuilderContextSpecifies the rootModel.- Specified by:
rootin interfaceAdaptedBuilderContext- Type Parameters:
r- RootModeltype.o- Operations type.- Parameters:
rootModelClass-Classof the rootModel.createOperations-Functionto 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:AdaptedRootBuilderAdds anAdaptedParent.- Specified by:
parentin interfaceAdaptedRootBuilder<R extends Model,O>- Type Parameters:
M-Modeltype.E-Modelevent type.RE- RootModelevent type.- Parameters:
modelPrototype-Modelprototype used in view validation, creation prototype and to obtain theClassof theModel.getParents-Functionto obtain the parentModelinstances.viewFactory-AdaptedChildVisualFactoryto create the view for theAdaptedParent.changeParentEvents-Enumevents on rootModelabout change in parentModellisting.- Returns:
AdaptedParentBuilderto build theAdaptedParentover theModel.
-
overlay
public void overlay(double x, double y, OverlayVisualFactory overlayVisualFactory)Description copied from interface:AdaptedRootBuilderAllows adding an overlay.
Co-ordinates used rather than Point to avoid importing libraries.
- Specified by:
overlayin interfaceAdaptedRootBuilder<R extends Model,O>- Parameters:
x- X co-ordinate.y- Y co-ordintate.overlayVisualFactory-OverlayVisualFactory.
-
getErrorHandler
public AdaptedErrorHandler getErrorHandler()
Description copied from interface:AdaptedRootBuilderObtains theAdaptedErrorHandler.- Specified by:
getErrorHandlerin interfaceAdaptedRootBuilder<R extends Model,O>- Returns:
AdaptedErrorHandler.
-
getChangeExecutor
public ChangeExecutor getChangeExecutor()
Description copied from interface:AdaptedRootBuilderObtains theChangeExecutor.- Specified by:
getChangeExecutorin interfaceAdaptedRootBuilder<R extends Model,O>- Returns:
ChangeExecutor.
-
getEditor
public javafx.scene.Parent getEditor()
Description copied from interface:EditorStylerObtains the root
Parentfor the editor.This allows for interrogating the structure of the editor.
- Specified by:
getEditorin interfaceEditorStyler- Returns:
- Editor
Parent.
-
getGridModel
public org.eclipse.gef.mvc.fx.models.GridModel getGridModel()
Description copied from interface:EditorStylerObtains theGridModelto configure the content grid.- Specified by:
getGridModelin interfaceEditorStyler- Returns:
GridModelto configure the content grid.
-
editorStyle
public javafx.beans.property.Property<java.lang.String> editorStyle()
Description copied from interface:EditorStylerObtains thePropertyto the style sheet rules for theScene.- Specified by:
editorStylein interfaceEditorStyler- Returns:
Propertyto specify the style sheet rules for theScene.
-
getPaletteIndicator
public javafx.scene.Node getPaletteIndicator()
Description copied from interface:PaletteIndicatorStylerObtains the palette indicator.
This allows for interrogating the structure of the palette indicator.
- Specified by:
getPaletteIndicatorin interfacePaletteIndicatorStyler- Returns:
- Palette indicator.
-
paletteIndicatorStyle
public javafx.beans.property.Property<java.lang.String> paletteIndicatorStyle()
Description copied from interface:AdaptedRootBuilderObtains thePropertyto the style sheet rules for the palette indicator.- Specified by:
paletteIndicatorStylein interfaceAdaptedRootBuilder<R extends Model,O>- Specified by:
paletteIndicatorStylein interfacePaletteIndicatorStyler- Returns:
Propertyto specify the style sheet rules for the palette indicator.
-
getPalette
public javafx.scene.Node getPalette()
Description copied from interface:PaletteStylerObtains the palette.
This allows for interrogating the structure of the palette.
- Specified by:
getPalettein interfacePaletteStyler- Returns:
- Palette.
-
paletteStyle
public javafx.beans.property.Property<java.lang.String> paletteStyle()
Description copied from interface:AdaptedRootBuilderObtains thePropertyto the style sheet rules for the palette.- Specified by:
paletteStylein interfaceAdaptedRootBuilder<R extends Model,O>- Specified by:
paletteStylein interfacePaletteStyler- Returns:
Propertyto 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:
createContentPartin interfaceorg.eclipse.gef.mvc.fx.parts.IContentPartFactory
-
-