Java TM Look and Feel Design Guidelines: Advanced Topics > Part II: Special Topics > 5: Idioms > Tree Table Idiom   Previous Next Contents/Index/Search


Tree Table Idiom

A tree table is a table in which the leftmost column is a tree of objects, one object to a row, and the other columns consist of rows that describe the corresponding object in the tree. Figure 55 shows a tree table. You can use a tree table to display two or more properties of each object in a tree.

Figure 55   Tree Table


In tree tables, each object in the tree is either a leaf node (such as a file) or a container (such as a folder). A container can contain leaf nodes and other containers. Users can expand or collapse rows for containers to show or hide rows for the container's contents.

Figure 56 shows containers and leaf nodes in tree table.

Figure 56   Containers and Leaf Nodes in a Tree Table


Tree tables have many features in common with other kinds of tables. For example, you can enable users of tree tables to:

  • Select a group of rows
  • Resize columns
  • Edit the contents of cells individually
  • Sort rows

By default, tree tables enable users to select only a single row. Selecting a row that corresponds to a container does not select rows for the container's contents. Moving or copying a container's row within a tree table also moves or copies the rows for the container's contents. Likewise, deleting a container's row from a tree table also deletes the rows for the container's contents.

You can enable users to sort the rows of a tree table. The default sort is hierarchical. It sorts leaf nodes and containers as a single set, with each container's contents sorted under that container.

In some applications, users might need to sort all rows of tree table as a single set, ignoring whether rows are for containers or leaf nodes. You can provide this capability by enabling users to convert a tree table into a non-hierarchical table. If you provide this capability, also provide a separate command for performing the conversion.

The following guidelines apply to tree tables:

 Use a row selection model, typically with internal editing. (For more information, see Using Row Selection Models and Editing Row-Selection Tables.)

 Enable users to sort the table by clicking its column headers. In addition, provide a keyboard-accessible command for sorting the table.

 When sorting tree tables, sort hierarchically, based on each object's level in the tree.

 Enable users to change the width of table columns.

 If a user changes the width of a table column, use the new width the next time the user opens that table.

 Do not place vertical grid lines between the columns of a tree table. (You can, however, place horizontal grid lines between a tree table's rows.)


Java Look and Feel Design Guidelines: Advanced Topics.
Copyright 2001. Sun Microsystems, Inc. All Rights Reserved.
Previous Next Contents/Index/Search
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
Java 8 banner (182)