Package org.jamesii.gui.application.action

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


    Icon deleteIcon =
        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


            "org.jamesii.server.ssmanagement",
            "Start simulation servers ...",
            new String[] { "org.jamesii.menu.main/org.jamesii.server?after=org.jamesii.server.mssmanagement" },
            null));

    IAction seperator =
        SeparatorAction
            .getSeparatorFor(
                "org.jamesii.menu.main/org.jamesii.server?after=org.jamesii.server.ssmanagement",
                null);
    actions.add(seperator);

    actions.add(new ShowSeverSystemInformationAction(
        "org.jamesii.server.mssysteminfo", "Show server system information...",
        new String[] { String.format(
            "org.jamesii.menu.main/org.jamesii.server?after=%s",
            seperator.getId()) }, null));

    actions
        .add(new InspectServerPlugInsAction(
            "org.jamesii.server.pluginview",
            "Inspect plug-ins of a server...",
View Full Code Here

  @Override
  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

    if (getSelectedNodeInfo() != null) {
      ServiceInfo info = (ServiceInfo) getSelectedNodeInfo().getInfo();
      Map<String, List<String[]>> commandList = info.getPossibleCommands();
      for (Entry<String, List<String[]>> entry : commandList.entrySet()) {
        String command = entry.getKey();
        IAction action =
            new ServiceAction(command, command, new String[] { "" }, info,
                entry.getValue(), this);
        action.setEnabled(getSelectedNodeInfo() != null);
        actions.add(action);
      }
    }
    return actions.toArray(new IAction[actions.size()]);
  }
View Full Code Here

   *
   * @param p
   *          the preset to add
   */
  private void addPreset(PerspectivePreset p) {
    IAction a = createActionForPreset(p);
    actions.add(a);
    presetActions.put(p, a);
  }
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() {
            synchronized (this) {
              export();
            }
          }
        };

    IAction runExpAct =
        new ActionIAction(runExpAction, "expoverview.runexpaction",
            new String[] { "" }, this);

    IAction stopSimAct =
        new ActionIAction(stopSimAction, "expoverview.stopsimaction",
            new String[] { "" }, this);

    IAction runSimAct =
        new ActionIAction(runSimAction, "expoverview.runsimaction",
            new String[] { "" }, this);

    IAction nextStepSimAct =
        new ActionIAction(nextStepSimAction, "expoverview.nextstepsimaction",
            new String[] { "" }, this);

    IAction nStepsSimAct =
        new ActionIAction(nStepsSimAction, "expoverview.nstepssimaction",
            new String[] { "" }, this);

    IAction sliderAction =
        new ActionIAction(sliderSimAction, "expoverview.slideraction",
            new String[] { "" }, this);

    IAction strucViewAction =
        new ActionIAction(strucModelViewAction, "expoverview.strucviewaction",
            new String[] { "" }, this);

    return new IAction[] { clearAction, exportAction,
        SeparatorAction.getSeparatorFor("", this), runExpAct,
View Full Code Here

    Icon startIcon = IconManager.getIcon(IconIdentifier.PLAY_SMALL, "start");
    Icon pauseIcon = IconManager.getIcon(IconIdentifier.PAUSE_SMALL, "pause");
    Icon stopIcon = IconManager.getIcon(IconIdentifier.STOP_SMALL, "stop");

    IAction action =
        new AbstractAction("simulation.start", "start", startIcon,
            new String[] { "" }, null, null, this) {

          @Override
          public void execute() {
            synchronized (this) {
              ISimulationServer simServer = (ISimulationServer) getServer();
              ComputationTaskIDObject info =
                  (ComputationTaskIDObject) getSelectedNodeInfo().getInfo();
              try {
                simServer.startSimulationRun(info);
              } catch (RemoteException e) {
                SimSystem.report(e);
              }
            }
          }
        };
    action.setEnabled(getSelectedNodeInfo() != null);
    actions.add(action);

    action =
        new AbstractAction("simulation.pause", "pause", pauseIcon,
            new String[] { "" }, null, null, this) {

          @Override
          public void execute() {
            synchronized (this) {
              ISimulationServer simServer = (ISimulationServer) getServer();
              ComputationTaskIDObject info =
                  (ComputationTaskIDObject) getSelectedNodeInfo().getInfo();
              try {
                simServer.executeRunnableCommand(info, "pause", null);
              } catch (RemoteException e) {
                SimSystem.report(e);
              }
            }
          }
        };
    action.setEnabled(getSelectedNodeInfo() != null);
    actions.add(action);

    action =
        new AbstractAction("simulation.stop", "stop", stopIcon,
            new String[] { "" }, null, null, this) {

          @Override
          public void execute() {
            synchronized (this) {
              ISimulationServer simServer = (ISimulationServer) getServer();
              ComputationTaskIDObject info =
                  (ComputationTaskIDObject) getSelectedNodeInfo().getInfo();
              try {
                simServer.stopProc(info);
              } catch (RemoteException e) {
                SimSystem.report(e);
              }
            }
          }
        };
    action.setEnabled(getSelectedNodeInfo() != null);
    actions.add(action);

    return actions.toArray(new IAction[actions.size()]);
  }
View Full Code Here

TOP

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

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.