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.ObjectAbstract adapted IDE editor.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractAdaptedIdeEditor.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 OcreateOperations(R model)Creates the operations for the rootModel.java.lang.StringeditorStyle()Allows overriding the editor styling.abstract java.lang.StringfileName()Obtains the default file name for the editor.AbstractItem.ConfigurableContext<R,O>getConfigurableContext()Obtains theAbstractItem.ConfigurableContextjava.lang.StringgetEditorStyleId()Obtains the preference identifier for the editor styling.java.lang.StringgetPaletteIndicatorStyleId()Obtains the preference identifier for the palette indicator styling.java.lang.StringgetPaletteStyleId()Obtains the preference identifier for the palette styling.AbstractConfigurableItem<R,RE,O,?,?,?>[]getParents()Obtains theAbstractConfigurableIteminstances.voidinit(com.google.inject.Module overrideModule, java.util.function.Function<com.google.inject.Injector,org.eclipse.gef.mvc.fx.domain.IDomain> initialiser)Initialise theAbstractAdaptedIdeEditor.protected voidinit(AbstractItem.ConfigurableContext<R,O> context)Allows overriding to initialise theAbstractAdaptedIdeEditor.voidinitNonOsgiEnvironment()Initialises for non OSGi environment.protected abstract voidloadParents(java.util.List<AbstractConfigurableItem<R,RE,O,?,?,?>> parents)Loads theAbstractConfigurableIteminstances.protected abstract RloadRootModel(ConfigurationItem configurationItem)Creates the rootModelfrom theConfigurationItem.AbstractAdaptedIdeEditor.ViewManager<R>loadView(java.util.function.Consumer<javafx.scene.layout.Pane> viewLoader)Loads the view.java.lang.StringnewFileContent()Obtains the new file content.abstract RnewFileRoot()Provides rootModelfor new file.java.lang.StringpaletteIndicatorStyle()Allows overriding the palette indicator styling.java.lang.StringpaletteStyle()Allows overriding the palette styling.abstract Rprototype()Obtains root prototype.abstract voidsaveRootModel(R model, WritableConfigurationItem configurationItem)Writes the rootModelto theWritableConfigurationItem.voidsetConfigurationItem(WritableConfigurationItem configurationItem)Specifies theWritableConfigurationItem.voidsetDragLatency(int dragLatency)Specifies the drag latency.voidsetModel(R model)Specifies theModel.voidsetSelectOnly(SelectOnly selectOnly)Instantiate.static java.lang.StringtranslateStyle(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
AdaptedEditorModuleimplementation.- Parameters:
rootModelType- RootModeltype.createOperations-Functionto 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 theAbstractConfigurableIteminstances.- Returns:
AbstractConfigurableIteminstances.
-
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 rootModelfor new file.- Returns:
- Root
Modelfor new file.
-
newFileContent
public java.lang.String newFileContent() throws java.lang.ExceptionObtains 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 theAbstractConfigurableIteminstances.- Parameters:
parents-Listto be populated with theAbstractConfigurableIteminstances.
-
loadRootModel
protected abstract R loadRootModel(ConfigurationItem configurationItem) throws java.lang.Exception
Creates the rootModelfrom theConfigurationItem.- Parameters:
configurationItem-ConfigurationItemcontaining the configuration of theModel.- Returns:
- Root
Modelwithin theConfigurationItem. - Throws:
java.lang.Exception- If fails to load the rootModelfrom theConfigurationItem.
-
saveRootModel
public abstract void saveRootModel(R model, WritableConfigurationItem configurationItem) throws java.lang.Exception
Writes the rootModelto theWritableConfigurationItem.- Parameters:
model- RootModelto be saved.configurationItem-WritableConfigurationItem.- Throws:
java.lang.Exception- If fails to save the rootModelinto theWritableConfigurationItem.
-
paletteStyle
public java.lang.String paletteStyle()
Allows overriding the palette styling.- Returns:
- Palette styling. May be
nullfor default styling.
-
paletteIndicatorStyle
public java.lang.String paletteIndicatorStyle()
Allows overriding the palette indicator styling.- Returns:
- Palette indicator styling. May be
nullfor default styling.
-
editorStyle
public java.lang.String editorStyle()
Allows overriding the editor styling.- Returns:
- Editor styling. May be
nullfor 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 theInjectorto 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.
-
-