Esempio n. 1
0
  @Override
  public Component getTreeCellRendererComponent(
      JTree tree,
      Object value,
      boolean selected,
      boolean expanded,
      boolean leaf,
      int row,
      boolean hasFocus) {
    super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);

    DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
    Object nodeInfo = node.getUserObject();

    if (nodeInfo instanceof Severity) {
      Severity s = (Severity) nodeInfo;
      setIcon(ImageProvider.get("data", s.getIcon()));
    } else if (nodeInfo instanceof TestError) {
      TestError error = (TestError) nodeInfo;
      MultipleNameVisitor v = new MultipleNameVisitor();
      v.visit(error.getPrimitives());
      setText(v.getText());
      setIcon(v.getIcon());
    }
    return this;
  }
Esempio n. 2
0
  @Override
  public int compareTo(TestError o) {
    if (equals(o)) return 0;

    MultipleNameVisitor v1 = new MultipleNameVisitor();
    MultipleNameVisitor v2 = new MultipleNameVisitor();

    v1.visit(getPrimitives());
    v2.visit(o.getPrimitives());
    return v1.toString().compareToIgnoreCase(v2.toString());
  }
Esempio n. 3
0
  @Override
  public int compareTo(TestError o) {
    if (equals(o)) return 0;

    MultipleNameVisitor v1 = new MultipleNameVisitor();
    MultipleNameVisitor v2 = new MultipleNameVisitor();

    v1.visit(getPrimitives());
    v2.visit(o.getPrimitives());
    return AlphanumComparator.getInstance().compare(v1.toString(), v2.toString());
  }