当前位置: 首页>>代码示例>>Java>>正文


Java RestoreEvent类代码示例

本文整理汇总了Java中org.uberfire.ext.editor.commons.version.events.RestoreEvent的典型用法代码示例。如果您正苦于以下问题:Java RestoreEvent类的具体用法?Java RestoreEvent怎么用?Java RestoreEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RestoreEvent类属于org.uberfire.ext.editor.commons.version.events包,在下文中一共展示了RestoreEvent类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRestore

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
void onRestore(final @Observes RestoreEvent event) {
    if (event == null || event.getPath() == null) {
        return;
    }
    if (versionRecordManager.getCurrentPath() == null) {
        return;
    }
    if (versionRecordManager.getCurrentPath().equals(event.getPath())) {
        activeDocument.setVersion(null);
        activeDocument.setLatestPath(versionRecordManager.getPathToLatest());
        activeDocument.setCurrentPath(versionRecordManager.getPathToLatest());
        initialiseVersionManager(activeDocument);
        activeDocument.setReadOnly(false);
        refreshDocument(activeDocument);
        notificationEvent.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemRestored()));
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:18,代码来源:KieMultipleDocumentEditor.java

示例2: restoreMakesTheDocumentEditable

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
@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 ) );

}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:25,代码来源:KieMultipleDocumentEditorRestoreTest.java

示例3: testOnRestore

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
@Test
public void testOnRestore() {
    final TestDocument document = createTestDocument();
    final ObservablePath currentPath = document.getCurrentPath();
    final ObservablePath latestPath = mock( ObservablePath.class );
    registerDocument( document );
    activateDocument( document );

    when( versionRecordManager.getCurrentPath() ).thenReturn( currentPath );
    when( versionRecordManager.getPathToLatest() ).thenReturn( latestPath );

    editor.onRestore( new RestoreEvent( currentPath ) );

    verify( document,
            times( 1 ) ).setVersion( eq( null ) );
    verify( document,
            times( 1 ) ).setLatestPath( latestPath );
    verify( document,
            times( 1 ) ).setCurrentPath( latestPath );
    verify( editor,
            times( 2 ) ).initialiseVersionManager( eq( document ) );
    verify( editor,
            times( 1 ) ).refreshDocument( eq( document ) );
    verify( notificationEvent,
            times( 1 ) ).fire( any( NotificationEvent.class ) );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:27,代码来源:KieMultipleDocumentEditorRestoreTest.java

示例4: RestorePopUpPresenter

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
@Inject
public RestorePopUpPresenter(View view,
                             BusyIndicatorView busyIndicatorView,
                             Caller<VersionService> versionService,
                             Event<RestoreEvent> restoreEvent,
                             RestoreUtil restoreUtil,
                             ToggleCommentPresenter toggleCommentPresenter) {
    this.view = view;
    this.busyIndicatorView = busyIndicatorView;
    this.versionService = versionService;
    this.restoreEvent = restoreEvent;
    this.restoreUtil = restoreUtil;
    this.toggleCommentPresenter = toggleCommentPresenter;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:15,代码来源:RestorePopUpPresenter.java

示例5: successCallback

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
private RemoteCallback<Path> successCallback(final String currentVersionRecordUri) {
    return restored -> {
        busyIndicatorView.hideBusyIndicator();
        restoreEvent.fire(new RestoreEvent(restoreUtil.createObservablePath(
                restored,
                currentVersionRecordUri)));
    };
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:9,代码来源:RestorePopUpPresenter.java

示例6: onRestore

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
public void onRestore(@Observes RestoreEvent restore) {
    if (versionRecordManager.getCurrentPath() == null || restore == null || restore.getPath() == null) {
        return;
    }
    if (versionRecordManager.getCurrentPath().equals(restore.getPath())) {
        //when a version is restored we don't want to add the concurrency listeners again -> false
        init(versionRecordManager.getPathToLatest(),
             place,
             type,
             false,
             displayShowMoreVersions);
        notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemRestored()));
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:15,代码来源:BaseEditor.java

示例7: onRestore

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
private void onRestore(final @Observes RestoreEvent restore) {
    if (getCurrentPath() != null &&
            getCurrentPath().equals(restore.getPath()) &&
            saveButton != null) {
        saveButton.setTextToSave();
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:8,代码来源:VersionRecordManager.java

示例8: onRestore

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
void onRestore(final @Observes RestoreEvent restore) {
    if (versionRecordManager.getCurrentPath() == null || restore == null || restore.getPath() == null) {
        return;
    }
    if (versionRecordManager.getCurrentPath().equals(restore.getPath())) {
        initialiseEditor(versionRecordManager.getPathToLatest(),
                         editorPlaceRequest);
        notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemRestored()));
    }
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:11,代码来源:GuidedDecisionTableGraphEditorPresenter.java

示例9: checkOnRestore

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
@Test
public void checkOnRestore() {
    final ObservablePath dtGraphPath = mock(ObservablePath.class);
    final PathPlaceRequest dtGraphPlaceRequest = mock(PathPlaceRequest.class);
    final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent();
    final RestoreEvent event = new RestoreEvent(dtGraphPath);

    when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
    when(dtGraphPath.getFileName()).thenReturn("filename");
    when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
    when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
    when(versionRecordManager.getPathToLatest()).thenReturn(dtGraphPath);

    presenter.onStartup(dtGraphPath,
                        dtGraphPlaceRequest);

    verify(presenter,
           times(1)).initialiseEditor(eq(dtGraphPath),
                                      eq(dtGraphPlaceRequest));

    presenter.onRestore(event);

    verify(presenter,
           times(2)).initialiseEditor(eq(dtGraphPath),
                                      eq(dtGraphPlaceRequest));
    verify(notification,
           times(1)).fire(any(NotificationEvent.class));
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:29,代码来源:GuidedDecisionTableGraphEditorPresenterTest.java

示例10: setUp

import org.uberfire.ext.editor.commons.version.events.RestoreEvent; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    view = mock(BaseEditorView.class);
    restoreEvent = mock(RestoreEvent.class);
    kieEditor = spy(new BaseEditor(view) {

        @Override
        protected void loadContent() {
        }

        @Override
        protected void showVersions() {

        }

        @Override
        protected void makeMenuBar() {

        }

        @Override
        protected void showConcurrentUpdatePopup() {
            // Overriding for testing.
        }

        @Override
        void disableMenus() {

        }

        @Override
        public void reload() {

        }
    });

    kieEditor.placeManager = mock(PlaceManager.class);
    kieEditor.concurrentRenameIgnoredEvent = spy(new EventMock<>());
    kieEditor.concurrentRenameAcceptedEvent = spy(new EventMock<>());
    kieEditor.concurrentDeleteIgnoredEvent = spy(new EventMock<>());
    kieEditor.concurrentDeleteAcceptedEvent = spy(new EventMock<>());
    kieEditor.versionRecordManager = mock(VersionRecordManager.class);
    kieEditor.notification = new EventMock<>();
    observablePath = mock(ObservablePath.class);
    PlaceRequest placeRequest = mock(PlaceRequest.class);
    ClientResourceType resourceType = mock(ClientResourceType.class);
    kieEditor.init(observablePath,
                   placeRequest,
                   resourceType);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:51,代码来源:KieEditorTest.java


注:本文中的org.uberfire.ext.editor.commons.version.events.RestoreEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。