Xoetrope
HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2006-12-07 10:10:57 by LuanO

Additions:
OLD NEW
new DatabaseTableModel() new DatabaseTableModel(project)
DatabaseTableModel.getTable('Voltages') DatabaseTableModel.getTable(project,'Voltages')
XModelHelper.get( rootNode, 'Type' ) XModelHelper.get( project, rootNode, 'Type' )


Deletions:
Unknown action; the action name must not contain special characters.



Edited on 2006-12-07 10:10:03 by LuanO

Additions:
Unknown action; the action name must not contain special characters.

Deletions:
Unknown action; the action name must not contain special characters.



Edited on 2006-12-07 10:08:41 by LuanO

Additions:
{{table columns="2" cellpadding="1" cells="OLD;NEW;new DatabaseTableModel();new DatabaseTableModel( project );DatabaseTableModel.getTable( "Voltages" );DatabaseTableModel.getTable( project, "Voltages" );

Deletions:
{{table columns="2" cellpadding="1" cells="OLD;NEW;new DatabaseTableModel();new DatabaseTableModel( project );DatabaseTableModel completeVoltageTable = DatabaseTableModel.getTable( "Voltages" ); DatabaseTableModel completeVoltageTable = DatabaseTableModel.getTable( project, "Voltages" );



Edited on 2006-12-07 10:07:17 by LuanO

Additions:
Widening of APIs
Many APIs now take a reference to the current project as an argument, for example new DatabaseTableModel(); becomes new DatabaseTableModel( project );. The change allows for better coordination of resources in the context of modular applications where two or more applications are loaded within the one JVM. Similarly
Unknown action; the action name must not contain special characters.




Edited on 2006-12-07 09:53:45 by LuanO

Additions:
Validations
The validations are setup by a single factory class that can take multiple configuration files, and therefore the initialization changes from:
try {
setValidationFactory( new XValidationFactory( project.getBufferedReader( "validate.xml", "UTF8" )) );
catch ( Exception ex ) {
ex.printStackTrace();
to
try {
setValidationFactory( new XValidationFactory( project ));
catch ( Exception ex ) {
ex.printStackTrace();
%%
the new factory reads a validations.xml file from the project, in addition to the one included in XUI itself (see net/xoetrope/xui/validation/validations.xml).
Similarly, the XDataBindingFactory has changed from and interface to an abstract class and it now has responsibility for calling the bindings setup method, so the old XUI 2.x factory
Finally, instantiating the bindings is now a little harder due to the new interfaces and a set of helper (not yet finalized) methods have been added to ease the transition
addBinding( new XTextBinding( roomNumber, "load/currentLoad" ));
becomes
addBinding( BindingHelper.newXTextBinding( roomNumber, "load/currentLoad" ));
The BindingHelper class performs the following functions (this will be inserted into XUI 3.0 at some point in the future prior to release).
package net.xoetrope.deprecated.binding.helper;
import java.awt.Component;
import java.util.Hashtable;
import net.xoetrope.optional.data.XLocalisedListBinding;
import net.xoetrope.xui.XProjectManager;
import net.xoetrope.xui.data.XDataBinding;
import net.xoetrope.xui.data.XListBinding;
import net.xoetrope.xui.data.XStateBinding;
import net.xoetrope.xui.data.XTextBinding;
public class BindingHelper
public static XDataBinding newXStateBinding( Object c, String source )
XStateBinding binding = new XStateBinding();
Hashtable instanceConfig = new Hashtable();
instanceConfig.put( "source", source );
instanceConfig.put( "sourcePath", source );
binding.setup( XProjectManager.getCurrentProject(), (Component)c, null, instanceConfig );
return binding;
public static XDataBinding newXTextBinding( Object c, String source )
XTextBinding binding = new XTextBinding();
Hashtable instanceConfig = new Hashtable();
instanceConfig.put( "source", source );
instanceConfig.put( "sourcePath", source );
binding.setup( XProjectManager.getCurrentProject(), (Component)c, null, instanceConfig );
return binding;
public static XDataBinding newXTextBinding( Object c, String source, String output )
XTextBinding binding = new XTextBinding();
Hashtable instanceConfig = new Hashtable();
instanceConfig.put( "source", source );
instanceConfig.put( "sourcePath", source );
instanceConfig.put( "output", output );
instanceConfig.put( "outputPath", output );
binding.setup( XProjectManager.getCurrentProject(), (Component)c, null, instanceConfig );
return binding;
}
public static XDataBinding newConversionTextBinding( Object c, String source, int units )
ConversionTextBinding binding = new ConversionTextBinding();
Hashtable instanceConfig = new Hashtable();
instanceConfig.put( "source", source );
instanceConfig.put( "sourcePath", source );
instanceConfig.put( "units", new Integer( units ));
binding.setup( XProjectManager.getCurrentProject(), (Component)c, null, instanceConfig );
return binding;
public static XDataBinding newConversionTextBinding( Object c, String source, int units, int decimals )
ConversionTextBinding binding = new ConversionTextBinding();
Hashtable instanceConfig = new Hashtable();
instanceConfig.put( "source", source );
instanceConfig.put( "sourcePath", source );
instanceConfig.put( "units", new Integer( units ));
instanceConfig.put( "decimals", new Integer( decimals ));
binding.setup( XProjectManager.getCurrentProject(), (Component)c, null, instanceConfig );
return binding;
public static XDataBinding newXLocalisedListBinding( Object c, String source )
XLocalisedListBinding binding = new XLocalisedListBinding();
Hashtable instanceConfig = new Hashtable();
instanceConfig.put( "source", source );
instanceConfig.put( "sourcePath", source );
binding.setup( XProjectManager.getCurrentProject(), (Component)c, null, instanceConfig );
return binding;
}
public static XDataBinding newXLocalisedListBinding( Object c, String source, String output )
XLocalisedListBinding binding = new XLocalisedListBinding();
Hashtable instanceConfig = new Hashtable();
instanceConfig.put( "source", source );
instanceConfig.put( "sourcePath", source );
instanceConfig.put( "output", output );
instanceConfig.put( "outputPath", output );
binding.setup( XProjectManager.getCurrentProject(), (Component)c, null, instanceConfig );
return binding;
}

public static XDataBinding newXListBinding( Object c, String source )
XListBinding binding = new XListBinding();
Hashtable instanceConfig = new Hashtable();
instanceConfig.put( "source", source );
instanceConfig.put( "sourcePath", source );
binding.setup( XProjectManager.getCurrentProject(), (Component)c, null, instanceConfig );
return binding;
public static XDataBinding newXListBinding( Object c, String source, String output )
XListBinding binding = new XListBinding();
Hashtable instanceConfig = new Hashtable();
instanceConfig.put( "source", source );
instanceConfig.put( "sourcePath", source );
instanceConfig.put( "output", output );
instanceConfig.put( "outputPath", output );
binding.setup( XProjectManager.getCurrentProject(), (Component)c, null, instanceConfig );
return binding;
}
Event handling
The event handling has changed to allow registration of new event handlers. For the most part this change will not be visible to XUI users unless XUI event handlers are added directly from Java. In such cases the API is more complicated, and again some helper methods are added.
addMouseHandler( imgHome, "showHome" );
addMouseHandler( imgMoreInfo, "moreInfo" );
addMouseHandler( imgContinue, "nextScreen" );
addMouseHandler( imgBack, "previousScreen" );
addMouseHandler( roomImage, "handleHotspotsClicks" );
addItemHandler( cmbFloorType, "floorTypeChanged" );
addKeyHandler( txtFloorThickness, "floorThicknessChanged" );
MigrationHelper.addMouseHandler( this, imgHome, "showHome" );
MigrationHelper.addMouseHandler( this, imgMoreInfo, "moreInfo" );
MigrationHelper.addMouseHandler( this, imgContinue, "nextScreen" );
MigrationHelper.addMouseHandler( this, imgBack, "previousScreen" );
MigrationHelper.addMouseHandler( this, roomImage, "handleHotspotsClicks" );
MigrationHelper.addItemHandler( this, cmbFloorType, "floorTypeChanged" );
MigrationHelper.addKeyHandler( this, txtFloorThickness, "floorThicknessChanged" );
Access to the data model and other project members that were available should now be accessed via the current project. Thus the model can be accessed as
  1. rootModel from within a page
  2. getModel() from within the project

    Deletions:
    Similarly



    Edited on 2006-12-07 09:33:36 by LuanO

    Additions:
    Similarly
public class XUnitBindingFactory implements XDataBindingFactory
{
public XDataBinding getBinding( PageSupport page, Object comp, XModel model, XmlElement bindingNode )
{
StaticBinding staticBinding = new StaticBinding();
staticBinding.setup( comp, bindingNode );
return staticBinding;
}
public class XUnitBindingFactory extends XDataBindingFactory
{
public XUnitBindingFactory( XProject project )
super( project );
}
public XDataBinding getBinding( PageSupport page, Object comp, Hashtable instanceConfig )
{
StaticBinding staticBinding = new StaticBinding();
staticBinding.setup( currentProject, comp, null, instanceConfig );
return staticBinding;
}
OLD NEW
import net.xoetrope.xui.helper.BuddyHelper import net.xoetrope.deprecated.xui.helper.BuddyHelper
import net.xoetrope.xui.data.XCustomDataBinding use the new XDataBinding interface


Deletions:
OLD NEW
import net.xoetrope.xui.helper.BuddyHelper import net.xoetrope.deprecated.xui.helper.BuddyHelper
import net.xoetrope.xui.data.XCustomDataBinding




Edited on 2006-12-07 09:28:17 by LuanO

Additions:
OLD NEW
import net.xoetrope.xui.helper.BuddyHelper import net.xoetrope.deprecated.xui.helper.BuddyHelper
import net.xoetrope.xui.data.XCustomDataBinding


Deletions:
Unknown action; the action name must not contain special characters.



Edited on 2006-12-07 09:28:03 by LuanO

Additions:
cells="OLD;NEW;import net.xoetrope.xui.helper.BuddyHelper;import net.xoetrope.deprecated.xui.helper.BuddyHelper;import net.xoetrope.xui.data.XCustomDataBinding;#"}}

Deletions:
cells="OLD;NEW;import net.xoetrope.xui.helper.BuddyHelper;import net.xoetrope.deprecated.xui.helper.BuddyHelper;
import net.xoetrope.xui.data.XCustomDataBinding;#"}}




Edited on 2006-12-07 09:27:49 by LuanO

Additions:
Two Hashtables are passed to the setup method, the first originating from the bindings.xml file that declares the binding type (see net/xoetrope/xui/data/bindings.xml for an example). Each project can include a file to specify custom bindings in addition to the one build into XUI. The second Hashtable includes attributes from the binding declaration in the page XML.
cells="OLD;NEW;import net.xoetrope.xui.helper.BuddyHelper;import net.xoetrope.deprecated.xui.helper.BuddyHelper;


Deletions:
Two Hashtables are passed to the setup method, the first originating from the bindings.xml file that declares the binding type (see net/xoetrope/xui/data/bindings.xml for an example). Each project can include a file to specify custom bindings in addition to the one build into XUI. The second ##Hashtable## includes attributes from the binding declaration in the page XML.
cells="OLD;NEW;import net.xoetrope.xui.helper.BuddyHelper;import net.xoetrope.deprecated.xui.helper.BuddyHelper




Edited on 2006-12-07 09:26:55 by LuanO

Additions:
Data bindings have undergone extensive changes in the upgrade to XUI 3.0, and if you have custom data bindings then you will need to change the implementation. In XUI 2.x the XDataBinding was an interface, but in XUI 3.0 this is changed to a abstract class, thus
The new members are usually initialized when the setup method is invoked. The derived class should now invoke the XDataBinding.setupHelper(...) method when implementing the setup method so as to setup the base class. The method can also implement any setup specific to the individual binding:
Two Hashtables are passed to the setup method, the first originating from the bindings.xml file that declares the binding type (see net/xoetrope/xui/data/bindings.xml for an example). Each project can include a file to specify custom bindings in addition to the one build into XUI. The second ##Hashtable## includes attributes from the binding declaration in the page XML.
import net.xoetrope.xui.data.XCustomDataBinding;#"}}


Deletions:
Data bindings have undergone extensive changes in the upgrade to XUI 3.0, and if you have custom data bindings then you will need to change the implementation. In XUI 2.x the ##XDataBinding## was an interface, but in XUI 3.0 this is changed to a abstract class, thus
The new members are usually initialized when the ##setup## method is invoked. The derived class should now invoke the ##XDataBinding.setupHelper(...)## method when implementing the ##setup## method so as to setup the base class. The method can also implement any setup specific to the individual binding:
Two ##Hashtable##s are passed to the ##setup## method, the first originating from the ##bindings.xml## file that declares the binding type (see net/xoetrope/xui/data/bindings.xml for an example). Each project can include a file to specify custom bindings in addition to the one build into XUI. The second ##Hashtable## includes attributes from the binding declaration in the page XML.
import net.xoetrope.xui.data.XCustomDataBinding;"}}




Edited on 2006-12-07 09:25:16 by LuanO

Additions:
Data bindings
Data bindings have undergone extensive changes in the upgrade to XUI 3.0, and if you have custom data bindings then you will need to change the implementation. In XUI 2.x the ##XDataBinding## was an interface, but in XUI 3.0 this is changed to a abstract class, thus
  1. public class StaticBinding implements XDataBinding

becomes
  1. public class StaticBinding extends XDataBinding

and the new abstract class provides some additional members:
  1.   protected XProject currentProject;
  2.   protected Object component;
  3.  
  4.   protected String sourcePath;
  5.   protected String outputPath;
  6.  
  7.   protected XModel sourceModel;
  8.   protected XModel outputModel;
  9.  
  10.   protected boolean reevaluate = true;

The new members are usually initialized when the ##setup## method is invoked. The derived class should now invoke the ##XDataBinding.setupHelper(...)## method when implementing the ##setup## method so as to setup the base class. The method can also implement any setup specific to the individual binding:
  1. /**
  2.    * Setup and configure the binding instance. The binding is configured via the
  3.    * XML setup registered for the particular binding type and then, subsequently
  4.    * by attibitional attributes of the binding instance specified in the page
  5.    * declaration, for the individual binding instance. The binding may also
  6.    * obtain configuration or reference information from the component and the
  7.    * project.
  8.    * @param project the owning project
  9.    * @param c the component being bound
  10.    * @param bindingConfig the XML element which contains the binding configuration
  11.    * @param instanceConfig the XML element which contains the setup attributes of the binding instance
  12.    */
  13.   public void setup( XProject project,
  14.                       Object c,
  15.                       Hashtable bindingConfig,
  16.                       Hashtable instanceConfig )
  17.   {
  18.     // Setup the base class, setting all its members
  19.     setupHelper( project, c, bindingConfig, instanceConfig );
  20.     // Do the local setup
  21.     Object obj = instanceConfig.get( "unitIdx" );
  22.     if ( obj != null )
  23.       unitIdx = ((Integer)obj).intValue();

Two ##Hashtable##s are passed to the ##setup## method, the first originating from the ##bindings.xml## file that declares the binding type (see net/xoetrope/xui/data/bindings.xml for an example). Each project can include a file to specify custom bindings in addition to the one build into XUI. The second ##Hashtable## includes attributes from the binding declaration in the page XML.
Unknown action; the action name must not contain special characters.


Deletions:
OLD NEW
import net.xoetrope.xui.helper.BuddyHelper import net.xoetrope.deprecated.xui.helper.BuddyHelper




Edited on 2006-12-07 09:02:44 by LuanO

Additions:
Deprecated APIs
Change the following imports
OLD NEW
import net.xoetrope.xui.helper.BuddyHelper import net.xoetrope.deprecated.xui.helper.BuddyHelper




Oldest known version of this page was edited on 2006-11-27 00:29:14 by LuanO []
Page view:

Upgrading to XUI 3.0


XUI 3.0 introduces many new features and capabilities designed to extend the scope of XUI, some of these changes have required changes to the APIs.

API changes
The biggest changes in XUI relate to the project sturcture. Prior to XUI 3.0 the XApplet class provided much of the infrastructure, however as XUI 3.0 expands the number of startup classes and startup styles the code in the class has been refactored into the XApplicationContext class. The second major change is the addition of support for multiple projects within the one JVM instance, this change provides support for construction of mudular applications, however, it required a better separation of project components. The upshot of these changes is that some APIs take an additional argument, a reference to a project.

Factories
Many of the factories in XUI have been redesigned to work with XML configuration files so that they can be extended more easily, and this change should have little impact of upgraded applications unless they rely on internal details of the factories. One side effect of the changes is that some of the internal factories are no longer required and have been dropped.

Event handlers
The event handling is one of those APIs affected by the above changes and has itself undergone significant changes. XUI 3.0 is better able to event types other than the built in types but at the price of changing the API. Gone from the core are the specific adder methods for the built in events and instead these events are configured from XML. In some cases however the events were added from Java code and this is now a little more difficult. To alleviate the problem we have added some helper classes to minimize the code changes and replicate the old way of working, see MigrationHelper in the deprecated packages. As we move toward completion of XUI 3.0, more of these upgrade helpers will be added.
Page was generated in 0.9973 seconds