示例#1
0
 public TagSet(Collection<TagCapability> tags) {
   this.tags.addAll(tags);
   Collections.sort(
       this.tags,
       new Comparator<TagCapability>() {
         @Override
         public int compare(TagCapability a, TagCapability b) {
           return a.getTag().compareTo(b.getTag());
         }
       });
   for (TagCapability tag : this.tags) {
     string += tag.getTag() + " ";
   }
 }
示例#2
0
    private JPanel makeEntry(TagSet tagSet) {
      JPanel entry = new JPanel();
      entry.setOpaque(false);
      entry.setLayout(new BoxLayout(entry, BoxLayout.LINE_AXIS));

      entry.add(new JLabel(new LegendIcon(tagSet)));
      for (TagCapability tag : tagSet.tags) {
        JComponent view = LabelView.VIEW_INFO.createView(tag.getComponentRepresentation());
        view.setForeground(Color.LIGHT_GRAY);
        entry.add(view);
      }
      if (tagSet.tags.isEmpty()) {
        JLabel label = new JLabel(tagSet.toString());
        label.setForeground(Color.LIGHT_GRAY);
        entry.add(label);
      }
      entry.setAlignmentX(LEFT_ALIGNMENT);
      entry.addMouseListener(new Highlighter(tagSet));
      return entry;
    }