Retrieving from a Delivery Service
In an earlier article
, I showed you how to build an XML delivery service using PHP, Apache, and MySQL. This service delivered the results of a query to a MySQL database in XML. To see Bambookit in action it would be a good idea to work through that article and set up the XML retrieval service that it steps you through. You can then enhance that service with the xml.php file that is in the download for this article.
The update adds a new parameter gui= to the service parameter list that, when set to 'y' (for 'yes'), generates a Bambookit XML file containing the definition for a table.
To understand this code, you first have to understand how Bambookit defines a table. The schema is below:
As you can see from the schema, Bambookit defines a table to be a collection of lists. Each column in the table is represented by a list. This can lead to a problem when, for example, you resize a column. In a table you would expect the rest to follow suit, but in Bambookit they will not unless you attach
them to each other. The property attachToWidget
achieves this. You simply specify the second column as attached to the first, the third to the second etc. and Bambookit will render the columns as a table. The PHP script in the downloadable source code for this article will do this for you.
In the download you will also see a sample XML file called table.xml. Examine it closely to see the relationships within the nodes defined within the XML attributes such as attachToWidget.
The HTML file is exactly like the HTML from the combo box example above. It simply contains an applet reference that loads the GUI definition from the PHP service. When rendered in Internet Explorer, it will display a table like that in Figure 2, above.
The example helps show how Bambookit adds a lot of value. The table has resizable columns and is sortable by clicking on the column headers in the way that is familiar to Windows Explorer users. Clicking on the column toggles between an ascending and descending sort.
This saves a lot of coding on the part of the user, and as it is Java based, it is cross platform by definition. To develop user interaction to enhance the base functionality derived from the Bambookit widgets there are a number of actions that can be set based on known stimuli. Check the Bambookit documentation for more details.