Search in sources :

Example 16 with PlaceRequest

use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method checkOnDecisionTableSelected.

private void checkOnDecisionTableSelected(final ParameterizedCommand<PlaceRequest> setup, final Command assertion) {
    final ObservablePath dtGraphPath = mock(ObservablePath.class);
    final PlaceRequest dtGraphPlaceRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent();
    final ObservablePath dtPath = mock(ObservablePath.class);
    final PlaceRequest dtPlaceRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent(0);
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(dtPath, dtPath, dtPlaceRequest, dtContent);
    final GuidedDecisionTableGraphEntry dtGraphEntry = new GuidedDecisionTableGraphEntry(dtPath, dtPath);
    dtGraphContent.getModel().getEntries().add(dtGraphEntry);
    when(dtPath.toURI()).thenReturn("dtPath");
    when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
    when(dtGraphPath.getFileName()).thenReturn("filename");
    when(dtService.loadContent(eq(dtPath))).thenReturn(dtContent);
    when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
    when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
    when(modeller.addDecisionTable(any(ObservablePath.class), any(PlaceRequest.class), any(GuidedDecisionTableEditorContent.class), any(Boolean.class), any(Double.class), any(Double.class))).thenReturn(dtPresenter);
    when(modeller.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter);
        }
    });
    setup.execute(dtGraphPlaceRequest);
    presenter.onStartup(dtGraphPath, dtGraphPlaceRequest);
    final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter);
    presenter.onDecisionTableSelected(event);
    assertion.execute();
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTableEditorGraphContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) OverviewWidgetPresenter(org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) GuidedDecisionTableGraphEntry(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry) ObservablePath(org.uberfire.backend.vfs.ObservablePath) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)

Example 17 with PlaceRequest

use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenter method onIssueSelectedEvent.

void onIssueSelectedEvent(@Observes final IssueSelectedEvent event) {
    if (event == null) {
        return;
    }
    final PlaceRequest placeRequest = event.getPlaceRequest();
    final Issue issue = event.getIssue();
    if (placeRequest == null || issue == null) {
        renderer.clearHighlights();
    } else if (!placeRequest.equals(this.getPlaceRequest())) {
        renderer.clearHighlights();
    } else {
        renderer.highlightRows(event.getIssue().getSeverity(), event.getIssue().getRowNumbers());
    }
    getView().draw();
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) Issue(org.drools.workbench.services.verifier.api.client.reporting.Issue)

Example 18 with PlaceRequest

use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerPresenterTest method refreshDecisionTable.

@Test
public void refreshDecisionTable() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
    final GuidedDecisionTableView dtView = dtPresenter.getView();
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    final ArgumentCaptor<Command> afterRemovalCommandCaptor = ArgumentCaptor.forClass(Command.class);
    presenter.refreshDecisionTable(dtPresenter, path, placeRequest, dtContent, false);
    verify(view, times(1)).removeDecisionTable(eq(dtView), afterRemovalCommandCaptor.capture());
    final Command afterRemovalCommand = afterRemovalCommandCaptor.getValue();
    assertNotNull(afterRemovalCommand);
    afterRemovalCommand.execute();
    verify(view, times(1)).addDecisionTable(eq(dtView));
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) Command(com.google.gwt.user.client.Command) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 19 with PlaceRequest

use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerPresenterTest method addDecisionTable.

@Test
public void addDecisionTable() {
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
    presenter.addDecisionTable(path, placeRequest, dtContent, false, null, null);
    verify(presenter, times(1)).updateLinks();
    verify(gridLayer, times(1)).refreshGridWidgetConnectors();
    verify(view, times(1)).addDecisionTable(eq(dtableView));
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 20 with PlaceRequest

use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenter method getRefreshContentSuccessCallback.

private RemoteCallback<GuidedDecisionTableEditorContent> getRefreshContentSuccessCallback(final GuidedDecisionTableView.Presenter dtPresenter) {
    final ObservablePath path = dtPresenter.getLatestPath();
    final PlaceRequest place = dtPresenter.getPlaceRequest();
    final boolean isReadOnly = dtPresenter.isReadOnly();
    return (content) -> {
        // Refresh Decision Table in modeller
        modeller.refreshDecisionTable(dtPresenter, path, place, content, isReadOnly);
        activateDocument(dtPresenter);
        view.hideBusyIndicator();
    };
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTableEditorService(org.drools.workbench.screens.guided.dtable.service.GuidedDecisionTableEditorService) AlertsButtonMenuItemBuilder(org.guvnor.messageconsole.client.console.widget.button.AlertsButtonMenuItemBuilder) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) GuidedDecisionTableModellerView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView) ChangeTitleWidgetEvent(org.uberfire.client.workbench.events.ChangeTitleWidgetEvent) ClientResourceType(org.uberfire.client.workbench.type.ClientResourceType) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) KieEditorView(org.kie.workbench.common.widgets.metadata.client.KieEditorView) UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) IsWidget(com.google.gwt.user.client.ui.IsWidget) Set(java.util.Set) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) MultiPageEditor(org.uberfire.client.workbench.widgets.multipage.MultiPageEditor) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) WorkspaceProjectContext(org.guvnor.common.services.project.client.context.WorkspaceProjectContext) RegisteredDocumentsMenuBuilder(org.kie.workbench.common.widgets.metadata.client.menu.RegisteredDocumentsMenuBuilder) PlaceRequest(org.uberfire.mvp.PlaceRequest) List(java.util.List) RadarMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.RadarMenuBuilder) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Caller(org.jboss.errai.common.client.api.Caller) Optional(java.util.Optional) AssetUpdateValidator(org.kie.workbench.common.widgets.metadata.client.validation.AssetUpdateValidator) ProvidesResize(com.google.gwt.user.client.ui.ProvidesResize) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) SavePopUpPresenter(org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter) RequiresResize(com.google.gwt.user.client.ui.RequiresResize) PlaceManager(org.uberfire.client.mvp.PlaceManager) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) MenuItems(org.uberfire.ext.editor.commons.client.menu.MenuItems) ViewMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.ViewMenuBuilder) EditMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.EditMenuBuilder) MenuItem(org.uberfire.workbench.model.menu.MenuItem) Page(org.uberfire.client.workbench.widgets.multipage.Page) CommonConstants(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) Event(javax.enterprise.event.Event) ColumnsPage(org.drools.workbench.screens.guided.dtable.client.editor.page.ColumnsPage) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) OverviewWidgetPresenter(org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter) VersionRecordManager(org.uberfire.ext.editor.commons.client.history.VersionRecordManager) ValidationPopup(org.kie.workbench.common.widgets.client.popups.validation.ValidationPopup) KieMultipleDocumentEditorWrapperView(org.kie.workbench.common.widgets.metadata.client.KieMultipleDocumentEditorWrapperView) ImportsWidgetPresenter(org.kie.workbench.common.widgets.configresource.client.widget.bound.ImportsWidgetPresenter) FileMenuBuilder(org.kie.workbench.common.widgets.client.menu.FileMenuBuilder) KieMultipleDocumentEditor(org.kie.workbench.common.widgets.metadata.client.KieMultipleDocumentEditor) InsertMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.InsertMenuBuilder) SyncBeanManager(org.jboss.errai.ioc.client.container.SyncBeanManager) DefaultFileNameValidator(org.uberfire.ext.editor.commons.client.validation.DefaultFileNameValidator) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Aggregations

PlaceRequest (org.uberfire.mvp.PlaceRequest)36 ObservablePath (org.uberfire.backend.vfs.ObservablePath)33 Test (org.junit.Test)29 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)26 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)25 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)13 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)12 DecisionTableSelectedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)10 GuidedDecisionTableEditorGraphContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent)10 OverviewWidgetPresenter (org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter)7 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)6 Path (org.uberfire.backend.vfs.Path)6 GuidedDecisionTableGraphEntry (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry)5 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)4 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)4 MultiPageEditor (org.uberfire.client.workbench.widgets.multipage.MultiPageEditor)3 Scheduler (com.google.gwt.core.client.Scheduler)2 Command (com.google.gwt.user.client.Command)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2