Hitachi Vantara Pentaho Community Wiki
Child pages
  • Advanced Guide to MVC in Pentaho XUL Applications

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It is the responsibility of your Controller implementation to setup bindings between your XUL components and your data model (a POJO/Java Bean). What do we mean by "binding"? Binding is a way to associate bean properties so that when one changes, the other is kept in sync. Binding can be unidirectional or bidirectional, but we won't get into that here. We will assume that a binding is always bidirectional meaning when either side of the binding changes, the other will reflect the change. This is useful in UI applications because we can tie, say, a text box's value to a model bean String property.  Consider the following XUL file snippet that defines a text box component by id "nameTextBox".  Notice that there are no attribute specifying event handler calls; these are not needed when using data binding.

Code Block
 <textbox id="nameTextBox">

...

  • represented as a Java Bean (with property change support)
  • "models" UI component state as bean properties
  • contains view logic such as enablement and visibility, i.e. the state of UI components
  • applies form validation

View

  • represented in the xul domXUL dom (via XUL source file)
  • contains syntax for creation of ui UI components
  • layout of ui UI components

Controller

  • represented as a Java class that implements XulEventHandler
  • binds UI state to the model
  • performs UI action evnt handling (not related to component state) such as launching of dialogs