Class AbstractSelectedColumnCommand
- java.lang.Object
-
- org.kie.workbench.common.command.client.AbstractCommand<ScenarioSimulationContext,ScenarioSimulationViolation>
-
- org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.AbstractScenarioSimulationCommand
-
- org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.AbstractScenarioSimulationUndoableCommand<ScenarioSimulationContext.Status>
-
- org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.AbstractScenarioGridCommand
-
- org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.AbstractSelectedColumnCommand
-
- All Implemented Interfaces:
org.kie.workbench.common.command.client.Command<ScenarioSimulationContext,ScenarioSimulationViolation>
- Direct Known Subclasses:
DuplicateInstanceCommand,InsertColumnCommand,SetInstanceHeaderCommand,SetPropertyHeaderCommand
public abstract class AbstractSelectedColumnCommand extends AbstractScenarioGridCommand
AbstractCommandclass which assures that aScenarioColumnis selected.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.drools.scenariosimulation.api.model.FactMappingValueTypefactMappingValueType-
Fields inherited from class org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.AbstractScenarioGridCommand
gridWidget
-
Fields inherited from class org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.AbstractScenarioSimulationUndoableCommand
restorableStatus
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSelectedColumnCommand(GridWidget gridWidget, org.drools.scenariosimulation.api.model.FactMappingValueType factMappingValueType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidexecuteIfSelectedColumn(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn)protected StringgetFullPackage(ScenarioSimulationContext context)Returns the full packageStringof aScenarioSimulationContext.protected Optional<String>getMatchingExpressionAlias(ScenarioSimulationContext context, List<String> propertyNameElements, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier)protected StringgetPropertyHeaderTitle(ScenarioSimulationContext context, List<String> propertyNameElements, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier)protected Optional<ScenarioGridColumn>getSelectedColumn(ScenarioSimulationContext context)Returns anOptionalfor aScenarioSimulationContext.protected ScenarioGridColumninsertNewColumn(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, int columnPosition, boolean cloneInstance)It inserts a newScenarioGridColumninScenarioGridModelprotected voidinternalExecute(ScenarioSimulationContext context)protected voidmanageCollectionProperty(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String factName, int columnIndex, List<String> fullPropertyPathElements)protected org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTreenavigateComplexObject(org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree factModelTree, List<String> pathElements, SortedMap<String,org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree> dataObjectFieldsMap)protected org.drools.scenariosimulation.api.model.FactIdentifiersetEditableHeadersAndGetFactIdentifier(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String aliasName, String canonicalClassName)Sets the editable headers on a givenScenarioGridColumnand returns aFactIdentifier.protected voidsetInstanceHeader(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String alias, String fullClassName)Sets the instance header for aScenarioSimulationContext.protected voidsetInstanceHeaderMetaData(ScenarioGridColumn selectedColumn, String aliasName, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier)Sets the metadata for an instance header on a givenScenarioGridColumn.protected voidsetPropertyHeader(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String canonicalClassName, List<String> propertyNameElements, String propertyClass)It assigns a property to the selectedScenarioGridColumnprotected voidsetPropertyHeader(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String canonicalClassName, List<String> propertyNameElements, String propertyClass, String propertyTitle)It assigns a property to the selectedScenarioGridColumnprotected voidsetPropertyHeader(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier, List<String> propertyNameElements, String propertyClass, String propertyTitle)It assigns a property to the selectedScenarioGridColumnprotected voidsetPropertyMetaData(ScenarioHeaderMetaData propertyHeaderMetaData, String title, boolean readOnly, ScenarioGridColumn selectedColumn, String placeHolder)It sets the title and readOnly setting of a property header and sets the place holder on a givenScenarioGridColumn.-
Methods inherited from class org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.AbstractScenarioGridCommand
commonUndoRedoPreExecution, getFactIdentifierByColumnTitle, getScenarioGridColumnLocal, setCurrentContext, setRestorableStatusPreExecution
-
Methods inherited from class org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.AbstractScenarioSimulationUndoableCommand
execute, redo, undo
-
Methods inherited from class org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.AbstractScenarioSimulationCommand
commonExecution, getId
-
-
-
-
Constructor Detail
-
AbstractSelectedColumnCommand
protected AbstractSelectedColumnCommand(GridWidget gridWidget, org.drools.scenariosimulation.api.model.FactMappingValueType factMappingValueType)
-
-
Method Detail
-
executeIfSelectedColumn
protected abstract void executeIfSelectedColumn(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn)
-
internalExecute
protected void internalExecute(ScenarioSimulationContext context)
- Specified by:
internalExecutein classAbstractScenarioSimulationCommand
-
insertNewColumn
protected ScenarioGridColumn insertNewColumn(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, int columnPosition, boolean cloneInstance)
It inserts a newScenarioGridColumninScenarioGridModel- Parameters:
context- It contains the Context inside which the commands will be executedselectedColumn- The selectedScenarioGridColumnwhere the command was launchedcolumnPosition- Used to define in which position the new column should be addedcloneInstance- If true, it create a new column inside the same instance of the selected column- Returns:
- The created
ScenarioGridColumn
-
setInstanceHeader
protected void setInstanceHeader(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String alias, String fullClassName)
Sets the instance header for aScenarioSimulationContext.- Parameters:
context- It contains the Context inside which the commands will be executedselectedColumn- The selectedScenarioGridColumnwhere the command was launched
-
getSelectedColumn
protected Optional<ScenarioGridColumn> getSelectedColumn(ScenarioSimulationContext context)
Returns anOptionalfor aScenarioSimulationContext.- Parameters:
context- It contains the Context inside which the commands will be executed- Returns:
-
getFullPackage
protected String getFullPackage(ScenarioSimulationContext context)
Returns the full packageStringof aScenarioSimulationContext.- Parameters:
context-- Returns:
-
setEditableHeadersAndGetFactIdentifier
protected org.drools.scenariosimulation.api.model.FactIdentifier setEditableHeadersAndGetFactIdentifier(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String aliasName, String canonicalClassName)
Sets the editable headers on a givenScenarioGridColumnand returns aFactIdentifier.- Parameters:
context-selectedColumn-aliasName-canonicalClassName-- Returns:
-
setInstanceHeaderMetaData
protected void setInstanceHeaderMetaData(ScenarioGridColumn selectedColumn, String aliasName, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier)
Sets the metadata for an instance header on a givenScenarioGridColumn.- Parameters:
selectedColumn- The selectedScenarioGridColumnwhere the command was launchedaliasName- The title to assign to the selected columnfactIdentifier- TheFactIdentifierto assign to the selected column
-
setPropertyHeader
protected void setPropertyHeader(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String canonicalClassName, List<String> propertyNameElements, String propertyClass)
It assigns a property to the selectedScenarioGridColumn- Parameters:
context- It contains the Context inside which the commands will be executedselectedColumn- The selectedScenarioGridColumnwhere the command was launchedpropertyNameElements- TheListwith the path instance_name.property.name (eg. Author.isAlive)propertyClass- it contains the full classname of the property (eg. com.Author)
-
setPropertyHeader
protected void setPropertyHeader(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String canonicalClassName, List<String> propertyNameElements, String propertyClass, String propertyTitle)
It assigns a property to the selectedScenarioGridColumn- Parameters:
context- It contains the Context inside which the commands will be executedselectedColumn- The selectedScenarioGridColumnwhere the command was launchedpropertyNameElements- TheListwith the path instance_name.property.name (eg. Author.isAlive)propertyClass- it contains the full classname of the property (eg. com.Author)propertyTitle- The title to assign to this property.
-
setPropertyHeader
protected void setPropertyHeader(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier, List<String> propertyNameElements, String propertyClass, String propertyTitle)
It assigns a property to the selectedScenarioGridColumn- Parameters:
context- It contains the Context inside which the commands will be executedselectedColumn- The selectedScenarioGridColumnwhere the command was launchedfactIdentifier- TheFactIdentifierassociated to the selected columnpropertyNameElements- TheListwith the path instance_name.property.name (eg. Author.isAlive)propertyClass- it contains the full classname of the property (eg. com.Author)propertyTitle- The title to assign to this property.
-
setPropertyMetaData
protected void setPropertyMetaData(ScenarioHeaderMetaData propertyHeaderMetaData, String title, boolean readOnly, ScenarioGridColumn selectedColumn, String placeHolder)
It sets the title and readOnly setting of a property header and sets the place holder on a givenScenarioGridColumn.- Parameters:
propertyHeaderMetaData-title-readOnly-selectedColumn-placeHolder-
-
manageCollectionProperty
protected void manageCollectionProperty(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, String factName, int columnIndex, List<String> fullPropertyPathElements)
- Parameters:
context-selectedColumn-factName- The name of the class to be used to retrieve the correspondingFactModelTree, i.e. without the packagecolumnIndex-fullPropertyPathElements- This is theListof all the elements pointing to the final property (ex. Book.author.books)
-
navigateComplexObject
protected org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree navigateComplexObject(org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree factModelTree, List<String> pathElements, SortedMap<String,org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree> dataObjectFieldsMap)- Parameters:
factModelTree-pathElements- This is theListof all the elements pointing to the final property (ex. Book.author.books)dataObjectFieldsMap-- Returns:
-
getPropertyHeaderTitle
protected String getPropertyHeaderTitle(ScenarioSimulationContext context, List<String> propertyNameElements, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier)
-
getMatchingExpressionAlias
protected Optional<String> getMatchingExpressionAlias(ScenarioSimulationContext context, List<String> propertyNameElements, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier)
-
-