Search in sources :

Example 6 with FlexTable

use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.

the class RuleModeller method wrapLHSWidget.

/**
 * This adds the widget to the UI, also adding the remove icon.
 */
private Widget wrapLHSWidget(final RuleModel model, int i, RuleModellerWidget w) {
    final FlexTable wrapper = new FlexTable();
    final Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
    remove.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisENTIREConditionAndAllTheFieldConstraintsThatBelongToIt());
    final int idx = i;
    remove.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisEntireConditionQ())) {
                if (model.removeLhsItem(idx)) {
                    refreshWidget();
                    // Signal possible change in Template variables
                    TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent(model);
                    eventBus.fireEventFromSource(tvce, model);
                } else {
                    ErrorPopup.showMessage(GuidedRuleEditorResources.CONSTANTS.CanTRemoveThatItemAsItIsUsedInTheActionPartOfTheRule());
                }
            }
        }
    });
    wrapper.getColumnFormatter().setWidth(0, "100%");
    w.setWidth("100%");
    wrapper.setWidget(0, 0, w);
    if (!(this.lockLHS() || w.isReadOnly()) || !w.isFactTypeKnown()) {
        wrapper.setWidget(0, 1, remove);
        wrapper.getColumnFormatter().setWidth(1, "20px");
    }
    return wrapper;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlexTable(com.google.gwt.user.client.ui.FlexTable) Image(com.google.gwt.user.client.ui.Image) TemplateVariablesChangedEvent(org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)

Example 7 with FlexTable

use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.

the class RuleModeller method wrapRHSWidget.

/**
 * This adds the widget to the UI, also adding the remove icon.
 */
private Widget wrapRHSWidget(final RuleModel model, int i, RuleModellerWidget w) {
    final FlexTable wrapper = new FlexTable();
    final Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
    remove.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisAction());
    final int idx = i;
    remove.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisItem())) {
                model.removeRhsItem(idx);
                refreshWidget();
                // Signal possible change in Template variables
                TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent(model);
                eventBus.fireEventFromSource(tvce, model);
            }
        }
    });
    // if ( !(w instanceof ActionRetractFactWidget) ) {
    // w.setWidth( "100%" );
    // horiz.setWidth( "100%" );
    // }
    wrapper.getColumnFormatter().setWidth(0, "100%");
    w.setWidth("100%");
    wrapper.setWidget(0, 0, w);
    if (!(this.lockRHS() || w.isReadOnly()) || !w.isFactTypeKnown()) {
        wrapper.setWidget(0, 1, remove);
        wrapper.getColumnFormatter().setWidth(1, "20px");
    }
    return wrapper;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlexTable(com.google.gwt.user.client.ui.FlexTable) Image(com.google.gwt.user.client.ui.Image) TemplateVariablesChangedEvent(org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)

Example 8 with FlexTable

use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.

the class RuleModeller method doLayout.

protected void doLayout() {
    layout = new FlexTable();
    initWidget();
    layout.setStyleName("model-builder-Background");
    initWidget(layout);
    setWidth("100%");
    setHeight("100%");
}
Also used : FlexTable(com.google.gwt.user.client.ui.FlexTable)

Example 9 with FlexTable

use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.

the class FromEntryPointFactPatternWidget method getCompositeLabel.

@Override
protected Widget getCompositeLabel() {
    ClickHandler click = new ClickHandler() {

        public void onClick(ClickEvent event) {
            showFactTypeSelector();
        }
    };
    String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName("from entry-point") + "</div>";
    FlexTable panel = new FlexTable();
    int r = 0;
    if (pattern.getFactPattern() == null) {
        panel.setWidget(r, 0, new ClickableLabel("<br> <font color='red'>" + GuidedRuleEditorResources.CONSTANTS.clickToAddPatterns() + "</font>", click, !this.readOnly));
        r++;
    }
    panel.setWidget(r, 0, new HTML(lbl));
    this.txtEntryPoint = new TextBox();
    this.txtEntryPoint.setText(getFromEntryPointPattern().getEntryPointName());
    this.txtEntryPoint.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            getFromEntryPointPattern().setEntryPointName(txtEntryPoint.getText());
            setModified(true);
        }
    });
    panel.setWidget(r, 1, this.txtEntryPoint);
    return panel;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlexTable(com.google.gwt.user.client.ui.FlexTable) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) HTML(com.google.gwt.user.client.ui.HTML) TextBox(org.gwtbootstrap3.client.ui.TextBox)

Example 10 with FlexTable

use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.

the class FactPatternWidget method compositeFieldConstraintEditor.

/**
 * This will show the constraint editor - allowing field constraints to be
 * nested etc.
 */
private Widget compositeFieldConstraintEditor(final CompositeFieldConstraint constraint) {
    FlexTable t = new FlexTable();
    String desc = null;
    ClickHandler click = new ClickHandler() {

        public void onClick(ClickEvent event) {
            popupCreator.showPatternPopupForComposite(constraint);
        }
    };
    if (constraint.getCompositeJunctionType().equals(CompositeFieldConstraint.COMPOSITE_TYPE_AND)) {
        desc = GuidedRuleEditorResources.CONSTANTS.AllOf() + ":";
    } else {
        desc = GuidedRuleEditorResources.CONSTANTS.AnyOf() + ":";
    }
    t.setWidget(0, 0, new ClickableLabel(desc, click, !this.readOnly));
    t.getFlexCellFormatter().setColSpan(0, 0, 2);
    FieldConstraint[] nested = constraint.getConstraints();
    FlexTable inner = new FlexTable();
    if (nested != null) {
        for (int i = 0; i < nested.length; i++) {
            this.renderFieldConstraint(inner, i, nested[i], constraint, true, 0);
            // add in remove icon here...
            final int currentRow = i;
            Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
            clear.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisNestedRestriction());
            clear.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisItemFromNestedConstraint())) {
                        setModified(true);
                        constraint.removeConstraint(currentRow);
                        getModeller().refreshWidget();
                    }
                }
            });
            if (!this.readOnly) {
                // This used to be 5 and Connectives were not rendered
                inner.setWidget(i, 6, clear);
            }
        }
    }
    t.setWidget(1, 1, inner);
    t.setWidget(1, 0, new HTML("&nbsp;&nbsp;&nbsp;&nbsp;"));
    return t;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlexTable(com.google.gwt.user.client.ui.FlexTable) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) HTML(com.google.gwt.user.client.ui.HTML) 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) CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)

Aggregations

FlexTable (com.google.gwt.user.client.ui.FlexTable)29 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)16 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)16 HTML (com.google.gwt.user.client.ui.HTML)13 Image (com.google.gwt.user.client.ui.Image)12 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)6 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)6 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)6 ListBox (org.gwtbootstrap3.client.ui.ListBox)5 ClickableLabel (org.uberfire.ext.widgets.common.client.common.ClickableLabel)5 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)4 Command (com.google.gwt.user.client.Command)4 Confirm (cz.metacentrum.perun.webgui.widgets.Confirm)4 Button (org.gwtbootstrap3.client.ui.Button)4 TextBox (org.gwtbootstrap3.client.ui.TextBox)4 DecoratorPanel (com.google.gwt.user.client.ui.DecoratorPanel)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)3 Label (com.google.gwt.user.client.ui.Label)3 Widget (com.google.gwt.user.client.ui.Widget)3 Style (com.google.gwt.dom.client.Style)2