コード例 #1
0
  public SettingsTabs(String initialSelectedTab) {
    Collection<String> definedParameterKeys = ParameterService.getDefinedParameterKeys();
    SortedMap<String, List<ParameterType>> groups = new TreeMap<String, List<ParameterType>>();

    for (String key : definedParameterKeys) {
      String group = ParameterService.getGroupKey(key);

      List<ParameterType> groupTypeList = groups.get(group);
      if (groupTypeList == null) {
        groupTypeList = new LinkedList<ParameterType>();
        groups.put(group, groupTypeList);
      }
      groupTypeList.add(ParameterService.getParameterType(key));
    }

    for (Entry<String, List<ParameterType>> entry : groups.entrySet()) {
      List<ParameterType> lists = entry.getValue();
      Collections.sort(
          lists,
          new Comparator<ParameterType>() {
            @Override
            public int compare(ParameterType o1, ParameterType o2) {
              return o1.getKey().compareTo(o2.getKey());
            }
          });
      SettingsPropertyPanel table = new SettingsPropertyPanel(lists);
      parameterPanels.add(table);

      ExtendedJScrollPane scrollPane = new ExtendedJScrollPane(table);
      scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
      scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
      scrollPane.setPreferredSize(new Dimension(600, 300));

      String group = entry.getKey();
      String name =
          new String(new char[] {group.charAt(0)}).toUpperCase()
              + group.substring(1, group.length());
      addTab(name, scrollPane);
    }
  }