Esempio n. 1
0
 public void clear() {
   Util.runInEDT(
       new Runnable() {
         @Override
         public void run() {
           dataset.clear();
           view.clear();
         }
       });
 }
  /*
   * (non-Javadoc)
   *
   * @see
   * com.intel.stl.ui.console.IConsoleEventListener#addNewConsole(booelan,
   * String)
   */
  @Override
  public void addNewConsole(
      final LoginBean loginBean, final boolean showDialog, final String command) {

    Runnable addConsole =
        new Runnable() {

          @Override
          public void run() {

            // Create new console terminal view and controller
            consoleNum++;

            if (consoleNum <= MAX_NUM_CONSOLES) {
              consoleTerminalView = new ConsoleTerminalView(owner, subpageView);
              consoleLogin = consoleTerminalView.getConsoleLogin();
              consoleLogin.setConsoleEventListener(listener);
              displayMaxConsoles(false);
              console =
                  new ConsoleTerminalController(
                      consoleTerminalView,
                      STLConstants.K2107_ADM_CONSOLE.getValue() + " " + consoleNum + "," + " ",
                      STLConstants.K2108_ADM_CONSOLE_DESC.getValue(),
                      consoleNum,
                      subpageView.getConsoleHelpListener());
              console.setContext(context, observer);
              console.setNewConsoleListener(listener);
              subpageView.setTab(console);

              // Provide a maximum for the number of allowable consoles
              boolean newConsolesAllowed = (consoleNum <= MAX_NUM_CONSOLES);
              tabListener = subpageView.getNewTabView();
              tabListener.enableNewTab(newConsolesAllowed);
              consoleTerminalView.enableNewTab(newConsolesAllowed);

              if (showDialog) {
                consoleLogin.showLogin(defaultLoginBean, true, consoleNum);
              } else {
                try {
                  initializeConsole(loginBean, command);
                } catch (NumberFormatException e) {
                  consoleLogin.showMessage(
                      UILabels.STL80002_INVALID_PORT_NUMBER.getDescription(loginBean.getPortNum()));
                  consoleLogin.killProgress();
                }
              }

            } else {
              consoleNum--;
              displayMaxConsoles(true);
            }
          }
        };
    Util.runInEDT(addConsole);
  }
Esempio n. 3
0
  public void updateStates(EnumMap<NoticeSeverity, Integer> states, final int total) {
    lastStates = states;
    lastTotal = total;

    if (lastStates == null) {
      view.clear();
      return;
    }

    final int[] counts = StateLongTypeViz.getDistributionValues(states, total);
    int countsLen = 0;
    if (counts != null) {
      countsLen = counts.length;
    }
    final double[] values = new double[countsLen];
    final String[] labels = new String[countsLen];
    final String[] tooltips = new String[countsLen];
    Util.runInEDT(
        new Runnable() {
          @Override
          public void run() {
            for (int i = 0; i < counts.length; i++) {
              dataset.setValue(StateLongTypeViz.values()[i].getName(), counts[i]);
              if (total > 0) {
                values[i] = (double) counts[i] / total;
                labels[i] =
                    UIConstants.INTEGER.format(counts[i])
                        + " ("
                        + UIConstants.PERCENTAGE.format(values[i])
                        + ") ";
                tooltips[i] =
                    UILabels.STL10202_NODE_STATES.getDescription(
                        UIConstants.INTEGER.format(counts[i]),
                        UIConstants.PERCENTAGE.format(values[i]),
                        StateLongTypeViz.names[i]);
              } else {
                labels[i] = STLConstants.K0039_NOT_AVAILABLE.getValue();
                tooltips[i] = null;
              }
            }

            view.setStates(values, labels, tooltips);
          }
        });
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * com.intel.stl.api.notice.IEmailEventListener#onNewEvent(java.lang.Object
  * [])
  */
 @Override
 public void onNewEvent(NoticeBean[] noticeList) {
   for (NoticeBean bean : noticeList) {
     Util.showErrorMessage(view, new String(bean.getData()));
   }
 }