Package net.officefloor.gef.ide.editor
Class AbstractAdaptedIdeEditor<R extends Model,RE extends java.lang.Enum<RE>,O>
- java.lang.Object
-
- net.officefloor.gef.ide.editor.AbstractAdaptedIdeEditor<R,RE,O>
-
- Direct Known Subclasses:
ActivityEditor
,SectionEditor
,WoofEditor
public abstract class AbstractAdaptedIdeEditor<R extends Model,RE extends java.lang.Enum<RE>,O> extends java.lang.Object
Abstract adapted IDE editor.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractAdaptedIdeEditor.ViewManager<R extends Model>
View manager.
-
Constructor Summary
Constructors Constructor Description AbstractAdaptedIdeEditor(java.lang.Class<R> rootModelType, java.util.function.Function<R,O> createOperations, EnvironmentBridge envBridge)
Instantiate to captureAdaptedEditorModule
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description O
createOperations(R model)
Creates the operations for the rootModel
.java.lang.String
editorStyle()
Allows overriding the editor styling.abstract java.lang.String
fileName()
Obtains the default file name for the editor.AbstractItem.ConfigurableContext<R,O>
getConfigurableContext()
Obtains theAbstractItem.ConfigurableContext
java.lang.String
getEditorStyleId()
Obtains the preference identifier for the editor styling.java.lang.String
getPaletteIndicatorStyleId()
Obtains the preference identifier for the palette indicator styling.java.lang.String
getPaletteStyleId()
Obtains the preference identifier for the palette styling.AbstractConfigurableItem<R,RE,O,?,?,?>[]
getParents()
Obtains theAbstractConfigurableItem
instances.void
init(com.google.inject.Module overrideModule, java.util.function.Function<com.google.inject.Injector,org.eclipse.gef.mvc.fx.domain.IDomain> initialiser)
Initialise theAbstractAdaptedIdeEditor
.protected void
init(AbstractItem.ConfigurableContext<R,O> context)
Allows overriding to initialise theAbstractAdaptedIdeEditor
.void
initNonOsgiEnvironment()
Initialises for non OSGi environment.protected abstract void
loadParents(java.util.List<AbstractConfigurableItem<R,RE,O,?,?,?>> parents)
Loads theAbstractConfigurableItem
instances.protected abstract R
loadRootModel(ConfigurationItem configurationItem)
Creates the rootModel
from theConfigurationItem
.AbstractAdaptedIdeEditor.ViewManager<R>
loadView(java.util.function.Consumer<javafx.scene.layout.Pane> viewLoader)
Loads the view.java.lang.String
newFileContent()
Obtains the new file content.abstract R
newFileRoot()
Provides rootModel
for new file.java.lang.String
paletteIndicatorStyle()
Allows overriding the palette indicator styling.java.lang.String
paletteStyle()
Allows overriding the palette styling.abstract R
prototype()
Obtains root prototype.abstract void
saveRootModel(R model, WritableConfigurationItem configurationItem)
Writes the rootModel
to theWritableConfigurationItem
.void
setConfigurationItem(WritableConfigurationItem configurationItem)
Specifies theWritableConfigurationItem
.void
setDragLatency(int dragLatency)
Specifies the drag latency.void
setModel(R model)
Specifies theModel
.void
setSelectOnly(SelectOnly selectOnly)
Instantiate.static java.lang.String
translateStyle(java.lang.String rawStyle, AbstractItem<?,?,?,?,?,?> item)
Translates the style with the details of the item being rendered.
-
-
-
Constructor Detail
-
AbstractAdaptedIdeEditor
public AbstractAdaptedIdeEditor(java.lang.Class<R> rootModelType, java.util.function.Function<R,O> createOperations, EnvironmentBridge envBridge)
Instantiate to capture
AdaptedEditorModule
.Allows for alternate
AdaptedEditorModule
implementation.- Parameters:
rootModelType
- RootModel
type.createOperations
-Function
to create the operations from the rootModel
.envBridge
-EnvironmentBridge
.
-
-
Method Detail
-
translateStyle
public static java.lang.String translateStyle(java.lang.String rawStyle, AbstractItem<?,?,?,?,?,?> item)
Translates the style with the details of the item being rendered.- Parameters:
rawStyle
- Raw style to be translated.item
-AbstractItem
.- Returns:
- Ready to use translate.
-
getConfigurableContext
public AbstractItem.ConfigurableContext<R,O> getConfigurableContext()
Obtains theAbstractItem.ConfigurableContext
- Returns:
-
getPaletteIndicatorStyleId
public java.lang.String getPaletteIndicatorStyleId()
Obtains the preference identifier for the palette indicator styling.- Returns:
- Preference identifier for the palette indicator styling.
-
getPaletteStyleId
public java.lang.String getPaletteStyleId()
Obtains the preference identifier for the palette styling.- Returns:
- Preference identifier for the palette styling.
-
getEditorStyleId
public java.lang.String getEditorStyleId()
Obtains the preference identifier for the editor styling.- Returns:
- Preference identifier for the editor styling.
-
setDragLatency
public void setDragLatency(int dragLatency)
Specifies the drag latency.- Parameters:
dragLatency
- Drag latency.
-
setSelectOnly
public void setSelectOnly(SelectOnly selectOnly)
Instantiate.- Parameters:
selectOnly
-SelectOnly
.
-
setConfigurationItem
public void setConfigurationItem(WritableConfigurationItem configurationItem)
Specifies theWritableConfigurationItem
.- Parameters:
configurationItem
-WritableConfigurationItem
.
-
init
protected void init(AbstractItem.ConfigurableContext<R,O> context)
Allows overriding to initialise theAbstractAdaptedIdeEditor
.- Parameters:
context
-AbstractItem.ConfigurableContext
.
-
getParents
public final AbstractConfigurableItem<R,RE,O,?,?,?>[] getParents()
Obtains theAbstractConfigurableItem
instances.- Returns:
AbstractConfigurableItem
instances.
-
fileName
public abstract java.lang.String fileName()
Obtains the default file name for the editor.- Returns:
- Default file name for the editor.
-
newFileRoot
public abstract R newFileRoot()
Provides rootModel
for new file.- Returns:
- Root
Model
for new file.
-
newFileContent
public java.lang.String newFileContent() throws java.lang.Exception
Obtains the new file content.- Returns:
- New file content.
- Throws:
java.lang.Exception
- If fails to generate new file content.
-
prototype
public abstract R prototype()
Obtains root prototype.- Returns:
- Root prototype.
-
loadParents
protected abstract void loadParents(java.util.List<AbstractConfigurableItem<R,RE,O,?,?,?>> parents)
Loads theAbstractConfigurableItem
instances.- Parameters:
parents
-List
to be populated with theAbstractConfigurableItem
instances.
-
loadRootModel
protected abstract R loadRootModel(ConfigurationItem configurationItem) throws java.lang.Exception
Creates the rootModel
from theConfigurationItem
.- Parameters:
configurationItem
-ConfigurationItem
containing the configuration of theModel
.- Returns:
- Root
Model
within theConfigurationItem
. - Throws:
java.lang.Exception
- If fails to load the rootModel
from theConfigurationItem
.
-
saveRootModel
public abstract void saveRootModel(R model, WritableConfigurationItem configurationItem) throws java.lang.Exception
Writes the rootModel
to theWritableConfigurationItem
.- Parameters:
model
- RootModel
to be saved.configurationItem
-WritableConfigurationItem
.- Throws:
java.lang.Exception
- If fails to save the rootModel
into theWritableConfigurationItem
.
-
paletteStyle
public java.lang.String paletteStyle()
Allows overriding the palette styling.- Returns:
- Palette styling. May be
null
for default styling.
-
paletteIndicatorStyle
public java.lang.String paletteIndicatorStyle()
Allows overriding the palette indicator styling.- Returns:
- Palette indicator styling. May be
null
for default styling.
-
editorStyle
public java.lang.String editorStyle()
Allows overriding the editor styling.- Returns:
- Editor styling. May be
null
for defaulting styling.
-
createOperations
public O createOperations(R model)
Creates the operations for the rootModel
.- Parameters:
model
- RootModel
.- Returns:
- Operations.
-
initNonOsgiEnvironment
public void initNonOsgiEnvironment()
Initialises for non OSGi environment.
-
init
public void init(com.google.inject.Module overrideModule, java.util.function.Function<com.google.inject.Injector,org.eclipse.gef.mvc.fx.domain.IDomain> initialiser)
Initialise theAbstractAdaptedIdeEditor
.- Parameters:
overrideModule
- Optional overrideModule
.initialiser
- Initialiser with theInjector
to return theIDomain
.
-
loadView
public AbstractAdaptedIdeEditor.ViewManager<R> loadView(java.util.function.Consumer<javafx.scene.layout.Pane> viewLoader)
Loads the view.- Parameters:
viewLoader
- Receives the view.- Returns:
AbstractAdaptedIdeEditor.ViewManager
.
-
-