use of org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52 in project drools-wb by kiegroup.
the class GuidedDecisionTableFactory method makeTableWithActionCol.
public static GuidedDecisionTable52 makeTableWithActionCol(final String packageName, final Collection<Import> imports, final String tableName) {
final GuidedDecisionTable52 dt = new GuidedDecisionTable52();
dt.setPackageName(packageName);
dt.getImports().getImports().addAll(imports);
dt.setTableName(tableName);
ActionInsertFactCol52 ins = new ActionInsertFactCol52();
ins.setBoundName("$i");
ins.setFactType("Applicant");
ins.setFactField("age");
ins.setType(DataType.TYPE_NUMERIC_INTEGER);
dt.getActionCols().add(ins);
dt.setData(DataUtilities.makeDataLists(new String[][] { new String[] { "1", "desc", "33" } }));
return dt;
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52 in project drools-wb by kiegroup.
the class ActionInsertFactWrapper method clone.
private ActionInsertFactCol52 clone(final ActionInsertFactCol52 column) {
final ActionInsertFactCol52 clone = newActionInsertFact();
if (tableFormat() == LIMITED_ENTRY) {
asLimited(clone).setValue(asLimited(column).getValue());
}
clone.setFactField(column.getFactField());
clone.setBoundName(column.getBoundName());
clone.setValueList(column.getValueList());
clone.setHeader(column.getHeader());
clone.setInsertLogical(column.isInsertLogical());
clone.setDefaultValue(column.getDefaultValue());
clone.setFactType(column.getFactType());
clone.setHideColumn(column.isHideColumn());
clone.setType(column.getType());
return clone;
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52 in project drools-wb by kiegroup.
the class ActionInsertFactFieldsPage method lookupExistingInsertFactPattern.
private ActionInsertFactFieldsPattern lookupExistingInsertFactPattern(final String boundName) {
for (ActionInsertFactFieldsPattern p : patternToActionsMap.keySet()) {
if (p.getBoundName().equals(boundName)) {
return p;
}
}
final ActionInsertFactFieldsPattern p = new ActionInsertFactFieldsPattern();
patternToActionsMap.put(p, new ArrayList<ActionInsertFactCol52>());
return p;
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52 in project drools-wb by kiegroup.
the class ActionInsertFactFieldsPageViewImpl method initialiseChosenFields.
private void initialiseChosenFields() {
chosenFieldsContainer.add(chosenFieldsWidget);
chosenFieldsWidget.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
chosenFieldsWidget.setMinimumWidth(130);
final Label lstEmpty = new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoChosenFields());
lstEmpty.setStyleName(WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem());
chosenFieldsWidget.setEmptyListWidget(lstEmpty);
final MultiSelectionModel<ActionInsertFactCol52> selectionModel = new MultiSelectionModel<ActionInsertFactCol52>(System::identityHashCode);
chosenFieldsWidget.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(final SelectionChangeEvent event) {
chosenFieldsSelections = new HashSet<ActionInsertFactCol52>();
final Set<ActionInsertFactCol52> selections = selectionModel.getSelectedSet();
for (ActionInsertFactCol52 a : selections) {
chosenFieldsSelections.add(a);
}
chosenConditionsSelected(chosenFieldsSelections);
}
private void chosenConditionsSelected(final Set<ActionInsertFactCol52> cws) {
btnRemove.setEnabled(true);
if (cws.size() == 1) {
chosenFieldsSelection = cws.iterator().next();
fieldDefinition.setVisible(true);
validateFieldHeader();
populateFieldDefinition();
} else {
chosenFieldsSelection = null;
fieldDefinition.setVisible(false);
txtColumnHeader.setEnabled(false);
txtValueList.setEnabled(false);
defaultValueContainer.setVisible(false);
}
}
private void populateFieldDefinition() {
// Fields common to all table formats
txtColumnHeader.setEnabled(true);
txtColumnHeader.setText(chosenFieldsSelection.getHeader());
criteriaExtendedEntry.setVisible(presenter.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY);
criteriaLimitedEntry.setVisible(presenter.getTableFormat() == GuidedDecisionTable52.TableFormat.LIMITED_ENTRY);
// Fields specific to the table format
switch(presenter.getTableFormat()) {
case EXTENDED_ENTRY:
txtValueList.setEnabled(!presenter.hasEnums(chosenFieldsSelection));
txtValueList.setText(chosenFieldsSelection.getValueList());
makeDefaultValueWidget();
defaultValueContainer.setVisible(true);
break;
case LIMITED_ENTRY:
makeLimitedValueWidget();
limitedEntryValueContainer.setVisible(true);
break;
}
}
private void makeLimitedValueWidget() {
if (!(chosenFieldsSelection instanceof LimitedEntryActionInsertFactCol52)) {
return;
}
LimitedEntryActionInsertFactCol52 lea = (LimitedEntryActionInsertFactCol52) chosenFieldsSelection;
if (lea.getValue() == null) {
lea.setValue(factory.makeNewValue(chosenFieldsSelection));
}
limitedEntryValueWidgetContainer.setWidget(factory.getWidget(chosenFieldsSelection, lea.getValue()));
}
});
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52 in project drools-wb by kiegroup.
the class ActionInsertFactFieldsPageViewImpl method btnRemoveFactTypesClick.
@UiHandler(value = "btnRemoveFactTypes")
public void btnRemoveFactTypesClick(final ClickEvent event) {
for (ActionInsertFactFieldsPattern p : chosenPatternsSelections) {
chosenPatterns.remove(p);
presenter.removePattern(p);
}
chosenPatternsSelection = null;
setChosenPatterns(chosenPatterns);
setAvailableFields(new ArrayList<AvailableField>());
setChosenFields(new ArrayList<ActionInsertFactCol52>());
presenter.stateChanged();
txtBinding.setText("");
txtBinding.setEnabled(false);
btnRemoveFactTypes.setEnabled(false);
patternDefinition.setVisible(false);
}
Aggregations