The Source for Java Technology Collaboration


Home | Changes | Index | Search | Go

ColumnControlButton

Note: this is work-in-progress - a collection of design thoughts

Requirements

The basic requirement is to allow users fine grained control of column-related table properties. The most prominent configuration is to toggle individual column visibility. A typical example is the control in the upper trailing corner of Thunderbird's table of messages: a mouse click into the corner component opens a popup with menu items to check/uncheck. The details about which interactions to support and how to present them may vary widely, see f.i. the first thread in the list of forum discussions.

How to trigger the popup

  • mouse gesture into/over the component (default is same as JButton)
  • keyboard binding

How to expose items for user interaction

  • menu items in a normal popup menu
  • menu items hooked into the application's menu bar
  • menu items in a scrollable popup menu. There's a reference implemenation in the incubator and a flash demo (2Mb) showing the scrollable popup in action. Two problems with this demo are that the seperator between the columns and the additional items is missing and is actually displayed at the end of the list, also if you have along list it would be more useful to have the additional items at the head of the list rather than the tail of the list. Also scrolling is very slow making use of this control less than optimum for tables with many columns would it be better to have a scrollable Jlist instead allowing the user to to scroll quickly up and down.
  • "swap list" in a dialog - columns are hidden/shown by moving between lists of hidden/visible columns. There's a reference implementation in the incubator, coming with a webstart demo
  • allow multiple columns to be toggled. Allow variation of select gesture (multi-select, checkboxes)
  • support submenus
  • select via drag-and-drop

What to expose for user interaction

  • allow control over which view columns are exposed for interactively toggling visible property - default is to expose all columns in the TableColumnModel
  • support column sets (predefined lists of columns or column orderings)
  • support complete control of which additional items to add - default is to add a subset of actions registered in the table'sActionMap, marked by a special key.
  • choose predefined filters/sorts

While not all of these will be supported out of the box, the overall design should allow developers to tweak the default classes with reasonable ease.

Building Blocks

Trigger View

Component which triggers the Popup View on user interaction.

Typically, this view is renderered in the trailing upper corner of a surrounding JScrollPane. A mouseClick into the component opens the Popup View. The default implementation (ColumnControlButton, abbreviated CCB) is a JButton descendant, auto-configured with a default action which opens the Popup View. The Icon is given in the constructor (TBD: default icon in UIManager?). CCB guarantees to keep its enabled property in synch with the enabled property of the associated table.

The JXTable is configurable to show or hide the Primary View. If shown, it's the table's responsibility to position it (depending on component orientation) inside the JScrollPane. The concrete type of the component is transparent, client code can set an arbitrary custom component to fill the role.

Popup View

Component which allows user interaction for fine-grained column-related table configuration

ColumnControlPopup

Property Controller

Handler which binds column-related table properties to Action properties.

The binding responsibility implies that the controller must listen to all relevant table properties, either direct (f.i. table "columnModel") properties or nested (f.i. to columnAdded/removed of the table's column model). The binding "currency" is Action. Currently, CCB implements the Controller (TBD: extract, doesn't belong into the view)

Links to relevant forum threads

Topic ColumnControlButton . { Edit | Ref-By | Printable | Diffs r7 < r6 < r5 < r4 < r3 | More }
 XML java.net RSS

Revision r7 - 13 Feb 2007 - 09:40:43 - Main.paultaylor
Parents: WebHome > SwingLabs > SwingLabsSwingX