Re: Form questions

2013-07-16 Thread Sven Meier

Hi,


Some problems I can't figure out. The code to create the button complains
that it requires a CnavUrl but gets back a String.

   add(new Button(publish, model) {
   @Override
   public void onSubmit() {
   CnavUrl cnavUrl = (CnavUrl) getModelObject();
   System.out.println(publish);
   }
   });


a Button always has a IModelString to fill the value attribute. Note that in 
#onSubmit() you're getting the model object of the button, not of your form.
You can write:


   add(new Button(publish, model) {
   @Override
   public void onSubmit() {
   CnavUrl cnavUrl = (CnavUrl) MyForm.this.getModelObject();
   System.out.println(publish);
   }
   });


Using generic types in your code should help you.

Sven


On 07/15/2013 11:41 PM, Daniel Watrous wrote:

Hello,

I'm interested in creating a single Form that will accommodate the
following use cases
1) display blank for creating new records
2) pre-populate for editing existing records
3) map submitted values on to an existing domain object
4) accommodate two actions, Save Draft -or- Publish

I'm following Wicket in Action and within my Form constructor I create my
model, like this

 CnavUrl cnavUrl = new BasicCnavUrl();
 IModel model = new Model((Serializable) cnavUrl);
 setModel(model);

I then use PropertyModel

 add(new TextField(url, new PropertyModel(cnavUrl, url)));

For the two actions, I'm creating the Button objects like this

 add(new Button(publish, model) {
 @Override
 public void onSubmit() {
 CnavUrl cnavUrl = (CnavUrl) getModelObject();
 System.out.println(publish);
 }
 });

Some problems I can't figure out. The code to create the button complains
that it requires a CnavUrl but gets back a String.

It seems that a new BasicCnavUrl is created once with the Form. What
happens on subsequent calls? Can I always expect my model to have the data
from the current form submission?

Is there a best way to incorporate the idea of an edit, where the model is
pre-populated from a data source and pre-fills the Form fields?

Thanks,
Daniel




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



RE: how to add select/deselect all checkbox to wicket DataTable

2013-07-16 Thread wicket_user_100
Hi Paul Bors, thanks for you reply.

I want to select all results for the entire data table.
I think it's a common problem, actually. I've seen many posts in the
Internet where people didn't find a simple solution for this task, so I
think it will be very useful to share it with the WicketStuff's extension
project.

Can you please provide a link to the wicket repository where I can find your
SelectAllPanel ? I didn't find it.





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-add-select-deselect-all-checkbox-to-wicket-DataTable-tp4660270p4660282.html
Sent from the Users forum 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



wicket based e-mail UI

2013-07-16 Thread Ernesto Reinaldo Barreiro
Hi,

Does anyone has developed an open source, easy to adapt, e-mail client
UI? Of course, based on wicket.

-- 
Regards - Ernesto Reinaldo Barreiro


Problem with wiQuery Dialog after upgrade to Wicket 6.9

2013-07-16 Thread Andrew Schetinin
Hi,

I've just upgraded from Wicket 1.4 to 6.9, and (among lots of other
problems) I have a trouble with porting the code that submitted a form from
within a wiQuery dialog.

My code is based on the sample that can be found here:
http://code.google.com/p/wiquery/source/browse/examples/wiquery-examples/src/main/resources/org/odlabs/wiquery/examples/dialog/DialogPage.java?r=407

The trick here was that the Dialog contains a form which has to be
submitted when OK button is clicked, and that was done with the following
code:

buttonsAdv.add(new DialogButton(Save,

JsScope.quickScope(wicketSubmitFormById('form',' +

formAjaxBehavior.getCallbackUrl() +
', null, null, null, null,
null);)));

Unfortunately, in Wicket 6.9 this code fails to find the function
wicketSubmitFormById()

I also have a feeling that in my previous attempt to port this code to
Wicket 6.6 the same functionality worked fine.

The question is - how is it possible to submit a form from JS?

Regards,

Andrew

--
Andrew Schetinin


Re: Problem with wiQuery Dialog after upgrade to Wicket 6.9

2013-07-16 Thread Sebastien
Hi Andrew,

You have to override your ajaxbehavior#updateAjaxAttributes()

protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes(attributes);

attributes.setMethod(Method.POST); //if you wish to post
attributes.setFormId(yourFormId);
}

Best regards,
Sebastien.


On Tue, Jul 16, 2013 at 5:21 PM, Andrew Schetinin ascheti...@gmail.comwrote:

 Hi,

 I've just upgraded from Wicket 1.4 to 6.9, and (among lots of other
 problems) I have a trouble with porting the code that submitted a form from
 within a wiQuery dialog.

 My code is based on the sample that can be found here:

 http://code.google.com/p/wiquery/source/browse/examples/wiquery-examples/src/main/resources/org/odlabs/wiquery/examples/dialog/DialogPage.java?r=407

 The trick here was that the Dialog contains a form which has to be
 submitted when OK button is clicked, and that was done with the following
 code:

 buttonsAdv.add(new DialogButton(Save,

 JsScope.quickScope(wicketSubmitFormById('form',' +

 formAjaxBehavior.getCallbackUrl() +
 ', null, null, null, null,
 null);)));

 Unfortunately, in Wicket 6.9 this code fails to find the function
 wicketSubmitFormById()

 I also have a feeling that in my previous attempt to port this code to
 Wicket 6.6 the same functionality worked fine.

 The question is - how is it possible to submit a form from JS?

 Regards,

 Andrew

 --
 Andrew Schetinin



Re: Problem with wiQuery Dialog after upgrade to Wicket 6.9

2013-07-16 Thread Andrew Schetinin
Hi Sebastien,

Thank you for the suggestion, but the trouble with the sample (and wiQuery)
is that DialogButton is not a wicket component - it is a very simple
object. There is no updateAjaxAttributes() to change.

As I explained, the form submit there works by a plain call from
JavaScript, and that call does not work anymore because of the missing
wicketSubmitFormById() function.

It seems to me that the only way to extend Dialog in wiQuery is through
JavaScript - at least everything related to reaction on the button clicks.

Regards,

Andrew

--
Andrew Schetinin


On Tue, Jul 16, 2013 at 6:33 PM, Sebastien seb...@gmail.com wrote:

 Hi Andrew,

 You have to override your ajaxbehavior#updateAjaxAttributes()

 protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
 {
 super.updateAjaxAttributes(attributes);

 attributes.setMethod(Method.POST); //if you wish to post
 attributes.setFormId(yourFormId);
 }

 Best regards,
 Sebastien.


 On Tue, Jul 16, 2013 at 5:21 PM, Andrew Schetinin ascheti...@gmail.com
 wrote:

  Hi,
 
  I've just upgraded from Wicket 1.4 to 6.9, and (among lots of other
  problems) I have a trouble with porting the code that submitted a form
 from
  within a wiQuery dialog.
 
  My code is based on the sample that can be found here:
 
 
 http://code.google.com/p/wiquery/source/browse/examples/wiquery-examples/src/main/resources/org/odlabs/wiquery/examples/dialog/DialogPage.java?r=407
 
  The trick here was that the Dialog contains a form which has to be
  submitted when OK button is clicked, and that was done with the following
  code:
 
  buttonsAdv.add(new DialogButton(Save,
 
  JsScope.quickScope(wicketSubmitFormById('form',' +
 
  formAjaxBehavior.getCallbackUrl() +
  ', null, null, null,
 null,
  null);)));
 
  Unfortunately, in Wicket 6.9 this code fails to find the function
  wicketSubmitFormById()
 
  I also have a feeling that in my previous attempt to port this code to
  Wicket 6.6 the same functionality worked fine.
 
  The question is - how is it possible to submit a form from JS?
 
  Regards,
 
  Andrew
 
  --
  Andrew Schetinin
 



Ajax Refreshing Issue

2013-07-16 Thread dhongyt
I have created a panel that I would like to have refresh every 5 seconds.

I have tried using AbstractAjaxTimerBehavior and
AjaxSelfUpdatingTimerBehavior.
I have created just a simple case to make sure a
System.out.println(Update); to make sure that line of code is being called
but is not called in any of the Ajax behaviors.



or



I'm looking at the World Clock example but can't seem to get to the code, I
always get internal error.
The System.out.println does not print out at all in my Elipse console.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-Refreshing-Issue-tp4660289.html
Sent from the Users forum 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



Re: Ajax Refreshing Issue

2013-07-16 Thread Francois Meillet
Can you show your stacktrace ?


François Meillet
Formation Wicket - Développement Wicket





Le 16 juil. 2013 à 19:17, dhongyt davidhtr...@gmail.com a écrit :

 I have created a panel that I would like to have refresh every 5 seconds.
 
 I have tried using AbstractAjaxTimerBehavior and
 AjaxSelfUpdatingTimerBehavior.
 I have created just a simple case to make sure a
 System.out.println(Update); to make sure that line of code is being called
 but is not called in any of the Ajax behaviors.
 
 
 
 or
 
 
 
 I'm looking at the World Clock example but can't seem to get to the code, I
 always get internal error.
 The System.out.println does not print out at all in my Elipse console.
 
 
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Ajax-Refreshing-Issue-tp4660289.html
 Sent from the Users forum 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
 



Re: Ajax Refreshing Issue

2013-07-16 Thread Gabriel Landon
Which version of wicket are your using?
I remember AjaxSelfUpdatingTimerBehavior was not working in 6.3.0
https://issues.apache.org/jira/browse/WICKET-4886

Regards,
Gabriel.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-Refreshing-Issue-tp4660289p4660292.html
Sent from the Users forum 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



How to hide an optional Image component?

2013-07-16 Thread Stefan Renz
Hi guys,

I'm desparate for your help: I just can't figure out how to suppress an
Image in case its IResource yields nothing.

Here's some context:

A customer may have a custom logo image (in fact, there's some logic
involved in determining which exact logo to use, but that's beside the
point) located in some database. Using Wicket's Image component, I
figured I would need to implement the logo resolution algorithm and
loading from the DB with either subclassing DynamicImageResource, or
subclassing AbstractResourceStream (which is more approriate?).

Works fine if a logo is there -- the image shows up. However, if there
_is_ no logo, the browser (firefox in my case) renders a question mark
instead of showing nothing. Both returning null or an empty byte array
doesn't matter.

I usually suppress a component with a behavior, or within the
#onConfigure()-Method, but in the Image's case, where I only have an
IResource or ResourceReference, I just don't have a hint on how to
determine if the image data is there or not (apart from asking the
database _again_ for the data or presence thereof).

Any ideas? What method/class have I missed? Where should I look?

Thanks for your help.
Cheers
Stefan


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



Re: How to hide an optional Image component?

2013-07-16 Thread Cedric Gatay
Hi,
a workaround could be returning an empty 1px*1px image from your IResource.
This way browsers won't complain with invalid content as you encounter.

Regards,

__
Cedric Gatay (@Cedric_Gatay http://twitter.com/Cedric_Gatay)
http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr


On Tue, Jul 16, 2013 at 10:53 PM, Stefan Renz s.r...@efonds.com wrote:

 Hi guys,

 I'm desparate for your help: I just can't figure out how to suppress an
 Image in case its IResource yields nothing.

 Here's some context:

 A customer may have a custom logo image (in fact, there's some logic
 involved in determining which exact logo to use, but that's beside the
 point) located in some database. Using Wicket's Image component, I
 figured I would need to implement the logo resolution algorithm and
 loading from the DB with either subclassing DynamicImageResource, or
 subclassing AbstractResourceStream (which is more approriate?).

 Works fine if a logo is there -- the image shows up. However, if there
 _is_ no logo, the browser (firefox in my case) renders a question mark
 instead of showing nothing. Both returning null or an empty byte array
 doesn't matter.

 I usually suppress a component with a behavior, or within the
 #onConfigure()-Method, but in the Image's case, where I only have an
 IResource or ResourceReference, I just don't have a hint on how to
 determine if the image data is there or not (apart from asking the
 database _again_ for the data or presence thereof).

 Any ideas? What method/class have I missed? Where should I look?

 Thanks for your help.
 Cheers
 Stefan


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




Re: How to hide an optional Image component?

2013-07-16 Thread Sven Meier

apart from asking the database _again_ for the data or presence thereof


Whether the image is visible must be determined when the page is rendered. The 
actual loading of the image is done in another request. Thus two times to ask 
the databse.

Alternatively you may render a default resource (e.g. 
https://www.google.com/search?q=no+image) if your database doesn't have any 
data to stream back when the image is requested.

Regards
Sven


On 07/16/2013 10:53 PM, Stefan Renz wrote:

Hi guys,

I'm desparate for your help: I just can't figure out how to suppress an
Image in case its IResource yields nothing.

Here's some context:

A customer may have a custom logo image (in fact, there's some logic
involved in determining which exact logo to use, but that's beside the
point) located in some database. Using Wicket's Image component, I
figured I would need to implement the logo resolution algorithm and
loading from the DB with either subclassing DynamicImageResource, or
subclassing AbstractResourceStream (which is more approriate?).

Works fine if a logo is there -- the image shows up. However, if there
_is_ no logo, the browser (firefox in my case) renders a question mark
instead of showing nothing. Both returning null or an empty byte array
doesn't matter.

I usually suppress a component with a behavior, or within the
#onConfigure()-Method, but in the Image's case, where I only have an
IResource or ResourceReference, I just don't have a hint on how to
determine if the image data is there or not (apart from asking the
database _again_ for the data or presence thereof).

Any ideas? What method/class have I missed? Where should I look?

Thanks for your help.
Cheers
 Stefan


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




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



Re: How to resolve this java.util.ConcurrentModificationException

2013-07-16 Thread saty
Thanks, but could you please explain how wicket handles serialization of
objects that could throw this error. 
I could be wrong but it appears to me wicket is iterating the data structure
for its serialization efforts when its being modified by other threads as
well and the iteration results in ConcurrentModificationException being
thrown by data structure iterator.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-this-java-util-ConcurrentModificationException-tp4660273p4660296.html
Sent from the Users forum 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



Re: How to resolve this java.util.ConcurrentModificationException

2013-07-16 Thread Dan Retzlaff
Wicket serializes access to each page instance, but provides no further
synchronization. Non-transient references to application data must be
synchronized by you.


On Tue, Jul 16, 2013 at 2:39 PM, saty satya...@gmail.com wrote:

 Thanks, but could you please explain how wicket handles serialization of
 objects that could throw this error.
 I could be wrong but it appears to me wicket is iterating the data
 structure
 for its serialization efforts when its being modified by other threads as
 well and the iteration results in ConcurrentModificationException being
 thrown by data structure iterator.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-this-java-util-ConcurrentModificationException-tp4660273p4660296.html
 Sent from the Users forum 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




Re: Problem with wiQuery Dialog after upgrade to Wicket 6.9

2013-07-16 Thread Sebastien
Hi,

I think the idea is more to replace
wicketSubmitFormById('form',' +formAjaxBehavior.getCallbackUrl() +',
null, null, null, null,null);)));
by
formAjaxBehavior.getCallbackFunction()

With the override mentioned bellow.
#getCallbackFunction() will get you the ready-to-use javascript function. I
am not a wiQuery expert so I don't know where exactly you have to use this
statement... (something like new JsScope(statement)?)

Maybe Ernesto or Hielke may help you more on this...

Best regards,
Sebastien.



On Tue, Jul 16, 2013 at 6:06 PM, Andrew Schetinin ascheti...@gmail.comwrote:

 Hi Sebastien,

 Thank you for the suggestion, but the trouble with the sample (and wiQuery)
 is that DialogButton is not a wicket component - it is a very simple
 object. There is no updateAjaxAttributes() to change.

 As I explained, the form submit there works by a plain call from
 JavaScript, and that call does not work anymore because of the missing
 wicketSubmitFormById() function.

 It seems to me that the only way to extend Dialog in wiQuery is through
 JavaScript - at least everything related to reaction on the button clicks.

 Regards,

 Andrew

 --
 Andrew Schetinin


 On Tue, Jul 16, 2013 at 6:33 PM, Sebastien seb...@gmail.com wrote:

  Hi Andrew,
 
  You have to override your ajaxbehavior#updateAjaxAttributes()
 
  protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
  {
  super.updateAjaxAttributes(attributes);
 
  attributes.setMethod(Method.POST); //if you wish to post
  attributes.setFormId(yourFormId);
  }
 
  Best regards,
  Sebastien.
 
 
  On Tue, Jul 16, 2013 at 5:21 PM, Andrew Schetinin ascheti...@gmail.com
  wrote:
 
   Hi,
  
   I've just upgraded from Wicket 1.4 to 6.9, and (among lots of other
   problems) I have a trouble with porting the code that submitted a form
  from
   within a wiQuery dialog.
  
   My code is based on the sample that can be found here:
  
  
 
 http://code.google.com/p/wiquery/source/browse/examples/wiquery-examples/src/main/resources/org/odlabs/wiquery/examples/dialog/DialogPage.java?r=407
  
   The trick here was that the Dialog contains a form which has to be
   submitted when OK button is clicked, and that was done with the
 following
   code:
  
   buttonsAdv.add(new DialogButton(Save,
  
   JsScope.quickScope(wicketSubmitFormById('form',' +
  
   formAjaxBehavior.getCallbackUrl() +
   ', null, null, null,
  null,
   null);)));
  
   Unfortunately, in Wicket 6.9 this code fails to find the function
   wicketSubmitFormById()
  
   I also have a feeling that in my previous attempt to port this code to
   Wicket 6.6 the same functionality worked fine.
  
   The question is - how is it possible to submit a form from JS?
  
   Regards,
  
   Andrew
  
   --
   Andrew Schetinin
  
 



Re: Form questions

2013-07-16 Thread Daniel Watrous
Thanks Paul and Sven. I got the form to work and available in the onSubmit
handler.

Now I'm interested in splitting the form out into it's one file. So I
created a class that has nothing more than the form, but I'm not sure how
to include this into a page.

In my class I do this:

public class CnavModify extends ConsoleBasePage {

public CnavModify(PageParameters parameters) {
super(parameters);

Form form = new CnavForm(cnavFormArea);
add(form);
}
}

My CnavModify obviously extends a base page. What do I put inside the
wicket:extend tag to have the form render?

Daniel


On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote:

 Hi,


  Some problems I can't figure out. The code to create the button complains
 that it requires a CnavUrl but gets back a String.

add(new Button(publish, model) {
@Override
public void onSubmit() {
CnavUrl cnavUrl = (CnavUrl) getModelObject();
System.out.println(publish);
}
});


 a Button always has a IModelString to fill the value attribute. Note
 that in #onSubmit() you're getting the model object of the button, not of
 your form.
 You can write:

 add(new Button(publish, model) {
@Override
public void onSubmit() {
CnavUrl cnavUrl = (CnavUrl) MyForm.this.getModelObject();
System.out.println(publish);
}
});


 Using generic types in your code should help you.

 Sven



 On 07/15/2013 11:41 PM, Daniel Watrous wrote:

 Hello,

 I'm interested in creating a single Form that will accommodate the
 following use cases
 1) display blank for creating new records
 2) pre-populate for editing existing records
 3) map submitted values on to an existing domain object
 4) accommodate two actions, Save Draft -or- Publish

 I'm following Wicket in Action and within my Form constructor I create my
 model, like this

  CnavUrl cnavUrl = new BasicCnavUrl();
  IModel model = new Model((Serializable) cnavUrl);
  setModel(model);

 I then use PropertyModel

  add(new TextField(url, new PropertyModel(cnavUrl, url)));

 For the two actions, I'm creating the Button objects like this

  add(new Button(publish, model) {
  @Override
  public void onSubmit() {
  CnavUrl cnavUrl = (CnavUrl) getModelObject();
  System.out.println(publish);
  }
  });

 Some problems I can't figure out. The code to create the button complains
 that it requires a CnavUrl but gets back a String.

 It seems that a new BasicCnavUrl is created once with the Form. What
 happens on subsequent calls? Can I always expect my model to have the data
 from the current form submission?

 Is there a best way to incorporate the idea of an edit, where the model is
 pre-populated from a data source and pre-fills the Form fields?

 Thanks,
 Daniel



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




RE: Form questions

2013-07-16 Thread Paul Bors
Wicket is a MVC component driven framework similar to Swing.
In short, what you want to do is create your own Panel with that form file
of yours and add it to another Panel as a child.

See chapter 4 Keeping control over HTML of the Wicket Free Guide at:
http://code.google.com/p/wicket-guide/

Also available from under the Learn section as the Books link on the right
side navigation section on Wicket's home page at:
http://wicket.apache.org/learn/books/

~ Thank you,
  Paul Bors

-Original Message-
From: Daniel Watrous [mailto:dwmaill...@gmail.com] 
Sent: Tuesday, July 16, 2013 7:13 PM
To: users@wicket.apache.org
Subject: Re: Form questions

Thanks Paul and Sven. I got the form to work and available in the onSubmit
handler.

Now I'm interested in splitting the form out into it's one file. So I
created a class that has nothing more than the form, but I'm not sure how to
include this into a page.

In my class I do this:

public class CnavModify extends ConsoleBasePage {

public CnavModify(PageParameters parameters) {
super(parameters);

Form form = new CnavForm(cnavFormArea);
add(form);
}
}

My CnavModify obviously extends a base page. What do I put inside the
wicket:extend tag to have the form render?

Daniel


On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote:

 Hi,


  Some problems I can't figure out. The code to create the button 
 complains
 that it requires a CnavUrl but gets back a String.

add(new Button(publish, model) {
@Override
public void onSubmit() {
CnavUrl cnavUrl = (CnavUrl) getModelObject();
System.out.println(publish);
}
});


 a Button always has a IModelString to fill the value attribute. Note 
 that in #onSubmit() you're getting the model object of the button, not 
 of your form.
 You can write:

 add(new Button(publish, model) {
@Override
public void onSubmit() {
CnavUrl cnavUrl = (CnavUrl) MyForm.this.getModelObject();
System.out.println(publish);
}
});


 Using generic types in your code should help you.

 Sven



 On 07/15/2013 11:41 PM, Daniel Watrous wrote:

 Hello,

 I'm interested in creating a single Form that will accommodate the 
 following use cases
 1) display blank for creating new records
 2) pre-populate for editing existing records
 3) map submitted values on to an existing domain object
 4) accommodate two actions, Save Draft -or- Publish

 I'm following Wicket in Action and within my Form constructor I 
 create my model, like this

  CnavUrl cnavUrl = new BasicCnavUrl();
  IModel model = new Model((Serializable) cnavUrl);
  setModel(model);

 I then use PropertyModel

  add(new TextField(url, new PropertyModel(cnavUrl, 
 url)));

 For the two actions, I'm creating the Button objects like this

  add(new Button(publish, model) {
  @Override
  public void onSubmit() {
  CnavUrl cnavUrl = (CnavUrl) getModelObject();
  System.out.println(publish);
  }
  });

 Some problems I can't figure out. The code to create the button 
 complains that it requires a CnavUrl but gets back a String.

 It seems that a new BasicCnavUrl is created once with the Form. What 
 happens on subsequent calls? Can I always expect my model to have the 
 data from the current form submission?

 Is there a best way to incorporate the idea of an edit, where the 
 model is pre-populated from a data source and pre-fills the Form fields?

 Thanks,
 Daniel



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




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



Re: Problem with wiQuery Dialog after upgrade to Wicket 6.9

2013-07-16 Thread Ernesto Reinaldo Barreiro
Hi,

Let me see If I get a chance to look at this today...


On Wed, Jul 17, 2013 at 2:54 AM, Sebastien seb...@gmail.com wrote:

 Hi,

 I think the idea is more to replace
 wicketSubmitFormById('form',' +formAjaxBehavior.getCallbackUrl() +',
 null, null, null, null,null);)));
 by
 formAjaxBehavior.getCallbackFunction()

 With the override mentioned bellow.
 #getCallbackFunction() will get you the ready-to-use javascript function. I
 am not a wiQuery expert so I don't know where exactly you have to use this
 statement... (something like new JsScope(statement)?)

 Maybe Ernesto or Hielke may help you more on this...

 Best regards,
 Sebastien.



 On Tue, Jul 16, 2013 at 6:06 PM, Andrew Schetinin ascheti...@gmail.com
 wrote:

  Hi Sebastien,
 
  Thank you for the suggestion, but the trouble with the sample (and
 wiQuery)
  is that DialogButton is not a wicket component - it is a very simple
  object. There is no updateAjaxAttributes() to change.
 
  As I explained, the form submit there works by a plain call from
  JavaScript, and that call does not work anymore because of the missing
  wicketSubmitFormById() function.
 
  It seems to me that the only way to extend Dialog in wiQuery is through
  JavaScript - at least everything related to reaction on the button
 clicks.
 
  Regards,
 
  Andrew
 
  --
  Andrew Schetinin
 
 
  On Tue, Jul 16, 2013 at 6:33 PM, Sebastien seb...@gmail.com wrote:
 
   Hi Andrew,
  
   You have to override your ajaxbehavior#updateAjaxAttributes()
  
   protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
   {
   super.updateAjaxAttributes(attributes);
  
   attributes.setMethod(Method.POST); //if you wish to post
   attributes.setFormId(yourFormId);
   }
  
   Best regards,
   Sebastien.
  
  
   On Tue, Jul 16, 2013 at 5:21 PM, Andrew Schetinin 
 ascheti...@gmail.com
   wrote:
  
Hi,
   
I've just upgraded from Wicket 1.4 to 6.9, and (among lots of other
problems) I have a trouble with porting the code that submitted a
 form
   from
within a wiQuery dialog.
   
My code is based on the sample that can be found here:
   
   
  
 
 http://code.google.com/p/wiquery/source/browse/examples/wiquery-examples/src/main/resources/org/odlabs/wiquery/examples/dialog/DialogPage.java?r=407
   
The trick here was that the Dialog contains a form which has to be
submitted when OK button is clicked, and that was done with the
  following
code:
   
buttonsAdv.add(new DialogButton(Save,
   
JsScope.quickScope(wicketSubmitFormById('form',' +
   
formAjaxBehavior.getCallbackUrl() +
', null, null, null,
   null,
null);)));
   
Unfortunately, in Wicket 6.9 this code fails to find the function
wicketSubmitFormById()
   
I also have a feeling that in my previous attempt to port this code
 to
Wicket 6.6 the same functionality worked fine.
   
The question is - how is it possible to submit a form from JS?
   
Regards,
   
Andrew
   
--
Andrew Schetinin
   
  
 




-- 
Regards - Ernesto Reinaldo Barreiro