use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldColumnSynchronizerTest method getOracle.
@Override
protected AsyncPackageDataModelOracle getOracle() {
final AsyncPackageDataModelOracle oracle = super.getOracle();
oracle.addModelFields(Collections.singletonMap("Applicant", new ModelField[] { modelField("this", "Applicant"), modelField("age", DataType.TYPE_NUMERIC_INTEGER), modelField("name", DataType.TYPE_STRING) }));
return oracle;
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class BRLActionColumnSynchronizerTest method getOracle.
@Override
protected AsyncPackageDataModelOracle getOracle() {
final AsyncPackageDataModelOracle oracle = super.getOracle();
oracle.addModelFields(new HashMap<String, ModelField[]>() {
{
put("Applicant", new ModelField[] { modelField("this", "Applicant"), modelField("age", DataType.TYPE_NUMERIC_INTEGER), modelField("salary", DataType.TYPE_NUMERIC_LONG), modelField("name", DataType.TYPE_STRING) });
put("Address", new ModelField[] { modelField("this", "Address"), modelField("country", DataType.TYPE_STRING) });
}
});
return oracle;
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class ActionSetFieldColumnSynchronizerTest method getOracle.
@Override
protected AsyncPackageDataModelOracle getOracle() {
final AsyncPackageDataModelOracle oracle = super.getOracle();
oracle.addModelFields(Collections.singletonMap("Applicant", new ModelField[] { modelField("this", "Applicant"), modelField("age", DataType.TYPE_NUMERIC_INTEGER), modelField("name", DataType.TYPE_STRING), modelField("approved", DataType.TYPE_BOOLEAN) }));
return oracle;
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class BRLConditionColumnSynchronizerTest method getOracle.
@Override
protected AsyncPackageDataModelOracle getOracle() {
final AsyncPackageDataModelOracle oracle = super.getOracle();
oracle.addModelFields(new HashMap<String, ModelField[]>() {
{
put("Applicant", new ModelField[] { modelField("this", "Applicant"), modelField("age", DataType.TYPE_NUMERIC_INTEGER), modelField("salary", DataType.TYPE_NUMERIC_LONG), modelField("name", DataType.TYPE_STRING) });
put("Address", new ModelField[] { modelField("this", "Address"), modelField("country", DataType.TYPE_STRING) });
}
});
return oracle;
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class ActionInsertFactWidget method showAddFieldPopup.
protected void showAddFieldPopup(Widget w) {
final AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorImages508.INSTANCE.Wizard(), GuidedRuleEditorResources.CONSTANTS.AddAField());
final ListBox box = new ListBox();
box.addItem("...");
final ModelField[] availableFieldCompletions = ModelFieldUtil.getAvailableFieldCompletions(fieldCompletions, model);
final boolean isEnabled = !isReadOnly() && availableFieldCompletions.length > 0;
if (availableFieldCompletions.length > 0) {
for (int i = 0; i < availableFieldCompletions.length; i++) {
box.addItem(availableFieldCompletions[i].getName());
}
}
box.setSelectedIndex(0);
popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.AddField(), box);
box.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String fieldName = box.getItemText(box.getSelectedIndex());
String fieldType = oracle.getFieldType(model.getFactType(), fieldName);
model.addFieldValue(new ActionFieldValue(fieldName, "", fieldType));
setModified(true);
getModeller().refreshWidget();
popup.hide();
}
});
/*
* Propose a textBox to the user to make him set a variable name
*/
final HorizontalPanel vn = new HorizontalPanel();
final TextBox varName = new TextBox();
if (this.model.getBoundName() != null) {
varName.setText(this.model.getBoundName());
}
final Button ok = new Button(HumanReadableConstants.INSTANCE.Set());
vn.add(varName);
vn.add(ok);
ok.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
String var = varName.getText();
if (getModeller().isVariableNameUsed(var) && ((model.getBoundName() != null && model.getBoundName().equals(var) == false) || model.getBoundName() == null)) {
Window.alert(GuidedRuleEditorResources.CONSTANTS.TheVariableName0IsAlreadyTaken(var));
return;
}
model.setBoundName(var);
setModified(true);
getModeller().refreshWidget();
popup.hide();
}
});
popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.BoundVariable(), vn);
box.setEnabled(isEnabled);
varName.setEnabled(isEnabled);
ok.setEnabled(isEnabled);
popup.show();
}
Aggregations