Package org.jamesii.gui.application.action

Examples of org.jamesii.gui.application.action.AbstractAction


        IconManager.getIcon(IconIdentifier.DELETE_SMALL, "Delete entry");

    // add variable on the current level

    IAction addVariableAction =
        new AbstractAction("variables.variable.add", "Add variable",
            addVariableIcon, new String[] { "" }, null, null, this) {

          @Override
          public void execute() {
            // synchronized (this) {
            // }
          }
        };
    addVariableAction.setEnabled(true);

    // add sub level

    IAction addLevelAction =
        new AbstractAction("variables.sublevel.add", "Add sub level",
            addLevelIcon, new String[] { "" }, null, null, this) {

          @Override
          public void execute() {
            // synchronized (this) {
            // }
          }
        };
    addLevelAction.setEnabled(true);

    // add optimization

    IAction addOptimizationAction =
        new AbstractAction("variables.optimization.add", "Add optimization",
            addOptimizationIcon, new String[] { "" }, null, null, this) {

          @Override
          public void execute() {
            // synchronized (this) {
            // }
          }
        };
    addOptimizationAction.setEnabled(true);

    // remove variable / sub level / optimization

    IAction addORemoveAction =
        new AbstractAction("variables.delete", "Delete entry", deleteIcon,
            new String[] { "" }, null, null, this) {

          @Override
          public void execute() {
            // synchronized (this) {
            // }
          }
        };
    addORemoveAction.setEnabled(true);

    return result;
  }
View Full Code Here


    List<IAction> actions = new ArrayList<>();

    actions.add(new ActionSet("org.jamesii.visualization", "Visualization",
        "org.jamesii.menu.main?after=org.jamesii.edit", null));

    actions.add(new AbstractAction("org.jamesii.visualization.offline",
        "Offline visualization...",
        new String[] { "org.jamesii.menu.main/org.jamesii.visualization" },
        null) {
      private ActionListener action = new ActionListener() {
        @Override
View Full Code Here

  protected IAction[] generateActions() {
    Icon clearIcon = null;
    clearIcon = IconManager.getIcon(IconIdentifier.DELETE_SMALL, "Clear Log");

    IAction clearAction =
        new AbstractAction("log.clear", "Clear Log", clearIcon,
            new String[] { "" }, null, null, this) {

          @Override
          public void execute() {
            synchronized (this) {
              model.clear();
            }
          }
        };

    IAction flatAction =
        new ToggleAction("org.jamesii.logview.toggle", "Flat",
            IconManager.getIcon(IconIdentifier.FLAT_SMALL),
            new String[] { "?last" }, null, null, this) {

          /**
           * The flat icon.
           */
          @SuppressWarnings("unused")
          private final Icon flatIcon = IconManager
              .getIcon(IconIdentifier.FLAT_SMALL);

          /**
           * The hierarchical icon.
           */
          @SuppressWarnings("unused")
          private final Icon hierarchicalIcon = IconManager
              .getIcon(IconIdentifier.HIERARCHICAL_SMALL);

          @Override
          protected void toggleChanged(boolean previousState) {
            /*
             * model.setFlat(!previousState); if (previousState) {
             * this.setLabel("Flat"); this.setIcon(flatIcon); } else {
             * this.setLabel("Hierarchical"); this.setIcon(hierarchicalIcon); }
             */

          }
        };

    flatAction.setEnabled(false);

    Icon exceptionIcon = null;
    exceptionIcon = IconManager.getIcon(IconIdentifier.ERROR_SMALL, null);

    final IAction showThrownAction =
        new AbstractAction("log.showthrown", "Show Exception Stack Trace",
            exceptionIcon, new String[] { "" }, null, null, this) {

          @Override
          public void execute() {
            Object node = getTreeTable().getNode(getSelectedRow());
            if (node instanceof Integer) {
              LogRecord record = model.getRecord((Integer) node);
              StringWriter result = new StringWriter();
              PrintWriter writer = new PrintWriter(result);

              if (record.getThrown() != null) {
                record.getThrown().printStackTrace(writer);
                JOptionPane.showMessageDialog(WindowManagerManager
                    .getWindowManager().getMainWindow(), result.toString());
              }
            }
          }
        };
    showThrownAction.setEnabled(false);

    addSelectionListener(new ListSelectionListener() {

      @Override
      public void valueChanged(ListSelectionEvent e) {
        showThrownAction.setEnabled(false);
        if (getSelectedRow() < 0
            || getSelectedRow() >= getTreeTable().getModel().getRowCount()) {
          return;
        }

        int row =
            treeTableModel.getRowForNode(getTreeTable().getNode(
                getSelectedRow()));
        if (row >= 0) {
          LogRecord record = model.getRecord(row);
          showThrownAction.setEnabled(record != null
              && record.getThrown() != null);
        }

      }

View Full Code Here

    actions.add(new ActionSet("org.jamesii.texteditor.highlighterselection",
        "Change Highlighting", "", null, null, icon, this));

    for (final IHighlighter h : highlighters) {
      actions
          .add(new AbstractAction("org.jamesii.texteditor.highlighter."
              + h.getName(), h.getName(),
              new String[] { "org.jamesii.texteditor.highlighterselection" },
              this) {

            @Override
View Full Code Here

              (IFactoryParameterDialog<ModelReaderFactory>) dialogFactory
                  .create(params, SimSystem.getRegistry().createContext());

         baseActions
              .add(new AbstractAction(
                  "model.open." + dialog.hashCode(),
                  dialog.getMenuDescription(),
                  new String[] {
                      "org.jamesii.menu.main/org.jamesii.file/org.jamesii.open/model.open",
                      "org.jamesii.toolbar.main/org.jamesii.open/model.open" },
View Full Code Here

      try {
        final URI uri = new URI(s);

        // TODO sr137: find a better label than just the URI
        recentlyOpenedActions
            .add(new AbstractAction(
                "model.open.recent." + s,
                uri.getPath(),
                new String[] {
                    "org.jamesii.menu.main/org.jamesii.file/org.jamesii.open/model.open/model.open.recent",
                    "org.jamesii.toolbar.main/org.jamesii.open/model.open/model.open.recent" },
                null) {

              private ActionListener action = new OpenModelAction(
                  new IFactoryParameterDialog<ModelReaderFactory>() {

                    @Override
                    public Pair<ParameterBlock, ModelReaderFactory> getFactoryParameter(
                        Window parentWindow) {
                      return new Pair<>(new ParameterBlock(uri,
                          IURIHandling.URI),
                      // FIXME sr137: add factory here
                          null);
                    }

                    @Override
                    public String getMenuDescription() {
                      return s;
                    }

                  });

              @Override
              public void execute() {
                action.actionPerformed(null);
              }
            });
      } catch (URISyntaxException e) {
        SimSystem.report(e);
      }
    }

    recentlyOpenedActions
        .add(new AbstractAction(
            "model.open.recent.clear",
            "Clear list...",
            IconManager.getIcon(IconIdentifier.DELETE_SMALL, "Clear list..."),
            new String[] {
                "org.jamesii.menu.main/org.jamesii.file/org.jamesii.open/model.open/model.open.recent?after=model.open.recent.clearSeparator",
View Full Code Here

  protected List<IAction> generateActions() {
    List<IAction> actions = new ArrayList<>();

    actions.add(new ActionSet("org.jamesii.workflow", "Workflow",
        "org.jamesii.menu.main?before=org.jamesii.help", null));
    actions.add(new AbstractAction("org.jamesii.workflow.overview",
        "Start simple M&S",
        new String[] { "org.jamesii.menu.main/org.jamesii.workflow" }, null) {

      @Override
      public void execute() {
        // show wizard
        Wizard wizard =
            new Wizard(getWindowManager().getMainWindow(), new BasicWorkflow());
        wizard.showWizard();
      }

    });

    actions.add(new AbstractAction("org.jamesii.workflow.simulation",
        "Start simulation",
        new String[] { "org.jamesii.menu.main/org.jamesii.workflow" }, null) {

      @Override
      public void execute() {
View Full Code Here

    final List<IAction> actions = new ArrayList<>();
    actions.add(new ActionSet("org.jamesii.edit", "Edit",
        "org.jamesii.menu.main?after=org.jamesii.file", null));
    actions
        .add(new AbstractAction(
            "org.jamesii.preferences",
            "Preferences...",
            new String[] { "org.jamesii.menu.main/org.jamesii.edit?after=org.jamesii.edit.additionals" },
            null) {
          @Override
          public void execute() {
            PreferencesDialog.showPreferencesDialog(windowManager);
          }
        });

    Icon newIcon = null;
    newIcon = IconManager.getIcon(IconIdentifier.NEW_SMALL, "New");

    actions.add(new ActionSet("org.jamesii.new", "New", new String[] {
        "org.jamesii.menu.main/org.jamesii.file?first",
        "org.jamesii.toolbar.main?first" }, null, null, newIcon, null));

    Icon openIcon = null;
    openIcon = IconManager.getIcon(IconIdentifier.OPEN_SMALL, "Open");

    actions.add(new ActionSet("org.jamesii.open", "Open", new String[] {
        "org.jamesii.menu.main/org.jamesii.file?after=org.jamesii.new",
        "org.jamesii.toolbar.main?after=org.jamesii.new" }, null, null,
        openIcon, null));

    Icon saveIcon = null;
    saveIcon = IconManager.getIcon(IconIdentifier.SAVE_SMALL, "Save");

    actions.add(new SaveAction("org.jamesii.save", "Save", windowManager,
        saveIcon, new String[] {
            "org.jamesii.menu.main/org.jamesii.file?after=org.jamesii.open",
            "org.jamesii.toolbar.main?after=org.jamesii.open" }, KeyStroke
            .getKeyStroke(KeyEvent.VK_S,
                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())
            .toString(), Integer.valueOf(KeyEvent.VK_S), null));

    Icon saveAsIcon = null;
    saveAsIcon = IconManager.getIcon(IconIdentifier.SAVE_SMALL, "Save As...");
    actions
        .add(new SaveAsAction(
            "org.jamesii.saveas",
            "Save As...",
            windowManager,
            saveAsIcon,
            new String[] { "org.jamesii.menu.main/org.jamesii.file?after=org.jamesii.save" },
            null, null, null));

    actions
        .add(new SeparatorAction(
            "org.jamesii.file.additionals1",
            new String[] { "org.jamesii.menu.main/org.jamesii.file?after=org.jamesii.saveas" },
            null));

    actions.add(new SeparatorAction("org.jamesii.toolbar.edit",
        new String[] { "org.jamesii.toolbar.main?after=org.jamesii.save" },
        null));

    actions.add(new ActionIAction(new UndoAction(windowManager),
        "org.jamesii.undo", new String[] {
            "org.jamesii.toolbar.main?after=org.jamesii.toolbar.edit",
            "org.jamesii.menu.main/org.jamesii.edit?first" }, null));

    actions.add(new ActionIAction(new RedoAction(windowManager),
        "org.jamesii.redo", new String[] {
            "org.jamesii.toolbar.main?after=org.jamesii.undo",
            "org.jamesii.menu.main/org.jamesii.edit?after=org.jamesii.undo" },
        null));

    actions.add(new SeparatorAction("org.jamesii.toolbar.additionals",
        new String[] { "org.jamesii.toolbar.main?after=org.jamesii.redo" },
        null));
    actions
        .add(new SeparatorAction(
            "org.jamesii.edit.additionals",
            new String[] { "org.jamesii.menu.main/org.jamesii.edit?after=org.jamesii.redo" },
            null));

    actions.add(new ActionSet("org.jamesii.help", "Help",
        "org.jamesii.menu.main?last", null));

    actions.add(new AbstractAction("org.jamesii.showSystemInfo",
        "Show System Information",
        new String[] { "org.jamesii.menu.main/org.jamesii.help?first" }, null) {

      @Override
      public void execute() {
        BasicUtilities.invokeLaterOnEDT(new Runnable() {
          @Override
          public void run() {
            JavaInfo info = new JavaInfo();
            windowManager.addWindow(new SystemInfoView(info, "this system",
                Contribution.DIALOG));
          }
        });
      }

    });

    actions
        .add(new AbstractAction(
            "org.jamesii.showPlugInInfo",
            "Inspect PlugIns",
            new String[] { "org.jamesii.menu.main/org.jamesii.help?after=org.jamesii.showSystemInfo" },
            null) {

          @Override
          public void execute() {
            BasicUtilities.invokeLaterOnEDT(new Runnable() {
              @Override
              public void run() {
                windowManager.addWindow(new PlugInView(Contribution.DIALOG));
              }
            });
          }

        });

    actions
        .add(new AbstractAction(
            "org.jamesii.showLogView",
            "Show Log View",
            new String[] { "org.jamesii.menu.main/org.jamesii.help?after=org.jamesii.showPlugInInfo" },
            null) {

          @Override
          public void execute() {
            BasicUtilities.invokeLaterOnEDT(new Runnable() {
              @Override
              public void run() {
                windowManager.addWindow(LogView.getInstance());
              }
            });
          }

        });

    actions.add(new ActionIAction(new HelpAction(), "help",
        new String[] { "org.jamesii.menu.main/org.jamesii.help" }, null));

    actions
        .add(new AbstractAction(
            "org.jamesii.showBackgroundTaskManager",
            "Show Background Tasks",
            new String[] { "org.jamesii.menu.main/org.jamesii.help?after=org.jamesii.showLogView" },
            null) {

          @Override
          public void execute() {
            BasicUtilities.invokeLaterOnEDT(new Runnable() {
              @Override
              public void run() {
                windowManager.addWindow(BackgroundTaskView.getInstance());
              }
            });
          }

        });

    actions.add(new AbstractAction("org.jamesii.help.about", "About...",
        new String[] { "org.jamesii.menu.main/org.jamesii.help?last" }, null) {

      @Override
      public void execute() {
        BasicUtilities.invokeLaterOnEDT(new Runnable() {
View Full Code Here

   * @param p
   *          the preset an {@link IAction} should be created for
   * @return the generated {@link IAction}
   */
  private IAction createActionForPreset(final PerspectivePreset p) {
    return new AbstractAction(
        "org.jamesii.perspectives.presets." + counter.incrementAndGet(),
        p.getName(),
        new String[] { "org.jamesii.menu.main/org.jamesii.edit/org.jamesii.presets" },
        null) {

View Full Code Here

  @Override
  protected IAction[] generateActions() {

    IAction clearAction =
        new AbstractAction("expoverview.clear", "Clear", "Clears table",
            "Clears table with simulation run information.",
            IconManager.getIcon(IconIdentifier.DELETE_SMALL, "Clear"),
            new String[] { "" }, null, null, this) {
          @Override
          public void execute() {
            synchronized (this) {
              if (JOptionPane.showConfirmDialog(null, "Clear execution list?",
                  "Do you really want to clear the list of simulation runs?",
                  JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                simRunTableModel.clear();
              }
              expDurationLabel.setText("");
            }
          }
        };

    IAction exportAction =
        new AbstractAction("expoverview.export", "Export", "Exports table",
            "Exports table with simulation run information to text file.",
            IconManager.getIcon(IconIdentifier.COPY_SMALL, null),
            new String[] { "" }, null, null, this) {
          @Override
          public void execute() {
View Full Code Here

TOP

Related Classes of org.jamesii.gui.application.action.AbstractAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.