The essential of MONOI in 2 minutes


The MONOI project aims to support several languages and technologies. Nevertheless, it is for now only available for Java 5, based on SWT/JFace. Use is encouraged in an Eclipse RCP environment even if standalone SWT can be enough.

Components and Context

MONOI is based around 2 notions :

  • the components, which represent the GUI widgets,
  • the context, which is a data container.

Components and context are linked by the code you write thanks to string expressions called "data paths".

To be more precise, a "data path" is a standard EL expression and will enable to retrieve any value in a hierarchy of JavaBean objects.

For instance, you can put a Person bean in the context :

1   context.put("person", myPerson);

and indicate that a field should display a property of this bean :

1   field.setValueDataPath("");

As a result, acting on the field (typing a new value) will affect the JavaBean in the context directly. In a sense, context holds the data model and components make the views.

Note: in fact, you can work with multiple contexts and attach any of them to any component of the hierarchy, but in most cases, working with one global context is enough and less confusing.


The layout management in MONOI is really different of what you can encounter in SWT or Swing. Instead of having to chose between many ways to layout the components and link one of them to every composite, MONOI comes with one general layout system which can cover most cases in an intuitive way.

Indeed, widgets are simply positioned in an implicit grid or table in the order you declare them. All you have to do is to declare the change of row or column.

For instance, this piece of code :

1   MContainer container = new MContainer(parent);
2   MLabel labelA = new MLabel(container);
3   MLabel labelB = new MLabel(container);
4   container.newColumn();
5   MLabel labelC = new MLabel(container);

will put labelA and labelB in a first column on the left (labelA above labelB) and labelC in a second column on the right (next to labelA).

labelA labelC

The ability to nest several containers gives much power to build complex layouts. Span and align properties are also provided to precise the behavior of each component.

This is simply the way HTML tables work (and are still often used for layout despite CSS positioning). The only real difference is that you can choose to describe the layout row by row or column by column.

Events and actions

MONOI will also avoid you all these listener classes that you have to develop with SWT or Swing. Each component will expose specialized methods, giving a simple view of what you can do and a simple way to react to the events.

For instance, adding behavior to a button is very straightforward :

1   button.getActions().onClick(obj, "action1");

will trigger obj.action1() when user press the button.


This is only a short view of what MONOI can bring but it shows its philosophy, oriented towards ease of use and efficiency.

If after reading this, you think MONOI is too simple and breaks radically some good design principles, then go on using SWT/JFace or Swing. If you think MONOI can simplify your developer life and help you concentrate on your business, then this project is for you !

Feel free to download it, browse the documentation, look at the samples (in package tests.monoi.widgets.swt) and look at the forum and trackers.