Class ScenarioSimulationUtils
- java.lang.Object
-
- org.drools.workbench.screens.scenariosimulation.client.utils.ScenarioSimulationUtils
-
public class ScenarioSimulationUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static AtomicIntegersubGroupCounter
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetCellHeight(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget gridWidget, org.uberfire.ext.wires.core.grids.client.model.GridColumn<?> column, boolean isHeader, int uiRowIndex)static StringgetColumnSubGroup(String columnGroup)Given a columnGroup, it creates a new subGroup with the following format: 'columnGroupName-x'.protected static doublegetColumnWidth(String columnId)static ScenarioSimulationBuilders.HeaderBuildergetHeaderBuilder(String instanceTitle, String propertyTitle, String columnId, String columnGroup, org.drools.scenariosimulation.api.model.FactMappingType factMappingType, ScenarioHeaderTextBoxSingletonDOMElementFactory factoryHeader)Retrieve a single or triple level Header metadata, i.e. aList<GridColumn.HeaderMetaData>with one or three elements, depending on the column Group:static com.ait.lienzo.client.core.types.Point2DgetMiddleXYCell(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget gridWidget, org.uberfire.ext.wires.core.grids.client.model.GridColumn<?> column, boolean isHeader, int uiRowIndex, org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer gridLayer)Returns an array where the 0-element is middle x of given cell and 1-element is middle ystatic StringgetOriginalColumnGroup(String columnGroup)Given a columnGroup, it returns the original group name, removing the the subgroup part (added ingetColumnSubGroupwith the following format: 'columnGroupName-x'static StringgetPlaceHolder(boolean isInstanceAssigned, boolean isPropertyAssigned, org.drools.scenariosimulation.api.model.FactMappingValueType valueType, String className)It provides the correct PlaceHolder value to be assigned to an empty cell given its parameters status.static List<String>getPropertyNameElementsWithoutAlias(List<String> propertyNameElements, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier, org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type type)Method to retrieve a newListof property name elements where the first one is the the actual class name (i.e. an eventual alias get replaced)static ScenarioGridColumngetScenarioGridColumn(String instanceTitle, String propertyTitle, String columnId, String columnGroup, org.drools.scenariosimulation.api.model.FactMappingType factMappingType, ScenarioHeaderTextBoxSingletonDOMElementFactory factoryHeader, ScenarioCellTextAreaSingletonDOMElementFactory factoryCell, String placeHolder)Returns aScenarioGridColumnwith the following default values:static ScenarioGridColumngetScenarioGridColumn(ScenarioSimulationBuilders.HeaderBuilder headerBuilder, ScenarioCellTextAreaSingletonDOMElementFactory factoryCell, String placeHolder)Returns aScenarioGridColumnwith the following default values:static ScenarioSimulationBuilders.ScenarioGridColumnBuildergetScenarioGridColumnBuilder(ScenarioCellTextAreaSingletonDOMElementFactory factoryCell, ScenarioSimulationBuilders.HeaderBuilder headerBuilder, String placeHolder)Returns aScenarioSimulationBuilders.ScenarioGridColumnBuilderwith the following default values:static booleanisSimpleJavaType(String className)This method can be used ONLY when managing a RULE type Test Scenario.
-
-
-
Field Detail
-
subGroupCounter
protected static AtomicInteger subGroupCounter
-
-
Method Detail
-
getColumnSubGroup
public static String getColumnSubGroup(String columnGroup)
Given a columnGroup, it creates a new subGroup with the following format: 'columnGroupName-x'.- Parameters:
columnGroup-- Returns:
-
getOriginalColumnGroup
public static String getOriginalColumnGroup(String columnGroup)
Given a columnGroup, it returns the original group name, removing the the subgroup part (added ingetColumnSubGroupwith the following format: 'columnGroupName-x'- Parameters:
columnGroup-- Returns:
-
isSimpleJavaType
public static boolean isSimpleJavaType(String className)
This method can be used ONLY when managing a RULE type Test Scenario.- Parameters:
className-- Returns:
-
getPlaceHolder
public static String getPlaceHolder(boolean isInstanceAssigned, boolean isPropertyAssigned, org.drools.scenariosimulation.api.model.FactMappingValueType valueType, String className)
It provides the correct PlaceHolder value to be assigned to an empty cell given its parameters status.- Parameters:
isInstanceAssigned-isPropertyAssigned-valueType-className-- Returns:
-
getPropertyNameElementsWithoutAlias
public static List<String> getPropertyNameElementsWithoutAlias(List<String> propertyNameElements, org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier, org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type type)
Method to retrieve a newListof property name elements where the first one is the the actual class name (i.e. an eventual alias get replaced)- Parameters:
propertyNameElements-factIdentifier-- Returns:
-
getScenarioGridColumn
public static ScenarioGridColumn getScenarioGridColumn(String instanceTitle, String propertyTitle, String columnId, String columnGroup, org.drools.scenariosimulation.api.model.FactMappingType factMappingType, ScenarioHeaderTextBoxSingletonDOMElementFactory factoryHeader, ScenarioCellTextAreaSingletonDOMElementFactory factoryCell, String placeHolder)
Returns aScenarioGridColumnwith the following default values:width: 150
isMovable:
false;isPropertyAssigned:
false;columnRenderer: new ScenarioGridColumnRenderer()
- Parameters:
instanceTitle-propertyTitle-columnId-columnGroup-factMappingType-factoryHeader-factoryCell-placeHolder-- Returns:
-
getScenarioGridColumn
public static ScenarioGridColumn getScenarioGridColumn(ScenarioSimulationBuilders.HeaderBuilder headerBuilder, ScenarioCellTextAreaSingletonDOMElementFactory factoryCell, String placeHolder)
Returns aScenarioGridColumnwith the following default values:width: 150
isMovable:
false;columnRenderer: new ScenarioGridColumnRenderer()
- Parameters:
headerBuilder-factoryCell-placeHolder-- Returns:
-
getScenarioGridColumnBuilder
public static ScenarioSimulationBuilders.ScenarioGridColumnBuilder getScenarioGridColumnBuilder(ScenarioCellTextAreaSingletonDOMElementFactory factoryCell, ScenarioSimulationBuilders.HeaderBuilder headerBuilder, String placeHolder)
Returns aScenarioSimulationBuilders.ScenarioGridColumnBuilderwith the following default values:width: 150
isMovable:
false;isPropertyAssigned:
false;columnRenderer: new ScenarioGridColumnRenderer()
- Parameters:
factoryCell-headerBuilder-placeHolder-- Returns:
-
getHeaderBuilder
public static ScenarioSimulationBuilders.HeaderBuilder getHeaderBuilder(String instanceTitle, String propertyTitle, String columnId, String columnGroup, org.drools.scenariosimulation.api.model.FactMappingType factMappingType, ScenarioHeaderTextBoxSingletonDOMElementFactory factoryHeader)
Retrieve a single or triple level Header metadata, i.e. aList<GridColumn.HeaderMetaData>with one or three elements, depending on the column Group:OTHER: single level
EXPECT/GIVEN: triple level
- Parameters:
instanceTitle-propertyTitle-columnId-columnGroup-factMappingType-factoryHeader-- Returns:
-
getMiddleXYCell
public static com.ait.lienzo.client.core.types.Point2D getMiddleXYCell(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget gridWidget, org.uberfire.ext.wires.core.grids.client.model.GridColumn<?> column, boolean isHeader, int uiRowIndex, org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer gridLayer)Returns an array where the 0-element is middle x of given cell and 1-element is middle y- Parameters:
gridWidget-column-isHeader-uiRowIndex-gridLayer-- Returns:
-
getCellHeight
public static int getCellHeight(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget gridWidget, org.uberfire.ext.wires.core.grids.client.model.GridColumn<?> column, boolean isHeader, int uiRowIndex)
-
getColumnWidth
protected static double getColumnWidth(String columnId)
-
-