Wicket Sessions and Load Balancing

2010-06-30 Thread Steven Haines
Hi,

I just setup my production environment for a wicket-based application today and 
I am having a problem with Page Expired messages. I have three servers that 
are not clustered together, but rather are configured with Apache's 
proxy_balancer to use sticky sessions (with failover turned off.) The homepage 
always loads, but a high percentage of the time when I enter the second page of 
my application I receive a Page Expired page - clicking on that takes me back 
to the home page and then the application works.

My guess is that when the homepage is loaded that Wicket provides a new 
jsessionid (I sometimes see it coming in the submission url) but then the user 
is directed to another server on the next request, and because the user does 
not 
yet have a JSESSIONID cookie, but does have the jsessionid in the URL, the 
Wicket instance that receives the request searches and cannot find the session 
id and marks the page as expired. The next request then populates the browser's 
cookie and the sticky session works.This is just a theory, but it would explain 
the behavior.

I thought I handled this case in the proxy_balancer configuration with an entry 
like the following:

ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid 
nofailover=On

Where JSESSIONID|jsessionid covers the cookie and encoded path, respectively, 
and the nofailover=On tells Apache to not to try to fail a user's session over 
to antoher server.

Has anyone faced this problem? Any ideas on how to resolve it? And we're going 
to start allow production load very shortly, so any insight would be much 
appreciated!

Thanks

Steve

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



Re: [wicketstuff/wicket-contrib-jasperpreports] Is anyone supporting this?

2010-06-09 Thread Steven Haines
We're just about to start integrating Jasper with our wicket application (with 
a due date by the end of the week), so I found your positing particularly 
timely! 

Do you have any sample code and/or configuration information that shows me how 
to integrate wicket-contrib-jasperreports into my application (Maven)?

Thanks!
Steve





- Original Message 
From: Michael O'Cleirigh michael.ocleir...@rivulet.ca
To: users@wicket.apache.org
Sent: Tue, June 8, 2010 9:05:07 AM
Subject: Re: [wicketstuff/wicket-contrib-jasperpreports] Is anyone supporting  
this?

Hi Charles,

As long as wicketstuff-core builds locally with 
wicket-contrib-jasperreports in the core pom (as a module) you can 
commit the core pom.

I have a hudson instance running that will build and auto deploy into 
the sonatype snapshot repository a 1.4.10-SNAPSHOT version of your 
artifacts.

For an internal work release I need to cut a 1.4.9.1 wicketstuff-core 
release this week.  If your changes work in trunk you can backport them 
to the wicket 1.4.9 branch and when I cut the release they will be 
included and deployed into the central maven repository.

Regards,

Mike


 Awesome. Thanks.

 I pushed up my initial set of changes.  wicket-contrib-jasperreports now
 builds as 1.4.10-SNAPSHOT using wicketstuff-core.

 However, I have not added it to the wicketstuff-core build.  I'll try to get
 on that shortly, at least it is no worse off than it was before and now at
 least it building closer to the newer wicketstuff projects.

 Next up would be actual enhancements to the code.  Rodolfo mentioned some
 additions and I have to refactor some of my code that I wrote as a
 workaround so that it can be pushed back as well.

 Thanks for your help!  That's one less project that I have to maintain a
 customized instance of!

 On Mon, Jun 7, 2010 at 6:05 PM, nino martinez wael
 nino.martinez.w...@gmail.com  wrote:


 youve been added.

 As for the requirement with core, I think you just need to add the
 project to the pom on core, I'd suggest looking at one of the projects
 thats already in there (so you can copy and paste)..

 regards Nino

 2010/6/7 Charles Dealchuckdea...@gmail.com:
  
 Excellent.  sf username: cdeal

 First things first then.  If I get some patches put into scm other people
 will see that it is still a viable project.  Then as I get time, I'll
 extract some of my code into some kind of example.

 What are the requirements for building with core and who do I contact to

 get
  
 this included in the core build process?

 On Thu, Jun 3, 2010 at 5:24 PM, nino martinez wael
 nino.martinez.w...@gmail.com  wrote:


 go for commit rights. And for requirements it would be good to have an
 example project other than that it should just be working :)



 2010/6/3 Charles Dealchuckdea...@gmail.com:
  
 Is anyone out there maintaining/using this library?

 I am using it and I have a handful of modifications that I'd like to

 push
  
 back into the source tree.  Should I prepare a patch and JIRA issue or

 shall
  
 I pursue commit access for this library?

 I would also like to get it hooked into the build process.  It seems

 like
  
 I
  
 only need to add the wicketstuff-core reference to this pom and have

 the
  
 wicketstuff-core pom updated to include this  module.  What else needs

 to
  
 be
  
 done?  Are there specific requirements for a library to be part of the
 wicketstuff-core build?


 -
 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


  



-
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: OnChangeAjaxBehavior and other form components

2010-06-01 Thread Steven Haines
Hi Everyone,

I have a followup question to this thread from last month... The following Ajax 
call decorator that I added to my zipcode field (stopping the ajax call until 
the user enters 5 digits) works in Firefox, but not in Chrome or Safari 
(webkit):

@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
{
return new AjaxCallDecorator()
{
private static final long serialVersionUID = 1L;

@Override
public CharSequence decorateScript( CharSequence script )
{
// Only return the script (which means that it will be 
executed) after the
// user enters the 5th digit (or more)
return if(this.value.length = 5){ + script + };
}
};
}

This resolves to the following JS:

 input wicket:id=address.zipcode id=zip_code class=check_address validate 
addressChecker type=text value= name=gettingStartedPanel:address.zipcode 
onchange=if(this.value.length gt;= 5){var 
wcall=wicketSubmitFormById('step_form', 
'?wicket:interface=:1:quoteForm:gettingStartedPanel:address.zipcode::IActivePageBehaviorListener:0:amp;wicket:ignoreIfNotActive=true',
 null,function() { }.bind(this),function() { }.bind(this), function() {return 
Wicket.$$(this)amp;amp;Wicket.$$('step_form')}.bind(this));};/script 
type=text/javascript!--/*--![CDATA[/*!--*/
new Wicket.ChangeHandler('zip_code');
/*--]]*//script

The problem seems to be that the browser loses sight of what this is and 
reports: Uncaught TypeError: Cannot read property 'length' of undefined.

The web developer that I'm working with suggested the following change to the 
Ajax decorator:

return var zipcode = 
document.getElementById('zip_code'); if(zipcode.value.length = 5 ){ + script 
+ };


And it worked correctly because it removed the ambiguity of the value of 
this. He was suggesting that something that Wicket's JavaScript is doing is 
changing the value of this.  I have a working solution, but wondering if you 
have any thoughts as to why this is happening?

Thanks
Steve



- Original Message 
From: Steven Haines lyg...@yahoo.com
To: users@wicket.apache.org
Sent: Wed, April 21, 2010 2:43:41 PM
Subject: Re: OnChangeAjaxBehavior and other form components

I finally got everything working... Here is what I did for anyone that comes 
across this problem..

I added an onComponentRendered() method to my AjaxFormSubmitBehavior in that 
method I added the new Wicket.ChangeHandler (I saw the code in the 
OnChangeAjaxBehavior class):

@Override
protected final void onComponentRendered()
{
Response response = getComponent().getResponse();

final String id = getComponent().getMarkupId();

response.write( JavascriptUtils.SCRIPT_OPEN_TAG );
response.write( new Wicket.ChangeHandler(' + id + '); );
response.write( JavascriptUtils.SCRIPT_CLOSE_TAG );
}

So here is my final zipcode field:

zipcodeField.add( new AjaxFormSubmitBehavior( form, onchange )
{
private static final long serialVersionUID = 1L;

@Override
protected void onSubmit( AjaxRequestTarget target )
{
 // Access your objects through the form bound in your 
CompoundPropertyModel
 myModel.getZipcode();
 myModel.getStreet1();
}

@Override
protected void onError( AjaxRequestTarget art )
{
// Called for things like validation errors ...
}

@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
{
return new AjaxCallDecorator()
{
private static final long serialVersionUID = 1L;

@Override
public CharSequence decorateScript( CharSequence script )
{
// Only return the script (which means that it will be 
executed) after the
// user enters the 5th digit (or more)
return if(this.value.length = 5){ + script + };
}
};
}

  @Override
protected final void onComponentRendered()
{
// Creates a new Wicket.ChangeHandler for immediate 
notifications of
// change events
Response response = getComponent().getResponse();
final String id = getComponent().getMarkupId();
response.write( JavascriptUtils.SCRIPT_OPEN_TAG );
response.write( new Wicket.ChangeHandler(' + id + '); );
response.write( JavascriptUtils.SCRIPT_CLOSE_TAG

Forms across multiple panels

2010-04-27 Thread Steven Haines
Hi, 

The application I'm building is composed of several panels, each contained in 
its own div. The panels are logical groupings of data, handle different Ajax 
requests, and so forth.

My challenge is that when a user completes the process by entering data into 
all of the panels, I want to submit the form data from all of the panels into a 
single form submit. Or written a different way, I do not want to have to submit 
each panel individually, I want a single submission. 

What is the best way to do this?

Thanks
Steve


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



Re: Forms across multiple panels

2010-04-27 Thread Steven Haines
Sorry, yes, I have a MasterPage HTML and Java combination that hosts the 
divs, so something like this:

Java:
public class MasterPage extends WebPage ...

MyObject myobject = new MyObject();
add( new Panel1( panel1, myobject ) );
add( new Pane2( panel2, myobject ) );

...

HTML:
...
div wicket:id=panel1/div
div wicket:id=panel2/div
...

So conceivably I could create a form object on the MasterPage...




- Original Message 
From: Martin Makundi martin.maku...@koodaripalvelut.com
To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
Sent: Tue, April 27, 2010 10:08:06 AM
Subject: Re: Forms across multiple panels

Panels are on same web-page?

**
Martin

2010/4/27 Steven Haines lyg...@yahoo.com:
 Hi,

 The application I'm building is composed of several panels, each contained in 
 its own div. The panels are logical groupings of data, handle different 
 Ajax requests, and so forth.

 My challenge is that when a user completes the process by entering data into 
 all of the panels, I want to submit the form data from all of the panels into 
 a single form submit. Or written a different way, I do not want to have to 
 submit each panel individually, I want a single submission.

 What is the best way to do this?

 Thanks
 Steve


 -
 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: Forms across multiple panels

2010-04-27 Thread Steven Haines
Okay, I'm working on it, here is a followup question: how do I add a panel to a 
form?

Here's where I'm stuck. Here is my HTML with my panels embedded inside my form:

   form wicket:id=myForm id=myForm
div id=panelOne wicket:id=panelOnePanel One/div
div id=panelTwo wicket:id=panelTwoPanel Two/div
div id=panelThree wicket:id=panelThreePanel 
Three/div
div id=panelFour wicket:id=panelFourPanel Four/div
/form

But how do I build the object hierarchy? The following fails because obviously 
the hierarchy is wrong (the panels are children of the form), but the Form 
class does not have an add() method to accept Panels..

final MyForm myForm = new MyForm();
final FormMyForm form = new FormMyForm( myForm, new 
CompoundPropertyModelMyForm( myForm ) );
add( new PanelOne( panelOne ), form );
add( new PanelTwo( panelTwo ), form );
add( new PanelThree( panelThree ), form );
add( new PanelFour( panelFour ), form );
add( form );

Should I make all of the panels implement IFormValidator so that I can make 
them match the page hierarchy? Or do you have any other more elegant 
suggestions?

Thanks
Steve



- Original Message 
From: Martin Makundi martin.maku...@koodaripalvelut.com
To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
Sent: Tue, April 27, 2010 10:18:13 AM
Subject: Re: Forms across multiple panels

Hi!

Yes.. you could have:

form
   panel 1/
   panel 2/
   submit-button/
/form

**
Martin

2010/4/27 Steven Haines lyg...@yahoo.com:
 Sorry, yes, I have a MasterPage HTML and Java combination that hosts the 
 divs, so something like this:

 Java:
 public class MasterPage extends WebPage ...

 MyObject myobject = new MyObject();
 add( new Panel1( panel1, myobject ) );
 add( new Pane2( panel2, myobject ) );

 ...

 HTML:
 ...
 div wicket:id=panel1/div
 div wicket:id=panel2/div
 ...

 So conceivably I could create a form object on the MasterPage...




 - Original Message 
 From: Martin Makundi martin.maku...@koodaripalvelut.com
 To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
 Sent: Tue, April 27, 2010 10:08:06 AM
 Subject: Re: Forms across multiple panels

 Panels are on same web-page?

 **
 Martin

 2010/4/27 Steven Haines lyg...@yahoo.com:
 Hi,

 The application I'm building is composed of several panels, each contained 
 in its own div. The panels are logical groupings of data, handle different 
 Ajax requests, and so forth.

 My challenge is that when a user completes the process by entering data into 
 all of the panels, I want to submit the form data from all of the panels 
 into a single form submit. Or written a different way, I do not want to have 
 to submit each panel individually, I want a single submission.

 What is the best way to do this?

 Thanks
 Steve


 -
 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



-
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: Forms across multiple panels

2010-04-27 Thread Steven Haines
Scratch that, the Form has an add() method that accepts a Component and a Panel 
is a component, netbeans is just being weird...

Thanks




- Original Message 
From: Steven Haines lyg...@yahoo.com
To: users@wicket.apache.org
Sent: Tue, April 27, 2010 12:17:04 PM
Subject: Re: Forms across multiple panels

Okay, I'm working on it, here is a followup question: how do I add a panel to a 
form?

Here's where I'm stuck. Here is my HTML with my panels embedded inside my form:

   form wicket:id=myForm id=myForm
div id=panelOne wicket:id=panelOnePanel One/div
div id=panelTwo wicket:id=panelTwoPanel Two/div
div id=panelThree wicket:id=panelThreePanel 
Three/div
div id=panelFour wicket:id=panelFourPanel Four/div
/form

But how do I build the object hierarchy? The following fails because obviously 
the hierarchy is wrong (the panels are children of the form), but the Form 
class does not have an add() method to accept Panels..

final MyForm myForm = new MyForm();
final FormMyForm form = new FormMyForm( myForm, new 
CompoundPropertyModelMyForm( myForm ) );
add( new PanelOne( panelOne ), form );
add( new PanelTwo( panelTwo ), form );
add( new PanelThree( panelThree ), form );
add( new PanelFour( panelFour ), form );
add( form );

Should I make all of the panels implement IFormValidator so that I can make 
them match the page hierarchy? Or do you have any other more elegant 
suggestions?

Thanks
Steve



- Original Message 
From: Martin Makundi martin.maku...@koodaripalvelut.com
To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
Sent: Tue, April 27, 2010 10:18:13 AM
Subject: Re: Forms across multiple panels

Hi!

Yes.. you could have:

form
   panel 1/
   panel 2/
   submit-button/
/form

**
Martin

2010/4/27 Steven Haines lyg...@yahoo.com:
 Sorry, yes, I have a MasterPage HTML and Java combination that hosts the 
 divs, so something like this:

 Java:
 public class MasterPage extends WebPage ...

 MyObject myobject = new MyObject();
 add( new Panel1( panel1, myobject ) );
 add( new Pane2( panel2, myobject ) );

 ...

 HTML:
 ...
 div wicket:id=panel1/div
 div wicket:id=panel2/div
 ...

 So conceivably I could create a form object on the MasterPage...




 - Original Message 
 From: Martin Makundi martin.maku...@koodaripalvelut.com
 To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
 Sent: Tue, April 27, 2010 10:08:06 AM
 Subject: Re: Forms across multiple panels

 Panels are on same web-page?

 **
 Martin

 2010/4/27 Steven Haines lyg...@yahoo.com:
 Hi,

 The application I'm building is composed of several panels, each contained 
 in its own div. The panels are logical groupings of data, handle different 
 Ajax requests, and so forth.

 My challenge is that when a user completes the process by entering data into 
 all of the panels, I want to submit the form data from all of the panels 
 into a single form submit. Or written a different way, I do not want to have 
 to submit each panel individually, I want a single submission.

 What is the best way to do this?

 Thanks
 Steve


 -
 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



-
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

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



Re: OnChangeAjaxBehavior and other form components

2010-04-21 Thread Steven Haines
Hi Igor,

I looked at the JavaScript that is generated when adding an 
AjaxFormComponentUpdatingBehavior and it does not include any form fields other 
than the component to which it is added:

onChange=if(this.value.length gt;= 5){var 
wcall=wicketAjaxPost('?wicket:interface=:1:gettingStartedPanel:step_1:zipcode::IBehaviorListener:0:',
 wicketSerialize(Wicket.$('zip')),function() { }.bind(this),function() { 
}.bind(this), function() {return Wicket.$('zip') != null;}.bind(this));}

Should I look at submitting the entire form via Ajax when my conditions are 
met? Or any other ideas about how to add a form field to the callback?

Here is what I added to my WebPage:

// Street 1
final TextFieldString street1 = new TextFieldString( street1 );
street1.setOutputMarkupId( true );
street1.setMarkupId( address1 );
form.add( street1.setRequired( true ) );

final TextFieldString zipcodeField = new TextFieldString( zipcode 
);
zipcodeField.setOutputMarkupId( true );
zipcodeField.setMarkupId( zip );
form.add( zipcodeField.setRequired( true ) );

zipcodeField.add( new AjaxFormComponentUpdatingBehavior( onChange ) {
private static final long serialVersionUID = 1L;

@Override
public void onUpdate( AjaxRequestTarget target ) {
System.out.println( Street 1 (final):  + street1.getValue() );
TextFieldString street1f = ( TextFieldString )form.get( 
street1 );
System.out.println( Street 1 (form):  + street1f.getValue() );
System.out.println( Zipcode value (form component):  + 
getFormComponent().getModelObject() );
}

@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
{
return new AjaxCallDecorator()
{
private static final long serialVersionUID = 1L;

@Override
public CharSequence decorateScript( CharSequence script )
{
// Only return the script (which means that it will be 
executed) after the
// user enters the 5th digit (or more)
return if(this.value.length = 5){ + script + };
}
};
}
});


...and on another note, I had the same code with an OnChangeAjaxBehavior and 
the callback was made when the 5th character was typed, but with the 
AjaxFormComponentUpdatingBehavior the callback was made when the component lost 
focus .. 

Thanks
Steve




- Original Message 
From: Igor Vaynberg igor.vaynb...@gmail.com
To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
Sent: Tue, April 20, 2010 6:25:03 PM
Subject: Re: OnChangeAjaxBehavior and other form components

user AjaxFormComponentUpdatingBehavior

-igor

On Tue, Apr 20, 2010 at 2:37 PM, Steven Haines lyg...@yahoo.com wrote:
 Hi,

 I have a form component to which I added an OnChangeAjaxBehavior derivative 
 and in its onUpdate() method I want to access the contents of it *and* 
 another form field.

 Here's what I'm doing:

form.add( new TextFieldString( street1 ).setRequired( true ) );
final TextFieldString zipcodeField = new TextFieldString( 
 zipcode );
zipcodeField.setOutputMarkupId( true );
zipcodeField.setMarkupId( zip );
form.add( zipcodeField.setRequired( true ) );

// Load cities when the zipcode is updated
zipcodeField.add( new OnChangeAjaxBehavior()
{
private static final long serialVersionUID = 1L;

@Override
protected void onUpdate( AjaxRequestTarget target )
{
//TextFieldString street1 = ( TextFieldString )form.get( 
 street1 );
//System.out.println( Street 1:  + street1.getValue() );
System.out.println( Zipcode value (form component):  + 
 getFormComponent().getModelObject() );
// Do something with street1 and the zipcode
}
} );

 The problem is that, although I've tried different techniques to obtain the 
 value of the street1 text field, it is always returning null. I've tried 
 creating street1 as a final text field and then calling its getValue() 
 method, I've tried getting it from the form, as above, and I've tried reading 
 from the underlying form model, all of which return null.

 Any suggestions?

 Thanks
 Steve


 -
 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: OnChangeAjaxBehavior and other form components

2010-04-21 Thread Steven Haines
Thanks Igor, the AjaxFormSubmitBehavior worked to give me access to all form 
fields. I have one additional problem: with the OnChangeAjaxBehavior 
implementation it used my Ajax call decorator correctly and sent me updates 
after the user typed the 5th character in the field, but with the 
AjaxFormSubmitBehavior it only calls back to my web page when the field loses 
focus. I setup both scenarios and looked at the HTML document. 

Here is the working one (OnChangeAjaxBehavior ):

input wicket:id=zipcode class=js_disable id=zip value= name=zipcode 
onchange=

if(this.value.length gt;= 5){var 
wcall=wicketAjaxPost('?wicket:interface=:1:gettingStartedPanel:step_1:zipcode::IBehaviorListener:0:',
 wicketSerialize(Wicket.$('zip')),function() { }.bind(this),function() { 
}.bind(this), function() {return Wicket.$('zip') != null;}.bind(this));}

script type=text/javascript!--/*--![CDATA[/*!--*/
new Wicket.ChangeHandler('zip');
/*--]]*//script


And here is the one that only sends requests when the text field loses focus 
(AjaxFormSubmitBehavior):

input wicket:id=zipcode class=js_disable id=zip value= name=zipcode 
onchange=

if(this.value.length gt;= 5){var wcall=wicketSubmitFormById('step__114', 
'?wicket:interface=:7:gettingStartedPanel:step_1:zipcode::IActivePageBehaviorListener:0:amp;wicket:ignoreIfNotActive=true',
 null,function() { }.bind(this),function() { }.bind(this), function() {return 
Wicket.$$(this)amp;amp;Wicket.$$('step__114')}.bind(this));};

My guess is that the Wicket.ChangeHandler('zip') is what is making it work, 
but that does not appear when I add the AjaxFormSubmitBehavior. Do you know 
what I need to add to it to get this behavior?

Thanks so much!
Steve





- Original Message 
From: Igor Vaynberg igor.vaynb...@gmail.com
To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
Sent: Wed, April 21, 2010 12:35:20 PM
Subject: Re: OnChangeAjaxBehavior and other form components

there is ajaxformsubmitbehavior if you want all the fields updated

-igor

On Wed, Apr 21, 2010 at 6:10 AM, Steven Haines lyg...@yahoo.com wrote:
 Hi Igor,

 I looked at the JavaScript that is generated when adding an 
 AjaxFormComponentUpdatingBehavior and it does not include any form fields 
 other than the component to which it is added:

 onChange=if(this.value.length = 5){var 
 wcall=wicketAjaxPost('?wicket:interface=:1:gettingStartedPanel:step_1:zipcode::IBehaviorListener:0:',
  wicketSerialize(Wicket.$('zip')),function() { }.bind(this),function() { 
 }.bind(this), function() {return Wicket.$('zip') != null;}.bind(this));}

 Should I look at submitting the entire form via Ajax when my conditions are 
 met? Or any other ideas about how to add a form field to the callback?

 Here is what I added to my WebPage:

// Street 1
final TextFieldString street1 = new TextFieldString( street1 );
street1.setOutputMarkupId( true );
street1.setMarkupId( address1 );
form.add( street1.setRequired( true ) );

final TextFieldString zipcodeField = new TextFieldString( 
 zipcode );
zipcodeField.setOutputMarkupId( true );
zipcodeField.setMarkupId( zip );
form.add( zipcodeField.setRequired( true ) );

zipcodeField.add( new AjaxFormComponentUpdatingBehavior( onChange ) {
private static final long serialVersionUID = 1L;

@Override
public void onUpdate( AjaxRequestTarget target ) {
System.out.println( Street 1 (final):  + street1.getValue() 
 );
TextFieldString street1f = ( TextFieldString )form.get( 
 street1 );
System.out.println( Street 1 (form):  + street1f.getValue() 
 );
System.out.println( Zipcode value (form component):  + 
 getFormComponent().getModelObject() );
}

@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
{
return new AjaxCallDecorator()
{
private static final long serialVersionUID = 1L;

@Override
public CharSequence decorateScript( CharSequence script )
{
// Only return the script (which means that it will be 
 executed) after the
// user enters the 5th digit (or more)
return if(this.value.length = 5){ + script + };
}
};
}
});


 ...and on another note, I had the same code with an OnChangeAjaxBehavior and 
 the callback was made when the 5th character was typed, but with the 
 AjaxFormComponentUpdatingBehavior the callback was made when the component 
 lost focus ..

 Thanks
 Steve




 - Original Message 
 From: Igor Vaynberg igor.vaynb...@gmail.com
 To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
 Sent: Tue, April 20, 2010 6:25:03 PM
 Subject: Re: OnChangeAjaxBehavior and other form components

 user

Re: OnChangeAjaxBehavior and other form components

2010-04-21 Thread Steven Haines
I finally got everything working... Here is what I did for anyone that comes 
across this problem..

I added an onComponentRendered() method to my AjaxFormSubmitBehavior in that 
method I added the new Wicket.ChangeHandler (I saw the code in the 
OnChangeAjaxBehavior class):

@Override
protected final void onComponentRendered()
{
Response response = getComponent().getResponse();

final String id = getComponent().getMarkupId();

response.write( JavascriptUtils.SCRIPT_OPEN_TAG );
response.write( new Wicket.ChangeHandler(' + id + '); );
response.write( JavascriptUtils.SCRIPT_CLOSE_TAG );
}

So here is my final zipcode field:

zipcodeField.add( new AjaxFormSubmitBehavior( form, onchange )
{
private static final long serialVersionUID = 1L;

@Override
protected void onSubmit( AjaxRequestTarget target )
{
 // Access your objects through the form bound in your 
CompoundPropertyModel
 myModel.getZipcode();
 myModel.getStreet1();
}

@Override
protected void onError( AjaxRequestTarget art )
{
// Called for things like validation errors ...
}

@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
{
return new AjaxCallDecorator()
{
private static final long serialVersionUID = 1L;

@Override
public CharSequence decorateScript( CharSequence script )
{
// Only return the script (which means that it will be 
executed) after the
// user enters the 5th digit (or more)
return if(this.value.length = 5){ + script + };
}
};
}

  @Override
protected final void onComponentRendered()
{
// Creates a new Wicket.ChangeHandler for immediate 
notifications of
// change events
Response response = getComponent().getResponse();
final String id = getComponent().getMarkupId();
response.write( JavascriptUtils.SCRIPT_OPEN_TAG );
response.write( new Wicket.ChangeHandler(' + id + '); );
response.write( JavascriptUtils.SCRIPT_CLOSE_TAG );
}
} );





- Original Message 
From: Steven Haines lyg...@yahoo.com
To: users@wicket.apache.org
Sent: Wed, April 21, 2010 1:38:04 PM
Subject: Re: OnChangeAjaxBehavior and other form components

Thanks Igor, the AjaxFormSubmitBehavior worked to give me access to all form 
fields. I have one additional problem: with the OnChangeAjaxBehavior 
implementation it used my Ajax call decorator correctly and sent me updates 
after the user typed the 5th character in the field, but with the 
AjaxFormSubmitBehavior it only calls back to my web page when the field loses 
focus. I setup both scenarios and looked at the HTML document. 

Here is the working one (OnChangeAjaxBehavior ):

input wicket:id=zipcode class=js_disable id=zip value= name=zipcode 
onchange=

if(this.value.length gt;= 5){var 
wcall=wicketAjaxPost('?wicket:interface=:1:gettingStartedPanel:step_1:zipcode::IBehaviorListener:0:',
 wicketSerialize(Wicket.$('zip')),function() { }.bind(this),function() { 
}.bind(this), function() {return Wicket.$('zip') != null;}.bind(this));}

script type=text/javascript!--/*--![CDATA[/*!--*/
new Wicket.ChangeHandler('zip');
/*--]]*//script


And here is the one that only sends requests when the text field loses focus 
(AjaxFormSubmitBehavior):

input wicket:id=zipcode class=js_disable id=zip value= name=zipcode 
onchange=

if(this.value.length gt;= 5){var wcall=wicketSubmitFormById('step__114', 
'?wicket:interface=:7:gettingStartedPanel:step_1:zipcode::IActivePageBehaviorListener:0:amp;wicket:ignoreIfNotActive=true',
 null,function() { }.bind(this),function() { }.bind(this), function() {return 
Wicket.$$(this)amp;amp;Wicket.$$('step__114')}.bind(this));};

My guess is that the Wicket.ChangeHandler('zip') is what is making it work, 
but that does not appear when I add the AjaxFormSubmitBehavior. Do you know 
what I need to add to it to get this behavior?

Thanks so much!
Steve





- Original Message 
From: Igor Vaynberg igor.vaynb...@gmail.com
To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
Sent: Wed, April 21, 2010 12:35:20 PM
Subject: Re: OnChangeAjaxBehavior and other form components

there is ajaxformsubmitbehavior if you want all the fields updated

-igor

On Wed, Apr 21, 2010 at 6:10 AM, Steven Haines lyg...@yahoo.com wrote:
 Hi Igor,

 I looked at the JavaScript that is generated when adding an 
 AjaxFormComponentUpdatingBehavior and it does

OnChangeAjaxBehavior and other form components

2010-04-20 Thread Steven Haines
Hi,

I have a form component to which I added an OnChangeAjaxBehavior derivative and 
in its onUpdate() method I want to access the contents of it *and* another form 
field.

Here's what I'm doing:

form.add( new TextFieldString( street1 ).setRequired( true ) );
final TextFieldString zipcodeField = new TextFieldString( zipcode 
);
zipcodeField.setOutputMarkupId( true );
zipcodeField.setMarkupId( zip );
form.add( zipcodeField.setRequired( true ) );

// Load cities when the zipcode is updated
zipcodeField.add( new OnChangeAjaxBehavior()
{
private static final long serialVersionUID = 1L;

@Override
protected void onUpdate( AjaxRequestTarget target )
{
//TextFieldString street1 = ( TextFieldString )form.get( 
street1 );
//System.out.println( Street 1:  + street1.getValue() );
System.out.println( Zipcode value (form component):  + 
getFormComponent().getModelObject() );
// Do something with street1 and the zipcode
}
} );

The problem is that, although I've tried different techniques to obtain the 
value of the street1 text field, it is always returning null. I've tried 
creating street1 as a final text field and then calling its getValue() method, 
I've tried getting it from the form, as above, and I've tried reading from the 
underlying form model, all of which return null.

Any suggestions?

Thanks
Steve


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



Wicket + Spring 3 + Hibernate

2010-04-15 Thread Steven Haines
Hi,

I am at a point where I need to upgrade my application from Spring 2.5.6 to 
Spring 3.0.1.RELEASE. I have a working application and when I update Spring, I 
see the following exception on deployment:

Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: 
Error creating bean with name 'sessionFactory': FactoryBean which is currently 
in creation returned null from getObject
at 
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:157)
at 
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1387)


I've simplified my Hibernate configuration to: 

bean id=sessionFactory 
class=org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
property name=dataSource ref=dataSource /
property name=hibernateProperties
props
prop 
key=hibernate.dialectorg.hibernate.dialect.Oracle10gDialect/prop
prop key=hibernate.hbm2ddl.autovalidate/prop
/props
/property
property name=packagesToScan
list
valuecom.mycompany.model/value
/list
/property
/bean

Finally, here is the dependency list in Maven for my Spring and Hibernate 
libraries with wicket.version=1.4.7 and spring.version=3.0.1.RELEASE:
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-spring/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdorg.springframework.context/artifactId
version${spring.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdorg.springframework.core/artifactId
version${spring.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdorg.springframework.web/artifactId
version${spring.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdorg.springframework.web.servlet/artifactId
version${spring.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdorg.springframework.beans/artifactId
version${spring.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdorg.springframework.oxm/artifactId
version${spring.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdorg.springframework.orm/artifactId
version${spring.version}/version
/dependency
dependency
groupIdjavax.servlet/groupId
artifactIdservlet-api/artifactId
version${servlet-api.version}/version
scopeprovided/scope
/dependency
dependency
groupIdorg.hibernate/groupId
artifactIdhibernate-core/artifactId
version3.3.2.GA/version
/dependency
dependency
groupIdjavax.persistence/groupId
artifactIdpersistence-api/artifactId
version1.0/version
/dependency
dependency
groupIdorg.hibernate/groupId
artifactIdhibernate-annotations/artifactId
version3.4.0.GA/version
/dependency


I have successfully integrated Spring 3 and Hibernate in a RESTful web service 
and I have successfully integrated Wicket 1.4.7 with Spring 2.5.6 and 
Hibernate, but I am seeing errors specifically with Wicket and Spring 3 with 
Hibernate. Has anyone successfully integrated the three technologies?

Any suggestions?

Thanks!
Steve

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



Re: Wicket + Spring 3 + Hibernate

2010-04-15 Thread Steven Haines
)
at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1308)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:825)
at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:754)
at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:685)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1134)
... 40 more
Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: 
Error creating bean with name 'sessionFactory': FactoryBean which is currently 
in creation returned null from getObject
at 
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:157)
at 
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1387)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:244)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 53 more
Apr 15, 2010 11:05:11 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext






- Original Message 
From: Sigmar Muuga meedi...@gmail.com
To: users@wicket.apache.org; Steven Haines lyg...@yahoo.com
Sent: Thu, April 15, 2010 11:09:50 AM
Subject: Re: Wicket + Spring 3 + Hibernate

What error? Next time post the stack :)

On Thu, Apr 15, 2010 at 5:47 PM, Steven Haines lyg...@yahoo.com wrote:

 Hi,

 I am at a point where I need to upgrade my application from Spring 2.5.6 to
 Spring 3.0.1.RELEASE. I have a working application and when I update Spring,
 I see the following exception on deployment:

 Caused by:
 org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
 creating bean with name 'sessionFactory': FactoryBean which is currently in
 creation returned null from getObject
at
 org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:157)
at
 org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
at
 org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1387)


 I've simplified my Hibernate configuration to:

bean id=sessionFactory
 class=org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
property name=dataSource ref=dataSource /
property name=hibernateProperties
props
prop
 key=hibernate.dialectorg.hibernate.dialect.Oracle10gDialect/prop
prop key=hibernate.hbm2ddl.autovalidate/prop
/props
/property
property name=packagesToScan
list
valuecom.mycompany.model/value
/list
/property
/bean

 Finally, here is the dependency list in Maven for my Spring and Hibernate
 libraries with wicket.version=1.4.7 and spring.version=3.0.1.RELEASE:
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-spring/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.springframework/groupId

Re: Wicket + Spring 3 + Hibernate

2010-04-15 Thread Steven Haines
Sorry for the spam, I found the root cause of the problem - I guess there is 
some kind of circular dependency in Spring/Hibernate that appeared when I 
integrated the app with Wicket... I dont full understand, but I changed 
application context XML file to wire by name instead of type and the problem 
went away:

beans default-autowire=byName
   xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns:context=http://www.springframework.org/schema/context;
   xmlns:util=http://www.springframework.org/schema/util;
   xsi:schemaLocation=http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util 
http://www.springframework.org/schema/util/spring-util-3.0.xsd;

I appreciate your responses and I hope that someone can find my couple days of 
troubleshooting helpful :)

Thanks
Steve




- Original Message 
From: Steven Haines lyg...@yahoo.com
To: users@wicket.apache.org
Sent: Thu, April 15, 2010 11:14:49 AM
Subject: Re: Wicket + Spring 3 + Hibernate

I posted a few lines from the error, but here is the complete stack trace. My 
initial searches on this pointed to a circular dependency caused by autowiring, 
which may or may not be the case - when I removed the default-autowire 
parameter from my beans node then the error changed to state that the bean 
needs a sessionFactory (because I removed it.) So note sure if I took a step 
forward or back.

If you are interested I created a sample project that produces the error, I can 
zip it up and mail it to you (but dont want to spam the whole list with an 
attachment...

Thanks
Steve

Stack Trace:

Apr 15, 2010 11:05:11 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of 
class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'messageDao' defined in file 
[/Users/scadmin/Downloads/apache-tomcat-6.0.20/webapps/wicketspringhibernateexample/WEB-INF/classes/com/informit/dao/HibernateMessageDaoImpl.class]:
 Unsatisfied dependency expressed through bean property 'sessionFactory': : 
Error creating bean with name 'sessionFactory' defined in class path resource 
[applicationContext.xml]: Unsatisfied dependency expressed through bean 
property 'eventListeners': : Error creating bean with name 'transactionManager' 
defined in class path resource [applicationContext.xml]: Cannot resolve 
reference to bean 'sessionFactory' while setting bean property 
'sessionFactory'; nested exception is 
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
creating bean with name 'sessionFactory': FactoryBean which is currently in 
creation returned null from getObject; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'transactionManager' defined in class path resource 
[applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' 
while setting bean property 'sessionFactory'; nested exception is 
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
creating bean with name 'sessionFactory': FactoryBean which is currently in 
creation returned null from getObject; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'sessionFactory' defined in class path resource 
[applicationContext.xml]: Unsatisfied dependency expressed through bean 
property 'eventListeners': : Error creating bean with name 'transactionManager' 
defined in class path resource [applicationContext.xml]: Cannot resolve 
reference to bean 'sessionFactory' while setting bean property 
'sessionFactory'; nested exception is
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
creating bean with name 'sessionFactory': FactoryBean which is currently in 
creation returned null from getObject; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'transactionManager' defined in class path resource 
[applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' 
while setting bean property 'sessionFactory'; nested exception is 
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
creating bean with name 'sessionFactory': FactoryBean which is currently in 
creation returned null from getObject
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1150)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean

Build custom JavaScript

2010-04-06 Thread Steven Haines
For my application I need to dynamically generate JavaScript, which can either 
be in its own file or even added to my HTML document. I'll handle the 
generation of the JavaScript, but does anyone have any good strategies for 
injecting it into a web page or even generating a JavaScript file with Wicket?

Thanks
Steve


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




Checkbox Group

2010-03-29 Thread Steven Haines
Hi Everyone, 

Our web developer is using checkboxes in the place of radio buttons with 
JavaScript that ensures that only one is selected at a time. I know how to 
handle radio buttons and to handle individual checkboxes, but does anyone have 
a good strategy for dealing with a checkbox group? For other sections of our 
site I handled this by defining a checkbox for each item and then setting the 
appropriate value. In this page, however, we have an unknown number of 
checkboxes, which makes things a bit more difficult...

Thanks
Steve

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



TextField hosting an Integer

2010-03-22 Thread Steven Haines
Hi,

I'm creating a text field to host an integer, namely the year that a house was 
built:
TextFieldInteger yearBuilt = new TextFieldInteger( yearBuilt 
).setRequired( true );

And I'm using a CompoundPropertyModel that maps yearBuilt to an underlying 
bean property. My problem is that the default value for an integer is 0, so 
the text field pre-populates its value to 0, which is a rather silly year 
built date ;)  What I would like to do is mark the field as required and 
validate against a number range, but display the text field without an initial 
value. 

I know I can make it a TextFieldString and then validate on submission, but 
what has me intrigued is my exploration into the DropDownChoice and the 
creation of renderers. For example, I have a dropdown list from which a user 
can choose a value between 0 and 50,000 (increments of 1000), but I built a 
custom renderer that displays No Coverage for 0 (insurance industry.) Can I 
build a custom renderer for the initial value of a text field so that if I see 
0 I return , otherwise I return the actual value, e.g. 2001?

Thanks in advance,
Steve


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



Page Design Question

2010-03-16 Thread Steven Haines
First, thanks for your help yesterday with the form id question, setMarkupId() 
solved my problem.

I have a generic page design question for you: how do you handle situations 
when your page form does not map easily to your domain objects? I can map 90% 
of the form's fields to my domain object, but there are a couple fields from 
which I derive values on my domain object. I can solve this by creating a Java 
object that maps one-to-one with my form and then constructing my domain 
object(s) from that form object, but is there a better way / best practice way 
of handling this situation?

Thanks for your insight!
Steve

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



Wicket Renames my Form id

2010-03-15 Thread Steven Haines
Hi,

I've noticed that wicket is renaming my form id, which has become problematic 
when our JavaScript developer makes use of the id for some of his behaviors. Is 
there a way to tell Wicket to preserve the form id in the HTML page?

Here's what I'm doing:

HTML:
  form wicket:id=step_1 id=step_1
  ...
  /form

Java:
final FormQuote form = new FormQuote( step_1, new 
CompoundPropertyModelQuote( quote ) );


And the resultant HTML file reads as follows:
form wicket:id=step_1 id=step__15 method=post 
action=?wicket:interface=:2:step_1::IFormSubmitListener::div 
style=display:noneinput type=hidden name=step__15_hf_0 
id=step__15_hf_0 //div
  

Thanks in advance for your help!
Steve

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



Re: OnChangeAjaxBehavior: nth character

2010-02-13 Thread Steven Haines
Thanks so much, I appreciate all of your collective help. This list is a 
testimony to the passion I spoke of about the Wicket community - you guys rock!

Steve



- Original Message 
From: Cemal Bayramoglu jweekend_for...@cabouge.com
To: users@wicket.apache.org
Sent: Sat, February 13, 2010 8:26:37 AM
Subject: Re: OnChangeAjaxBehavior: nth character

Steven,

Start with something like this:

zipcodeField.add(new OnChangeAjaxBehavior() {
@Override protected void onUpdate(AjaxRequestTarget target) {
// do your stuff here
}
@Override protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxCallDecorator() {
@Override public CharSequence decorateScript(CharSequence script) {
return if(this.value.length % 5 == 0){ + script + };
}
};
}
});

Regards - Cemal
jWeekend
OO  Java Technologies, Wicket
Consulting, Development, Training
http://jWeekend.com


On 12 February 2010 20:45, Steven Haines lyg...@yahoo.com wrote:
 Hi,

 I
 would like to add AJAX behavior to an application that sends an update
 to my application after a certain number of characters have been typed.
 For example, if the user is entering a zipcode, I would like a callback
 to my application to be made after the user enters the fifth character.

 I've
 written code using OnChangeAjaxBehavior that sends messages back to my
 application after every character has been typed, such as the following:

final TextFieldString zipcodeField = new TextFieldString( zipcode );
form.add( zipcodeField.setRequired( true ) );
OnChangeAjaxBehavior zipcodeUpdated = new OnChangeAjaxBehavior() {
  @Override
  protected void onUpdate( AjaxRequestTarget target ) {
System.out.println( Zipcode value:  + 
 zipcodeField.getDefaultModelObjectAsString() );
  }
};
zipcodeField.add( zipcodeUpdated );


 I
 could check to see the size of the zipcodeField (in this example), but
 it makes my application more chatty than it needs to be. I also tried
 using onblur, which works fine, but does not satisfy my business
 requirements:

  final TextFieldString zipcodeField = new TextFieldString( zipcode );
  form.add( zipcodeField.setRequired( true ) );

  AjaxFormComponentUpdatingBehavior zipcodeOnBlur = new 
 AjaxFormComponentUpdatingBehavior( onblur ) {
  @Override
  protected void onUpdate( AjaxRequestTarget target ) {
  System.out.println( Zipcode value (form component):  + 
 getFormComponent().getModelObject() );
  }
  };
  zipcodeField.add( zipcodeOnBlur );



 Prior
 to using Wicket (which I'm currently prototyping for my company), we
 would handle this logic in JavaScript (observe changes to the field and
 when the user enters the fifth character then we made an AJAX call back
 our Struts 2 application.)

 What is the best way to achieve the same end using Wicket?

 Thanks, in advance, for your help!
 Steve

 P.S.
 I started using Wicket as part of an article series (because of all of
 your passion for it) and I have to say all of you are doing incredible
 work - I love it.. Here's the link to the article series in case any of
 you are interested:
 http://www.informit.com/guides/content.aspx?g=javaseqNum=529

 -
 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

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



OnChangeAjaxBehavior: nth character

2010-02-12 Thread Steven Haines
Hi,

I
would like to add AJAX behavior to an application that sends an update
to my application after a certain number of characters have been typed.
For example, if the user is entering a zipcode, I would like a callback
to my application to be made after the user enters the fifth character.

I've
written code using OnChangeAjaxBehavior that sends messages back to my
application after every character has been typed, such as the following:

final TextFieldString zipcodeField = new TextFieldString( zipcode );
form.add( zipcodeField.setRequired( true ) );
OnChangeAjaxBehavior zipcodeUpdated = new OnChangeAjaxBehavior() {
  @Override
  protected void onUpdate( AjaxRequestTarget target ) {
System.out.println( Zipcode value:  + 
zipcodeField.getDefaultModelObjectAsString() );
  }
};
zipcodeField.add( zipcodeUpdated );


I
could check to see the size of the zipcodeField (in this example), but
it makes my application more chatty than it needs to be. I also tried
using onblur, which works fine, but does not satisfy my business
requirements:

  final TextFieldString zipcodeField = new TextFieldString( zipcode );
  form.add( zipcodeField.setRequired( true ) );

  AjaxFormComponentUpdatingBehavior zipcodeOnBlur = new 
AjaxFormComponentUpdatingBehavior( onblur ) {
  @Override
  protected void onUpdate( AjaxRequestTarget target ) {
  System.out.println( Zipcode value (form component):  + 
getFormComponent().getModelObject() );
  }
  };
  zipcodeField.add( zipcodeOnBlur );



Prior
to using Wicket (which I'm currently prototyping for my company), we
would handle this logic in JavaScript (observe changes to the field and
when the user enters the fifth character then we made an AJAX call back
our Struts 2 application.) 

What is the best way to achieve the same end using Wicket?

Thanks, in advance, for your help!
Steve

P.S.
I started using Wicket as part of an article series (because of all of
your passion for it) and I have to say all of you are doing incredible
work - I love it.. Here's the link to the article series in case any of
you are interested:
http://www.informit.com/guides/content.aspx?g=javaseqNum=529

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