Search in sources :

Example 16 with Icon

use of org.gwtbootstrap3.client.ui.Icon in project kie-wb-common by kiegroup.

the class ReassignmentWidgetViewImpl method initEdit.

private void initEdit() {
    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.EDIT));
            sb.append(SafeHtmlUtils.fromTrustedString(button.toString()));
        }

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

        @Override
        public ReassignmentRow getValue(ReassignmentRow object) {
            return object;
        }
    };
    editColumn.setSortable(false);
    table.addColumn(editColumn, StunnerFormsClientFieldsConstants.CONSTANTS.Edit());
    table.setColumnWidth(editColumn, 50, 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)

Example 17 with Icon

use of org.gwtbootstrap3.client.ui.Icon 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)

Example 18 with Icon

use of org.gwtbootstrap3.client.ui.Icon in project drools-wb by kiegroup.

the class FactPatternWidget method drawConstraints.

/**
 * Render a hierarchy of constraints, hierarchy here means constraints that
 * may themselves depend on members of constraint objects. With this code,
 * the GUI enables clicking rules of the form: $result = RoutingResult(
 * NerOption.types contains "arzt" )
 * @param sortedConst a sorted list of constraints to display.
 */
protected void drawConstraints(List<FieldConstraint> sortedConst, HasConstraints hasConstraints) {
    final FlexTable table = new FlexTable();
    layout.setWidget(1, 0, table);
    List<FieldConstraint> parents = new ArrayList<>();
    for (int i = 0; i < sortedConst.size(); i++) {
        traverseSingleFieldConstraints(sortedConst, table, parents, hasConstraints, i);
        // now the clear icon
        final int currentRow = i;
        Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
        clear.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisWholeRestriction());
        clear.addClickHandler(createClickHandlerForClearImageButton(currentRow));
        if (!this.readOnly) {
            // This used to be 5 and Connectives were not rendered
            table.setWidget(currentRow, 6, clear);
            table.setWidget(currentRow, 7, new MoveUpButton(event -> {
                hasConstraints.moveUp(currentRow);
                getModeller().refreshWidget();
            }));
            table.setWidget(currentRow, 8, new MoveDownButton(event -> {
                hasConstraints.moveDown(currentRow);
                getModeller().refreshWidget();
            }));
        }
    }
}
Also used : CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) DataType(org.kie.soup.project.datamodel.oracle.DataType) FlexTable(com.google.gwt.user.client.ui.FlexTable) Image(com.google.gwt.user.client.ui.Image) SingleFieldConstraintOperatorSelector(org.drools.workbench.screens.guided.rule.client.widget.operator.SingleFieldConstraintOperatorSelector) HumanReadable(org.kie.workbench.common.widgets.client.resources.HumanReadable) HTML(com.google.gwt.user.client.ui.HTML) Label(com.google.gwt.user.client.ui.Label) Map(java.util.Map) RuleModeller(org.drools.workbench.screens.guided.rule.client.editor.RuleModeller) ToStringExpressionVisitor(org.drools.workbench.models.datamodel.rule.visitors.ToStringExpressionVisitor) EventBus(com.google.gwt.event.shared.EventBus) DOM(com.google.gwt.user.client.DOM) ConstraintValueEditor(org.drools.workbench.screens.guided.rule.client.editor.ConstraintValueEditor) TextBox(org.gwtbootstrap3.client.ui.TextBox) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) MoveUpButton(org.drools.workbench.screens.guided.rule.client.editor.MoveUpButton) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) List(java.util.List) Widget(com.google.gwt.user.client.ui.Widget) GuidedRuleEditorImages508(org.drools.workbench.screens.guided.rule.client.resources.images.GuidedRuleEditorImages508) DRLConstraintValueBuilder(org.drools.workbench.models.datamodel.rule.builder.DRLConstraintValueBuilder) HumanReadableConstants(org.kie.workbench.common.widgets.client.resources.i18n.HumanReadableConstants) CEPWindowOperatorsDropdown(org.drools.workbench.screens.guided.rule.client.editor.CEPWindowOperatorsDropdown) OperatorSelection(org.drools.workbench.screens.guided.rule.client.editor.OperatorSelection) RefreshUtil(org.drools.workbench.screens.guided.rule.client.util.RefreshUtil) SingleFieldConstraintEBLeftSide(org.drools.workbench.models.datamodel.rule.SingleFieldConstraintEBLeftSide) HasCEPWindow(org.drools.workbench.models.datamodel.rule.HasCEPWindow) MoveDownButton(org.drools.workbench.screens.guided.rule.client.editor.MoveDownButton) RuleModel(org.drools.workbench.models.datamodel.rule.RuleModel) GuidedRuleEditorResources(org.drools.workbench.screens.guided.rule.client.resources.GuidedRuleEditorResources) FactPattern(org.drools.workbench.models.datamodel.rule.FactPattern) HashMap(java.util.HashMap) GWT(com.google.gwt.core.client.GWT) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ArrayList(java.util.ArrayList) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) Window(com.google.gwt.user.client.Window) RuleAttribute(org.drools.workbench.models.datamodel.rule.RuleAttribute) IPattern(org.drools.workbench.models.datamodel.rule.IPattern) SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) Connectives(org.drools.workbench.screens.guided.rule.client.editor.factPattern.Connectives) HasHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment) HasConstraints(org.drools.workbench.models.datamodel.rule.HasConstraints) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) HasVerticalAlignment(com.google.gwt.user.client.ui.HasVerticalAlignment) PopupCreator(org.drools.workbench.screens.guided.rule.client.editor.factPattern.PopupCreator) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) MoveDownButton(org.drools.workbench.screens.guided.rule.client.editor.MoveDownButton) FlexTable(com.google.gwt.user.client.ui.FlexTable) ArrayList(java.util.ArrayList) MoveUpButton(org.drools.workbench.screens.guided.rule.client.editor.MoveUpButton) Image(com.google.gwt.user.client.ui.Image) CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint) CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)

Aggregations

Icon (org.gwtbootstrap3.client.ui.Icon)8 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Widget (com.google.gwt.user.client.ui.Widget)4 Button (org.gwtbootstrap3.client.ui.Button)4 AbstractCell (com.google.gwt.cell.client.AbstractCell)3 ValueUpdater (com.google.gwt.cell.client.ValueUpdater)3 GWT (com.google.gwt.core.client.GWT)3 Element (com.google.gwt.dom.client.Element)3 NativeEvent (com.google.gwt.dom.client.NativeEvent)3 EventBus (com.google.gwt.event.shared.EventBus)3 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)3 Column (com.google.gwt.user.cellview.client.Column)3 DOM (com.google.gwt.user.client.DOM)3 Window (com.google.gwt.user.client.Window)3 FlexTable (com.google.gwt.user.client.ui.FlexTable)3 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)3 HTML (com.google.gwt.user.client.ui.HTML)3 HasHorizontalAlignment (com.google.gwt.user.client.ui.HasHorizontalAlignment)3 HasVerticalAlignment (com.google.gwt.user.client.ui.HasVerticalAlignment)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)3