Documentation

(jvx:client:gui)

Using ImageViewer for Pictures

Translations of this page:

Displaying pictures from databases is relatively simple, but time and again, the implementation in the UI causes problems and repetitive efforts.

JVx reduces the effort to a minimum. The picture data is displayed in tables, selection lists, or forms, and usually no more than three lines of code are necessary.

Example

We have saved a profile picture of a user in the database in binary format. At a different location, we have saved a picture path (e.g., /com/sibvisions/apps/packung/images/flag/austria.png). We want to display both contents in UI as a picture. The definition of the picture's path requires that the picture is contained in the class path. If that is not the case, a standard picture is displayed!

Now the promised three lines of code:

//create the image viewer
UIImageViewer ivProfile = new UIImageViewer();
ivProfile.setDefaultImageName(NO_IMAGE);
 
//set the image viewer als cell editor
rdbPerson.getRowDefinition().getColumnDefinition("IMAGE").getDataType().
                                                          setCellEditor(imageViewer);

All controls that refer to IMAGE represent the saved picture or the standard picture NO_IMAGE such as UITable, UIEditor, etc.

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