Search in sources :

Example 1 with SmallLabel

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

the class ActivateRuleFlowWidget method render.

private void render(final FixtureList retList, final FlexTable outer, final Scenario sc) {
    outer.clear();
    outer.getCellFormatter().setStyleName(0, 0, "modeller-fact-TypeHeader");
    outer.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
    outer.setStyleName("modeller-fact-pattern-Widget");
    outer.setWidget(0, 0, new SmallLabel(TestScenarioConstants.INSTANCE.ActivateRuleFlowGroup()));
    outer.getFlexCellFormatter().setColSpan(0, 0, 2);
    int row = 1;
    for (Fixture fixture : retList) {
        final ActivateRuleFlowGroup acticateRuleFlowGroup = (ActivateRuleFlowGroup) fixture;
        outer.setWidget(row, 0, new SmallLabel(acticateRuleFlowGroup.getName()));
        Button deleteButton = new Button();
        deleteButton.setIcon(IconType.TRASH);
        deleteButton.setTitle(TestScenarioConstants.INSTANCE.RemoveThisRuleFlowActivation());
        deleteButton.addClickHandler(clickEvent -> {
            retList.remove(acticateRuleFlowGroup);
            sc.getFixtures().remove(acticateRuleFlowGroup);
            render(retList, outer, sc);
            parent.renderEditor();
        });
        outer.setWidget(row, 1, deleteButton);
        row++;
    }
    ScenarioUtils.addBottomAndRightPaddingToTableCells(outer);
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) Button(org.gwtbootstrap3.client.ui.Button) Fixture(org.drools.workbench.models.testscenarios.shared.Fixture) ActivateRuleFlowGroup(org.drools.workbench.models.testscenarios.shared.ActivateRuleFlowGroup)

Example 2 with SmallLabel

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

the class CallMethodWidget method getSetterLabel.

private Widget getSetterLabel() {
    HorizontalPanel horiz = new HorizontalPanel();
    if (mCall.getState() == ActionCallMethod.TYPE_UNDEFINED) {
        Image edit = TestScenarioAltedImages.INSTANCE.AddFieldToFact();
        edit.setTitle(TestScenarioConstants.INSTANCE.AddAnotherFieldToThisSoYouCanSetItsValue());
        edit.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                Image w = (Image) event.getSource();
                showAddFieldPopup(w);
            }
        });
        // NON-NLS
        horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + mCall.getVariable() + "]"));
        horiz.add(edit);
    } else {
        // NON-NLS
        horiz.add(new SmallLabel(HumanReadable.getActionDisplayName("call") + " [" + mCall.getVariable() + "." + mCall.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) Image(com.google.gwt.user.client.ui.Image)

Example 3 with SmallLabel

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

the class MethodParameterCallValueEditor method showTypeChoice.

protected void showTypeChoice(final Widget w) {
    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) {
            methodParameter.nature = FieldData.TYPE_LITERAL;
            methodParameter.value = " ";
            refresh();
            form.hide();
        }
    });
    form.addAttribute(TestScenarioConstants.INSTANCE.LiteralValue() + ":", widgets(lit, new InfoPopup(TestScenarioConstants.INSTANCE.Literal(), TestScenarioConstants.INSTANCE.LiteralValTip())));
    form.addRow(new HTML("<hr/>"));
    form.addRow(new SmallLabel(TestScenarioConstants.INSTANCE.AdvancedSection()));
    /*
         * If there is a bound variable that is the same type of the current
         * variable type, then show a button
         */
    List<String> vars = model.getFactNamesInScope(ex, true);
    for (String v : vars) {
        boolean createButton = false;
        Button variable = new Button(TestScenarioConstants.INSTANCE.BoundVariable());
        FactData factData = (FactData) model.getFactTypes().get(v);
        if (factData.getType().equals(this.parameterType)) {
            createButton = true;
        }
        if (createButton == true) {
            form.addAttribute(TestScenarioConstants.INSTANCE.BoundVariable() + ":", variable);
            variable.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    methodParameter.nature = FieldData.TYPE_VARIABLE;
                    methodParameter.value = "=";
                    refresh();
                    form.hide();
                }
            });
            break;
        }
    }
    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) FactData(org.drools.workbench.models.testscenarios.shared.FactData) 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)

Example 4 with SmallLabel

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

the class VerifyRulesFiredWidget method render.

private FlexTable render(final FixtureList rfl, final Scenario sc) {
    FlexTable data = new FlexTable();
    for (int i = 0; i < rfl.size(); i++) {
        final VerifyRuleFired v = (VerifyRuleFired) rfl.get(i);
        if (showResults && v.getSuccessResult() != null) {
            if (!v.getSuccessResult().booleanValue()) {
                data.setWidget(i, 0, new Image(CommonImages.INSTANCE.warning()));
                data.setWidget(i, 4, new HTML(TestScenarioConstants.INSTANCE.ActualResult(v.getActualResult().toString())));
                data.getCellFormatter().addStyleName(i, 4, // NON-NLS
                "testErrorValue");
            } else {
                data.setWidget(i, 0, new Image(TestScenarioImages.INSTANCE.testPassed()));
            }
        }
        data.setWidget(i, 1, new SmallLabel(v.getRuleName() + ":"));
        data.getFlexCellFormatter().setAlignment(i, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE);
        final ListBox b = new ListBox();
        b.addItem(TestScenarioConstants.INSTANCE.firedAtLeastOnce(), "y");
        b.addItem(TestScenarioConstants.INSTANCE.didNotFire(), "n");
        b.addItem(TestScenarioConstants.INSTANCE.firedThisManyTimes(), "e");
        final TextBox num = new TextBox();
        ((InputElement) num.getElement().cast()).setSize(5);
        if (v.getExpectedFire() != null) {
            b.setSelectedIndex((v.getExpectedFire().booleanValue()) ? 0 : 1);
            num.setVisible(false);
        } else {
            b.setSelectedIndex(2);
            String xc = (v.getExpectedCount() != null) ? "" + v.getExpectedCount().intValue() : "0";
            num.setText(xc);
        }
        b.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                String s = b.getValue(b.getSelectedIndex());
                if (s.equals("y") || s.equals("n")) {
                    num.setVisible(false);
                    v.setExpectedFire((s.equals("y")) ? Boolean.TRUE : Boolean.FALSE);
                    v.setExpectedCount(null);
                } else {
                    num.setVisible(true);
                    v.setExpectedFire(null);
                    num.setText("1");
                    v.setExpectedCount(Integer.valueOf(1));
                }
            }
        });
        b.addItem(TestScenarioConstants.INSTANCE.ChooseDotDotDot());
        num.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                v.setExpectedCount(Integer.valueOf(num.getText()));
            }
        });
        HorizontalPanel h = new HorizontalPanel();
        h.add(b);
        h.add(num);
        data.setWidget(i, 2, h);
        Button del = new Button();
        del.setIcon(IconType.TRASH);
        del.setTitle(TestScenarioConstants.INSTANCE.RemoveThisRuleExpectation());
        del.addClickHandler(clickEvent -> {
            if (Window.confirm(TestScenarioConstants.INSTANCE.AreYouSureYouWantToRemoveThisRuleExpectation())) {
                rfl.remove(v);
                sc.removeFixture(v);
                outer.setWidget(1, 0, render(rfl, sc));
            }
        });
        data.setWidget(i, 3, del);
        // we only want numbers here...
        num.addKeyPressHandler(new KeyPressHandler() {

            public void onKeyPress(KeyPressEvent event) {
                if (Character.isLetter(event.getCharCode())) {
                    ((TextBox) event.getSource()).cancelKey();
                }
            }
        });
    }
    ScenarioUtils.addBottomAndRightPaddingToTableCells(data);
    return data;
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) VerifyRuleFired(org.drools.workbench.models.testscenarios.shared.VerifyRuleFired) FlexTable(com.google.gwt.user.client.ui.FlexTable) HTML(com.google.gwt.user.client.ui.HTML) TextBox(org.gwtbootstrap3.client.ui.TextBox) InputElement(com.google.gwt.dom.client.InputElement) Image(com.google.gwt.user.client.ui.Image) KeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) KeyPressEvent(com.google.gwt.event.dom.client.KeyPressEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Button(org.gwtbootstrap3.client.ui.Button) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ListBox(org.gwtbootstrap3.client.ui.ListBox)

Example 5 with SmallLabel

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

the class AttributeColumnConfigRowView method addDefaultValue.

public void addDefaultValue(AttributeCol52 attributeColumn, boolean isEditable, DefaultValueWidgetFactory.DefaultValueChangedEventHandler handler) {
    final FlowPanel panel = new FlowPanel();
    panel.add(new SmallLabel(new StringBuilder(GuidedDecisionTableConstants.INSTANCE.DefaultValue()).append(GuidedDecisionTableConstants.COLON).toString()));
    panel.add(DefaultValueWidgetFactory.getDefaultValueWidget(attributeColumn, !isEditable, handler));
    add(panel);
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

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