![]() |
|||
6 ConcernsA concern is something like an aspect, some behaviour the component has, some role/task that the component is capable to fulfill. For each of the lifecycle methods listed in the previous section, there is a concern with a similar name, for example:
In programming, concerns are represented by public interface Showable { /** * Shows the view. * * @param v the view */ public void show(View v); /** * Hides the view. * * @param v the view */ public void hide(View v); }
You are free to create your own concerns for special roles that your component offers.
As an example, you might want to code something like an
Why do we need those concerns/interfaces? There are two reasons.
So, the container HelloWorldLauncher.java just calls the single lifecycle methods in the specified order.
It checks the component for each concern offered and then calls a method or not.
To see if a component has the concern if (c instanceof Showable) { c.show(View v); } What remains to do for us now, is to let our HelloWorldControllerImpl.java component inherit from the needed interfaces (concerns), so that the container (launcher) will call the right methods: public class HelloWorldControllerImpl extends ApplicationControllerImpl implements Contextualizable, Configurable, Initializable, Showable { }
Don't forget to import the right packages!
All component functionality is to be found in
The result has remained the same: We see an empty default view of the ResMedLib Framework.
But the way to come there is different now.
|
|||
Copyright (c) 1999-2002. The Res Medicinae Webmasters. All rights reserved. GNU FDL license. Last Update: 07.05.2002 |