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);
}
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();
}
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();
}
Aggregations