Search in sources :

Example 1 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class ActivityDataIOEditorWidget method addAssignment.

private void addAssignment() {
    List<AssignmentRow> as = view.getAssignmentRows();
    if (as.isEmpty()) {
        view.setTableDisplayStyle();
    }
    AssignmentRow newAssignment = new AssignmentRow();
    newAssignment.setVariableType(variableType);
    as.add(newAssignment);
    AssignmentListItemWidgetView widget = view.getAssignmentWidget(view.getAssignmentsCount() - 1);
    widget.setDataTypes(dataTypeListBoxValues);
    widget.setProcessVariables(processVarListBoxValues);
    widget.setShowConstants(getShowConstants());
    widget.setDisallowedNames(disallowedNames, disallowedNameErrorMessage);
    widget.setAllowDuplicateNames(allowDuplicateNames, duplicateNameErrorMessage);
    widget.setParentWidget(this);
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow)

Example 2 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class ActivityDataIOEditorWidgetViewImplTest method setUp.

@Before
public void setUp() {
    GwtMockito.initMocks(this);
    view = GWT.create(ActivityDataIOEditorWidgetViewImpl.class);
    view.assignments = assignments;
    view.addVarButton = button;
    view.nameth = nameth;
    view.datatypeth = datatypeth;
    view.notification = notification;
    doCallRealMethod().when(view).setAssignmentRows(any(List.class));
    doCallRealMethod().when(view).init(any(ActivityDataIOEditorWidgetView.Presenter.class));
    doCallRealMethod().when(view).handleAddVarButton(any(ClickEvent.class));
    doCallRealMethod().when(view).showOnlySingleEntryAllowed();
    doCallRealMethod().when(view).getAssignmentRows();
    doCallRealMethod().when(view).getAssignmentWidget(anyInt());
    doCallRealMethod().when(view).getAssignmentsCount();
    rows = new ArrayList<AssignmentRow>();
    rows.add(new AssignmentRow("varName", null, null, null, "varName", null));
    rows.add(new AssignmentRow("varName2", null, null, null, "varName2", null));
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) List(java.util.List) Before(org.junit.Before)

Example 3 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetViewImplTest method testSetModelOutputNormalConstant.

@Test
public void testSetModelOutputNormalConstant() {
    AssignmentRow row = new AssignmentRow();
    row.setProcessVar(null);
    row.setConstant(CONSTANT_NAME);
    row.setName(VARIABLE_NAME);
    row.setCustomDataType(null);
    row.setDataType(DATA_TYPE_NAME);
    row.setVariableType(Variable.VariableType.OUTPUT);
    doReturn(row).when(assignment).getModel();
    view.setModel(row);
    verify(assignment, times(1)).setModel(row);
    verify(deleteButton, times(1)).setIcon(IconType.TRASH);
    verify(constant, times(1)).setVisible(false);
    verify(customDataType, never()).setValue(DATA_TYPE_NAME);
    verify(dataType, times(1)).setValue(DATA_TYPE_NAME);
    verify(constant, times(1)).setValue(CONSTANT_NAME);
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) Test(org.junit.Test)

Example 4 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetViewImplTest method testHandleDeleteButton.

@Test
public void testHandleDeleteButton() {
    ActivityDataIOEditorWidget widget = mock(ActivityDataIOEditorWidget.class);
    AssignmentRow model = mock(AssignmentRow.class);
    when(view.getModel()).thenReturn(model);
    view.setParentWidget(widget);
    view.handleDeleteButton(null);
    verify(widget).removeAssignment(model);
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) Test(org.junit.Test)

Example 5 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetViewImplTest method testSetModelInputCustomProcessVar.

@Test
public void testSetModelInputCustomProcessVar() {
    AssignmentRow row = new AssignmentRow();
    row.setProcessVar(VARIABLE_NAME);
    row.setConstant(null);
    row.setName(VARIABLE_NAME);
    row.setCustomDataType(CUST_DATA_TYPE_NAME);
    row.setDataType(null);
    row.setVariableType(Variable.VariableType.INPUT);
    doReturn(row).when(assignment).getModel();
    view.setModel(row);
    verify(assignment, times(1)).setModel(row);
    verify(deleteButton, times(1)).setIcon(IconType.TRASH);
    verify(constant, never()).setVisible(false);
    verify(customDataType, times(1)).setValue(CUST_DATA_TYPE_NAME);
    verify(dataType, times(1)).setValue(CUST_DATA_TYPE_NAME);
    verify(processVar, times(1)).setValue(VARIABLE_NAME);
    verify(constant, never()).setValue(anyString());
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) Test(org.junit.Test)

Aggregations

AssignmentRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow)15 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)4 Before (org.junit.Before)4 Mockito.anyString (org.mockito.Mockito.anyString)4 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 List (java.util.List)2 TextBox (org.gwtbootstrap3.client.ui.TextBox)2 ValueListBox (org.gwtbootstrap3.client.ui.ValueListBox)2 ComboBox (org.kie.workbench.common.stunner.bpmn.client.forms.widgets.ComboBox)2 VariableNameTextBox (org.kie.workbench.common.stunner.bpmn.client.forms.widgets.VariableNameTextBox)2 ListBoxValues (org.kie.workbench.common.stunner.bpmn.client.forms.util.ListBoxValues)1 Mockito.anyBoolean (org.mockito.Mockito.anyBoolean)1 Mockito.anyList (org.mockito.Mockito.anyList)1