Esempio n. 1
0
 private void checkWithUserBeforeSavingModelFromOldVersion() throws UserCancelException {
   if (!org.nlogo.api.Version.compatibleVersion(savedVersion)) {
     String[] options = {
       I18N.guiJ().get("common.buttons.save"), I18N.guiJ().get("common.buttons.cancel")
     };
     String message =
         "This model was made with "
             + savedVersion
             + ". "
             + "If you save it in "
             + org.nlogo.api.Version.version()
             + " it may not work in the old version anymore.";
     if (org.nlogo.swing.OptionDialog.show(this, "NetLogo", message, options) != 0) {
       throw new UserCancelException();
     }
     savedVersion = org.nlogo.api.Version.version();
   }
 }
Esempio n. 2
0
 private void checkWithUserBeforeOpening2DModelin3D() throws UserCancelException {
   String[] options = {
     I18N.guiJ().get("common.buttons.continue"), I18N.guiJ().get("common.buttons.cancel")
   };
   String message =
       "You are attempting to open a 2D model in "
           + org.nlogo.api.Version.version()
           + ". "
           + "You might need to make changes before it will work in 3D.";
   if (org.nlogo.swing.OptionDialog.show(this, "NetLogo", message, options) != 0) {
     throw new UserCancelException();
   }
 }
Esempio n. 3
0
 private void checkWithUserBeforeOpening3DModelin2D(String version) throws UserCancelException {
   String[] options = {
     I18N.guiJ().get("common.buttons.continue"), I18N.guiJ().get("common.buttons.cancel")
   };
   String message =
       "You are attempting to open a model that was created"
           + " in a 3D version of NetLogo.  (This is "
           + org.nlogo.api.Version.version()
           + "; "
           + "the model was created in "
           + version
           + ".) "
           + "NetLogo can try to open the model, but it may "
           + "or may not work.";
   if (org.nlogo.swing.OptionDialog.show(this, "NetLogo", message, options) != 0) {
     throw new UserCancelException();
   }
 }
Esempio n. 4
0
  public FileMenu(App app, ModelSaver modelSaver, AppletSaver appletSaver) {
    super(I18N.guiJ().get("menu.file"));
    this.app = app;
    this.modelSaver = modelSaver;
    this.appletSaver = appletSaver;
    addMenuItem('N', new NewAction());
    addMenuItem('O', new OpenAction());
    addMenuItem('M', new ModelsLibraryAction());
    addSeparator();
    addMenuItem('S', new SaveAction());
    addMenuItem(new SaveAsAction());
    addMenuItem(new SaveAppletAction());
    addSeparator();
    addMenuItem(I18N.guiJ().get("menu.file.print"), 'P', app.tabs().printAction());
    addSeparator();
    org.nlogo.swing.Menu exportMenu = new org.nlogo.swing.Menu(I18N.guiJ().get("menu.file.export"));
    exportMenu.addMenuItem(new ExportWorldAction());
    exportMenu.addMenuItem(new ExportPlotAction());
    exportMenu.addMenuItem(new ExportAllPlotsAction());
    exportMenu.addMenuItem(new ExportGraphicsAction());
    exportMenu.addMenuItem(new ExportInterfaceAction());
    exportMenu.addMenuItem(new ExportOutputAction());
    add(exportMenu);
    addSeparator();
    org.nlogo.swing.Menu importMenu = new org.nlogo.swing.Menu(I18N.guiJ().get("menu.file.import"));
    importMenu.addMenuItem(new ImportWorldAction());
    importMenu.addMenuItem(new ImportPatchColorsAction());
    importMenu.addMenuItem(new ImportPatchColorsRGBAction());
    if (!org.nlogo.api.Version.is3D()) {
      importMenu.addMenuItem(new ImportDrawingAction());
    }
    importMenu.addMenuItem(new ImportClientAction());

    add(importMenu);
    if (!System.getProperty("os.name").startsWith("Mac")) {
      addSeparator();
      addMenuItem('Q', new QuitAction());
    }
    // initialize here, unless there's a big problem early on in the
    // initial load process it'll get initialize properly below
    // maybe this fixes Nigel Gilbert's bug. maybe. ev 1/30/07
    savedVersion = org.nlogo.api.Version.version();
  }