Search in sources :

Example 41 with Image

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

the class GuidedRuleEditorImages508 method EditDisabled.

public Image EditDisabled() {
    Image image = new Image(GuidedRuleEditorResources.INSTANCE.images().editDisabled());
    image.setAltText(GuidedRuleEditorResources.CONSTANTS.EditDisabled());
    return image;
}
Also used : Image(com.google.gwt.user.client.ui.Image)

Example 42 with Image

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

the class ActionSetFieldWidget method doLayout.

private void doLayout() {
    layout.clear();
    for (int i = 0; i < model.getFieldValues().length; i++) {
        ActionFieldValue val = model.getFieldValues()[i];
        layout.setWidget(i, 0, getSetterLabel());
        layout.setWidget(i, 1, fieldSelector(val));
        layout.setWidget(i, 2, valueEditor(val));
        final int idx = i;
        Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
        remove.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveThisItem())) {
                    model.removeField(idx);
                    setModified(true);
                    getModeller().refreshWidget();
                    // Signal possible change in Template variables
                    TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent(getModeller().getModel());
                    getEventBus().fireEventFromSource(tvce, getModeller().getModel());
                }
            }
        });
        if (!this.readOnly) {
            layout.setWidget(i, 3, remove);
        }
    }
    if (model.getFieldValues().length == 0) {
        HorizontalPanel h = new HorizontalPanel();
        h.add(getSetterLabel());
        if (!this.readOnly) {
            Image image = GuidedRuleEditorImages508.INSTANCE.Edit();
            image.setAltText(GuidedRuleEditorResources.CONSTANTS.AddFirstNewField());
            image.setTitle(GuidedRuleEditorResources.CONSTANTS.AddFirstNewField());
            image.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent sender) {
                    showAddFieldPopup(sender);
                }
            });
            h.add(image);
        }
        layout.setWidget(0, 0, h);
    }
// layout.setWidget( 0, 1, inner );
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ActionFieldValue(org.drools.workbench.models.datamodel.rule.ActionFieldValue) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Image(com.google.gwt.user.client.ui.Image) TemplateVariablesChangedEvent(org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)

Example 43 with Image

use of com.google.gwt.user.client.ui.Image 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 44 with Image

use of com.google.gwt.user.client.ui.Image 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)

Example 45 with Image

use of com.google.gwt.user.client.ui.Image 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)

Aggregations

Image (com.google.gwt.user.client.ui.Image)98 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)28 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)28 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)15 Test (org.junit.Test)13 FlexTable (com.google.gwt.user.client.ui.FlexTable)12 HTML (com.google.gwt.user.client.ui.HTML)10 Element (com.google.gwt.dom.client.Element)8 Label (com.google.gwt.user.client.ui.Label)8 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)7 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)7 ImageResource (com.google.gwt.resources.client.ImageResource)6 Widget (com.google.gwt.user.client.ui.Widget)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)5 Style (com.google.gwt.dom.client.Style)4 Anchor (com.google.gwt.user.client.ui.Anchor)4 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)4 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)3 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)3 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)3