The power of table-oriented programming

An introduction to Butler

Page 2 of 2
  controller = new RecordController(orderTab);
  ValueEditor editor;
  Column col = orderTab.getColumn("OrderDate");
  editor = controller.createColumn(col)

The RecordController is also a RecordSelectionListener in the same way as a RecordEditor.

In many clients, a list of records exists (RecordListTable), and, when a row (record) is selected, the selected record should appear in a detail view (RecordEditor or RecordController). To add this functionality with Butler, simply register the RecordEditor as a RecordSelectionListener to the RecordListTable:


In most clients, the user needs the ability of first selecting the records he wants to show or edit. With Butler, add that ability with a QueryPanel, which takes a Query and produces a corresponding GUI where the values for populating the filters can be entered. If the result should be shown in a RecordListTable, just register the RecordListTable as a RecordSelectionListener to the QueryPanel:

  query = orderTab.createQuery();
  query.setFilter(new EqualsFilter(orderTab.getColumn("CustomerID")));
  panel = new QueryPanel(query);
  recListTable = new RecordListTable(orderTab); 

The QueryPanel also has a corresponding QueryController if the layout must be customized.

I have introduced the most common data-aware components. If you look at an enterprise client application, you will discover the following pattern in many frames: At the top of the application frame is a section for entering search parameters and a search button (QueryPanel). Below is a list or table showing the search result (RecordListTable). Below that, or as a popup frame, is a detail view for editing one record (RecordEditor).

If you want to create a client following this pattern and you have no need for customizing the layout, you don't need to manually set up these components. Instead, use the SimpleForm class to create a frame with this structure, with just a few lines of code.


This article has described a non-mainstream solution for database programming. The solution resembles database programming before the object-oriented era. But there is one big difference: Butler utilizes the full power of the object-oriented programming language. There does not need to be any impedance mismatch between the use of a relational database and an object-oriented programming language.

Fredrik Bertilsson is the founder of the Butler project. He is a senior software engineer at WM-Data Cross Industry Solutions and holds a master's degree from Chalmers University of Technology. He has been developing enterprise applications in a number of different areas spanning from production control to human resource administration.

Learn more about this topic

| 1 2 Page 2