Re: Accessing Page components

2009-12-17 Thread Juan Carlos Garcia M.
> > there (I put it in my submitLinks/buttons) >> >> > >> >> > On Thu, Dec 17, 2009 at 2:45 PM, Pieter Degraeuwe < >> >> > pieter.degrae...@systemworks.be> wrot

Re: Accessing Page components

2009-12-17 Thread Pieter Degraeuwe
Links/buttons) > >> > > >> > On Thu, Dec 17, 2009 at 2:45 PM, Pieter Degraeuwe < > >> > pieter.degrae...@systemworks.be> wrote: > >> > > >> >> Use the onSubmit(AjaxRequestTarget target) of your AjaxSubmitLink > >> instea

Re: Accessing Page components

2009-12-17 Thread Juan Carlos Garcia M.
arget target) of your AjaxSubmitLink >> instead >> >> of your form. >> >> (Note that if you make use of FeedbackPanel, youd should also override >> >> the >> >> onError() method of that ajaxlink to 'refresh' your fee

Re: Accessing Page components

2009-12-17 Thread Pieter Degraeuwe
to 'refresh' your feedback panel) > >> > > > > At first I wanted to do this in onSubmit of AjaxSubmitLink, but i've > problem > to get name and address components inside this method :( > > -- > View this message in context: > http://old.nabble.co

Re: Accessing Page components

2009-12-17 Thread marioosh.net
first I wanted to do this in onSubmit of AjaxSubmitLink, but i've problem to get name and address components inside this method :( -- View this message in context: http://old.nabble.com/Accessing-Page-components-tp26824375p26828432.html Sent from the Wicket - User mailing list archiv

Re: Accessing Page components

2009-12-17 Thread Pieter Degraeuwe
allback; >> >>Link link = new Link(); >>this.setModel(new Model(link)); >>add(new TextField("name", new PropertyModel(link, >> "name"))); >>add(new TextField("address&qu

Re: Accessing Page components

2009-12-17 Thread Pieter Degraeuwe
tyModel(link, > "address"))); >add(new AjaxSubmitLink("ok"){ >@Override >protected void onSubmit(AjaxRequestTarget target, > Form form) {} >}); >}

Re: Accessing Page components

2009-12-17 Thread marioosh.net
); } @Override protected void onSubmit() { System.out.println("ok"); Link l = (Link)this.getModelObject(); new LinkDAO().save(l); callback.onAdd(target ); // ?

Re: Accessing Page components

2009-12-17 Thread Pieter Degraeuwe
There are several ways how you can do this... To encourage losely coupled components folowing is in my opinion the best solution.. Work with a callback mechanism. let's say you define a callback interface SaveCallback with a method onSaved(AjaxRequestTarget target). The component that uses you pa

Re: Accessing Page components

2009-12-17 Thread marioosh.net
2009/12/17, Pieter Degraeuwe : > However, I never do it like this. I always use PropertyModels() to 'map' my > TextFields to properties of my object. This way your code in the onClick() > method uses that just the object properties. (Note that the AjaxSubmitLink > has no onClick(), but a onSubmit()

Re: Accessing Page components

2009-12-17 Thread Paul Szulc
Just declare them final, should work just fine, but with consequences (you wont be able to re-reference them in a future). On Thu, Dec 17, 2009 at 8:45 AM, marioosh.net wrote: > Is simple possibility to access page components in anonymous onClick > method like in code below ? > > public class New

Re: Accessing Page components

2009-12-16 Thread Bert
If you want to access them from a call you need to declare them final final TextField name = new TextField("name"); But i' m missing a Model that should receive the values from the form components? Normally, with wicket you do not access the FormComponets to get the values but let Wicket handle th

Re: Accessing Page components

2009-12-16 Thread Pieter Degraeuwe
Place your textfields in a Form. Replace your AjaxLink() by a AjaxSubmitLink (and place that link also in the form) then, you should be able to get the values by name.getDefaultModelObject() I think... However, I never do it like this. I always use PropertyModels() to 'map' my TextFields to proper

Accessing Page components

2009-12-16 Thread marioosh.net
Is simple possibility to access page components in anonymous onClick method like in code below ? public class NewLinkPanel extends Panel { public NewLinkPanel(String id) { super(id); TextField name = new TextField("name"); TextField address