Class SwingForester.LazyNode

java.lang.Object
eu.bandm.tools.graficUtils.SwingForester.TreeProxy
eu.bandm.tools.graficUtils.SwingForester.LazyNode
All Implemented Interfaces:
TreeNode
Direct Known Subclasses:
FormatTree.Inner1
Enclosing class:
SwingForester

public abstract class SwingForester.LazyNode extends SwingForester.TreeProxy
Lazy node which will display sub-nodes on demand. Must be subclassed by the user for lazy evaluation.
  • Field Details

    • root

      protected final String root
      The displayed name (of a field of a type constructor.)
    • children

      protected final List<TreeNode> children
      List of subtrees.
  • Constructor Details

    • LazyNode

      protected LazyNode(@Opt @Opt TreeNode parent, @Opt @Opt String label, Object source, String root)
      Only constructor.
      Parameters:
      parent - the parent node
      label - describes the role of the object in its context, eg. the "UML associaton" pointing to a subtree, or the field name of a (class or primitive type) field value.
      source - is the data object represented by this GUI node.
      root - name of the type constructor represented by this subtree.
  • Method Details

    • valueToString

      public String valueToString()
      Returns root for display as a subtree name.
      Specified by:
      valueToString in class SwingForester.TreeProxy
    • demand

      protected final void demand()
      Aux method called whenever swing runtime system inquires the node. (Probably to paint it, therefore this triggers the evaluation.)
    • eval

      protected abstract void eval()
      Creation of subtrees, as overridden by the user.
    • addSEQ

      protected void addSEQ(@Opt @Opt String label, List<?> i)
      Add a specialized subclass of SwingForester.LazyNode displaying a sequence. Service for the user code overriding eval().
    • addSET

      protected void addSET(@Opt @Opt String label, Set<?> i)
      Add a specialized subclass of SwingForester.LazyNode displaying a set. Service for the user code overriding eval().
    • addMAP

      protected void addMAP(@Opt @Opt String label, Map<?,?> i)
      Add a specialized subclass of SwingForester.LazyNode displaying a map. Service for the user code overriding eval().
    • addREL

      protected void addREL(@Opt @Opt String label, Multimap<?,?> i)
      Add a specialized subclass of SwingForester.LazyNode displaying a multimap. Service for the user code overriding eval().
    • add

      protected void add(@Opt @Opt String label, Object x)
      Add a SwingForester.TreeProxy displaying an object. Service for the user code overriding eval(). The overridden method SwingForester.growBranch(TreeNode, String, Object) is consulted whether a complex SwingForester.LazyNode representation is wanted. Otherwise a SwingForester.Leaf is created.
      Parameters:
      label - shown as field name (/role/association name)
      x - the object to display
    • add

      protected void add(@Opt @Opt String label, int x)
      Add a SwingForester.Leaf displaying one primitive field of an object. Service for the user code overriding eval().
      Parameters:
      label - shown as field name (/role/association name)
      x - the value to display
    • add

      protected void add(@Opt @Opt String label, boolean b)
      Add a SwingForester.Leaf displaying one primitive field of an object. Service for the user code overriding eval().
      Parameters:
      label - shown as field name (/role/association name)
      b - the value to display
    • addChild

      protected void addChild(TreeNode child)
      Add a just created sub-node to the list of children.
    • getChildAt

      public final TreeNode getChildAt(int index)
      Overridden from TreeNode for to trigger evaluation.
    • getChildCount

      public final int getChildCount()
      Overridden from TreeNode for to trigger evaluation.
    • getIndex

      public final int getIndex(TreeNode child)
      Overridden from TreeNode for to trigger evaluation.
    • getAllowsChildren

      public final boolean getAllowsChildren()
      Overridden from TreeNode for to trigger evaluation.
    • isLeaf

      public final boolean isLeaf()
      Overridden from TreeNode for to trigger evaluation.
    • children

      public final Enumeration<? extends TreeNode> children()
      Overridden from TreeNode for to trigger evaluation.