What about this:

BasePage:
---------------------------------------
add(newFindingNumber("findingNumber"));

protected Component newFindingNumber(String id) {
 return new TextField<String>(id);
}
---------------------------------------

in ChildPage:
---------------------------------------
protected Component newFindingNumber(String id) {
  Component component = super. newFindingNumber(id);
  component.setEnabled(false);// or whatever
  return component;
}
---------------------------------------


Alex


fachhoch wrote:
> 
> I looking for some  best practices or better way to control my  page
> components , like set enable add attribute modifiers  etc.
> 
> for example
> 
> I have add and edit page , where one textField   should be enabled in add
> and   disabled in edit so for this I did
> 
> add(new
> TextField<String>("findingNumber").setEnabled(enableFindingNumber()));
> 
>     protected boolean   enableFindingNumber(){
>         return false;
>     }
> 
> 
> the subclass Add page will override this method to true .but this will not
> be generic tomarrow If I need some attribute modifiers    for addpage and
> not for edit again I will do the same add  a protected method  call that
> in
> textfield and override in addpage ,  this approach will make me change the
> base class for everytime for any new features  the sub class needs .I am
> looking for some  way through whcih I can retrieve the component in the
> sub
> class and add decoratos without changing the base class ?
> 
> 

-- 
View this message in context: 
http://www.nabble.com/controlling-components-from-sub-classes-tp23853627p23856345.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to