Public: Concord Software Projects : OTrunk Controllers
This page last changed on Jul 14, 2009 by sfentress.
OTrunk Controllers are used link OTrunk objects with Plain Old Java Objects (POJO). The are useful if you want to use OTrunk to configure and save data from java libraries which don't directly use OTrunk objects.
There are 3 objects involved when an controller is used. The OTObject, the OTController, and the "RealObject"(POJO).
Here is an example of how controllers can be used. There is a java library that supports graphing data. To supply data to the graph a DataProducer interface is implemented and the implementation is passed to the graph. For example lets say we want to provide a DataProducer that always supplies the same value:
Make a new java interface which extends OTObjectInterface
Make a new java class which implements OTController
For each controller you need to do the following things:
Define the following two public static fields:
Replace MyObject.class with the class this controller is working with.
Implement the "loadRealObject" method. It should get properties from the otObject field, and set them on
There needs to be a OTPackage in the same java package as the OTObject. The name of the OTPackage class
In the initialize method add a call to register your new controller class:
|Document generated by Confluence on Jan 27, 2014 16:52|