Ejemplo n.º 1
0
    public Component getTreeCellRendererComponent(
        JTree tree,
        Object value,
        boolean selected,
        boolean expanded,
        boolean leaf,
        int row,
        boolean hasFocus) {

      Component c =
          super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);

      if (value instanceof VariableNode) {
        VariableNode node = (VariableNode) value;
        tooltipText = node.getToolTipText();

        if (node.var instanceof Structure) {
          Structure s = (Structure) node.var;
          setIcon(structIcon);
          tooltipText = s.getNameAndAttributes();
        } else tooltipText = node.getToolTipText();
      } else if (value instanceof DimensionNode) {
        DimensionNode node = (DimensionNode) value;
        tooltipText = node.getToolTipText();
        setIcon(dimIcon);
      } else if (value instanceof GroupNode) {
        GroupNode node = (GroupNode) value;
        tooltipText = node.getToolTipText();
      }

      return c;
    }
Ejemplo n.º 2
0
    void makeChildren() {
      children = new ArrayList<>();

      if (var instanceof Structure) {
        Structure s = (Structure) var;
        List vars = s.getVariables();
        for (int i = 0; i < vars.size(); i++)
          children.add(new VariableNode(this, (VariableIF) vars.get(i)));
      }

      if (debugTree) System.out.println("children=" + var.getShortName() + " ");
    }