Search in sources :

Example 96 with Image

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

the class MethodParameterCallValueEditor method choice.

private Widget choice() {
    Image clickme = CommonAltedImages.INSTANCE.Edit();
    clickme.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            showTypeChoice((Widget) event.getSource());
        }
    });
    return clickme;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Widget(com.google.gwt.user.client.ui.Widget) Image(com.google.gwt.user.client.ui.Image)

Example 97 with Image

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

the class VerifyFactWidget method render.

private FlexTable render(final VerifyFact vf) {
    FlexTable data = new FlexTable();
    for (int i = 0; i < vf.getFieldValues().size(); i++) {
        final VerifyField fld = (VerifyField) vf.getFieldValues().get(i);
        data.setWidget(i, 1, new SmallLabel(fld.getFieldName() + ":"));
        data.getFlexCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_RIGHT);
        final ListBox opr = new ListBox();
        opr.addItem(TestScenarioConstants.INSTANCE.equalsScenario(), "==");
        opr.addItem(TestScenarioConstants.INSTANCE.doesNotEqualScenario(), "!=");
        if (fld.getOperator().equals("==")) {
            opr.setSelectedIndex(0);
        } else {
            opr.setSelectedIndex(1);
        }
        opr.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                fld.setOperator(opr.getValue(opr.getSelectedIndex()));
            }
        });
        data.setWidget(i, 2, opr);
        Widget cellEditor = new VerifyFieldConstraintEditor(type, new ValueChanged() {

            public void valueChanged(String newValue) {
                fld.setExpected(newValue);
            }
        }, fld, oracle, this.scenario, this.executionTrace);
        data.setWidget(i, 3, cellEditor);
        Button deleteButton = new Button();
        deleteButton.setIcon(IconType.TRASH);
        deleteButton.setTitle(TestScenarioConstants.INSTANCE.RemoveThisFieldExpectation());
        deleteButton.addClickHandler(clickEvent -> {
            if (Window.confirm(TestScenarioConstants.INSTANCE.AreYouSureYouWantToRemoveThisFieldExpectation(fld.getFieldName()))) {
                vf.getFieldValues().remove(fld);
                FlexTable renderedTableAfterDelete = render(vf);
                outer.setWidget(1, 0, renderedTableAfterDelete);
            }
        });
        data.setWidget(i, 4, deleteButton);
        if (showResults && fld.getSuccessResult() != null) {
            if (!fld.getSuccessResult().booleanValue()) {
                data.setWidget(i, 0, new Image(CommonImages.INSTANCE.warning()));
                data.setWidget(i, 5, new HTML(TestScenarioConstants.INSTANCE.ActualResult(fld.getActualResult())));
                data.getCellFormatter().addStyleName(i, 5, // NON-NLS
                "testErrorValue");
            } else {
                data.setWidget(i, 0, new Image(TestScenarioImages.INSTANCE.testPassed()));
            }
        }
    }
    ScenarioUtils.addBottomAndRightPaddingToTableCells(data);
    return data;
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) VerifyField(org.drools.workbench.models.testscenarios.shared.VerifyField) FlexTable(com.google.gwt.user.client.ui.FlexTable) Widget(com.google.gwt.user.client.ui.Widget) HTML(com.google.gwt.user.client.ui.HTML) Image(com.google.gwt.user.client.ui.Image) ValueChanged(org.uberfire.ext.widgets.common.client.common.ValueChanged) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Button(org.gwtbootstrap3.client.ui.Button) ListBox(org.gwtbootstrap3.client.ui.ListBox)

Example 98 with Image

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

the class TestScenarioAltedImages method RuleAsset.

public Image RuleAsset() {
    Image image = new Image(TestScenarioImages.INSTANCE.RuleAsset());
    image.setAltText(CommonConstants.INSTANCE.RuleAsset());
    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