예제 #1
0
 @Override
 protected void save(String commitMessage) {
   dslTextEditorService
       .call(
           getSaveSuccessCallback(view.getContent().hashCode()),
           new HasBusyIndicatorDefaultErrorCallback(view))
       .save(versionRecordManager.getCurrentPath(), view.getContent(), metadata, commitMessage);
 }
예제 #2
0
 @OnMayClose
 public boolean checkIfDirty() {
   if (isDirty()) {
     return view.confirmClose();
   }
   return true;
 }
예제 #3
0
  @OnSave
  public void onSave() {
    if (isReadOnly) {
      view.alertReadOnly();
      return;
    }

    if (concurrentUpdateSessionInfo != null) {
      newConcurrentUpdate(
              concurrentUpdateSessionInfo.getPath(),
              concurrentUpdateSessionInfo.getIdentity(),
              new Command() {
                @Override
                public void execute() {
                  save();
                }
              },
              new Command() {
                @Override
                public void execute() {
                  // cancel?
                }
              },
              new Command() {
                @Override
                public void execute() {
                  reload();
                }
              })
          .show();
    } else {
      save();
    }
  }
예제 #4
0
 @IsDirty
 public boolean isDirty() {
   return view.isDirty();
 }
예제 #5
0
 private void reload() {
   changeTitleNotification.fire(new ChangeTitleWidgetEvent(place, getTitle(), null));
   view.showBusyIndicator(CommonConstants.INSTANCE.Loading());
   loadContent();
 }
예제 #6
0
  @OnStartup
  public void onStartup(final ObservablePath path, final PlaceRequest place) {
    this.path = path;
    this.place = place;
    this.isReadOnly = place.getParameter("readOnly", null) == null ? false : true;
    this.version = place.getParameter("version", null);

    this.path.onRename(
        new Command() {
          @Override
          public void execute() {
            changeTitleNotification.fire(new ChangeTitleWidgetEvent(place, getTitle(), null));
          }
        });
    this.path.onConcurrentUpdate(
        new ParameterizedCommand<ObservablePath.OnConcurrentUpdateEvent>() {
          @Override
          public void execute(final ObservablePath.OnConcurrentUpdateEvent eventInfo) {
            concurrentUpdateSessionInfo = eventInfo;
          }
        });

    this.path.onConcurrentRename(
        new ParameterizedCommand<ObservablePath.OnConcurrentRenameEvent>() {
          @Override
          public void execute(final ObservablePath.OnConcurrentRenameEvent info) {
            newConcurrentRename(
                    info.getSource(),
                    info.getTarget(),
                    info.getIdentity(),
                    new Command() {
                      @Override
                      public void execute() {
                        disableMenus();
                      }
                    },
                    new Command() {
                      @Override
                      public void execute() {
                        reload();
                      }
                    })
                .show();
          }
        });

    this.path.onConcurrentDelete(
        new ParameterizedCommand<ObservablePath.OnConcurrentDelete>() {
          @Override
          public void execute(final ObservablePath.OnConcurrentDelete info) {
            newConcurrentDelete(
                    info.getPath(),
                    info.getIdentity(),
                    new Command() {
                      @Override
                      public void execute() {
                        disableMenus();
                      }
                    },
                    new Command() {
                      @Override
                      public void execute() {
                        placeManager.closePlace(place);
                      }
                    })
                .show();
          }
        });

    makeMenuBar();

    view.showBusyIndicator(CommonConstants.INSTANCE.Loading());

    multiPage.addWidget(view, DSLTextEditorConstants.INSTANCE.DSL());

    multiPage.addPage(
        new Page(metadataWidget, CommonConstants.INSTANCE.MetadataTabTitle()) {
          @Override
          public void onFocus() {
            metadataWidget.showBusyIndicator(CommonConstants.INSTANCE.Loading());
            metadataService
                .call(
                    new MetadataSuccessCallback(metadataWidget, isReadOnly),
                    new HasBusyIndicatorDefaultErrorCallback(metadataWidget))
                .getMetadata(path);
          }

          @Override
          public void onLostFocus() {
            // Nothing to do
          }
        });

    loadContent();
  }
예제 #7
0
 protected void loadContent() {
   view.showLoading();
   dslTextEditorService
       .call(getModelSuccessCallback(), getNoSuchFileExceptionErrorCallback())
       .loadContent(versionRecordManager.getCurrentPath());
 }
예제 #8
0
 @OnMayClose
 public boolean mayClose() {
   return super.mayClose(view.getContent());
 }