eva/3 Application BuilderDeveloping eva/3 ApplicationsWorking with FormsStandard Beans 

SScrollTree

Fig. 183: SScrollTree Icons
Fig. 183: SScrollTree Icons

The SScrollTree can be used to represent tree structures. To edit the structure, Commands must be used.

The property RootVisible defines the representation of the root node. Has this property the value false, the root node will not be shown(s. fig. 184 ).

Fig. 184: Property RootVisible = false
Fig. 184: Property RootVisible = false

The property RowHeight defines the distance between the elements of the SScrollTree (s. fig. 185 ).

Fig. 185: Property RowHeight = 30
Fig. 185: Property RowHeight = 30

The property ShowsRootHandles defines the representation of the handle of the root node. Has this property the value true, so the handle of the root not will be shown (s. Fig.48).

Fig. 186: Property ShowsRootHandles = true
Fig. 186: Property ShowsRootHandles = true

To define a tree structure, a Command will be used.

Example:

package eva3.application.command;
import com.odc.eva3.rt.se.beans.*;
import com.odc.eva3.rt.se.form.*;
import com.odc.eva3.rt.macro.*;
import com.odc.eva3.rt.se.form.SWindowUtils;
import com.odc.eva3.rt.se.tree.*;
import javax.swing.*;
import javax.swing.tree.*;

public class SetSScrollTree implements com.odc.eva3.rt.command.Command {
    /**
     * Message constructor comment.
     */
    public SetSScrollTree() {
        super();
        // Die Methode darf nicht verändert werden.
    }
    /**
     * action method comment.
     */
    public Object action(Object[] args, com.odc.eva3.rt.macro.Macro macro) {
        SWindow window = SWindowUtils.getSWindow(arg0[0].toString());
        SScrollTree tree = (SScrollTree)window.getComponent(arg0[1].toString());
        DefaultMutableTreeNode baseNode = new DefaultMutableTreeNode("Basis-Knoten");
        DefaultMutableTreeNode secondNode = new DefaultMutableTreeNode("Unterknoten1");
        baseNode.add(secondNode);
        DefaultMutableTreeNode thirdNode = new DefaultMutableTreeNode("Unterknoten2");
        baseNode.add(thirdNode);
        DefaultMutableTreeNode fourthNode = new DefaultMutableTreeNode("Unterknoten3");
        secondNode.add(fourthNode);
        DefaultMutableTreeNode fifthNode = new DefaultMutableTreeNode("Unterknoten4");
        secondNode.add(fifthNode);
        /* aus dem SScrollTree muss der Tree geholt werden, da der SScrollTree auch das ScrollPane beinhaltet. Dies geschieht durch die Methode getETree(). */
        JTree eTree = tree.getETree();
        /* Erzeugen eines DefaultTreeModels. Diesem wird dann der Basis Knoten zugewiesen */
        DefaultTreeModel model = new DefaultTreeModel(baseNode);
        /* Dem JTree wird das Model zugewiesen */
        eTree.setModel(model);
        return null;
    }
    /**
     * getComment method comment.
     */
    public String getComment() {
        return "Dieser Befehl setzt Werte in den SScrollTree";
    }
    /**
     * getParameters method comment.
     */
    public java.util.Vector getParameters() {
        java.util.Vector v = new java.util.Vector();
        v.addElement(new Parameter("Name des aktuellen Fensters", String.class, "SWindow-Name"));
        v.addElement(new Parameter("Name des SScrollTrees", String.class, "SScrollTree-Name"));
        return v;
    }
}

This command creates the following tree structure:

Fig. 187: SScrollTree Example
Fig. 187: SScrollTree Example