Search in sources :

Example 6 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 setData.

public void setData(final List<AssignmentRow> assignmentRows) {
    // Hide the properties which shouldn't be shown
    hiddenPropertyRows.clear();
    if (disallowedNames != null && !disallowedNames.isEmpty()) {
        for (int i = assignmentRows.size() - 1; i >= 0; i--) {
            AssignmentRow row = assignmentRows.get(i);
            if (row.getName() != null && !row.getName().isEmpty()) {
                if (disallowedNames.contains(row.getName().toLowerCase())) {
                    assignmentRows.remove(i);
                    hiddenPropertyRows.add(0, row);
                }
            }
        }
    }
    if (assignmentRows.isEmpty()) {
        view.setNoneDisplayStyle();
    } else {
        view.setTableDisplayStyle();
    }
    view.setAssignmentRows(assignmentRows);
    for (int i = 0; i < assignmentRows.size(); i++) {
        view.getAssignmentWidget(i).setParentWidget(this);
        view.getAssignmentWidget(i).setDisallowedNames(disallowedNames, disallowedNameErrorMessage);
        view.getAssignmentWidget(i).setAllowDuplicateNames(allowDuplicateNames, duplicateNameErrorMessage);
    }
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow)

Example 7 with AssignmentRow

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

the class ActivityDataIOEditorTest method getAssignmentsWithSameNames.

private List<AssignmentRow> getAssignmentsWithSameNames() {
    List<AssignmentRow> rows = new ArrayList<AssignmentRow>();
    rows.add(new AssignmentRow("varName", null, null, null, "varName", null));
    rows.add(new AssignmentRow("varName2", null, null, null, "varName2", null));
    return rows;
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) ArrayList(java.util.ArrayList)

Example 8 with AssignmentRow

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

the class ActivityDataIOEditorTest method testSaveClickCallback.

@Test
public void testSaveClickCallback() {
    AssignmentRow row = new AssignmentRow("name", Variable.VariableType.INPUT, "String", "Object", "var", null);
    List<AssignmentRow> input = new ArrayList<AssignmentRow>();
    input.add(row);
    List<AssignmentRow> output = new ArrayList<AssignmentRow>();
    output.add(row);
    when(ioEditorView.getInputAssignmentData()).thenReturn(input);
    when(ioEditorView.getOutputAssignmentData()).thenReturn(output);
    List<String> dataTypes = new ArrayList<String>();
    List<String> dataTypesDisplayNames = new ArrayList<String>();
    dataTypes.add("a.b.c.Name");
    dataTypesDisplayNames.add("Name");
    ActivityDataIOEditor.GetDataCallback mockCallback = mock(ActivityDataIOEditor.GetDataCallback.class);
    ioEditor.setCallback(mockCallback);
    ioEditor.handleSaveClick();
    verify(ioEditorView).getInputAssignmentData();
    verify(ioEditorView).getOutputAssignmentData();
    verify(ioEditorView).hideView();
    verify((ioEditor.callback)).getData(anyString());
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) ArrayList(java.util.ArrayList) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.Test)

Example 9 with AssignmentRow

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

the class ActivityDataIOEditorViewImplTest method setUp.

@Before
public void setUp() {
    GwtMockito.initMocks(this);
    view.inputAssignmentsWidget = inputAssignmentsWidget;
    view.outputAssignmentsWidget = outputAssignmentsWidget;
    view.presenter = presenter;
    doCallRealMethod().when(view).setInputAssignmentRows(any(List.class));
    doCallRealMethod().when(view).setOutputAssignmentRows(any(List.class));
    doCallRealMethod().when(view).setPossibleInputAssignmentsDataTypes(anyList());
    doCallRealMethod().when(view).setPossibleOutputAssignmentsDataTypes(anyList());
    doCallRealMethod().when(view).setInputAssignmentsProcessVariables(anyList());
    doCallRealMethod().when(view).setOutputAssignmentsProcessVariables(anyList());
    doCallRealMethod().when(view).setInputAssignmentsDisallowedNames(anySet());
    doCallRealMethod().when(view).setIsInputAssignmentSingleVar(anyBoolean());
    doCallRealMethod().when(view).setIsOutputAssignmentSingleVar(anyBoolean());
    doCallRealMethod().when(view).setInputAssignmentsVisibility(anyBoolean());
    doCallRealMethod().when(view).setOutputAssignmentsVisibility(anyBoolean());
    doCallRealMethod().when(view).getInputAssignmentData();
    doCallRealMethod().when(view).getOutputAssignmentData();
    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) ArrayList(java.util.ArrayList) List(java.util.List) Mockito.anyList(org.mockito.Mockito.anyList) Before(org.junit.Before)

Example 10 with AssignmentRow

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

the class AssignmentListItemWidgetTest method testSetModelInput.

@Test
public void testSetModelInput() {
    when(widget.getVariableType()).thenReturn(Variable.VariableType.INPUT);
    widget.setModel(new AssignmentRow());
    verify(deleteButton).setIcon(IconType.TRASH);
    verify(constant, never()).setVisible(anyBoolean());
    verify(widget).getCustomDataType();
    verify(widget).getDataType();
    verify(widget).getConstant();
    verify(widget).getProcessVar();
}
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