Search in sources :

Example 36 with Image

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

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

the class RuleModeller method initWidget.

/**
 * This updates the widget to reflect the state of the model.
 */
public void initWidget() {
    layout.removeAllRows();
    currentLayoutRow = 0;
    Image addPattern = GuidedRuleEditorImages508.INSTANCE.NewItem();
    addPattern.setTitle(GuidedRuleEditorResources.CONSTANTS.AddAConditionToThisRule());
    addPattern.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            showConditionSelector(null);
        }
    });
    layout.getColumnFormatter().setWidth(0, "20px");
    layout.getColumnFormatter().setWidth(1, "20px");
    layout.getColumnFormatter().setWidth(2, "48px");
    layout.getColumnFormatter().setWidth(4, "64px");
    if (this.showExtendedRuleDropdown()) {
        addExtendedRuleDropdown();
    }
    if (this.showLHS()) {
        layout.setWidget(currentLayoutRow, 0, new SmallLabel("<b>" + GuidedRuleEditorResources.CONSTANTS.WHEN() + "</b>"));
        layout.getFlexCellFormatter().setColSpan(currentLayoutRow, 0, 4);
        if (!lockLHS()) {
            layout.setWidget(currentLayoutRow, 1, addPattern);
        }
        currentLayoutRow++;
        renderLhs(this.model);
    }
    if (this.showRHS()) {
        layout.setWidget(currentLayoutRow, 0, new SmallLabel("<b>" + GuidedRuleEditorResources.CONSTANTS.THEN() + "</b>"));
        layout.getFlexCellFormatter().setColSpan(currentLayoutRow, 0, 4);
        Image addAction = GuidedRuleEditorImages508.INSTANCE.NewItem();
        addAction.setTitle(GuidedRuleEditorResources.CONSTANTS.AddAnActionToThisRule());
        addAction.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                showActionSelector(null);
            }
        });
        if (!lockRHS()) {
            layout.setWidget(currentLayoutRow, 1, addAction);
        }
        currentLayoutRow++;
        renderRhs(this.model);
    }
    if (showAttributes()) {
        final int optionsRowIndex = currentLayoutRow;
        if (!this.showingOptions) {
            ClickableLabel showMoreOptions = new ClickableLabel(GuidedRuleEditorResources.CONSTANTS.ShowOptions(), new ClickHandler() {

                public void onClick(ClickEvent event) {
                    showingOptions = true;
                    renderOptions(optionsRowIndex);
                }
            });
            layout.setWidget(optionsRowIndex, 2, showMoreOptions);
        } else {
            renderOptions(optionsRowIndex);
        }
    }
    currentLayoutRow++;
    layout.setWidget(currentLayoutRow + 1, 3, spacerWidget());
    layout.getCellFormatter().setHeight(currentLayoutRow + 1, 3, "100%");
}
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) ClickableLabel(org.uberfire.ext.widgets.common.client.common.ClickableLabel) Image(com.google.gwt.user.client.ui.Image)

Example 38 with Image

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

the class GuidedRuleEditorImages508 method Edit.

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

Example 39 with Image

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

the class GuidedRuleEditorImages508 method Wizard.

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

Example 40 with Image

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

the class GuidedRuleEditorImages508 method DeleteItemSmall.

public Image DeleteItemSmall() {
    Image image = new Image(GuidedRuleEditorResources.INSTANCE.itemImages().deleteItemSmall());
    image.setAltText(GuidedRuleEditorResources.CONSTANTS.DeleteItem());
    return image;
}
Also used : 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