Re: [Wicket-user] Could not find root ajax-response element with AjaxFormSubmitBehavior+ browser back botton

2007-01-13 Thread Ingram Chen

I trace the code and found the cause is some AjaxBehavior calling
AbstractAjaxBehavior.getCallbackScript(boolean recordPageVersion, boolean
onlyTargetActivePage) with onlyTargetActivePage=true. by this, ajax behavior
is only actived in latest access page.

I check core component and those AjaxFormSubmitBehavior,
AjaxSelfUpdatingTimerBehavior, and AjaxFormComponentUpdatingBehavior are
setting flag as true and don't have alternative option. Is there any concern
why these behaviors have to use latest access page ?


On 1/13/07, Ingram Chen [EMAIL PROTECTED] wrote:


I turn on log4j.logger.wicket=DEBUG and only see one message:

DEBUG - Session- wicket.Session=updateSession():
Attaching session to PageMap [PageMap name=null, access=[[Access id=0,
version=0], [Access id=1, version=0], [Access id=2, version=0]]]

and no exception. It doesn't go to further steps like: Getting page [path
= 1:form:go, versionNumber = -1]... either.


On 1/13/07, Matej Knopp [EMAIL PROTECTED] wrote:

 This is weird. Can you please check if there is no exception in the log?


 -Matej

 Ingram Chen wrote:
  Hi all,
 
 I just found a bug (?) about AjaxFormSubmitBehavior when doing some
  browser back botton, like:
 
  (1) X page has a Form and use AjaxFormSubmitBehavior
  (2) navigate X to Y by a link
  (3) browser back to X
  (4) submit form of X by AjaxFormSubmitBehavior
  (5) then:
 
  *INFO: *
  *INFO:
  *Initiating Ajax POST request on
 
/quickstart/app?wicket:interface=:2:form:go:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=truerandom=
 0.9194877543437688
 
  *INFO: *Invoking pre-call handler(s)...
  *INFO: *Received ajax response (0 characters)
  *INFO: *
  *ERROR:
  *Error while parsing response: Could not find root ajax-response
 element
  *INFO: *Invoking post-call handler(s)...
  *INFO: *Invoking failure handler(s)...
 
  I just got Received ajax response (0 characters) and no idea how to
  investigate futher more.
 
  tested with 1.2.3 and 1.2.4 (both in IE and  Firefox)
  attachment is quickstart for 1.2.4
 
  Any help ?
 
  --
  Ingram Chen
  ��便��啦: http://dinbendon.net
  blog: http://www.javaworld.com.tw/roller/page/ingramchen
 
 
 
 
 
 
 -
  Take Surveys. Earn Cash. Influence the Future of IT
  Join SourceForge.net's Techsay panel and you'll get the chance to
 share your
  opinions on IT  business topics through brief surveys - and earn cash
  http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

 
 
 
 
 
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user




 -

 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share
 your
 opinions on IT  business topics through brief surveys - and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV


 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user





--
Ingram Chen
��便��啦: http://dinbendon.net
blog: http://www.javaworld.com.tw/roller/page/ingramchen





--
Ingram Chen
��便��啦: http://dinbendon.net
blog: http://www.javaworld.com.tw/roller/page/ingramchen
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] DropDownChoice inconsistent value returned

2007-01-13 Thread pboyd

Hi,

I’m having some trouble getting a DropDownChoice component to bind the value
I want to the supplied model and could use some help. More specifically,
I’ve created a custom dropdown by extending DropDownChoice (see below)
because I need to use a custom value for the hidden value attribute in the
HTML option tag and a more readable version of that value for display. The
hidden value needs to be bound to the model, not the display value.
Everything renders and binds to the model properly the first time the user
fills out and submits the form. The problem appears when the user returns to
the form (which will display his/her previous choices) and tries to update
the selection in the dropdown. For some reason unknown to me the when the
user updates the form, the value from the dropdown that is passed to the
model is the (undesired) display value instead of the (desired) hidden value
attribute data that is passed to it the first time the form is submitted.

Thoughts?

Thanks,
Peter



Package…
Import…

public class DateDropDownChoice extends DropDownChoice implements
Serializable {
// values to go into the hidden value attribute in the HTML option tag
// AND to go into the model/database
final static private String[] ids =
{20031,20032,20033,20034,20041,…};

// values to be displayed in the dropdown
final static private String[] values ={2003, Fall,2003,
Winter,2003, Spring,2003, Summer,2004, Fall,…};

public DateDropDownChoice(String id, IModel iModel) {
super(id, iModel);
ArrayList choices = new ArrayList();

int i = 0;
for(;iids.length;i++)
   // choices.add(new DateChoice(ids[i],values[i]));
  choices.add(values[i]);

this.setChoices(choices);
this.setChoiceRenderer(new CustomChoiceRenderer());
}



class CustomChoiceRenderer implements IChoiceRenderer{


public Object getDisplayValue(Object obj) {
return obj.toString();
}

public String getIdValue(Object obj, int i) {

/**
 * An i of -1 is passed when a previous selection
 * has been made and is stored, so just return the obj string
value
 * because it is a properly stored value such as 20063 from
the previous submission
 *
 * An i  0 means that I need to look up the
appropriate/corresponding
 * value from the ids array.
 *
 */

String returnVal = i0?obj.toString():ids[i];
System.out.println(returnVal: +returnVal+ :: ID:: +i);
return returnVal;
}
}
}

And then in my form I set up the custom dropdown.

//…

DateDropDownChoice studentSince =
 new DateDropDownChoice(studentSince,new
PropertyModel(iModel,studentSince));
 add(studentSince);

//…

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-inconsistent-value-returned-tf2971300.html#a8314245
Sent from the Wicket - User mailing list archive at Nabble.com.


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] DropDownChoice inconsistent value returned

2007-01-13 Thread Igor Vaynberg

dropdownchoice works like this:

DropDownChoiceT(String id, IModelT model, IModelListT choices,
IChoiceRendererT)

but from your description i see you are using it like this:

DropDownChoiceString(String id, IModelString, IModelListDateChoice,
IChoiceRendererDateChoice)

i take it studentSince is a String?

DropDownChoice works with objects, not their id values. so it is one of the
objects you pass in as choices that gets put into the model. looks like you
are putting in DateChoice objects into the choices, but your model prefers a
string.

it probably works the first time because DateChoice.toString() returns the
id?

what you want is something like this:

final MapString,String codeToText=new LinkedHashMap();
codeToText.put(20041, 2004,Fall);
...
ListString keys=new ArrayListSTring();
keys.addall(codeToText.keyset());
IChoiceRenderer renderer=new IChoiceRenderer() {
 getid(Obect o) { return o.toString(); }
 getValue(Object o) { return codeToText.get(o.toString()); }
}

new DropDownChoice(foo, new PropertyModel(...), keys, renderer);

another approach would be to write a model that does the translation between
string and datechoice. use whatever route appeals to you more.

-igor


On 1/13/07, pboyd [EMAIL PROTECTED] wrote:



Hi,

I'm having some trouble getting a DropDownChoice component to bind the
value
I want to the supplied model and could use some help. More specifically,
I've created a custom dropdown by extending DropDownChoice (see below)
because I need to use a custom value for the hidden value attribute in the
HTML option tag and a more readable version of that value for display. The
hidden value needs to be bound to the model, not the display value.
Everything renders and binds to the model properly the first time the user
fills out and submits the form. The problem appears when the user returns
to
the form (which will display his/her previous choices) and tries to update
the selection in the dropdown. For some reason unknown to me the when the
user updates the form, the value from the dropdown that is passed to the
model is the (undesired) display value instead of the (desired) hidden
value
attribute data that is passed to it the first time the form is submitted.

Thoughts?

Thanks,
Peter



Package…
Import…

public class DateDropDownChoice extends DropDownChoice implements
Serializable {
// values to go into the hidden value attribute in the HTML option tag
// AND to go into the model/database
final static private String[] ids =
{20031,20032,20033,20034,20041,…};

// values to be displayed in the dropdown
final static private String[] values ={2003, Fall,2003,
Winter,2003, Spring,2003, Summer,2004, Fall,…};

public DateDropDownChoice(String id, IModel iModel) {
super(id, iModel);
ArrayList choices = new ArrayList();

int i = 0;
for(;iids.length;i++)
   // choices.add(new DateChoice(ids[i],values[i]));
  choices.add(values[i]);

this.setChoices(choices);
this.setChoiceRenderer(new CustomChoiceRenderer());
}



class CustomChoiceRenderer implements IChoiceRenderer{


public Object getDisplayValue(Object obj) {
return obj.toString();
}

public String getIdValue(Object obj, int i) {

/**
 * An i of -1 is passed when a previous selection
 * has been made and is stored, so just return the obj string
value
 * because it is a properly stored value such as 20063 from
the previous submission
 *
 * An i  0 means that I need to look up the
appropriate/corresponding
 * value from the ids array.
 *
 */

String returnVal = i0?obj.toString():ids[i];
System.out.println(returnVal: +returnVal+ :: ID:: +i);
return returnVal;
}
}
}

And then in my form I set up the custom dropdown.

//…

DateDropDownChoice studentSince =
 new DateDropDownChoice(studentSince,new
PropertyModel(iModel,studentSince));
 add(studentSince);

//…

--
View this message in context:
http://www.nabble.com/DropDownChoice-inconsistent-value-returned-tf2971300.html#a8314245
Sent from the Wicket - User mailing list archive at Nabble.com.


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get 

Re: [Wicket-user] wicket presentation

2007-01-13 Thread Eelco Hillenius
Those dropdowns should be updated without troubles. Why do you need
the wantOnSelectionChangedNotifications there? Did you try removing
the overrides of these methods? As far as I can see you're not doing
anything useful with them.


Eelco

On 1/12/07, Nino Wael [EMAIL PROTECTED] wrote:




 To my presentation im doing both a jsp version and a wicket version of a
 very small applikation (might just be a form or two separate pages with
 forms), btw would it be an idea to put the presentation with examples up
 somewhere perhaps the wiki (when im done with it?)?





 However upon doing this I've stumbled into something I find odd, in the
 below code the label called model are not updatet when it's model are
 changed, I got the same problem with the dropdown, I fixed that by calling
 the dropdown.modelchanged() method. But is it really necessary to call
 modelchanged? I saw the ajax example which is almost identical to this does
 not call modelchanged.







 public class IndexPage extends WebPage {



   public IndexPage() {



 FormModel
 formModel = new FormModel();



 final
 PropertyModel carModel = new PropertyModel(formModel, carModel);

 final
 PropertyModel carBrand = new PropertyModel(formModel, carBrand);



 IModel
 carsFromBrand = new AbstractReadOnlyModel() {




  public Object getObject(Component arg0) {


String selected = (String)
 carBrand.getObject(null);


if (selected != null) {



   return Offline.getCarsFromBrand(selected);


}


return Collections.EMPTY_LIST;


  }

 };



 add(new
 Label(brand, carBrand));

 add(new
 Label(model, carModel));

 Form form = new
 Form(theform);

 add(form);

 final
 DropDownChoice ddcCarModel = new DropDownChoice(carmodel,


carModel, carsFromBrand) {


  protected boolean
 wantOnSelectionChangedNotifications() {


return true;


  }

 };

 DropDownChoice
 ddcCarbrand = new DropDownChoice(carbrand, carBrand,


Offline.getCarBrands()) {


   protected boolean
 wantOnSelectionChangedNotifications() {


return true;


  }




  protected void onSelectionChanged(Object arg0) {


// TODO Auto-generated method
 stub


super.onSelectionChanged(arg0);


ddcCarModel.modelChanged();




  }

 };


 form.add(ddcCarbrand);




 form.add(ddcCarModel);



   }



 }



  


 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On
 Behalf Of Nino Wael
  Sent: 4. januar 2007 14:16
  To: wicket-user@lists.sourceforge.net
  Subject: [Wicket-user] wicket presentation




 Hi im doing a wicket presentation for our consultants team, on this first
 teaser I have about ten minutes.





 I plan to talk something about markup inheritance(the stuff with panels and
 borders, which are very nice), and the POJO concept.



 Also wickets model concept and that you don't have to think about the
 tedious tasks like printing html and setting the correct radio to be
 selected. I guess that part will be a big eye opener for some of themJ



 Which features should I show?





 The crowd will maximum have knowledge of struts or simple jsp pages.







 Regards Nino
 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys - and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user




-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list

Re: [Wicket-user] has anyone got a book on wicket?

2007-01-13 Thread ZedroS Schwart
Just some side questions :
- is the book compatible with wicket 1.2.4 ?
- are the erratas included in the ebook ?
- will Wicket 2.0 require a lot of changes ?

Thanks in advance
ZedroS

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] has anyone got a book on wicket?

2007-01-13 Thread Eelco Hillenius
On 1/13/07, ZedroS Schwart [EMAIL PROTECTED] wrote:
 Just some side questions :
 - is the book compatible with wicket 1.2.4 ?

Pro Wicket was written for 1.2.x, so yes.

 - are the erratas included in the ebook ?
 - will Wicket 2.0 require a lot of changes ?

Enough to not want to make you do it for an existing project :) A
migration doc (1.2 - 2.0) is here:
http://cwiki.apache.org/WICKET/migrate-20.html

Also, we are working on 1.3, which is basically 1.2.x, but with some
important backports of 2.0 we couldn't do in 1.2.x as it broke the
API. If you (anyone for that matter) can, upgrading to 1.3 is
recommended. Migration from 1.2 - 1.3 is documented here:
http://cwiki.apache.org/WICKET/migrate-13.html

Eelco

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] API break for 1.3 and 2.0: Session constructor

2007-01-13 Thread Eelco Hillenius
I just committed an API for 1.3 and 2.0. For those of you working on
the 1.x branch or trunk, and you're using a custom session, you'll
have to fix this:

* Add a Request argument to your custom session object, e.g.

public class MySession extends WebSession {

  protected MySession(final WebApplication application, Request request)

* Method WebApplication#newSession is made final and will be removed
in the near future. Instead, use WebApplication#newSession. Big chance
you don't have to do anything as this method was already available and
you might have overriden getSessionFactory rather than the method in
WebApplication.


Regards,

Eelco

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user