Search in sources :

Example 1 with BaseSingletonDOMElementFactory

use of org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.BaseSingletonDOMElementFactory in project drools-wb by kiegroup.

the class AbstractScesimGridModelTest method getDOMElementFactory_Expression.

@Test
public void getDOMElementFactory_Expression() {
    BaseSingletonDOMElementFactory factory = abstractScesimGridModelSpy.getDOMElementFactory("com.Test", ScenarioSimulationModel.Type.DMN, FactMappingValueType.EXPRESSION);
    assertSame(scenarioCellTextAreaSingletonDOMElementFactorySpy, factory);
    factory = abstractScesimGridModelSpy.getDOMElementFactory("com.Test", ScenarioSimulationModel.Type.RULE, FactMappingValueType.EXPRESSION);
    assertSame(scenarioExpressionCellTextAreaSingletonDOMElementFactorySpy, factory);
}
Also used : BaseSingletonDOMElementFactory(org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.BaseSingletonDOMElementFactory) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest) Test(org.junit.Test)

Example 2 with BaseSingletonDOMElementFactory

use of org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.BaseSingletonDOMElementFactory in project drools-wb by kiegroup.

the class AbstractScesimGridModelTest method getDOMElementFactory_NotExpressionNotCollection.

@Test
public void getDOMElementFactory_NotExpressionNotCollection() {
    BaseSingletonDOMElementFactory factory = abstractScesimGridModelSpy.getDOMElementFactory("com.Test", ScenarioSimulationModel.Type.DMN, FactMappingValueType.NOT_EXPRESSION);
    assertSame(scenarioCellTextAreaSingletonDOMElementFactorySpy, factory);
    factory = abstractScesimGridModelSpy.getDOMElementFactory("com.Test", ScenarioSimulationModel.Type.RULE, FactMappingValueType.NOT_EXPRESSION);
    assertSame(scenarioCellTextAreaSingletonDOMElementFactorySpy, factory);
}
Also used : BaseSingletonDOMElementFactory(org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.BaseSingletonDOMElementFactory) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest) Test(org.junit.Test)

Example 3 with BaseSingletonDOMElementFactory

use of org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.BaseSingletonDOMElementFactory in project drools-wb by kiegroup.

the class ScenarioGrid method setHeaderColumn.

protected void setHeaderColumn(int columnIndex, FactMapping factMapping, boolean editableHeaders) {
    final FactIdentifier factIdentifier = factMapping.getFactIdentifier();
    String columnId = factMapping.getExpressionIdentifier().getName();
    String instanceTitle = factMapping.getFactAlias();
    String propertyTitle = factMapping.getExpressionAlias();
    String columnGroup = factMapping.getExpressionIdentifier().getType().name();
    boolean isInstanceAssigned = isInstanceAssigned(factIdentifier);
    boolean isPropertyAssigned = isPropertyAssigned(isInstanceAssigned, factMapping);
    String placeHolder = getPlaceHolder(isInstanceAssigned, isPropertyAssigned, factMapping.getFactMappingValueType(), factMapping.getClassName());
    ScenarioGridColumn scenarioGridColumn = getScenarioGridColumnLocal(instanceTitle, propertyTitle, columnId, columnGroup, factMapping.getExpressionIdentifier().getType(), placeHolder);
    scenarioGridColumn.setInstanceAssigned(isInstanceAssigned);
    scenarioGridColumn.setPropertyAssigned(isPropertyAssigned);
    scenarioGridColumn.setFactIdentifier(factIdentifier);
    scenarioGridColumn.setEditableHeaders(editableHeaders);
    if (FactMappingType.OTHER.equals(factMapping.getExpressionIdentifier().getType())) {
        scenarioGridColumn.setColumnWidthMode(ColumnWidthMode.FIXED);
        scenarioGridColumn.setMinimumWidth(scenarioGridColumn.getWidth());
    }
    if (isPropertyAssigned) {
        BaseSingletonDOMElementFactory factory = ((AbstractScesimGridModel) model).getDOMElementFactory(factMapping.getClassName(), type, factMapping.getFactMappingValueType());
        scenarioGridColumn.setFactory(factory);
    }
    ((AbstractScesimGridModel) model).insertColumnGridOnly(columnIndex, scenarioGridColumn);
}
Also used : BaseSingletonDOMElementFactory(org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.BaseSingletonDOMElementFactory) FactIdentifier(org.drools.scenariosimulation.api.model.FactIdentifier) AbstractScesimGridModel(org.drools.workbench.screens.scenariosimulation.client.models.AbstractScesimGridModel)

Example 4 with BaseSingletonDOMElementFactory

use of org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.BaseSingletonDOMElementFactory in project drools-wb by kiegroup.

the class AbstractScesimGridModelTest method getDOMElementFactory_Collection.

@Test
public void getDOMElementFactory_Collection() {
    BaseSingletonDOMElementFactory factory = abstractScesimGridModelSpy.getDOMElementFactory("java.util.List", ScenarioSimulationModel.Type.RULE, FactMappingValueType.NOT_EXPRESSION);
    assertSame(collectionEditorSingletonDOMElementFactoryTest, factory);
    factory = abstractScesimGridModelSpy.getDOMElementFactory("java.util.Map", ScenarioSimulationModel.Type.RULE, FactMappingValueType.NOT_EXPRESSION);
    assertSame(collectionEditorSingletonDOMElementFactoryTest, factory);
    factory = abstractScesimGridModelSpy.getDOMElementFactory("java.util.List", ScenarioSimulationModel.Type.DMN, FactMappingValueType.NOT_EXPRESSION);
    assertSame(collectionEditorSingletonDOMElementFactoryTest, factory);
    factory = abstractScesimGridModelSpy.getDOMElementFactory("java.util.List", ScenarioSimulationModel.Type.DMN, FactMappingValueType.EXPRESSION);
    assertSame(scenarioCellTextAreaSingletonDOMElementFactorySpy, factory);
    factory = abstractScesimGridModelSpy.getDOMElementFactory("java.util.List", ScenarioSimulationModel.Type.RULE, FactMappingValueType.EXPRESSION);
    assertSame(scenarioExpressionCellTextAreaSingletonDOMElementFactorySpy, factory);
}
Also used : BaseSingletonDOMElementFactory(org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.BaseSingletonDOMElementFactory) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest) Test(org.junit.Test)

Aggregations

BaseSingletonDOMElementFactory (org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.BaseSingletonDOMElementFactory)4 AbstractScenarioSimulationTest (org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)3 Test (org.junit.Test)3 FactIdentifier (org.drools.scenariosimulation.api.model.FactIdentifier)1 AbstractScesimGridModel (org.drools.workbench.screens.scenariosimulation.client.models.AbstractScesimGridModel)1