use of org.drools.workbench.models.testscenarios.shared.CallFieldValue 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();
}
Aggregations