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

--Work with ChoiceCellEditors instead of Checkboxes

Documents for the development of and with JVx.

--Work with ChoiceCellEditors instead of Checkboxes

Postby Development@SIB » Sat Oct 26, 2013 11:42 pm

This article is outdated - please use our new system at

JVx has checkboxes defined with ICheckbox, but such checkboxes are not automatically bound to the model. It's possible to bind checkboxes manually and update the state after value changed events. If you need a checkbox automatically bound to the model an IChoiceCellEditor is the class to use.

The choice cell editor is not a real checkbox, it is a cell editor that has a list of values and shows an image instead of the value. It's very easy to use it as checkbox, because the only things you need are two images. One image for checked state and one for unchecked state. You can e.g. use YES/NO, Y/N, TRUE/FALSE as checked/unchecked values. The choice cell editor is very powerful because it offers multi-state checkboxes. This is what you need if you develop database applications, because two states are not enough.

How to use the choice cell editor?

There are more options, but the easiest one is to set the cell editor for the column:
Syntax: [ Download ] [ Hide ]

The ApplicationUtil defines default cell editors. The YESNO_EDITOR is defined as:
Syntax: [ Download ] [ Hide ]
new UIChoiceCellEditor(new Object [] {"Y", "N"},
                       new String [] {UIImage.CHECK_YES_SMALL, UIImage.CHECK_SMALL},

It's also possible to define default choice cell editors for an application:
Syntax: [ Download ] [ Hide ]

A default choice cell editor will be set automatically, for a column, if the metadata of the column defines allowed values. Allowed values could be set via check constraints in the database or via setAllowedValues in the column metadata.

It works great if you use check constraints, enums or sets in your database, for specific columns, together with default choice cell editors. You don't need extra source code to show "checkboxes". Everything will be auto-configured.
User avatar
Posts: 313
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation