This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

--Using DataBookBuilder

Documents for the development of and with JVx.

--Using DataBookBuilder

Postby Development@SIB » Fri Jun 06, 2014 1:15 pm



This article is outdated - please use our new system at

https://doc.sibvisions.com




JVx has one model for all controls. It's called Data Book. We have implementations for memory and database organized data books. A data book 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 data book, you could use the DataBookBuilder. It supports creating memory organized data books with Lists, Maps, and arrays.

If you have an array of strings, simply create a data book with following code:

Code: Select all
String[] saValues = new String[] {"First", "First", "Second", "First", "Third"};

IDataBook book = DataBookBuilder.build(saValues);

The book will have two columns. The first is an automatic 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:

Code: Select all
ID                      | VALUE                                             
----------------------------------------------------------------------------
                      0 | First                                             
                      1 | First                                             
                      2 | Second                                           
                      3 | First                                             
                      4 | Third
User avatar
Development@SIB
 
Posts: 313
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation