Search in sources :

Example 21 with FormStylePopup

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

the class PopupCreatorTest method testMakeExpressionEditorButton.

@Test
public void testMakeExpressionEditorButton() {
    final HasConstraints hasConstraints = mock(HasConstraints.class);
    final FormStylePopup popup = mock(FormStylePopup.class);
    final Button button = mock(Button.class);
    final ClickHandler clickHandler = mock(ClickHandler.class);
    doReturn(button).when(popupCreator).makeExpressionEditorButton();
    doReturn(clickHandler).when(popupCreator).onExpressionEditorButtonClick(hasConstraints, popup);
    popupCreator.makeExpressionEditorButton(hasConstraints, popup);
    verify(button).addClickHandler(clickHandler);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) HasConstraints(org.drools.workbench.models.datamodel.rule.HasConstraints) Button(org.gwtbootstrap3.client.ui.Button) FormStylePopup(org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup) Test(org.junit.Test)

Example 22 with FormStylePopup

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

the class CallMethodWidget method showAddFieldPopup.

protected void showAddFieldPopup(final Widget w) {
    final FormStylePopup popup = new FormStylePopup(TestScenarioAltedImages.INSTANCE.Wizard(), TestScenarioConstants.INSTANCE.ChooseAMethodToInvoke());
    ListBox box = new ListBox();
    box.addItem("...");
    for (int i = 0; i < fieldCompletionTexts.length; i++) {
        box.addItem(fieldCompletionTexts[i], fieldCompletionValues[i]);
    }
    box.setSelectedIndex(0);
    popup.addAttribute(TestScenarioConstants.INSTANCE.ChooseAMethodToInvoke(), box);
    box.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            mCall.setState(ActionCallMethod.TYPE_DEFINED);
            ListBox sourceW = (ListBox) event.getSource();
            final String methodName = sourceW.getItemText(sourceW.getSelectedIndex());
            final String methodNameWithParams = sourceW.getValue(sourceW.getSelectedIndex());
            mCall.setMethodName(methodName);
            oracle.getMethodParams(variableClass, methodNameWithParams, new Callback<List<String>>() {

                @Override
                public void callback(final List<String> fieldList) {
                    // String fieldType = oracle.getFieldType( variableClass, fieldName );
                    int i = 0;
                    for (String fieldParameter : fieldList) {
                        mCall.addFieldValue(new CallFieldValue(methodName, String.valueOf(i), fieldParameter));
                        i++;
                    }
                    parent.renderEditor();
                    popup.hide();
                }
            });
        }
    });
    popup.show();
}
Also used : Callback(org.uberfire.client.callbacks.Callback) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FormStylePopup(org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup) List(java.util.List) ListBox(org.gwtbootstrap3.client.ui.ListBox) CallFieldValue(org.drools.workbench.models.testscenarios.shared.CallFieldValue)

Example 23 with FormStylePopup

use of org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup 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

FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)23 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)15 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)14 Button (org.gwtbootstrap3.client.ui.Button)14 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)12 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)12 ListBox (org.gwtbootstrap3.client.ui.ListBox)12 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)8 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)7 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)7 FromCompositeFactPattern (org.drools.workbench.models.datamodel.rule.FromCompositeFactPattern)6 HTML (com.google.gwt.user.client.ui.HTML)5 FromAccumulateCompositeFactPattern (org.drools.workbench.models.datamodel.rule.FromAccumulateCompositeFactPattern)5 FromCollectCompositeFactPattern (org.drools.workbench.models.datamodel.rule.FromCollectCompositeFactPattern)5 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)5 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)4 Widget (com.google.gwt.user.client.ui.Widget)4 FromEntryPointFactPattern (org.drools.workbench.models.datamodel.rule.FromEntryPointFactPattern)4 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)4 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)4