Exemplo n.º 1
0
 /**
  * Save or discard editable element modification. Show a dialog if there is at least one unsaved
  * editable element.
  *
  * @return True if the application must cancel the close shutdown operation
  */
 private boolean isShutdownVetoed() {
   List<EditableElement> modifiedElements = new ArrayList<EditableElement>();
   Collection<EditableElement> editableElement = editors.getEditableElements();
   for (EditableElement editable : editableElement) {
     if (editable.isModified()) {
       modifiedElements.add(editable);
     }
   }
   if (!modifiedElements.isEmpty()) {
     SaveDocuments.CHOICE userChoice = SaveDocuments.showModal(mainFrame, modifiedElements);
     // If the user do not want to save the editable elements
     // Then cancel the modifications
     if (userChoice == SaveDocuments.CHOICE.SAVE_NONE) {
       for (EditableElement element : modifiedElements) {
         element.setModified(false);
       }
     }
     return userChoice == SaveDocuments.CHOICE.CANCEL;
   } else {
     return false;
   }
 }
Exemplo n.º 2
0
  /** Free all resources allocated by this object */
  public void dispose() {
    // Close all running jobs
    final AppContext appContext = AppContext.getAppContext();
    ExecutorService executorService = (ExecutorService) appContext.get(SwingWorker.class);
    if (executorService != null) {
      executorService.shutdown();
    }

    // Free UI resources
    if (editors != null) {
      editors.dispose();
    }
    if (geoCatalog != null) {
      geoCatalog.dispose();
    }
    if (mainFrame != null) {
      mainFrame.dispose();
    }
    if (singleFrameTracker != null) {
      singleFrameTracker.close();
    }
    if (editorFactoryTracker != null) {
      editorFactoryTracker.close();
    }
    if (editorTracker != null) {
      editorTracker.close();
    }
    if (toolBarTracker != null) {
      toolBarTracker.close();
    }
    dockManager.dispose();
    loggerCollection.dispose();

    // Free libraries resources
    mainContext.dispose();

    UIFactory.setMainFrame(null);
  }
Exemplo n.º 3
0
 /** Load the built-ins editors factories */
 private void loadEditorFactories() {
   TableEditorFactory tableEditorFactory = new TableEditorFactory();
   tableEditorFactory.setDataManager(mainContext.getDataManager());
   editors.addEditorFactory(tableEditorFactory);
 }