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);
}
});
}
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));
}
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));
}
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());
}
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);
}
Aggregations