Search in sources :

Example 16 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 onSubscription.

public void onSubscription(@Observes ReassignmentEvent event) {
    this.getParent().getParent().setVisible(true);
    ReassignmentRow reassignment = event.getReassignment();
    if (reassignment != null) {
        if (!dataProvider.getList().contains(reassignment)) {
            dataProvider.getList().add(reassignment);
        }
        refreshTable();
    }
}
Also used : ReassignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow)

Example 17 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 initDelete.

private void initDelete() {
    AbstractCell<ReassignmentRow> buttonCell = new AbstractCell<ReassignmentRow>(ClickEvent.getType().getName()) {

        @Override
        public void render(Context context, ReassignmentRow value, SafeHtmlBuilder sb) {
            Button button = new Button();
            button.setSize(ButtonSize.SMALL);
            button.add(new Icon(IconType.REMOVE));
            sb.append(SafeHtmlUtils.fromTrustedString(button.toString()));
        }

        @Override
        public void onBrowserEvent(Context context, Element parent, ReassignmentRow value, NativeEvent event, ValueUpdater<ReassignmentRow> valueUpdater) {
            if (!readOnly) {
                delete(value);
            }
        }
    };
    Column<ReassignmentRow, ReassignmentRow> deleteColumn = new Column<ReassignmentRow, ReassignmentRow>(buttonCell) {

        @Override
        public ReassignmentRow getValue(ReassignmentRow object) {
            return object;
        }
    };
    deleteColumn.setSortable(false);
    table.addColumn(deleteColumn, presenter.getDeleteLabel());
    table.setColumnWidth(deleteColumn, 60, Style.Unit.PX);
}
Also used : Button(org.gwtbootstrap3.client.ui.Button) ValueUpdater(com.google.gwt.cell.client.ValueUpdater) Column(com.google.gwt.user.cellview.client.Column) HTMLButtonElement(elemental2.dom.HTMLButtonElement) Element(com.google.gwt.dom.client.Element) AbstractCell(com.google.gwt.cell.client.AbstractCell) Icon(org.gwtbootstrap3.client.ui.Icon) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) ReassignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow) NativeEvent(com.google.gwt.dom.client.NativeEvent)

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