Products
About Guided Tour Online Demo Trial Version Requirements
Resources
Documents Configuration examples TagLib Reference Useful Links
Customer Support
Updates Forums Contact Services
Sales
Licensing Sales FAQ Buy Online
 
 
 
buy online   |   about us   |   german version  

» 4. Provision of the display data

The tree consists of group and leaf nodes. Group nodes can, in turn have additional nodes (composite pattern). Accordingly, for both the node types, the interfaces TreeGroupDataModel and TreeNodeDataModel are available (TreeGroupDataModel extendsTreeNodeDatamodel). With their help, the tree structure can be easily generated.

In doing so, the root node is generated first and under it, additional groups or leaves are suspended. The root node is passed onto the TreeControl as a data model.

// Root
ProductGroupDsp root = new ProductGroupDsp("0", "Products", "Root");

ProductGroupDsp group = null;
ProductGroupDsp subgroup = null;

// First Group under the Root-Element
group = new ProductGroupDsp("1201", "Workstations & Monitors");

subgroup = new ProductGroupDsp("2102", "Workstations");
subgroup.addChild( new ProductDsp("3005", "XWR4000", "product description"));
subgroup.addChild( new ProductDsp("3005", "XWR4010", "product description"));
group.addChild(subgroup);

subgroup = new ProductGroupDsp("2103", "Monitors");
subgroup.addChild( new ProductDsp("3101", "ITV 2800") );
subgroup.addChild( new ProductDsp("3102", "ITV 2820i") );
subgroup.addChild( new ProductDsp("3103", "ITV 3220") );
group.addChild(subgroup);

root.addChild(group);

// Secound Group under the Root-Element
group = new ProductGroupDsp("1204", "Printing & Multifunction");
root.addChild(group);

The following classes show the corresponding models for this example:
ProductGroupDsp
ProductDsp
ProductBaseDsp

back   |   continue to step 5

Impressum | This product includes software developed by the Java Apache Project
Tours
ListControl TreeControl TreeListControl TabSetControl Form Tags MenuControl Print version Live demo Configuration