Re: [Wicket-user] Best use of Links

2005-11-20 Thread Juergen Donnerstag
As Igor mentioned. It is completely fine to use. Nothing wrong with it.

Juergen

On 11/20/05, Andrew Lombardi [EMAIL PROTECTED] wrote:
 So, I see all this talk of using static factory methods to generate a
 Page, but what would be wrong with just using

 add(new Link(myLink) {
 public void onClick() {
 setResponsePage(new MyPage(param1, param2, param3));
 }
 };

 this looks like it ensures that the page doesn't get created until
 the link is clicked (avoiding the stack overflow problem), and it
 avoids usage of PageParameters (which harken me back to MVC
 frameworks anyway (ick!))...

 is that right?


 On Nov 18, 2005, at 3:19 PM, Eduardo Rocha wrote:

  Yeah, I just forgot IPageLink and PageLink (by the way these names can
  be quite confusing!), so ignore my classes, but I keep my point :P.
 
  2005/11/18, Igor Vaynberg [EMAIL PROTECTED]:
  Actually what i meant was a simple static factory method that
  translates
  strongly typed params into PageParameters.
 
  ie
 
  class MyBookmarkablePage extends WebPage {
  public MyBookmarkablePage(PageParameters params) {
  ...
  }
  public static MyBookmarkablePage(String p1, int p2, String p3) {
  PageParameters params=new PageParameters();
  ...fill in params...
  return new MyBookmarkablePage(params);
  }
  }
 
  also see IPageLink interface that is used by PageLink class. but i
  think
  this is more work, a simple Link's onclick() implementation is the
  path of
  least resistance imho.
 
  -Igor
 
 
 
   On 11/18/05, Eduardo Rocha [EMAIL PROTECTED] wrote:
 
  If it's OK to write a little more code, you could use a factory for
  the page with the same signature your constructor uses. In my
  opinion
  this could be more elegant, but what Igor said is simpler. Something
  like (not tested):
 
  // reusable class
  public interface IPageCreator {
  Page newInstance();
  }
 
  // reusable class
  public class PageCreatorLink extends Link {
  public PageCreatorLink(String id, IPageCreator creator) {
  super(id);
  this.creator = creator;
  }
  public void onClick() {
  setResponsePage(creator.newInstance());
  }
  }
 
  // your class
  public class MyPageCreator implements IPageCreator {
  public MyPageCreator(Object provided) {
  this.provided = provided;
  }
  public Page newInstance() {
  return new MyPage(provided);
  }
  }
 
  // your class
  add(new PageCreatorLink(cancelLink, new MyPageCreator(provided));
 
  maybe your page class could also be the IPageCreator, serving like a
  prototype:
 
  // your class
  public class MyPage extends WebPage implements IPageCreator {
  
  }
 
  The factory would be nice when you have to execute some service
  method
  before rendering the page, so you would have more clearly separated
  responsabilities, i.e., the factory would be responsible for calling
  the service and the page would act just for the view. That way your
  classes would be more testable too.
 
  2005/11/18, Igor Vaynberg [EMAIL PROTECTED]:
  imho that is the best practice. that is what i use whenever i do
  not
  need a
  bookmarkable page. i have yet to use the PageLink class.
  PageLink makes
  it
  easier to create links to pages because it lets you specify the
  class
  name
  of the page or the created page instance. This is ok for pages
  that are
  not
  bookmarkable and take no parameters, but most of the time that
  is not
  the
  case in my experience.
 
  if you work with bookmarkable pages a lot, a static factory
  method that
  fills in pageparameters can help with type safety and forgotten
  params.
 
  -Igor
 
 
 
  On 11/18/05, Gustavo Hexsel [EMAIL PROTECTED] wrote:
Hi all,
 
I wanted to know what's the best way to use Links (PageLinks,
  BookmarkablePageLinks).
 
In the beginning, I was using BookmarkablePageLink's and
  converting
  everything to and from Strings.  That obviously was flawed, as I
  was
  using
  string names and passing them back and forth (lost strong-typing,
  occasionally forgot one parameter, or mistyped the name of it).
  It also
  made me reload objects from the database even though I had them
  handy on
  the
  calling class.
 
Then I tried using PageLink's, passing a new
  XXXPage(whateverparameter) in the constructor.  That didn't work
  either, as
  pages have links back and forth, leading to stackoverflows.
 
Then I moved one step up in the object hierarchy and started
  using
  Link's, but it seems such red tape for each link having to write:
  add(new Link(cancelLink) {
  public void onClick() { setResponsePage(new
  EditProviderPage(provider)); };
  });
 
Any suggestions?
 
 
 []s Gus
 
 
 
 
 
 
 
  ---
  This SF.Net email is sponsored by the JBoss Inc.  Get Certified
  Today
  Register for a JBoss Training Course.  Free Certification Exam
  for All 

[Wicket-user] Formatting numbers in Labels

2005-11-20 Thread Anders Peterson

With code like this

anItem.add(new Label(return, new PropertyModel(tmpInstrument, 
diffusionProcess.localDrift)));


I'm trying to display small numbers.

1.1465448173051241E-12
1.2381223801081599E-6

In the generated page this just appears as 0 or -0. I want it to be 
0.012381223801081599


How can I create Labels that know how to format these small numbers?

/Anders
--
http://ojalgo.org/

Mathematics, Linear Algebra and Optimisation with Java



---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] wicket bench 0.2.0

2005-11-20 Thread Joni Suominen
Version 0.2.0 of wicket bench plugin is available:
http://www.laughingpanda.org/mediawiki/index.php/Wicket_Bench

changes:
- Igor's wicketeer is merged
- initial take on navigation support (this feature will be enhanced in
later versions)
- renamed packages: fi.ri.wicket.bench.* - wicketbench.*

Current features:
http://www.laughingpanda.org/~inhuman/wicket-bench/docs/features-0.2.html

There's also jira site to add bugs/RFEs:
http://www.laughingpanda.org/jira/browse/WB

-- 
Joni Suominen 



---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Formatting numbers in Labels

2005-11-20 Thread Christian Essl

If you use BigDecimals this should work out of the box.

To provide your own format you can override getConverter() on the Label or 
for the whole application Application.getConverterFactory(). For details 
see the wicket page on custom converters:

http://www.wicket-wiki.org.uk/wiki/index.php/Using_custom_converters

Christian

On Sun, 20 Nov 2005 13:20:02 +0100, Anders Peterson 
[EMAIL PROTECTED] wrote:



With code like this

anItem.add(new Label(return, new PropertyModel(tmpInstrument, 
diffusionProcess.localDrift)));


I'm trying to display small numbers.

1.1465448173051241E-12
1.2381223801081599E-6

In the generated page this just appears as 0 or -0. I want it to be 
0.012381223801081599


How can I create Labels that know how to format these small numbers?

/Anders




--
Christian Essl 






___ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de




---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Getting input in a link, not in submit

2005-11-20 Thread Manuel Corrales
Hi, i have a page with a small form, a couple links and a button (submit).
Now, when the button is pressed, i can get the model data, but i need that when a link is clicked, get some data of the form.

How can i achieve this?

Thanks.


Re: [Wicket-user] Getting input in a link, not in submit

2005-11-20 Thread Johan Compagner
then you need to do an onClick on the button that submits the form.only at this time you can't know that that link was clicked (or you have to do that with a special hidden field and check that field in the Form.submit
 () method)johanOn 11/20/05, Manuel Corrales [EMAIL PROTECTED] wrote:
Hi, i have a page with a small form, a couple links and a button (submit).
Now, when the button is pressed, i can get the model data, but i need that when a link is clicked, get some data of the form.

How can i achieve this?

Thanks.




[Wicket-user] wicket-contrib-jasperreports img resource bug

2005-11-20 Thread Matej Knopp

Hi,

there's a bug in JRImageResource that the size of output image does not 
reflets the zoom. (It's always the same - iamage than gets cropped).


I wanted to submit a bugreport and commit a patch but I can't even 
checkout the project from anonymous cvs (I've got the source code from 
web interface) nor can I login to sf.


this should fix it:

class JRImageResource

...

protected byte[] getData() {
...
// create an image object
	BufferedImage image = new BufferedImage((int) 
(float)print.getPageWidth() * getZoomRatio()), 		 
 (int) ((float)print.getPageHeight() * 
getZoomRatio()), type);


...
}

-Matej


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Best use of Links

2005-11-20 Thread Igor Vaynberg
i said the static factories are only useful when you have bookmarkable pages with parameters. that means you need to create a PageParameters, fill it in, and pass it into the page's constructor. i said, imho, it is much better to have a static factory method on the page that does that because you get the benefits of typesafety when creating the pageparameters object.
-IgorOn 11/20/05, Juergen Donnerstag [EMAIL PROTECTED] wrote:
As Igor mentioned. It is completely fine to use. Nothing wrong with it.JuergenOn 11/20/05, Andrew Lombardi [EMAIL PROTECTED] wrote: So, I see all this talk of using static factory methods to generate a
 Page, but what would be wrong with just using add(new Link(myLink) { public void onClick() { setResponsePage(new MyPage(param1, param2, param3));
 } }; this looks like it ensures that the page doesn't get created until the link is clicked (avoiding the stack overflow problem), and it avoids usage of PageParameters (which harken me back to MVC
 frameworks anyway (ick!))... is that right? On Nov 18, 2005, at 3:19 PM, Eduardo Rocha wrote:  Yeah, I just forgot IPageLink and PageLink (by the way these names can
  be quite confusing!), so ignore my classes, but I keep my point :P.   2005/11/18, Igor Vaynberg [EMAIL PROTECTED]:  Actually what i meant was a simple static factory method that
  translates  strongly typed params into PageParameters.   ie   class MyBookmarkablePage extends WebPage {  public MyBookmarkablePage(PageParameters params) {
  ...  }  public static MyBookmarkablePage(String p1, int p2, String p3) {  PageParameters params=new PageParameters();  ...fill in params...
  return new MyBookmarkablePage(params);  }  }   also see IPageLink interface that is used by PageLink class. but i  think
  this is more work, a simple Link's onclick() implementation is the  path of  least resistance imho.   -Igor  
  On 11/18/05, Eduardo Rocha [EMAIL PROTECTED] wrote:   If it's OK to write a little more code, you could use a factory for
  the page with the same signature your constructor uses. In my  opinion  this could be more elegant, but what Igor said is simpler. Something  like (not tested):
   // reusable class  public interface IPageCreator {  Page newInstance();  }   // reusable class
  public class PageCreatorLink extends Link {  public PageCreatorLink(String id, IPageCreator creator) {  super(id);  this.creator
 = creator;  }  public void onClick() {  setResponsePage(creator.newInstance());  }  } 
  // your class  public class MyPageCreator implements IPageCreator {  public MyPageCreator(Object provided) {  this.provided = provided;
  }  public Page newInstance() {  return new MyPage(provided);  }  }   // your class
  add(new PageCreatorLink(cancelLink, new MyPageCreator(provided));   maybe your page class could also be the IPageCreator, serving like a  prototype:
   // your class  public class MyPage extends WebPage implements IPageCreator {    }   The factory would be nice when you have to execute some service
  method  before rendering the page, so you would have more clearly separated  responsabilities, i.e., the factory would be responsible for calling  the service and the page would act just for the view. That way your
  classes would be more testable too.   2005/11/18, Igor Vaynberg [EMAIL PROTECTED]:  imho that is the best practice. that is what i use whenever i do
  not  need a  bookmarkable page. i have yet to use the PageLink class.  PageLink makes  it  easier to create links to pages because it lets you specify the
  class  name  of the page or the created page instance. This is ok for pages  that are  not  bookmarkable and take no parameters, but most of the time that
  is not  the  case in my experience.   if you work with bookmarkable pages a lot, a static factory  method that
  fills in pageparameters can help with type safety and forgotten  params.   -Igor  
   On 11/18/05, Gustavo Hexsel [EMAIL PROTECTED] wrote:  Hi all, 
  I wanted to know what's the best way to use Links (PageLinks,  BookmarkablePageLinks).   In the beginning, I was using BookmarkablePageLink's and
  converting  everything to and from Strings.That obviously was flawed, as I  was  using  string names and passing them back and forth (lost strong-typing,
  occasionally forgot one parameter, or mistyped the name of it).  It also  made me reload objects from the database even though I had them  handy on
  the  calling class.   Then I tried using PageLink's, passing a new  XXXPage(whateverparameter) in the constructor.That didn't work
  either, as  pages have links back and forth, leading to stackoverflows.   Then I moved one step up in the object hierarchy and started
  using  Link's, but it seems such red tape for each link having to write:  add(new Link(cancelLink) {  public void onClick() { setResponsePage(new
  EditProviderPage(provider)); };  });   Any suggestions?  
 []s Gus   
  ---  This SF.Net email is sponsored by the JBoss 

Re: [Wicket-user] wicket-contrib-jasperreports img resource bug

2005-11-20 Thread Eelco Hillenius
Thanks, it's fixed.

Eelco

On 11/20/05, Matej Knopp [EMAIL PROTECTED] wrote:
 Hi,

 there's a bug in JRImageResource that the size of output image does not
 reflets the zoom. (It's always the same - iamage than gets cropped).

 I wanted to submit a bugreport and commit a patch but I can't even
 checkout the project from anonymous cvs (I've got the source code from
 web interface) nor can I login to sf.

 this should fix it:

 class JRImageResource

 ...

 protected byte[] getData() {
 ...
 // create an image object
 BufferedImage image = new BufferedImage((int)
 (float)print.getPageWidth() * getZoomRatio()),
   (int) ((float)print.getPageHeight() *
 getZoomRatio()), type);

 ...
 }

 -Matej


 ---
 This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
 Register for a JBoss Training Course.  Free Certification Exam
 for All Training Attendees Through End of 2005. For more info visit:
 http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Re: There must be some docs somewhere?

2005-11-20 Thread Igor Vaynberg
wicket-contrib-data and wicket-contrib-data-hibernate do not provide any form of transaction management. furthermore, they are obsolete due to repeater package (what used to be wicket-contrib-dataview) in wicket-extensions.
also, this discussion did not have much to do with spring itself, but with the fact that it isnt the greatest idea to tightly couple your persistence layer with your ui layer, because that forces your business logic to live inside the ui. i am familiar with spring so that is what i chose to build the example of how not to do that, same functionality can be accomplished with a slew of other technologies.
so far all i see is whining that we should have a wicket/hibernate integration framework, but no one has actually pointed out what features/functionality it should provide. so how about something more concrete? and an explanation of why wicket - a user interface framework - should provide transaction management services.
-IgorOn 11/18/05, Nathan Hamblen [EMAIL PROTECTED] wrote:
I don't think we all agree about Spring's role in Wicket. It's fine tosay that Spring will open and close Hibernate transactions if you wantto use it, but that's not a good reason to delete projects that do the
same thing without Spring.NathanIgor Vaynberg wrote: irt spring+hibernate+wicket: Dan is absolutely correct when he says that wicket should never touch hibernate directly. all the hibernate-related logic should stay inside
 spring and be exposed directly through a dao object or through a service facade. i think wicket-contrib-data and wicket-contrib-data-hibernate should be taken out of cvs as they do not display good programming
 practices in general. i thought Phil was going to do that, but i guess he never got around to it, are you reading Phil? take a look at wicket-phonebook in wicket-stuff, its an extremely simple
 crud application that uses the above technologies. it also has excellent javadoc thanks to Gwyn. irt general dao: if you are talking about pulling out data from the database to display,
 such dao already exists and is documented. look up: IDataProvider in wicket-extensions. it is used by the DataView component which is also in the extensions. to see a demo of these look in wicket-phonebook or
 wicket-examples - repeaters. the repeater examples build upon each other from a simple looping view to a fully database driven datatable component. irt spring integration: spring integration doesn't come easy with a framework like wicket.
 unlike servlets which are fairly static singletons wicket applications consist of a lot of volatile objects with varying life cycles. this makes keeping dependencies difficult especially because objects are
 often serialized. there are basically two approaches: simpler approach is to keep all your dependencies in wicket's singleton Application object and let everything else look up dependencies from there, the
 other approach is more sophisticated - it involves creating proxies for dependencies that can be serialized and retain enough information to be able to look up the dependency when they are deserialized (possibly in
 another vm). i recently wrote up an article on this in the wiki that describes the two ways: http://www.wicket-wiki.org.uk/wiki/index.php/Spring
 i haven't had much time to spend on it so its rough around the edges. people should feel free to fix it, it is a wiki after all. irt detaching: the whole idea of detaching objects is to reduce session state. if you
 have a pretty big object that you are using as a model, why keep it in session when you can only keep the id and load the object when it is fist accessed. if you are using the object as a model for the form, then
 you don't need to reattach/lock it, just use hibernate merge instead of saveorupdate. see wicket-phonebook for both use cases. irt trail tutorial: if someone can come up with a scope/spec for a small
 wicket+hibernate+spring application / trail breakdown i can put one together as long as other people promise to write documentation, some javadoc, and dress up the html templates. -Igor
 On 11/17/05, *Dan Gould* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Sam Gendler wrote:
 ... The nice thing is that if examples use a fairly generic DAO abstraction, it should be possible to provide nice examples that aren't dependant upon any particular
 suite of technologies.Just describe the DAO interface and then use those them to access standard POJOs.Obviously, most folks will probably be doing a Hibernate/Spring thing, so addressing best
 practices for combin ing those technologies with Wicket is enormously valuable, but it should be secondary to providing generic best practices for dealing with DAO access, detachability, etc.
 ... 1. hibernate/spring integration (separate from wicket) 2. hibernate/spring/wicket best practices Sam -- all of what you propose sounds excellent.
 [The tradional example has been the pet shop, but nowadays, I think a blogging system is a nice worked example for 

Re: [Wicket-user] Re: There must be some docs somewhere?

2005-11-20 Thread Eelco Hillenius
I don't agree with wicket-contrib-data being obsolete. What happened
is that I created some basic Hibernate support classes last year, and
that other people commented that they didn't like them so much, and
wanted to add alternatives. From there it grew into the bunch a quasi
related classes it is now. I still think classes like
HibernateObjectModel are pretty useable. You may argue about how
elegant the choices as hibernate session delegate etc are, and you may
even argue that it is not best practice to bind to Hibernate in your
view layer. But not every project has to display the perfect
seperation of (service) layers and these classes gives users the
opportunity to go for a more RAD approach. Depending on how much Phil
(and did other people work on that project?) wants to keep, we could
do a clean-up and keep only the classes we still think are usuable.

We don't have to promote the project as best practices, but saying
it's obsolete goes a bit too far.

Eelco


On 11/20/05, Igor Vaynberg [EMAIL PROTECTED] wrote:
 wicket-contrib-data and wicket-contrib-data-hibernate do not provide any
 form of transaction management. furthermore, they are obsolete due to
 repeater package (what used to be wicket-contrib-dataview) in
 wicket-extensions.

 also, this discussion did not have much to do with spring itself, but with
 the fact that it isnt the greatest idea to tightly couple your persistence
 layer with your ui layer, because that forces your business logic to live
 inside the ui.


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Getting input in a link, not in submit

2005-11-20 Thread Manuel Corrales
Maybe i was not clear about my problem. What i need is that when i
click the link get some info and redirect to other page. So far, the
only way i can get the info is getting the model on the onSubmit
method, but that method i use it for redirect to a diferent page.On 11/20/05, Johan Compagner [EMAIL PROTECTED]
 wrote:then you need to do an onClick on the button that submits the form.
only
at this time you can't know that that link was clicked (or you have to
do that with a special hidden field and check that field in the
Form.submit () method)johanOn 11/20/05, Manuel Corrales 
[EMAIL PROTECTED] wrote:
Hi, i have a page with a small form, a couple links and a button (submit).
Now, when the button is pressed, i can get the model data, but i need that when a link is clicked, get some data of the form.

How can i achieve this?

Thanks.






Re: [Wicket-user] Getting input in a link, not in submit

2005-11-20 Thread Christian Essl
I don't know if I understand you right but enclosed is a component which 
behaves (and is) exactly like a Wicket Button but renders instead a 
href=javascript:document.generatedFormName.submit(), which triggers the 
form submit.


One of the SubmitLinks must be given the form in the constructor to 
register an AttributeModifier,  which sets the name attribute of the form.


The usage is:

final MyModel mod = new MyModel();
Form f = new Form(linkForm, new CompoundPropertyModel(mod));
f.add(new TextField(value1));
f.add(new SubmitLink(link1, f) {
protected void onSubmit() {
System.out.println(Link1 was clicked, value1 is: 
+ mod.getValue1());
};
});
f.add(new SubmitLink(link2) {
protected void onSubmit() {
System.out.println(Link2 was clicked, value1 is: 
+ mod.getValue1());
};
});
html:

form wicket:id=linkForm 
input wicket:id=value1 type=text size=30/
a wicket:id=link1Press link1 to submit/a
a wicket:id=link2Press link 2 to submit/a
input type=submit value=Send/
/form

Hope that helps,

Christian

On Sun, 20 Nov 2005 21:28:54 -0300, Manuel Corrales 
[EMAIL PROTECTED] wrote:


Maybe i was not clear about my problem. What i need is that when i click 
the

link get some info and redirect to other page. So far, the only way i can
get the info is getting the model on the onSubmit method, but that 
method i

use it for redirect to a diferent page.

On 11/20/05, Johan Compagner [EMAIL PROTECTED] wrote:


then you need to do an onClick on the button that submits the form.
only at this time you can't know that that link was clicked (or you have
to do that with a special hidden field and check that field in the
Form.submit () method)

johan


On 11/20/05, Manuel Corrales [EMAIL PROTECTED] wrote:

 Hi, i have a page with a small form, a couple links and a button
 (submit).
 Now, when the button is pressed, i can get the model data, but i need
 that when a link is clicked, get some data of the form.

 How can i achieve this?

 Thanks.







--
Christian Essl 

SubmitLink.java
Description: Binary data


Re: [Wicket-user] Getting input in a link, not in submit

2005-11-20 Thread Christian Essl
Sorry I just realized that the SubmitLink before had a bug (test, test, 
test ;)).Enclosed is something which should work - at least for FireFox 
and IE it does. Please test it if you need it - at all.


Thanks,
Christian


On Mon, 21 Nov 2005 04:43:26 +0100, Christian Essl 
[EMAIL PROTECTED] wrote:



I don't know if I understand you right but enclosed is a component which
behaves (and is) exactly like a Wicket Button but renders instead a
href=javascript:document.generatedFormName.submit(), which triggers 
the

form submit.

One of the SubmitLinks must be given the form in the constructor to
register an AttributeModifier,  which sets the name attribute of the 
form.


The usage is:

 final MyModel mod = new MyModel();
 Form f = new Form(linkForm, new CompoundPropertyModel(mod));
 f.add(new TextField(value1));
 f.add(new SubmitLink(link1, f) {
 protected void onSubmit() {
 System.out.println(Link1 was clicked, value1 is: 
 + mod.getValue1());
 };
 });
 f.add(new SubmitLink(link2) {
 protected void onSubmit() {
 System.out.println(Link2 was clicked, value1 is: 
 + mod.getValue1());
 };
 });
html:

 form wicket:id=linkForm 
 input wicket:id=value1 type=text size=30/
 a wicket:id=link1Press link1 to submit/a
 a wicket:id=link2Press link 2 to submit/a
 input type=submit value=Send/
 /form

Hope that helps,

Christian

On Sun, 20 Nov 2005 21:28:54 -0300, Manuel Corrales
[EMAIL PROTECTED] wrote:


Maybe i was not clear about my problem. What i need is that when i click
the
link get some info and redirect to other page. So far, the only way i 
can

get the info is getting the model on the onSubmit method, but that
method i
use it for redirect to a diferent page.

On 11/20/05, Johan Compagner [EMAIL PROTECTED] wrote:


then you need to do an onClick on the button that submits the form.
only at this time you can't know that that link was clicked (or you 
have

to do that with a special hidden field and check that field in the
Form.submit () method)

johan


On 11/20/05, Manuel Corrales [EMAIL PROTECTED] wrote:

 Hi, i have a page with a small form, a couple links and a button
 (submit).
 Now, when the button is pressed, i can get the model data, but i need
 that when a link is clicked, get some data of the form.

 How can i achieve this?

 Thanks.











--
Christian Essl 

SubmitLink.java
Description: Binary data