Skip to end of metadata
Go to start of metadata

New components vs. new pages

Q: When should I implement a new dialog in a new component, when should I put it into an existing one?

A: This is a question of design and so far also a matter of taste. Pages in the same component can easily exchange also complex data, components can only communicate with component properties (and maybe the HTTP session). On the other hand, an independent component can be started by other applications as well.

Different main pages in same component

Q: Is there a possibility to use different main pages in the same component?

A: Yes. In the invoke() method of the component client you can decide witch page you create and invoke e.g. depending on a component parameter.

Sharing objects for multiple components

Q: How can I keep server objects to be shared over multiple components?

A: Use the HTTP session. You can retrieve it from the components XMA session with component.getSession().getHttpSession(). Alternative, you can obtain it in a static way by using XMASessionServer.getXMASession().

Ensuring code execution on session end

Q: How can I ensure, that code (e.g. closing a stream or connection) of a session stored object is executed reliable at the end of the session?

A: A HttpSessionListener implementation can be used for that. To force the servlet container to use an instance of this class, insert the appropriate <listener> element into your web.xml.

Modeless application main page

Q: How can I start a modeless dioalog as main page of a XMA application?

A: You cannot. It would be modeless related to what? But you can start it (only) in this case modal: The generated dialog base class has a constructor where you can pass the modality as int parameter. If you override that, you can decide (e.g. depended on a component propery) before you invoke, that you want to start the dialog as PRIMARY_MODAL in this case. The described constructor is only available in the form MyDialog(ComponentClient component, Shell parentShell, int modal), to replace the call of MyDialogTestDlg(ComponentClient component) you have to pass null for the parentShell parameter.

Initialisation error in enter()

Q: An initialisation error in enter() causes an invalid system state. How can I deal with this?

A: Avoid exceptions in enter(), because it is called somewhere in the middle of the GUI page creation process. Model initialisations (also on the server side) can be done before. See "XMA HOWTO avoid page invocation when initialisation errors occur" for details.

determineState() and stateChanged()

Q: On client side pages there are two generated methods to react to state changes: determineState() and stateChanged(). Why? Which one should I use?

A: determineState() comes first, then stateChanged(). In some projects there is specific code, that will be executed between them and there is in some cases a need for both. Normally stateChanged() alone should be used, you can remove the other one from your derived class.

Labels: