Search in sources :

Example 31 with SmallLabel

use of org.uberfire.ext.widgets.common.client.common.SmallLabel 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 32 with SmallLabel

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

the class VerifyFieldConstraintEditor method showTypeChoice.

private void showTypeChoice(Widget w, final VerifyField con) {
    final FormStylePopup form = new FormStylePopup(TestScenarioAltedImages.INSTANCE.Wizard(), TestScenarioConstants.INSTANCE.FieldValue());
    Button lit = new Button(TestScenarioConstants.INSTANCE.LiteralValue());
    lit.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            con.setNature(FieldData.TYPE_LITERAL);
            doTypeChosen(form);
        }
    });
    form.addAttribute(TestScenarioConstants.INSTANCE.LiteralValue() + ":", widgets(lit, new InfoPopup(TestScenarioConstants.INSTANCE.LiteralValue(), TestScenarioConstants.INSTANCE.LiteralValTip())));
    form.addRow(new HTML("<hr/>"));
    form.addRow(new SmallLabel(TestScenarioConstants.INSTANCE.AdvancedOptions()));
    // If we are here, then there must be a bound variable compatible with
    // me
    Button variable = new Button(TestScenarioConstants.INSTANCE.BoundVariable());
    variable.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            con.setNature(FieldData.TYPE_VARIABLE);
            doTypeChosen(form);
        }
    });
    form.addAttribute(TestScenarioConstants.INSTANCE.AVariable(), widgets(variable, new InfoPopup(TestScenarioConstants.INSTANCE.ABoundVariable(), TestScenarioConstants.INSTANCE.BoundVariableTip())));
    form.show();
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(org.gwtbootstrap3.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FormStylePopup(org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup) HTML(com.google.gwt.user.client.ui.HTML) InfoPopup(org.uberfire.ext.widgets.common.client.common.InfoPopup)

Aggregations

SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)32 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)13 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)13 Button (org.gwtbootstrap3.client.ui.Button)12 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)9 HTML (com.google.gwt.user.client.ui.HTML)8 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)7 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)7 Image (com.google.gwt.user.client.ui.Image)7 FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)7 ListBox (org.gwtbootstrap3.client.ui.ListBox)6 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)5 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)5 TextBox (org.gwtbootstrap3.client.ui.TextBox)5 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)5 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)4 Widget (com.google.gwt.user.client.ui.Widget)3 CompositeFieldConstraint (org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint)3 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)3 ClickableLabel (org.uberfire.ext.widgets.common.client.common.ClickableLabel)3