Overview

ReflectionUI is an open source Java GUI (general user interface) generator library.

The generation of the GUI requires no other information that the object itself. Its structure is discovered at run-time through Java reflection.The generated GUI can be customized in a non-intrusive way by overriding some key methods of the generator objects.

CustomUI is a sub-project of ReflectionUI providing a GUI builder. It actually allows WYSIWYG advanced customizations of user interfaces generated by ReflectionUI.

Use Cases

  • Developing a project GUI by generating and customizing it
  • Prototyping a GUI
  • Exploring a library capabilities quickly through a generated GUI

Advantages

  • Instant prototyping
  • Reduced cost of user interface development and testing
  • Code injection simplified for cross-cutting concerns (logs, usage statistics, etc.)

GUIs created using CustomUI (ReflectionUI)

  • (Open source software) Phoyo ID

Features

(ReflectionUI)

  • On the fly GUI generation
  • Controls generated for public and getter/setter fields, methods, …
  • Elegant display for exceptions
  • Automatic undo/redo management
  • Automatic copy/cut/paste management
  • Dynamic menus
  • Field validation
  • On-line help management
  • Non-intrusive customizations
  • Generator pluggable to any meta- data model

(CustomUI)

  • GUI customization
  • Various configurable controls (forms, sliders, spinners, tables, trees, html panes, …)
  • Grouping and categorizing controls
  • Flexible layout management
  • Skinning
  • Icons
  • Menus (standard and custom items)
  • Extensible (control plugins)

Differences compared to classic GUI builders

CustomUI (ReflectionUI) Classical GUI builder
GUI structure
  • generated
  • customized
  • designed
  • connected to the data
GUI code mostly interpreted (XML-based customizations) generated and/or interpreted
Standard features
  • copy/cut/ paste
  • undo/redo
  • open/save file
  • etc
enabled/disabled developed
GUI update automatic manual
GUI maintenance optional mandatory
GUI re-usability reusable plugins can be developed reusable controls can be developed

Getting started

How to include the libraries in a project

  • Get the archive file from the download area
  • Extract it
  • Add the jars from the ‘lib’ directory to your classpath

How to use

Basic usage:


Disable the design mode by setting this system property:

-Dxy.reflect.ui.infoCustomizationsToolsHidden=true

Complete HelloWorld example:

Download

Documentation

Architecture

This UI is generated in 2 steps:

  1. Each object class informations are read and interpreted by the ReflectionUI object. The result is an abstract GUI model element: ITypeInfo.
  2. Then this abstract GUI model is passed to the SwingRenderer that will create the various GUI controls displaying the object values
(ReflectionUI) (SwingRenderer)
Class ——————–> ITypeInfo ——————–> UI

The ReflectionUI interpretation algorithm is based on the Java language coding standards (ex: getter/setter interpreted as a unique property, …).

Unfortunately, even when these standards are respected, there might not be enough information in every class definition to provide a UI that looks and behaves exactly as expected. This is why the ReflectionUI interpretation process will often need to be customized. This is where the InfoProxyFactory comes into play. It is not essential to the ReflectionUI customization, but it makes it easier by allowing to specify conveniently a proxy for the ITypeInfo object.

CustomUI provides the customizations editor by  using the following classes:

  • InfoCustomizations: declarative customizations persisted in XML.
  • InfoCustomizationsFactory: subclass of InfoProxyFactory generating proxies according to an InfoCustomizations instance.
  • CustomizedUI: ReflectionUI subclass compatible with InfoCustomizationsFactory
  • SwingCustomizer: subclass of SwingRenderer compatible with CustomizedUI
(CustomizedUI) (InfoCustomizationsFactory) (SwingCustomizer)
| | |
(ReflectionUI) (InfoProxyFactory) (SwingRenderer)
Class ——————–> ITypeInfo ——————–> ITypeInfo (proxy) ——————–> UI
^
             |_______  ____|

Tutorials

Tutorials have been written as class methods in the examples sub-project. You should read the comments first:

  • ReflectionUI tutorial: <DISTRIBUTION_DIRECTORY>/examples/src/main/java/xy/reflect/ui/example/ReflectionUITutorial.java
  • CustomUI tutorial: <DISTRIBUTION_DIRECTORY>/examples/src/main/java/xy/reflect/ui/example/CustomUITutorial.java

More Examples

Explore the the examples sub-project (‘examples’ directory) in the distribution folder for more information.

Support

The support page is hosted here on GitHub.

You can also contact us by email: dotxyteam@yahoo.fr.

Find more support here.