Search in sources :

Example 6 with ReassignmentRow

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

the class ReassignmentWidgetViewImpl method initGroups.

private void initGroups() {
    PopoverTextCell toGroups = new PopoverTextCell();
    Column<ReassignmentRow, String> toGroupsColumn = new Column<ReassignmentRow, String>(toGroups) {

        @Override
        public String getValue(ReassignmentRow object) {
            if (object.getGroups() != null) {
                return object.getGroups().stream().collect(Collectors.joining(","));
            } else {
                return "";
            }
        }
    };
    toGroupsColumn.setSortable(false);
    table.addColumn(toGroupsColumn, presenter.getToGroupsLabel());
    table.setColumnWidth(toGroupsColumn, 150, Style.Unit.PX);
}
Also used : Column(com.google.gwt.user.cellview.client.Column) PopoverTextCell(org.uberfire.ext.widgets.common.client.tables.PopoverTextCell) ReassignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow)

Example 7 with ReassignmentRow

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

the class ReassignmentWidgetViewImpl method initType.

private void initType() {
    TextCell typeCell = new TextCell();
    Column<ReassignmentRow, String> typeColumn = new Column<ReassignmentRow, String>(typeCell) {

        @Override
        public String getValue(ReassignmentRow object) {
            if (object.getType() != null) {
                return object.getType().getType();
            }
            return "";
        }
    };
    typeColumn.setSortable(false);
    table.addColumn(typeColumn, presenter.getTypeLabel());
    table.setColumnWidth(typeColumn, 140, Style.Unit.PX);
}
Also used : Column(com.google.gwt.user.cellview.client.Column) TextCell(com.google.gwt.cell.client.TextCell) PopoverTextCell(org.uberfire.ext.widgets.common.client.tables.PopoverTextCell) ReassignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow)

Example 8 with ReassignmentRow

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

the class ReassignmentEditorWidgetTest method testCreateAndSaveEmpty.

@Test
public void testCreateAndSaveEmpty() {
    ReassignmentRow test = new ReassignmentRow();
    doNothing().when(view).hide();
    when(customerBinder.getModel()).thenReturn(test);
    when(notCompleted.getValue()).thenReturn(ReassignmentType.NotCompletedReassign.getAlias());
    when(typeSelect.getSelectedItem()).thenReturn(notCompleted);
    when(multipleLiveSearchSelectionHandlerGroups.getSelectedValues()).thenReturn(Collections.EMPTY_LIST);
    when(multipleLiveSearchSelectionHandlerUsers.getSelectedValues()).thenReturn(Collections.EMPTY_LIST);
    view.createOrEdit(reassignmentWidgetViewImpl, test);
    view.ok();
    ReassignmentRow result = getFieldValue(ReassignmentEditorWidgetViewImpl.class, view, "current");
    Assert.assertEquals(result, test);
}
Also used : ReassignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest) Test(org.junit.Test)

Example 9 with ReassignmentRow

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

the class ReassignmentWidgetViewImplTest method generateRows.

private List<ReassignmentRow> generateRows() {
    List<ReassignmentRow> rows = new ArrayList<>();
    ReassignmentRow row1 = new ReassignmentRow();
    row1.setId(1);
    ReassignmentRow row2 = new ReassignmentRow();
    row2.setId(2);
    ReassignmentRow row3 = new ReassignmentRow();
    row3.setId(3);
    ReassignmentRow row4 = new ReassignmentRow();
    row4.setId(4);
    rows.add(row1);
    rows.add(row2);
    rows.add(row3);
    rows.add(row4);
    return rows;
}
Also used : ArrayList(java.util.ArrayList) ReassignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow)

Example 10 with ReassignmentRow

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

the class ReassignmentWidgetViewImplTest method testDeleteRow.

@Test
public void testDeleteRow() {
    ReassignmentRow row4 = new ReassignmentRow();
    row4.setId(4);
    reassignmentWidgetViewImpl.init(presenter, generateRows());
    ListDataProvider<ReassignmentRow> dataProvider = getFieldValue(ReassignmentWidgetViewImpl.class, reassignmentWidgetViewImpl, "dataProvider");
    Assert.assertEquals(4, dataProvider.getList().size());
    reassignmentWidgetViewImpl.delete(row4);
    Assert.assertEquals(3, dataProvider.getList().size());
}
Also used : ReassignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest) Test(org.junit.Test)

Aggregations

ReassignmentRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow)17 Test (org.junit.Test)8 ReflectionUtilsTest (org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest)8 Column (com.google.gwt.user.cellview.client.Column)6 ArrayList (java.util.ArrayList)5 PopoverTextCell (org.uberfire.ext.widgets.common.client.tables.PopoverTextCell)4 LienzoMockitoTestRunner (com.ait.lienzo.test.LienzoMockitoTestRunner)3 HasData (com.google.gwt.view.client.HasData)3 ListDataProvider (com.google.gwt.view.client.ListDataProvider)3 GwtMock (com.google.gwtmockito.GwtMock)3 GwtMockito (com.google.gwtmockito.GwtMockito)3 Collections (java.util.Collections)3 List (java.util.List)3 Assert (org.junit.Assert)3 Before (org.junit.Before)3 RunWith (org.junit.runner.RunWith)3 ReassignmentsEditorWidget (org.kie.workbench.common.stunner.bpmn.client.forms.fields.reassignmentsEditor.ReassignmentsEditorWidget)3 ReassignmentEvent (org.kie.workbench.common.stunner.bpmn.client.forms.fields.reassignmentsEditor.event.ReassignmentEvent)3 ReassignmentTypeListValue (org.kie.workbench.common.stunner.bpmn.definition.property.reassignment.ReassignmentTypeListValue)3 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)3