欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

实操示例:在Java中运用CommonConstants类

最编程 2024-02-05 16:32:02
...

实例1: getCommand

import org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants; //导入依赖的package包/类
public Command getCommand(final Path path) {
    return new Command() {

        @Override
        public void execute() {
            savePopUpPresenter.show(path,
                                    new ParameterizedCommand<String>() {

                                        @Override
                                        public void execute(final String comment) {
                                            busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Restoring());
                                            versionService.call(
                                                    getRestorationSuccessCallback(),
                                                    new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView))
                                                    .restore(path,
                                                             comment);
                                        }
                                    });
        }
    };
}
 

实例2: saveDocumentGraph

import org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants; //导入依赖的package包/类
private void saveDocumentGraph(final Path editorPath) {
    final GuidedDecisionTableEditorGraphModel model = buildModelFromEditor();
    graphService.call(new RemoteCallback<Path>() {
                          @Override
                          public void callback(final Path path) {
                              editorView.hideBusyIndicator();
                              versionRecordManager.reloadVersions(path);
                              originalGraphHash = model.hashCode();
                              concurrentUpdateSessionInfo = null;
                              notificationEvent.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemSavedSuccessfully()));
                          }
                      },
                      new HasBusyIndicatorDefaultErrorCallback(view)).save(editorPath,
                                                                           model,
                                                                           content.getOverview().getMetadata(),
                                                                           commitMessage);
}
 

实例3: onRestore

import org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants; //导入依赖的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()));
    }
}
 

推荐阅读