Table Widget: Model

Table Widget
Introduction
<<Model>>
Demo
Tutorial
Documentation
Download

Data Model

This component's data is built upon String elements. Arrays of such Strings make-up rows and columns. Each column of Strings has a title associated with it.

Rows and columns of data can be added or deleted dynamically. Further, any element at a [row, column] can be reset to another string. In future versions, replacement of rows/columns by new string arrays will be supported.

Layout

Click here[5k] for a sample screen shot of the Table widget.

Column titles are displayed at the top of the Table, and the column data is displayed below the header. Narrow regions between consecutive coulmn-titles are active and can be dragged to resize widths of columns. Although by default all columns are of equal width, the user (a Java developer) of this component can explicitely specify relative weights for columns. A scrollbar is displayed whenever necessary.

[Back to top]

Event Model

This widget allows two modes of user-interaction:

  1. Actions with single mouse-clicks: In this configuration, single mouse-clicks cause action events (ActionEvent.ACTION_PERFORMED), while mouse-movement causes selection (ItemEvent.SELECTED) and deselection (ItemEvent.DESELECTED).
  2. Actions with double mouse-clicks: This is a more elaborate feature in which double mouse-clicks cause action events, and single mouse-clicks cause selection and deselection events. Multiple selection of rows/columns/elements is possible in this setup.

Both these modes of interaction can be enforced element-level, row-level or column-level. Element-level model allows interaction with data elements directly. In row-level model, an event over a data element applies to all the elements in the same row; while in column-level model, the events apply to all the elements in the same column.

By default, this widget follows the row-level double mouse-click model but this can be changed dynamically.

Selections can also be done manually. However, this will not trigget the event listeners

Event Listeners

The Table Widget supports the folling listeners.

The users of the Table Widget must implement appropriate listener objects and call addXXXListener methods on Table Widget objects. The approach is similar to adding listeners to any Java AWT component.

Customization of Look and Feel

In addition to customization of event model for user-interaction, the following attributes are configurable:


Last modified: Fri Jun 18 11:55:16 India Standard Time 1999

© Subbu Allamaraju 1998, 1999. All rights reserved.

All copyrights and trademarks acknowledged.