Search in sources :

Example 56 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.

the class AbstractProjectDiagramEditor method saveAsXML.

private void saveAsXML(final String commitMessage) {
    final ObservablePath diagramPath = versionRecordManager.getCurrentPath();
    projectDiagramServices.saveAsXml(diagramPath, stunnerEditor.getXmlEditorView().getContent(), metadata, commitMessage, new ServiceCallback<String>() {

        @Override
        public void onSuccess(final String xml) {
            getSaveSuccessCallback(xml.hashCode()).callback(diagramPath);
            showMessage(org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants.INSTANCE.ItemSavedSuccessfully());
            onSaveSuccess();
        }

        @Override
        public void onError(final ClientRuntimeError error) {
            AbstractProjectDiagramEditor.this.onError(error);
        }
    });
}
Also used : ClientRuntimeError(org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Example 57 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.

the class KieMultipleDocumentEditorRestoreTest method restoreMakesTheDocumentEditable.

@Test
public void restoreMakesTheDocumentEditable() throws Exception {
    final TestDocument document = createTestDocument();
    final ObservablePath currentPath = document.getCurrentPath();
    registerDocument(document);
    activateDocument(document);
    when(versionRecordManager.getCurrentPath()).thenReturn(currentPath);
    editor.onRestore(new RestoreEvent(currentPath));
    final InOrder inOrder = inOrder(document, editor);
    // Order is important. Flip these around and document is editable, but the view is not.
    inOrder.verify(document).setReadOnly(false);
    inOrder.verify(editor, times(1)).refreshDocument(eq(document));
}
Also used : InOrder(org.mockito.InOrder) RestoreEvent(org.uberfire.ext.editor.commons.version.events.RestoreEvent) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 58 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.

the class KieMultipleDocumentEditorTestBase method createTestDocument.

protected TestDocument createTestDocument() {
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    return spy(new TestDocument(path, placeRequest));
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Example 59 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.

the class OverviewWidgetPresenterTest method testAddingDescription.

@Test
public void testAddingDescription() throws Exception {
    Metadata metadata = new Metadata();
    overview.setMetadata(metadata);
    ObservablePath observablePath = mock(ObservablePath.class);
    editor.setContent(overview, observablePath);
    presenter.onDescriptionEdited("Hello");
    assertEquals("Hello", overview.getMetadata().getDescription());
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 60 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.

the class KieMultipleDocumentEditorTest method testDeregisterDocument.

@Test()
public void testDeregisterDocument() {
    final TestDocument document = createTestDocument();
    final ObservablePath path = document.getLatestPath();
    registerDocument(document);
    editor.deregisterDocument(document);
    verify(path, times(1)).dispose();
    verify(registeredDocumentsMenuBuilder, times(1)).deregisterDocument(document);
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Aggregations

ObservablePath (org.uberfire.backend.vfs.ObservablePath)97 Test (org.junit.Test)70 PlaceRequest (org.uberfire.mvp.PlaceRequest)38 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)32 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)29 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)19 Path (org.uberfire.backend.vfs.Path)14 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)13 GuidedDecisionTableEditorGraphContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent)13 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)11 DecisionTableSelectedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)11 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)11 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)9 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)8 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)7 OverviewWidgetPresenter (org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter)7 List (java.util.List)6 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)6 Command (org.uberfire.mvp.Command)6 ArrayList (java.util.ArrayList)5