Search in sources :

Example 91 with Image

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

the class GuidedRuleEditorImages508 method Error.

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

Example 92 with Image

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

the class Connectives method connectives.

public Widget connectives(final SingleFieldConstraint c) {
    final HorizontalPanel hp = new HorizontalPanel();
    if (c.getConnectives() != null && c.getConnectives().length > 0) {
        hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        for (int i = 0; i < c.getConnectives().length; i++) {
            final int index = i;
            final ConnectiveConstraint con = c.getConnectives()[i];
            connectiveOperatorDropDown(con, new Callback<Widget>() {

                @Override
                public void callback(final Widget w) {
                    hp.add(w);
                    hp.add(connectiveValueEditor(con));
                    if (!isReadOnly) {
                        Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
                        clear.setAltText(GuidedRuleEditorResources.CONSTANTS.RemoveThisRestriction());
                        clear.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisRestriction());
                        clear.addClickHandler(createClickHandlerForClearImageButton(c, index));
                        hp.add(clear);
                    }
                }
            });
        }
    }
    return hp;
}
Also used : HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Widget(com.google.gwt.user.client.ui.Widget) ConnectiveConstraint(org.drools.workbench.models.datamodel.rule.ConnectiveConstraint) Image(com.google.gwt.user.client.ui.Image) ConnectiveConstraint(org.drools.workbench.models.datamodel.rule.ConnectiveConstraint) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)

Example 93 with Image

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

the class ActionInsertFactWidget method doLayout.

private void doLayout() {
    layout.clear();
    layout.setWidget(0, 0, getAssertLabel());
    layout.setWidget(1, 0, new HTML("&nbsp;&nbsp;&nbsp;&nbsp;"));
    layout.getFlexCellFormatter().setColSpan(0, 0, 2);
    FlexTable inner = new FlexTable();
    int col = 0;
    for (int i = 0; i < model.getFieldValues().length; i++) {
        ActionFieldValue val = model.getFieldValues()[i];
        inner.setWidget(i, 0 + col, fieldSelector(val));
        inner.setWidget(i, 1 + col, 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) {
            inner.setWidget(i, 2 + col, remove);
        }
    }
    layout.setWidget(1, 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) FlexTable(com.google.gwt.user.client.ui.FlexTable) HTML(com.google.gwt.user.client.ui.HTML) Image(com.google.gwt.user.client.ui.Image) TemplateVariablesChangedEvent(org.drools.workbench.screens.guided.rule.client.editor.events.TemplateVariablesChangedEvent)

Example 94 with Image

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

the class ActionCallMethodWidget method getSetterLabel.

private Widget getSetterLabel() {
    HorizontalPanel horiz = new HorizontalPanel();
    if (model.getState() == ActionCallMethod.TYPE_UNDEFINED) {
        Image edit = GuidedRuleEditorImages508.INSTANCE.AddFieldToFact();
        edit.setAltText(GuidedRuleEditorResources.CONSTANTS.AddAnotherFieldToThisSoYouCanSetItsValue());
        edit.setTitle(GuidedRuleEditorResources.CONSTANTS.AddAnotherFieldToThisSoYouCanSetItsValue());
        edit.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                Widget w = (Widget) event.getSource();
                showAddFieldPopup(w);
            }
        });
        // NON-NLS
        horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + model.getVariable() + "]"));
        if (!this.readOnly) {
            horiz.add(edit);
        }
    } else {
        // NON-NLS
        horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + model.getVariable() + "." + model.getMethodName() + "]"));
    }
    return horiz;
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Widget(com.google.gwt.user.client.ui.Widget) Image(com.google.gwt.user.client.ui.Image)

Example 95 with Image

use of com.google.gwt.user.client.ui.Image 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<FieldConstraint>();
    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);
        }
    }
}
Also used : FlexTable(com.google.gwt.user.client.ui.FlexTable) ArrayList(java.util.ArrayList) 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

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