use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class BaseWidgetFactory method factory.
protected DTCellValueWidgetFactory factory() {
final GuidedDecisionTable52 model = getPlugin().getPresenter().getModel();
final AsyncPackageDataModelOracle oracle = getPlugin().getPresenter().getDataModelOracle();
final boolean allowEmptyValues = model.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY;
return DTCellValueWidgetFactory.getInstance(model, oracle, false, allowEmptyValues);
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class BaseGuidedDecisionTablePresenterTest method makeDecisionTable.
protected GuidedDecisionTableView.Presenter makeDecisionTable(final Path originalPath, final ObservablePath path, final PlaceRequest placeRequest, final GuidedDecisionTableEditorContent content) {
final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
final AsyncPackageDataModelOracle oracle = mock(AsyncPackageDataModelOracle.class);
final Overview overview = mock(Overview.class);
final GuidedDecisionTablePresenter.Access access = new GuidedDecisionTablePresenter.Access();
when(dtService.loadContent(eq(path))).thenReturn(content);
when(modeller.addDecisionTable(eq(path), eq(placeRequest), eq(content), any(Boolean.class), any(Double.class), any(Double.class))).thenReturn(dtPresenter);
when(path.getOriginal()).thenReturn(originalPath);
when(dtPresenter.getLatestPath()).thenReturn(path);
when(dtPresenter.getCurrentPath()).thenReturn(path);
when(dtPresenter.getPlaceRequest()).thenReturn(placeRequest);
when(dtPresenter.getModel()).thenReturn(content.getModel());
when(dtPresenter.getDataModelOracle()).thenReturn(oracle);
when(dtPresenter.getOverview()).thenReturn(overview);
when(dtPresenter.getAccess()).thenReturn(access);
when(dtPresenter.getView()).thenReturn(mock(GuidedDecisionTableView.class));
when(overview.getMetadata()).thenReturn(mock(Metadata.class));
return dtPresenter;
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method testActivateDocument.
@Test
public void testActivateDocument() {
final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
final Overview overview = mock(Overview.class);
final AsyncPackageDataModelOracle oracle = mock(AsyncPackageDataModelOracle.class);
final GuidedDecisionTable52 model = mock(GuidedDecisionTable52.class);
final Imports imports = mock(Imports.class);
final GuidedDecisionTablePresenter.Access access = mock(GuidedDecisionTablePresenter.Access.class);
final MultiPageEditor pageEditor = mock(MultiPageEditor.class);
final boolean isEditable = true;
doReturn(overview).when(dtPresenter).getOverview();
doReturn(oracle).when(dtPresenter).getDataModelOracle();
doReturn(model).when(dtPresenter).getModel();
doReturn(imports).when(model).getImports();
doReturn(access).when(dtPresenter).getAccess();
doReturn(isEditable).when(access).isEditable();
doReturn(pageEditor).when(presenter).getKieEditorWrapperMultiPage();
doNothing().when(presenter).activateDocument(any(), any(), any(), any(), anyBoolean());
presenter.activateDocument(dtPresenter);
verify(dtPresenter).activate();
verify(presenter).enableMenus(true);
verify(presenter).addColumnsTab();
verify(presenter).enableColumnsTab(dtPresenter);
verify(presenter).activateDocument(dtPresenter, overview, oracle, imports, !isEditable);
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorPresenterTest method checkInitialiseKieEditorTabs.
@Test
public void checkInitialiseKieEditorTabs() {
final ObservablePath dtGraphPath = mock(ObservablePath.class);
final PlaceRequest dtGraphPlaceRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent(0);
when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
when(dtGraphPath.getFileName()).thenReturn("filename");
when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
when(versionRecordManager.getVersion()).thenReturn("version");
presenter.onStartup(dtGraphPath, dtGraphPlaceRequest);
verify(kieEditorWrapperView, times(1)).clear();
final GuidedDecisionTableView.Presenter document = mock(GuidedDecisionTableView.Presenter.class);
final AsyncPackageDataModelOracle dmo = mock(AsyncPackageDataModelOracle.class);
final Imports imports = mock(Imports.class);
final boolean isReadOnly = true;
final ArgumentCaptor<com.google.gwt.user.client.Command> onFocusCommandCaptor = ArgumentCaptor.forClass(com.google.gwt.user.client.Command.class);
presenter.initialiseKieEditorTabs(document, dtGraphContent.getOverview(), dmo, imports, isReadOnly);
verify(kieEditorWrapperView, times(2)).clear();
verify(kieEditorWrapperView, times(2)).addMainEditorPage(view);
verify(kieEditorWrapperView, times(2)).addOverviewPage(eq(overviewWidget), onFocusCommandCaptor.capture());
verify(overviewWidget, times(2)).setContent(eq(dtGraphContent.getOverview()), any(ObservablePath.class));
verify(kieEditorWrapperView, times(1)).addSourcePage(any(ViewDRLSourceWidget.class));
verify(kieEditorWrapperView, times(1)).addImportsTab(eq(importsWidget));
verify(importsWidget, times(1)).setContent(eq(dmo), eq(imports), eq(isReadOnly));
final com.google.gwt.user.client.Command onFocusCommand = onFocusCommandCaptor.getValue();
assertNotNull(onFocusCommand);
onFocusCommand.execute();
verify(overviewWidget, times(1)).refresh(eq("version"));
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class FieldPage method forEachFactField.
void forEachFactField(Consumer<String> consumer) {
if (hasEditingPattern()) {
final AsyncPackageDataModelOracle oracle = presenter.getDataModelOracle();
oracle.getFieldCompletions(factType(), getAccessor(), fieldsCallback(consumer));
}
}
Aggregations