Search in sources :

Example 6 with DirtyableHorizontalPane

use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.

the class CompositeFactPatternWidget method wrapLHSWidget.

/**
 * Wraps a RuleModellerWidget with an icon to delete the pattern
 */
private Widget wrapLHSWidget(final CompositeFactPattern model, int i, RuleModellerWidget w) {
    DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
    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 (pattern.removeFactPattern(idx)) {
                    getModeller().refreshWidget();
                }
            }
        }
    });
    horiz.setWidth("100%");
    w.setWidth("100%");
    horiz.add(w);
    if (!(getModeller().lockLHS() || w.isReadOnly())) {
        horiz.add(remove);
    }
    return horiz;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) DirtyableHorizontalPane(org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane) Image(com.google.gwt.user.client.ui.Image)

Example 7 with DirtyableHorizontalPane

use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.

the class FromCompositeFactPatternWidget method addRemoveButton.

protected Widget addRemoveButton(Widget w, ClickHandler listener) {
    DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
    final Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
    remove.setAltText(GuidedRuleEditorResources.CONSTANTS.RemoveThisBlockOfData());
    remove.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisBlockOfData());
    remove.addClickHandler(listener);
    horiz.setWidth("100%");
    w.setWidth("100%");
    horiz.add(w);
    if (!this.readOnly) {
        horiz.add(remove);
    }
    return horiz;
}
Also used : DirtyableHorizontalPane(org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane) Image(com.google.gwt.user.client.ui.Image)

Example 8 with DirtyableHorizontalPane

use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.

the class AttributeSelectorPopup method setMetadataPanel.

private void setMetadataPanel() {
    box.getElement().setAttribute("size", "15");
    DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
    horiz.add(box);
    horiz.add(getAddButton());
    addAttribute(GuidedRuleEditorResources.CONSTANTS.Metadata3(), horiz);
}
Also used : DirtyableHorizontalPane(org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane)

Example 9 with DirtyableHorizontalPane

use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.

the class RuleAttributeWidget method getEditorWidget.

private Widget getEditorWidget(final RuleMetadata rm, final int idx, final boolean isReadOnly) {
    IsWidget editor;
    if (rm.getAttributeName().equals(LOCK_LHS) || rm.getAttributeName().equals(LOCK_RHS)) {
        editor = new InfoPopup(GuidedRuleEditorResources.CONSTANTS.FrozenAreas(), GuidedRuleEditorResources.CONSTANTS.FrozenExplanation());
    } else {
        editor = textBoxEditor(rm, isReadOnly);
    }
    DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
    horiz.add(editor);
    if (!isReadOnly) {
        horiz.add(getRemoveMetaIcon(idx));
    }
    return horiz;
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget) DirtyableHorizontalPane(org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane) InfoPopup(org.uberfire.ext.widgets.common.client.common.InfoPopup)

Example 10 with DirtyableHorizontalPane

use of org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane in project drools-wb by kiegroup.

the class RuleModeller method renderLhs.

/**
 * Builds all the condition widgets.
 */
private void renderLhs(final RuleModel model) {
    for (int i = 0; i < model.lhs.length; i++) {
        DirtyableVerticalPane vert = new DirtyableVerticalPane();
        vert.setWidth("100%");
        // if lockLHS() set the widget RO, otherwise let them decide.
        Boolean readOnly = this.lockLHS() ? true : null;
        IPattern pattern = model.lhs[i];
        final RuleModellerWidget widget = getWidgetFactory().getWidget(this, eventBus, pattern, readOnly);
        widget.addOnModifiedCommand(this.onWidgetModifiedCommand);
        vert.add(wrapLHSWidget(model, i, widget));
        vert.add(spacerWidget());
        layout.setWidget(currentLayoutRow, 0, new DirtyableHorizontalPane());
        layout.setWidget(currentLayoutRow, 1, new DirtyableHorizontalPane());
        layout.setWidget(currentLayoutRow, 2, this.wrapLineNumber(i + 1, true));
        layout.getFlexCellFormatter().setHorizontalAlignment(currentLayoutRow, 2, HasHorizontalAlignment.ALIGN_CENTER);
        layout.getFlexCellFormatter().setVerticalAlignment(currentLayoutRow, 2, HasVerticalAlignment.ALIGN_MIDDLE);
        layout.setWidget(currentLayoutRow, 3, vert);
        layout.getFlexCellFormatter().setHorizontalAlignment(currentLayoutRow, 3, HasHorizontalAlignment.ALIGN_LEFT);
        layout.getFlexCellFormatter().setVerticalAlignment(currentLayoutRow, 3, HasVerticalAlignment.ALIGN_TOP);
        layout.getFlexCellFormatter().setWidth(currentLayoutRow, 3, "100%");
        layout.getRowFormatter().addStyleName(currentLayoutRow, (i % 2 == 0 ? GuidedRuleEditorResources.INSTANCE.css().evenRow() : GuidedRuleEditorResources.INSTANCE.css().oddRow()));
        if (!widget.isFactTypeKnown()) {
            addInvalidPatternIcon();
            addFactTypeKnownValueChangeHandler(widget, currentLayoutRow);
        }
        final int index = i;
        if (!(this.lockLHS() || widget.isReadOnly())) {
            this.addActionsButtonsToLayout(GuidedRuleEditorResources.CONSTANTS.AddAConditionBelow(), new ClickHandler() {

                public void onClick(ClickEvent event) {
                    showConditionSelector(index + 1);
                }
            }, new ClickHandler() {

                public void onClick(ClickEvent event) {
                    model.moveLhsItemDown(index);
                    refreshWidget();
                }
            }, new ClickHandler() {

                public void onClick(ClickEvent event) {
                    model.moveLhsItemUp(index);
                    refreshWidget();
                }
            });
        }
        this.lhsWidgets.add(widget);
        currentLayoutRow++;
    }
}
Also used : IPattern(org.drools.workbench.models.datamodel.rule.IPattern) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) DirtyableVerticalPane(org.uberfire.ext.widgets.common.client.common.DirtyableVerticalPane) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) DirtyableHorizontalPane(org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane) RuleModellerWidget(org.drools.workbench.screens.guided.rule.client.widget.RuleModellerWidget)

Aggregations

DirtyableHorizontalPane (org.uberfire.ext.widgets.common.client.common.DirtyableHorizontalPane)11 RuleModellerWidget (org.drools.workbench.screens.guided.rule.client.widget.RuleModellerWidget)4 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)3 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)3 Image (com.google.gwt.user.client.ui.Image)3 Widget (com.google.gwt.user.client.ui.Widget)3 IsWidget (com.google.gwt.user.client.ui.IsWidget)2 DirtyableVerticalPane (org.uberfire.ext.widgets.common.client.common.DirtyableVerticalPane)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)1 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 HTML (com.google.gwt.user.client.ui.HTML)1 Date (java.util.Date)1 IAction (org.drools.workbench.models.datamodel.rule.IAction)1 IPattern (org.drools.workbench.models.datamodel.rule.IPattern)1 ListBox (org.gwtbootstrap3.client.ui.ListBox)1 TextBox (org.gwtbootstrap3.client.ui.TextBox)1 DatePicker (org.uberfire.ext.widgets.common.client.common.DatePicker)1 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)1