use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class NewGuidedDecisionTableHandler method createEmptyDecisionTable.
private void createEmptyDecisionTable(final Path contextPath, final String baseFileName) {
final GuidedDecisionTable52 model = new GuidedDecisionTable52();
model.setTableFormat(options.getTableFormat());
model.setHitPolicy(options.getHitPolicy());
if (GuidedDecisionTable52.HitPolicy.RESOLVED_HIT.equals(options.getHitPolicy())) {
final MetadataCol52 metadataCol52 = new MetadataCol52();
metadataCol52.setMetadata(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT_METADATA_NAME);
model.getMetadataCols().add(metadataCol52);
}
model.setTableName(baseFileName);
final RemoteCallback<Path> onSaveSuccessCallback = getSuccessCallback(newResourcePresenter);
busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
service.call((Path path) -> {
busyIndicatorView.hideBusyIndicator();
onSaveSuccessCallback.callback(path);
}, new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(contextPath, buildFileName(baseFileName, resourceType), model, "");
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testHideMetadataClickHandlerWhenVetoExceptionIsNotRaised.
@Test
public void testHideMetadataClickHandlerWhenVetoExceptionIsNotRaised() throws Exception {
final MetadataCol52 clone = mock(MetadataCol52.class);
final CheckBox checkBox = mock(CheckBox.class);
final ClickEvent clickEvent = mock(ClickEvent.class);
final GuidedDecisionTableView.Presenter activeDecisionTable = mock(GuidedDecisionTableView.Presenter.class);
doReturn(Optional.of(activeDecisionTable)).when(modeller).getActiveDecisionTable();
doReturn(clone).when(metadataColumn).cloneColumn();
final ClickHandler clickHandler = presenter.hideMetadataClickHandler(modeller, checkBox, metadataColumn);
clickHandler.onClick(clickEvent);
verify(clone).setHideColumn(checkBox.getValue());
verify(activeDecisionTable).updateColumn(metadataColumn, clone);
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsNotEmpty.
@Test
public void testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsNotEmpty() {
final MetadataCol52 metadataColumn1 = mock(MetadataCol52.class);
final MetadataCol52 metadataColumn2 = mock(MetadataCol52.class);
final HorizontalPanel metaDataWidget1 = mock(HorizontalPanel.class);
final HorizontalPanel metaDataWidget2 = mock(HorizontalPanel.class);
final List<MetadataCol52> metaDataColumns = new ArrayList<MetadataCol52>() {
{
add(metadataColumn1);
add(metadataColumn2);
}
};
doReturn(verticalPanel).when(presenter).getMetaDataWidget();
doReturn(metaDataWidget1).when(presenter).makeMetaDataWidget(modeller, metadataColumn1);
doReturn(metaDataWidget2).when(presenter).makeMetaDataWidget(modeller, metadataColumn2);
presenter.refreshMetaDataWidget(metaDataColumns);
verify(verticalPanel).clear();
verify(verticalPanel).add(metaDataWidget1);
verify(verticalPanel).add(metaDataWidget2);
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterAttributesAndMetadataTest method appendMetadataColumn.
@Test
public void appendMetadataColumn() throws VetoException {
reset(modellerPresenter);
final MetadataCol52 column = new MetadataCol52();
column.setMetadata("metadata");
dtPresenter.appendColumn(column);
verify(synchronizer, times(1)).appendColumn(eq(column));
verify(refreshMetaDataPanelEvent, times(1)).fire(any(RefreshMetaDataPanelEvent.class));
verify(modellerPresenter, times(1)).updateLinks();
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterAttributesAndMetadataTest method isMetaDataUnique.
@Test
public void isMetaDataUnique() {
final MetadataCol52 metadata = new MetadataCol52();
metadata.setMetadata("metadata");
dtPresenter.getModel().getMetadataCols().add(metadata);
assertFalse(dtPresenter.isMetaDataUnique("metadata"));
assertTrue(dtPresenter.isMetaDataUnique("cheese"));
}
Aggregations