May I suggest the "state pattern" :).
public class Yours
{
private YourState state;
public Foo someMethod()
{
return state.getFoo();
}
etc.
}
http://en.wikipedia.org/wiki/State_pattern
On 7/12/07, Ittay Dror <[EMAIL PROTECTED]> wrote:
>
>
>
> Hi,
>
>
>
>
> Say I have some entity E, and it can have states A,B,C. now, for each state,
> I render the entity a bit differently (showing more or less information,
> changing colors). The page is comprised of many, sometimes nested (in
> panels) components. What is the best way to achieve those variations, other
> than sprinkling 'if (state == S)' statements when creating the components?
>
>
>
>
> One way could be to allow variations ala xslt on the template html based on
> the state (remove a div, change color of a label etc.). But this changes the
> structure of the page, and may make wicket issue errors (no matching markup
> for component).
>
>
>
>
> I would like to hear what others have to say about this issue
>
>
>
>
> Thank you,
>
> Ittay
>
>
>
> --
> Ittay Dror
> Chief Architect,
> R&D, Qlusters Inc.
> Web: qlusters.com
> Email: [EMAIL PROTECTED]
> Phone: +972-3-6081994
>
> openQRM - Data Center Provisioning
> ------
> I own this number: D0E008A921FF04A9DB8C12668E4315F4. Get
> your own at http://www.freedom-to-tinker.com
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
--
Scott Swank
reformed mathematician
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user