Esempio n. 1
0
 /**
  * Returns a String containing the chart plot options selected by the user in the View Options
  * dialog box.
  *
  * @param list - A List of ChartPlotOptions enumeration values that specify the user selected
  *     chart plot options.
  * @return A string containing the user selected chart plot options.
  * @see ChartPlotOptions
  */
 public static String toUserPrefsListString(List<ChartPlotOptions> list) {
   StringBuilder sb = new StringBuilder();
   for (ChartPlotOptions cpo : list) {
     sb.append(cpo.name()).append(DELIM);
   }
   return sb.toString();
 }
Esempio n. 2
0
  /**
   * Returns the list of chart plot options selected by the user in the View Options dialog box.
   * These options specify which items are plotted on the Diagnostics Chart.
   *
   * @param delimitedPrefsString - The delimeter string that is used to separate the returned list
   *     of chart plot options.
   * @return A List of ChartPlotOptions enumeration values that specify the user selected chart plot
   *     options.
   */
  public static List<ChartPlotOptions> toUserPrefsList(String delimitedPrefsString) {
    List<ChartPlotOptions> list = new ArrayList<ChartPlotOptions>();

    if (delimitedPrefsString == null) {
      return null;
    }

    String[] tokens = delimitedPrefsString.split(DELIM);
    for (String s : tokens) {
      if (s != null && !"".equals(s.trim())) {
        try {
          ChartPlotOptions cpo = ChartPlotOptions.valueOf(s);
          if (cpo != null) {
            list.add(cpo);
          }
        } catch (IllegalArgumentException e) {
          logger.warning("Unrecognized chart plot option in preferences: " + s);
        }
      }
    }
    return list;
  }