Introduction Vaadin 7.4 was recently released and it includes a new component called the GRID . It represents a 'Spreadsheet" type model from a UI perspective, however I think it lacks a lot of features you would expect from this type of component. Maybe this component will evolve over time and it will begin to have the functions that you expect from a spreadsheet. ( note: there is a commercial add on called the Spreadsheet from Vaadin ) Use Case The use case I am demonstrating below is a simple grid showing projected sales of Widgets over a five year period. Creation Creating a Grid is very simple and you have numerous options for sizing on the page. In the example below I setting it across the page. The Grid rows can be selected for editing, you can select single or multiple rows in a single action. myGrid = new Grid(); myGrid.setSizeFull(); myGrid.setSelectionMode(SelectionMode.SINGLE); Container Backing Similar to many other Vaadin componen...
My previous post concerning the Vaadin SQL Contanier covered how to create a SQL Container and a Table Query using the Vaadin SQL Container Add On. In this post I will give a very short overview on how to filter the results of a Table Query. A filter can be applied to a SQL Container so that the results of that Table Query can be narrowed to a specific set of rows within the table. For example, lets assume you have created a Table Query on an address table within your database. TableQuery q = new TableQuery("address", connectionPool); Your requirement is to filter the data within that Table Query to a specific suburb, street and postcode. To achieve that requirement you create three filters using the Compare.Equal object. The values for suburb, postcode and street are passed in as parameters. Compare.Equal suburbFilter = new Compare.Equal("suburb", suburb); Compare.Equal postcodeFilter = new Compare.Equal("postcode", postcode); Compare....
It must be me. But I spent a lot of time trying to figure out how to connect a database table implemented as a Vaadin SQL Container to a Vaadin Combo Box. It seems such a simple concept. Anyway, here was my requirement. I needed a combo box to contain a list of Australia suburbs. The user would select a suburb which would filter the results in a table on the screen. My database table was very simple. A id field ( which was the primary key ) and a name field which contained the suburb name. The code for the SQL Container was simple. TableQuery q = new TableQuery("suburb", connectionPool); suburbContainer = new SQLContainer(q); Now code to establish the combo box and links to the SQL Container. ComboBox suburbCB = new ComboBox(); suburbCB.addItem(""); suburbCB.setCaption("Filter by Suburb"); suburbCB.setContainerDataSource(app.getDatabase().loadSuburbs()); suburbCB.setItemCaptionPropertyId("name"); suburbCB.setItemC...
Comments
Post a Comment