예제 #1
0
 public TaskManagerInternalFrame(MainFrame mainFrame) {
   super("Task Manager", true, true, true, true);
   this.mainFrame = mainFrame;
   TaskManagerPanel<Long> taskManagerPanel =
       new TaskManagerPanel<>(mainFrame.getLongWorkManager());
   setLayout(new GridLayout(1, 1));
   add(taskManagerPanel);
   taskManagerPanel.setPaused(false);
   addInternalFrameListener(new CleanupWindowChangeListener());
 }
  protected String createGraphTitle(SourceIdentifier sourceIdentifier) {
    ApplicationPreferences applicationPreferences = mainFrame.getApplicationPreferences();
    Map<String, String> sourceNames = null;
    boolean showingPrimaryIdentifier = false;
    if (applicationPreferences != null) {
      sourceNames = applicationPreferences.getSourceNames();
      showingPrimaryIdentifier = applicationPreferences.isShowingPrimaryIdentifier();
    }
    String title =
        ViewActions.getPrimarySourceTitle(
            sourceIdentifier.getIdentifier(), sourceNames, showingPrimaryIdentifier);

    return title + " @ " + DateTimeFormatters.DATETIME_IN_SYSTEM_ZONE_SPACE.format(Instant.now());
  }
예제 #3
0
  private void initUI() {
    SortedMap<String, SourceIdentifier> stats = mainFrame.getAvailableStatistics();

    List<WrappedSourceIdentifier> wrappedSources =
        new ArrayList<WrappedSourceIdentifier>(stats.size() + 1);
    wrappedSources.add(new WrappedSourceIdentifier("Global", new SourceIdentifier("global")));
    for (Map.Entry<String, SourceIdentifier> current : stats.entrySet()) {
      WrappedSourceIdentifier wrapped =
          new WrappedSourceIdentifier(current.getKey(), current.getValue());
      wrappedSources.add(wrapped);
    }
    Object[] newSourcesArray = wrappedSources.toArray();
    if (!Arrays.equals(previousSourcesArray, newSourcesArray)) {
      previousSourcesArray = newSourcesArray;
      DefaultComboBoxModel model = new DefaultComboBoxModel(newSourcesArray);
      sourcesComboBox.setModel(model);
    }
    int index = 0;
    if (sourceIdentifier != null) {
      ComboBoxModel model = sourcesComboBox.getModel();
      for (int i = 0; i < model.getSize(); i++) {
        Object current = model.getElementAt(i);
        if (current instanceof WrappedSourceIdentifier) {
          WrappedSourceIdentifier wrapped = (WrappedSourceIdentifier) current;
          if (sourceIdentifier.getIdentifier().equals(wrapped.sourceIdentifier.getIdentifier())) {
            if (logger.isDebugEnabled()) logger.debug("Equal");
            index = i;
            break;
          } else {
            if (logger.isDebugEnabled()) {
              logger.debug("Not equal: {} != {}", sourceIdentifier, wrapped.sourceIdentifier);
            }
          }
        } else {
          if (logger.isWarnEnabled()) logger.warn("Not instanceof WrappedSourceIdentifier");
        }
      }
    }
    sourcesComboBox.setSelectedIndex(index);
  }
 protected File getRrdFile(SourceIdentifier sourceIdentifier) {
   File statisticsParent =
       new File(mainFrame.getApplicationPreferences().getStartupApplicationPath(), "statistics");
   return new File(statisticsParent, sourceIdentifier.getIdentifier() + ".rrd");
 }