RE: Wicket Philosophy/Best Practice

2011-02-09 Thread Wilhelmsen Tor Iver
> I tell people that I think you should let your Model and Model backing
> object control the look and feel/display/content of your components.
> Even visibility should be delegated to the model or model object and not
> set by the component.   Am I wrong here?  
 
Yes. :)

The model should NOT care about the view, or even know one is there; a 
"controller" is supposed to manipulate the model, any view (if any) should just 
get the value from there and do any necessary formatting (e.g. using a 
converter to/from textual representation).

For instance, why should a Model need to know the locale of a web user to 
produce a correct representation? Separation of concerns and all that.

- Tor Iver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket Philosophy/Best Practice

2011-02-09 Thread Brown, Berlin [GCG-PFS]
I tell people that I think you should let your Model and Model backing
object control the look and feel/display/content of your components.
Even visibility should be delegated to the model or model object and not
set by the component.   Am I wrong here?  
 
I use this approach (only work with the Model/ModelObject) as opposed to
monkeying with the wicket internal(seemingly) methods like
onComponentTag or adding javascript to control the look feel or tags?
 
 
E.g.
 
MyComponent {
  isVisible() {
getModelObject().isVisible();
  }
 isEnabled() { 
getModelObject().isEnabled();
  }
}
 
 
Berlin Brown