[ Previous section | Next section | This Package | Package List | Table of Contents ]

Class DataContainer

public class extend.awt.DataContainer extends java.awt.Panel implements extend.awt.ItemProcessor {
    public static final int Details_View
    public static final int List_View
    public static final int Tree_View
    public static final int Icon_View
    public static final int Left_Justify
    public static final int Center_Justify
    public static final int Right_Justify
    public static final int No_Vertical_Line
    public static final int Vertical_Line
    public static final int Single_Selection
    public static final int Forced_Single_Selection
    public static final int Multiple_Selection
    public static final int No_Split_Bar
    public DataContainer(int)
    public void setView(int)
    public void setRoot(ContainerItem)
    public void setTitle(String)
    public void setColumnData(Object, int, int)
    public void setSelectionType(int)
    public void setSplitBar(int, int)
    public ContainerItem getSelected()[]
    public void setAllSelection(boolean)
    public ContainerItem getRoot()
    public void refresh()
}
The DataContainer class provides a container control for managing lists and trees of data items.

Fields

Details_View

public final static int Details_View
Used to display data item details.

List_View

public final static int List_View
Used to display data items as a simple list.

Tree_View

public final static int Tree_View
Used to display data items in a tree structure.

Icon_View

public final static int Icon_View
Used to display data items as a collection of labeled icons.

Left_Justify

public final static int Left_Justify
In the Details view, displays a column's data left aligned in the column.

Center_Justify

public final static int Center_Justify
In the Details view, displays a column's data centered in the column.

Right_Justify

public final static int Right_Justify
In the Details view, displays a column's data right aligned in the column.

No_Vertical_Line

public final static int No_Vertical_Line
In the Details view, prevents the display of a divider line to the right of the column.

Vertical_Line

public final static int Vertical_Line
In the Details view, displays a divider line to the right of the column.

Single_Selection

public final static int Single_Selection
Allows zero or one items to be selected at a time.

Forced_Single_Selection

public final static int Forced_Single_Selection
Forces one and only one item to be selected at a time.

Multiple_Selection

public final static int Multiple_Selection
Allows any number of items to be selected at a time.

No_Split_Bar

public final static int No_Split_Bar
Defines no split bar in the Details view.

Constructors

DataContainer

public DataContainer (int newView)
This is the only constructor for the DataContainer class.

Parameters:
newView - The view to set the container to. It must be one of Details_View, List_View, Tree_View or Icon_View.
Throws:
IllegalArgumentException This exception is thrown when any argument is not valid.

Methods

setView

public void setView (int newView)
This method sets the DataContainer into one of several views, or ways of displaying the ContainerItems in the container.

Parameters:
newView - The view to set the container to. It must be one of Details_View, List_View, Tree_View or Icon_View.
Throws:
IllegalArgumentException This exception is thrown when any argument is not valid.

setRoot

public void setRoot (ContainerItem baseItem)
This method sets a ContainerItem as the root item for the DataContainer. This item need not be the first in its sibling list.

Parameters:
baseItem - This is the item to set as the base item.

setTitle

public void setTitle (String title)
This method sets the text of the title for the DataContainer. It may be null.

Parameters:
title - This is the title text.

setColumnData

public void setColumnData (Object title, int justify, int vertLines)
This method sets the title and style for the next column in the container. Columns must be added in the appropriate order.

Parameters:
title - This is the title for the column. If it is a java.awt.Image, it will be rendered as such. Otherwise, its toString () method will be used to determine the text to draw.
justify - This is the justification of the column and must be one of Left_Justif, Center_Justify or Right_Justify.
vertLines - This indicates whether a vertical separator line should follow the column and must be either No_Vertical_Line or Vertical_Line.
Throws:
IllegalArgumentException This exception is thrown when any argument is not valid.

setSelectionType

public setSelectionType (int newSetting)
This method sets the selection style to be used by the container.

Parameters:
newSetting - The selection style the container is to use. It must be one of Single_Selection, Forced_Single_Selection or Multiple_Selection.
Returns:
This method returns void.
Throws:
IllegalArgumentException This exception is thrown when any argument is not valid.

setSplitBar

public void setSplitBar (int, afterColumn, int windowPos)
This method defines if and where a split bar will be displayed in the Details view.

Parameters:
afterColumn - The number of the column (zero-based) after which the split bar will be placed. All columns up to and including afterColumn will be displayed in the left-hand pane. All columns after afterColumn will be displayed in the right-hand pane. Valid values are any number between 0 and n-1 where n is the total number of columns or the No_Split_Bar constant.
windowPos - This number defines where (horizontally) the split bar is to be drawn. It is treated as a percentage of the container's width. Valid values are any number between 10-90.
Throws:
IllegalArgumentException This exception is thrown when any argument is not valid.

getSelected

public ContainerItem [] getSelected ()
This method returns an array of the currently selected ContainerItems. If no item is selected, null is returned. When the DataContainer is in single selection mode and an item is selected, this array will always contain a single element.

Returns:
This method returns an array of ContainerItems.

setAllSelection

public void setAllSelection (boolean newState)
This method sets the selection state for all ContainerItems in the DataContainer.

Parameters:
newState - The 'selected' state to set for all the items.

getRoot

public ContainerItem getRoot ()
This method returns the root container item for the container.

Returns:
This method returns a ContainerItem.

refresh

public void refresh ()
This method places the container in sync with its collection of ContainerItems.


Events

The following table lists the relevant contents of an Event object and under what circumstances the event is posted. All events are posted to the owner of the container. The event.target attribute will always hold a reference to the container.

Event.id Event.arg Event posting trigger
ACTION_EVENT A reference to the ContainerItem which was double-clicked on. The user double-clicked on an item in the container.
LIST_SELECT A reference to the ContainerItem which was selected. The user clicked on an item to select it.
LIST_DESELECT A reference to the ContainerItem which was deselected. The user clicked on an item to deselect it.


[ Previous section | Next section | This Package | Package List | Table of Contents ]