Trace: • Using DataBookBuilder
JVx has one model for all controls. It's called DataBook. We have implementations for memory and database organized databooks. A databook is like a table (with columns and rows). It needs column definitions to work properly.
If you have simple string arrays or key/value pairs and want to create a databook, you could use the DataBookBuilder. It supports creating memory organized databooks with lists, maps, and arrays.
If you have an array of strings, simply create a databook with the following code:
String[] saValues = new String[] {"First", "First", "Second", "First", "Third"}; IDataBook book = DataBookBuilder.build(saValues);
The book will have two columns. The first is an automatically created ID (BigDecimal), and the second one is the VALUE (string) from the array. The builder has an optional flag to create unique records or to use every given value. The ID is a number starting with 0.
The result of our example:
ID | VALUE ---------------------------------------------------------------------------- 0 | First 1 | First 2 | Second 3 | First 4 | Third