use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumn in project drools-wb by kiegroup.
the class ActionColumnSynchronizer method isWorkItemFragment.
protected boolean isWorkItemFragment(final List<? extends MetaData> metaData) {
if (!metaData.stream().allMatch((c) -> (c instanceof MoveColumnToMetaData))) {
return false;
}
if (!metaData.stream().map(c -> (MoveColumnToMetaData) c).allMatch(this::isWorkItemActionColumn)) {
return false;
}
final BaseColumn firstColumnInFragment = ((MoveColumnToMetaData) metaData.get(0)).getColumn();
final BaseColumn lastColumnInFragment = ((MoveColumnToMetaData) metaData.get(metaData.size() - 1)).getColumn();
final int firstColumnIndex = model.getExpandedColumns().indexOf(firstColumnInFragment);
final int lastColumnIndex = model.getExpandedColumns().indexOf(lastColumnInFragment);
return lastColumnIndex - firstColumnIndex == metaData.size() - 1;
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumn in project drools-wb by kiegroup.
the class ActionInsertFactColumnSynchronizer method isActionInsertFactFragment.
private boolean isActionInsertFactFragment(final List<? extends MetaData> metaData) {
if (!metaData.stream().allMatch((c) -> (c instanceof MoveColumnToMetaData))) {
return false;
}
if (!metaData.stream().map(c -> (MoveColumnToMetaData) c).allMatch(c -> c.getColumn() instanceof ActionInsertFactCol52)) {
return false;
}
final int lastMetaDataIndex = metaData.size() - 1;
final BaseColumn firstColumnInFragment = ((MoveColumnToMetaData) metaData.get(0)).getColumn();
final BaseColumn lastColumnInFragment = ((MoveColumnToMetaData) metaData.get(lastMetaDataIndex)).getColumn();
final int firstColumnIndex = model.getExpandedColumns().indexOf(firstColumnInFragment);
final int lastColumnIndex = model.getExpandedColumns().indexOf(lastColumnInFragment);
return lastColumnIndex - firstColumnIndex == lastMetaDataIndex;
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumn in project drools-wb by kiegroup.
the class ColumnHeaderPopOverImplTest method makeBuildersInstance.
private Instance<ColumnDefinitionBuilder> makeBuildersInstance() {
final List<ColumnDefinitionBuilder> builders = new ArrayList<>();
builders.add(new ConditionCol52DefinitionBuilder(serviceCaller));
builders.add(new ColumnDefinitionBuilder() {
@Override
public Class getSupportedColumnType() {
return RowNumberCol52.class;
}
@Override
public void generateDefinition(final GuidedDecisionTableView.Presenter dtPresenter, final BaseColumn column, final Callback<String> afterGenerationCallback) {
afterGenerationCallback.callback(column.getHeader());
}
});
builders.add(new ColumnDefinitionBuilder() {
@Override
public Class getSupportedColumnType() {
return DescriptionCol52.class;
}
@Override
public void generateDefinition(final GuidedDecisionTableView.Presenter dtPresenter, final BaseColumn column, final Callback<String> afterGenerationCallback) {
afterGenerationCallback.callback(column.getHeader());
}
});
return new MockInstanceImpl<>(builders);
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumn in project drools-wb by kiegroup.
the class GridWidgetColumnFactoryImplTest method columnResizingListenerSetup_RowNumberColumn.
@Test
public void columnResizingListenerSetup_RowNumberColumn() {
final BaseColumn column = new RowNumberCol52();
final GridColumn<?> uiColumn = factory.convertColumn(column, access, gridWidget);
assertFalse(uiColumn instanceof BaseUiColumn);
assertEquals((int) uiColumn.getWidth(), column.getWidth());
assertEquals(50.0, column.getWidth(), 0.0);
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumn in project drools-wb by kiegroup.
the class DTCellValueWidgetFactory method makeListBoxForColumn.
private ListBox makeListBoxForColumn(final DropDownData dd, final Pattern52 basePattern, final BaseColumn baseCondition, final DTCellValue52 dcv, final boolean isMultipleSelect) {
final ListBox lb = makeListBox(dd, isMultipleSelect, dcv);
// Wire up update handler
lb.setEnabled(!isReadOnly);
if (!isReadOnly) {
lb.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String value = null;
if (lb.isMultipleSelect()) {
for (int i = 0; i < lb.getItemCount(); i++) {
if (lb.isItemSelected(i)) {
if (value == null) {
value = lb.getValue(i);
} else {
value = value + "," + lb.getValue(i);
}
}
}
} else {
int index = lb.getSelectedIndex();
if (index > -1) {
// Set base column value
value = lb.getValue(index);
}
}
dcv.setStringValue(value);
// Update any dependent enumerations
final LimitedEntryDropDownManager.Context context = new LimitedEntryDropDownManager.Context(basePattern, baseCondition);
Set<Integer> dependentColumnIndexes = dropDownManager.getDependentColumnIndexes(context);
for (Integer iCol : dependentColumnIndexes) {
BaseColumn column = model.getExpandedColumns().get(iCol);
if (column instanceof LimitedEntryCol) {
((LimitedEntryCol) column).setValue(null);
} else if (column instanceof DTColumnConfig52) {
((DTColumnConfig52) column).setDefaultValue(null);
}
}
}
});
}
return lb;
}
Aggregations