RE: message internationalization

2011-12-05 Thread Wilhelmsen Tor Iver
 The label components are not refreshed after changing locale. Do you know
 why.

My guess is that the labels are not using a Locale-aware model like 
ResourceModel, but instead have been set using construction-time getString() or 
the like.
 
 Another problem is that when I change the locale I refresh the whole page.
 (target.addComponent(instance);) where instance is my Page class.

Remember that you need to use the AjaxFormComponent* classes in order to get 
form input values submitted to you.

Also: try instead to repaint a subset of the page, e.g. wrap most stuff in a 
WebMarkupContainer.

- Tor Iver

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



Re: Freemarker+ExtJS vs Wicket questions

2011-12-05 Thread Brian Mulholland
As a Wicket neophyte myself I can't comment on most of this, but we
did just look deeply into the notion of subclassing components for the
purpose of making them render as rich text widgets from ExtJS.  Having
just done that I will say that there are ALOT of little hidden nits
and difficulties that come up in such an effort.  Wicket and ExtJS
both want to control the rendering of the end markup, so when you
replace the generated markup with Ext widgets, many of Wicket's little
pre-created solutions for various internet use cases breaks.  Each
problem is circumventable, but eventually you find yourself almost
writing your own framework rather than extending a framework.

I would really love it if a more experienced Wicket developer took a
serious crack at creating a Wicket extension that worked with rich
internet controls.  I get the feeling that my effort failed as much
because I didn't have deep Wicket knowledge as anything else.

Brian Mulholland




On Sun, Dec 4, 2011 at 12:30 AM, Andrei Voden are...@gmail.com wrote:
 Hi. I have been developing for a while using Freemarker + some JS
 frameworks (like ExtJS, Dojo and JQuery) and Java as Model building on
 back-end. Now I hear lots of talks about Wicket so Im trying to understand
 pros and cons. After reading intro in Wicket I have mixed feelings. Below
 are my conclusions. I know Im biased but dont take it as offense. Instead
 rather as my misunderstanding since Im really trying to see if Wicket
 is thing to switch to.

 Pros:

 -Seems like this is good for companies where you have Java programmers that
 you can now utilize for building Front-end.

 - Clean HTML code and all logic handled by Java.

 - Quick to start building simple apps that fall into the box of the
 framework.

 - No JScript or HTML/CSS knowledge needed. Can separate easier Frot-end and
 Back-end developers -- easier to hire.

 Cons:

 - On other hand, as Front-end developer this looks weird to me since I feel
 like I don't have full control of JScript code.

 1) Since Wicket uses Java for generating HTML/CSS/JScript UI controls for
 me meaning if I need to tweak those controls outside of their box it maybe
 problematic. In my experience any framework good until you start doing
 something different from what it was intended and then you can spend more
 time trying to do simple out of box thing then using native JScript. Is
 there JScript sources for Wicket controls?

 2) Prototyping: using Freemarker I can do changes and simply refresh page.
 In case of Wicket I need to recompile.

 3) Logic blocks: Looks like Wicket allows injection of values into HTML
 tags with wicket: attribute but how do you handle block logic like
 IF(condition) then {use HTML block1} else { use another HTML block}?

 4) Non html data templating: often during page generation I compose some
 AJAX data from FreeMarker inside tag. How do I do similar things from
 Wicket?

 5) Is it harder/simpler to create custom UI controls in Wicket vs using say
 Dojo, ExtJS or JQuery?

 Andrei

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



Re: Freemarker+ExtJS vs Wicket questions

2011-12-05 Thread Martin Grigorov
Hi,

On Mon, Dec 5, 2011 at 1:23 PM, Brian Mulholland blmulholl...@gmail.com wrote:
 As a Wicket neophyte myself I can't comment on most of this, but we
 did just look deeply into the notion of subclassing components for the
 purpose of making them render as rich text widgets from ExtJS.  Having
 just done that I will say that there are ALOT of little hidden nits
 and difficulties that come up in such an effort.  Wicket and ExtJS
 both want to control the rendering of the end markup, so when you
 replace the generated markup with Ext widgets, many of Wicket's little
 pre-created solutions for various internet use cases breaks.  Each
 problem is circumventable, but eventually you find yourself almost
 writing your own framework rather than extending a framework.

I'm not sure what exactly you tried but here is how I'd approach it:
- create a Wicket component that purpose is to render just the HTML
needed by the ExtJS component
e.g. div id=someId/div
for this simple HTML snipper you can just use WebMarkupContainer, but
for something more complex you'll need your own Panel
- create a Behavior that should contribute the JS code
this will load the js template, populate it with some options, connect
it to someId and finally just contribute it to the response with
#renderHead()


 I would really love it if a more experienced Wicket developer took a
 serious crack at creating a Wicket extension that worked with rich
 internet controls.  I get the feeling that my effort failed as much
 because I didn't have deep Wicket knowledge as anything else.

There are several: wiquery, jqwicket, jwicket, wicketstuff-dojo,
wicketstuff-yui, ...
I guess these use different approach to integrate Wicket with the JS
widgets. Pick the one that you like the most and make it better.

There are talks about making official integration of Wicket with
JQuery UI, i.e. maintained by Wicket core developers but so far there
is nothing done on it.


 Brian Mulholland




 On Sun, Dec 4, 2011 at 12:30 AM, Andrei Voden are...@gmail.com wrote:
 Hi. I have been developing for a while using Freemarker + some JS
 frameworks (like ExtJS, Dojo and JQuery) and Java as Model building on
 back-end. Now I hear lots of talks about Wicket so Im trying to understand
 pros and cons. After reading intro in Wicket I have mixed feelings. Below
 are my conclusions. I know Im biased but dont take it as offense. Instead
 rather as my misunderstanding since Im really trying to see if Wicket
 is thing to switch to.

 Pros:

 -Seems like this is good for companies where you have Java programmers that
 you can now utilize for building Front-end.

 - Clean HTML code and all logic handled by Java.

 - Quick to start building simple apps that fall into the box of the
 framework.

 - No JScript or HTML/CSS knowledge needed. Can separate easier Frot-end and
 Back-end developers -- easier to hire.

 Cons:

 - On other hand, as Front-end developer this looks weird to me since I feel
 like I don't have full control of JScript code.

 1) Since Wicket uses Java for generating HTML/CSS/JScript UI controls for
 me meaning if I need to tweak those controls outside of their box it maybe
 problematic. In my experience any framework good until you start doing
 something different from what it was intended and then you can spend more
 time trying to do simple out of box thing then using native JScript. Is
 there JScript sources for Wicket controls?

 2) Prototyping: using Freemarker I can do changes and simply refresh page.
 In case of Wicket I need to recompile.

 3) Logic blocks: Looks like Wicket allows injection of values into HTML
 tags with wicket: attribute but how do you handle block logic like
 IF(condition) then {use HTML block1} else { use another HTML block}?

 4) Non html data templating: often during page generation I compose some
 AJAX data from FreeMarker inside tag. How do I do similar things from
 Wicket?

 5) Is it harder/simpler to create custom UI controls in Wicket vs using say
 Dojo, ExtJS or JQuery?

 Andrei

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Internationalization on panels

2011-12-05 Thread cosmindumy
I solved the localization for most of the components except one. This is
BeatyTipBehavior
This is the code:
sourceLanguageTooltip = new Label(sourceLanguageTooltip);
BeautyTipBehavior behavior = new BeautyTipBehavior(new
ResourceModel(baloise.order.create.ordercreate.sourcelanguagetooltip));
behavior.setFadeInOut(true);
sourceLanguageTooltip.add(behavior);

It give me the message that it doesn't find the key, but surely the key is
there. Any idea? 
I've got the same error with the code 
myLabel = new Label(id, new ModelString(new
ResourceModel(key).getObject()) ). but i solved by passing the
ResourceModel directly to label. But for TolltipBehavior I found no
solution. 

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4160300.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: Internationalization on panels

2011-12-05 Thread Martin Grigorov
Hi,

How do you use the resource model in this behavior ?

On Mon, Dec 5, 2011 at 1:36 PM, cosmindumy cosmind...@yahoo.com wrote:
 I solved the localization for most of the components except one. This is
 BeatyTipBehavior
 This is the code:
 sourceLanguageTooltip = new Label(sourceLanguageTooltip);
        BeautyTipBehavior behavior = new BeautyTipBehavior(new
 ResourceModel(baloise.order.create.ordercreate.sourcelanguagetooltip));
        behavior.setFadeInOut(true);
        sourceLanguageTooltip.add(behavior);

 It give me the message that it doesn't find the key, but surely the key is
 there. Any idea?
 I've got the same error with the code
 myLabel = new Label(id, new ModelString(new
 ResourceModel(key).getObject()) ). but i solved by passing the
 ResourceModel directly to label. But for TolltipBehavior I found no
 solution.

 Thanks

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4160300.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Internationalization on panels

2011-12-05 Thread cosmindumy
I'm afraid I don't understand your question? What do you mean by how do you
use ResourceModel ?
Actually I have a class LTooltipBehavior that extends BeautyTipBehavior, but
i alson tried with BeautyTipBehavior as you saw in the example and it didn't
work.

Here is the original code:
 targetLanguageToolTip = new Label(targetLanguageToolTip);
targetLanguageToolTip.add(new LTooltipBehavior(new
ResourceModel(baloise.order.create.ordercreate.targetlanguagetooltip)).setFadeInOut(true));
targetLanguageToolTip.setOutputMarkupId(true);

and I also tried for test the following as you saw thinking that the problem
is in my behavior: 

sourceLanguageTooltip = new Label(sourceLanguageTooltip);
BeautyTipBehavior behavior = new BeautyTipBehavior(new
ResourceModel(baloise.order.create.ordercreate.sourcelanguagetooltip));
behavior.setFadeInOut(true);
sourceLanguageTooltip.add(behavior);
sourceLanguageTooltip.setOutputMarkupId(true);



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4160335.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: Internationalization on panels

2011-12-05 Thread Martin Grigorov
Paste the code of the behavior.
I want to see what you do with the model inside.
Use any pastebin service to paste the code because it is easier to
read formatted and highlighted code ;-)

On Mon, Dec 5, 2011 at 1:48 PM, cosmindumy cosmind...@yahoo.com wrote:
 I'm afraid I don't understand your question? What do you mean by how do you
 use ResourceModel ?
 Actually I have a class LTooltipBehavior that extends BeautyTipBehavior, but
 i alson tried with BeautyTipBehavior as you saw in the example and it didn't
 work.

 Here is the original code:
  targetLanguageToolTip = new Label(targetLanguageToolTip);
        targetLanguageToolTip.add(new LTooltipBehavior(new
 ResourceModel(baloise.order.create.ordercreate.targetlanguagetooltip)).setFadeInOut(true));
        targetLanguageToolTip.setOutputMarkupId(true);

 and I also tried for test the following as you saw thinking that the problem
 is in my behavior:

 sourceLanguageTooltip = new Label(sourceLanguageTooltip);
        BeautyTipBehavior behavior = new BeautyTipBehavior(new
 ResourceModel(baloise.order.create.ordercreate.sourcelanguagetooltip));
        behavior.setFadeInOut(true);
        sourceLanguageTooltip.add(behavior);
        sourceLanguageTooltip.setOutputMarkupId(true);



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4160335.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Internationalization on panels

2011-12-05 Thread cosmindumy
Here is the class:
http://www.heypasteit.com/clip/04FA
But I don't use the model inside. I just pass it to superclass. 
Anyway it didn't work with their BeautyTipBehavior, so it should't be a
problem with my Behavior.
But you can take a look.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4160360.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: Freemarker+ExtJS vs Wicket questions

2011-12-05 Thread Brian Mulholland
 I'm not sure what exactly you tried but here is how I'd approach it:
 - create a Wicket component that purpose is to render just the HTML
 needed by the ExtJS component
 e.g. div id=someId/div
 for this simple HTML snipper you can just use WebMarkupContainer, but
 for something more complex you'll need your own Panel
 - create a Behavior that should contribute the JS code
 this will load the js template, populate it with some options, connect
 it to someId and finally just contribute it to the response with
 #renderHead()

That's not too far from what I did.  But as you get into it, all kinds
of little problems arise.  For example, Ext wants it's form in place
instead of the basic HTML form, Ext controls often want to tie into a
separate data source, making the JS controls breaks alot of Wicket's
behaviors which are geared towards markup, and so on.  The devil is in
the details.  As i said, each individual hurdle that presented itself
I was able to overcome, but as time went on, I began to feel like I
had a package full or workarounds.

 I would really love it if a more experienced Wicket developer took a
 serious crack at creating a Wicket extension that worked with rich
 internet controls.  I get the feeling that my effort failed as much
 because I didn't have deep Wicket knowledge as anything else.

 There are several: wiquery, jqwicket, jwicket, wicketstuff-dojo,
 wicketstuff-yui, ...

I saw WiQuery and JQWicket...but didn't really seem to me to be geared
towards a full integration as much as a collection of random stuff for
specific web use cases.  I wasn't familiar with the others.  I'll go
look at those.

 I guess these use different approach to integrate Wicket with the JS
 widgets. Pick the one that you like the most and make it better.

Perhaps once I am more deeply familiar with Wicket I would be
confident enough to try to extend something for public consumption,
but I don't really feel experienced enough to do things Wicket's way.
And Wicket seems like one of those frameworks that really wants you to
know the right way.  I probably shouldn't have attempted this until
I'd had a few years of development time in Wicket first.  But since
Ext is basically a component hierarchy and Wicket is basically a
component hierarchy, it SEEMED like a perfect fit.  And to some extent
i still believe it could be...in the hands of a more experienced
Wicket developer.

 There are talks about making official integration of Wicket with
 JQuery UI, i.e. maintained by Wicket core developers but so far there
 is nothing done on it.

I read some of those threads.  I think this would be an excellent
idea.  Accessibility is a BIG deal for my contract (US Govt), and many
jQuery widgets aren't ARIA enabled, so I would gently prod those
thinking about it to keep an eye on accessibility if they decided to
do this.  Try to pick jQuery components that support ARIA.

I think the world is going this way.  Users expectations of browser
interfaces are increasing quickly.  If Wicket were to come to market
with it's strong object-orientation (the selling feature that
attracted my contract), and more rich client features built in (like
the various GWT frameworks, but not using that javascript generating
methodology), I think it would capture a space most other web
frameworks aren't as well positioned to exploit.

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



Re: Internationalization on panels

2011-12-05 Thread cosmindumy
Just as a remar, the following code works, but the tooltip is not refreshed
after I change locale:

Label phoneTooltip = new Label(phoneTooltip);
phoneTooltip.add(new LTooltipBehavior(new
ModelString(getString(baloise.settings.userdetails.phonetooltip))).setFadeInOut(true));

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4160383.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: Internationalization on panels

2011-12-05 Thread Martin Grigorov
Re-read the wiki page about dynamic models, then read what Igor pasted
in his response and I'm sure you'll find the solution.

On Mon, Dec 5, 2011 at 2:07 PM, cosmindumy cosmind...@yahoo.com wrote:
 Just as a remar, the following code works, but the tooltip is not refreshed
 after I change locale:

 Label phoneTooltip = new Label(phoneTooltip);
        phoneTooltip.add(new LTooltipBehavior(new
 ModelString(getString(baloise.settings.userdetails.phonetooltip))).setFadeInOut(true));

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4160383.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Form Submit components

2011-12-05 Thread cheesus
Hmm, change all under wicket.markup.html.navigation.paging
to use SubmitLink instead of Link sounds easier than it is.
Really, nobody has a pointer to a solution for submit form upon table
navigation ?
Cheers, Tom.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Form-Submit-components-tp4119429p4160443.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: Re: DataTable and FilterToolbar

2011-12-05 Thread cheesus
To follow up that old post of mine, the solution is of course to add a
default button, and if we don't have one, but need one, we make it
invisible:





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DataTable-Multiple-Filter-and-OrderSubmittingLink-tp3520329p4160454.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: Internationalization on panels

2011-12-05 Thread cosmindumy
Thanks. :*
I subcalssed the Model. It works. I understand now exactly the difference
between static and dynamic models. 
But as I know ResourceModel is a dynamic model. Why it didn't find the key? 
And why for other components it worked and for BeatyTipBehavior it didn't
work? I didn't find an explanation in that wiki.

P.S As you probably noticed I'm very new in wicket, and there my questions
may seem stupid. But I enjoy wicket very much.
It's the coolest web framework I worked with. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4160463.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: Internationalization on panels

2011-12-05 Thread Martin Grigorov
The only reason I can see is that your .properties file (the resource
bundle) is next to a Component (e.g. MyPage.properties).
If the translation is in MyApplication.properties then it will work.

On Mon, Dec 5, 2011 at 2:38 PM, cosmindumy cosmind...@yahoo.com wrote:
 Thanks. :*
 I subcalssed the Model. It works. I understand now exactly the difference
 between static and dynamic models.
 But as I know ResourceModel is a dynamic model. Why it didn't find the key?
 And why for other components it worked and for BeatyTipBehavior it didn't
 work? I didn't find an explanation in that wiki.

 P.S As you probably noticed I'm very new in wicket, and there my questions
 may seem stupid. But I enjoy wicket very much.
 It's the coolest web framework I worked with.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4160463.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Form Submit components

2011-12-05 Thread cheesus

Martin Grigorov-4 wrote
 
 What is hard with it ?
 
Well, it would have been a lot easier if SubmitLink were a LinkT ;-)
...

Well, I have it running now, with a solution looking roughly like...

 Really, nobody has a pointer to a solution for submit form upon table
 navigation ?


Martin Grigorov-4 wrote
 
 Contributions are welcome!
 

The point is, this is quite messy, and an awlut lot of code, just to make
the links the submitting kind.

Thus my question, if this not better be solved as e.g. a Behavior ?
Or in any other (better) way ?

I'm not afraid to contribute ;-) but I'm asking which direction you would
recommend, as I can hack
out some Wicket code, but I'm not soo sure concerning concepts and
architecture...

Any input ?
Cheers, Tom.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Form-Submit-components-tp4119429p4161290.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: Form Submit components

2011-12-05 Thread Martin Grigorov
On Mon, Dec 5, 2011 at 5:53 PM, cheesus t...@tomeicher.de wrote:

 Martin Grigorov-4 wrote

 What is hard with it ?

 Well, it would have been a lot easier if SubmitLink were a LinkT ;-)

If there is no ticket in Jira then we cannot know about this problem and fix it.
Ticket + patch would be awesome! :-)

 ...

 Well, I have it running now, with a solution looking roughly like...

 Really, nobody has a pointer to a solution for submit form upon table
 navigation ?


 Martin Grigorov-4 wrote

 Contributions are welcome!


 The point is, this is quite messy, and an awlut lot of code, just to make
 the links the submitting kind.

 Thus my question, if this not better be solved as e.g. a Behavior ?
 Or in any other (better) way ?

 I'm not afraid to contribute ;-) but I'm asking which direction you would
 recommend, as I can hack
 out some Wicket code, but I'm not soo sure concerning concepts and
 architecture...

If just adding a behavior to the navigator enables this functionality
then it will be much better than now.
Play with it and if you create something simpler then attach it to a ticket.
I think there is a ticket Re-think PagingNavigator and Co. but no
one had time to think on it so far.


 Any input ?
 Cheers, Tom.


 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Form-Submit-components-tp4119429p4161290.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



1.5 Printing Markup

2011-12-05 Thread Ben Tilford
Has something changed where WicketTester.getResponse().getDocument() no
longer contains the generated markup? I'm getting empty strings for any
component started through the tester. Stepping through with the debugger it
does resolve the associated markup correctly it just never gets added to
the response/document.


Re: 1.5 Printing Markup

2011-12-05 Thread Martin Grigorov
Use org.apache.wicket.util.tester.BaseWicketTester.getLastResponseAsString()

The difference is in #getLastResponse() vs. getResponse() (for the
next request/response)

On Mon, Dec 5, 2011 at 6:11 PM, Ben Tilford b...@tilford.info wrote:
 Has something changed where WicketTester.getResponse().getDocument() no
 longer contains the generated markup? I'm getting empty strings for any
 component started through the tester. Stepping through with the debugger it
 does resolve the associated markup correctly it just never gets added to
 the response/document.



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



urlFor()

2011-12-05 Thread John Toncart

Hi guys,

with 1.4 I was doing:
ResourceReference resourceImg = new ResourceReference(name + .jpg);
String urlString = RequestCycle.get().urlFor(imageResource).toString();

Now with 1.5 I can't do this, not know where is problem.

Does anyone know how to do this in 1.5 please?

John

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



RE: best way to accommodate dynamic properties

2011-12-05 Thread Daniel Watrous
I'm still trying to figure this out. I would like to be able to do something 
like the following:

HTML:
img wicket:id=testimage

JAVA:
public class ImageTestPage extends WebPage{
public ImageTestPage() {
Image myImg = new Image(testimage);
myImg.setUrlForImageSrc(http://path/to/image.gif;);
myImg.setWidth(200);
myImg.setHeight(100);
add(myImg);
}
}

Obviously the Image class doesn't work that way... Can someone tell me how I 
would accomplish this so that I can define the image, height and width 
independent from the markup?

Daniel

-Original Message-
From: Daniel Watrous [mailto:daniel.watr...@bodybuilding.com] 
Sent: Friday, December 02, 2011 5:20 PM
To: users@wicket.apache.org
Subject: best way to accommodate dynamic properties

I'm interested in having pulling the width and height for an img from a 
database, but I'm not sure what the best way is to create a component and 
corresponding HTML mapping.

Please send an example or link to previous response if possible. I've searched 
the users list archives but didn't find what I was looking for.

Thanks.

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



Re: urlFor()

2011-12-05 Thread Martin Grigorov
org.apache.wicket.request.resource.PackageResourceReference.PackageResourceReference(String)

2011/12/5 John Toncart john.tonc...@gmail.com:
 Hi guys,

 with 1.4 I was doing:
 ResourceReference resourceImg = new ResourceReference(name + .jpg);
 String urlString = RequestCycle.get().urlFor(imageResource).toString();

 Now with 1.5 I can't do this, not know where is problem.

 Does anyone know how to do this in 1.5 please?

 John

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: best way to accommodate dynamic properties

2011-12-05 Thread Martin Grigorov
class MyImage extends WebComponent {

  public void onComponentTag(ComponentTag tag) {
 tag.put(src, url);
...
  }
}

On Mon, Dec 5, 2011 at 7:16 PM, Daniel Watrous
daniel.watr...@bodybuilding.com wrote:
 I'm still trying to figure this out. I would like to be able to do something 
 like the following:

 HTML:
 img wicket:id=testimage

 JAVA:
 public class ImageTestPage extends WebPage{
    public ImageTestPage() {
        Image myImg = new Image(testimage);
        myImg.setUrlForImageSrc(http://path/to/image.gif;);
        myImg.setWidth(200);
        myImg.setHeight(100);
        add(myImg);
    }
 }

 Obviously the Image class doesn't work that way... Can someone tell me how I 
 would accomplish this so that I can define the image, height and width 
 independent from the markup?

 Daniel

 -Original Message-
 From: Daniel Watrous [mailto:daniel.watr...@bodybuilding.com]
 Sent: Friday, December 02, 2011 5:20 PM
 To: users@wicket.apache.org
 Subject: best way to accommodate dynamic properties

 I'm interested in having pulling the width and height for an img from a 
 database, but I'm not sure what the best way is to create a component and 
 corresponding HTML mapping.

 Please send an example or link to previous response if possible. I've 
 searched the users list archives but didn't find what I was looking for.

 Thanks.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: best way to accommodate dynamic properties

2011-12-05 Thread John Toncart
I think you can't do this without markup. Put in DB binary data, width 
and height and pul it out then and with this data modify markup. If 
image doesn't have exif data you don't know dimensions (I think...)



Daniel Watrous wrote:

I'm still trying to figure this out. I would like to be able to do something 
like the following:

HTML:
img wicket:id=testimage

JAVA:
public class ImageTestPage extends WebPage{
public ImageTestPage() {
Image myImg = new Image(testimage);
myImg.setUrlForImageSrc(http://path/to/image.gif;);
myImg.setWidth(200);
myImg.setHeight(100);
add(myImg);
}
}

Obviously the Image class doesn't work that way... Can someone tell me how I 
would accomplish this so that I can define the image, height and width 
independent from the markup?

Daniel

-Original Message-
From: Daniel Watrous [mailto:daniel.watr...@bodybuilding.com] 
Sent: Friday, December 02, 2011 5:20 PM

To: users@wicket.apache.org
Subject: best way to accommodate dynamic properties

I'm interested in having pulling the width and height for an img from a 
database, but I'm not sure what the best way is to create a component and 
corresponding HTML mapping.

Please send an example or link to previous response if possible. I've searched 
the users list archives but didn't find what I was looking for.

Thanks.

-
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: Using Property Resolver

2011-12-05 Thread Igor Vaynberg
as long as you are in a wicket thread you should be, see how the
property model does it.

-igor

On Mon, Dec 5, 2011 at 10:05 AM, anantasthana anant.a...@gmail.com wrote:
 I want to be able to do some thing similar to what a property model does in
 the sense that we give the property model an object and field and it
 automatically finds the get and set methods. Can i use property resolver
 some how to make a Comparator that takes in an object and the sort field. I
 know this isnt exactly a wicket question but i figured some one here would
 know

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Using-Property-Resolver-tp4161550p4161550.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


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



Re: urlFor()

2011-12-05 Thread John Toncart
PackageResourceReference resourceImg = new PackageResourceReference(name 
+ .jpg);

String urlString = RequestCycle.get().urlFor(imageResource).toString();

gives me error:
The method urlFor(IRequestHandler) in the type RequestCycle is not 
applicable for the arguments (PackageResourceReference)


which is exact problem I have :-( So exact question is: how to get url 
from PackageResourceReference? 1.4 method won't work anymore or I miss

somethink.


Martin Grigorov wrote:

org.apache.wicket.request.resource.PackageResourceReference.PackageResourceReference(String)


2011/12/5 John Toncart john.tonc...@gmail.com:

Hi guys,

with 1.4 I was doing: ResourceReference resourceImg = new
ResourceReference(name + .jpg); String urlString =
RequestCycle.get().urlFor(imageResource).toString();

Now with 1.5 I can't do this, not know where is problem.

Does anyone know how to do this in 1.5 please?

John

-
 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: best way to accommodate dynamic properties

2011-12-05 Thread Igor Vaynberg
class myimage extends image {
  oncomponenttag(tag) {
  Integer width=getImageWidth();
  Integer height=getImageHeight();
  if (width!=null) tag.put(width, width);
  if (height!=null) tag.put(height, height);
  }}

-igor

On Mon, Dec 5, 2011 at 10:20 AM, John Toncart john.tonc...@gmail.com wrote:
 I think you can't do this without markup. Put in DB binary data, width and
 height and pul it out then and with this data modify markup. If image
 doesn't have exif data you don't know dimensions (I think...)



 Daniel Watrous wrote:

 I'm still trying to figure this out. I would like to be able to do
 something like the following:

 HTML:
 img wicket:id=testimage

 JAVA:
 public class ImageTestPage extends WebPage{
    public ImageTestPage() {
        Image myImg = new Image(testimage);
        myImg.setUrlForImageSrc(http://path/to/image.gif;);
        myImg.setWidth(200);
        myImg.setHeight(100);
        add(myImg);
    }
 }

 Obviously the Image class doesn't work that way... Can someone tell me how
 I would accomplish this so that I can define the image, height and width
 independent from the markup?

 Daniel

 -Original Message-
 From: Daniel Watrous [mailto:daniel.watr...@bodybuilding.com] Sent:
 Friday, December 02, 2011 5:20 PM
 To: users@wicket.apache.org
 Subject: best way to accommodate dynamic properties

 I'm interested in having pulling the width and height for an img from a
 database, but I'm not sure what the best way is to create a component and
 corresponding HTML mapping.

 Please send an example or link to previous response if possible. I've
 searched the users list archives but didn't find what I was looking for.

 Thanks.

 -
 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: urlFor()

2011-12-05 Thread Martin Grigorov
Why don't use an IDE. It gives you the method signature and even suggests fixes:

RequestCycle.get().urlFor(imageResource, null).toString();

On Mon, Dec 5, 2011 at 7:26 PM, John Toncart john.tonc...@gmail.com wrote:
 PackageResourceReference resourceImg = new PackageResourceReference(name +
 .jpg);
 String urlString = RequestCycle.get().urlFor(imageResource).toString();

 gives me error:
 The method urlFor(IRequestHandler) in the type RequestCycle is not
 applicable for the arguments (PackageResourceReference)

 which is exact problem I have :-( So exact question is: how to get url from
 PackageResourceReference? 1.4 method won't work anymore or I miss
 somethink.



 Martin Grigorov wrote:


 org.apache.wicket.request.resource.PackageResourceReference.PackageResourceReference(String)


 2011/12/5 John Toncart john.tonc...@gmail.com:

 Hi guys,

 with 1.4 I was doing: ResourceReference resourceImg = new
 ResourceReference(name + .jpg); String urlString =
 RequestCycle.get().urlFor(imageResource).toString();

 Now with 1.5 I can't do this, not know where is problem.

 Does anyone know how to do this in 1.5 please?

 John

 -
  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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: urlFor()

2011-12-05 Thread Igor Vaynberg
urlfor(new ResourceReferenceRequestHandler(ref))

-igor

On Mon, Dec 5, 2011 at 10:26 AM, John Toncart john.tonc...@gmail.com wrote:
 PackageResourceReference resourceImg = new PackageResourceReference(name +
 .jpg);
 String urlString = RequestCycle.get().urlFor(imageResource).toString();

 gives me error:
 The method urlFor(IRequestHandler) in the type RequestCycle is not
 applicable for the arguments (PackageResourceReference)

 which is exact problem I have :-( So exact question is: how to get url from
 PackageResourceReference? 1.4 method won't work anymore or I miss
 somethink.



 Martin Grigorov wrote:


 org.apache.wicket.request.resource.PackageResourceReference.PackageResourceReference(String)


 2011/12/5 John Toncart john.tonc...@gmail.com:

 Hi guys,

 with 1.4 I was doing: ResourceReference resourceImg = new
 ResourceReference(name + .jpg); String urlString =
 RequestCycle.get().urlFor(imageResource).toString();

 Now with 1.5 I can't do this, not know where is problem.

 Does anyone know how to do this in 1.5 please?

 John

 -
  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: urlFor()

2011-12-05 Thread Igor Vaynberg
actually, request handler has: public final CharSequence
urlFor(ResourceReference reference, PageParameters params)

-igor

On Mon, Dec 5, 2011 at 10:29 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 urlfor(new ResourceReferenceRequestHandler(ref))

 -igor

 On Mon, Dec 5, 2011 at 10:26 AM, John Toncart john.tonc...@gmail.com wrote:
 PackageResourceReference resourceImg = new PackageResourceReference(name +
 .jpg);
 String urlString = RequestCycle.get().urlFor(imageResource).toString();

 gives me error:
 The method urlFor(IRequestHandler) in the type RequestCycle is not
 applicable for the arguments (PackageResourceReference)

 which is exact problem I have :-( So exact question is: how to get url from
 PackageResourceReference? 1.4 method won't work anymore or I miss
 somethink.



 Martin Grigorov wrote:


 org.apache.wicket.request.resource.PackageResourceReference.PackageResourceReference(String)


 2011/12/5 John Toncart john.tonc...@gmail.com:

 Hi guys,

 with 1.4 I was doing: ResourceReference resourceImg = new
 ResourceReference(name + .jpg); String urlString =
 RequestCycle.get().urlFor(imageResource).toString();

 Now with 1.5 I can't do this, not know where is problem.

 Does anyone know how to do this in 1.5 please?

 John

 -
  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: Freemarker+ExtJS vs Wicket questions

2011-12-05 Thread Andrei Voden
I think using String.format for that is breaking idea of MVC where you
endup writing JScript code in Java. Sounds really awkward.
I guess I can hookup Velocity or Freemarker but isnt whole point of Wicket
is to replace that? Plus another problem I see is if I have to use separate
templates for each script tag I may end up with lots of small files so my
logic will be peppered around.

Andrei

On Mon, Dec 5, 2011 at 12:25 AM, Wilhelmsen Tor Iver toriv...@arrive.nowrote:

 script
 .templated code.
 /script

 I tend to use a Label for that kind of scenario, where the Label's model
 uses some other templating engine, anything from a simple String.format()
 to a more complex beast like Velocity (or FreeMarker).

 script wicket:id=complexScript
 /script

 - Tor Iver

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




Re: Freemarker+ExtJS vs Wicket questions

2011-12-05 Thread Martin Grigorov
On Mon, Dec 5, 2011 at 7:52 PM, Andrei Voden are...@gmail.com wrote:
 I think using String.format for that is breaking idea of MVC where you
 endup writing JScript code in Java. Sounds really awkward.
 I guess I can hookup Velocity or Freemarker but isnt whole point of Wicket
 is to replace that?

you asked how to do if/else in my templates not me ;-)

 Plus another problem I see is if I have to use separate
 templates for each script tag I may end up with lots of small files so my
 logic will be peppered around.

The templates should be in separate files because this way your
components will contribute only what is needed by them.
But then Wicket can merge all these contributions in one script that
is delivered to the browser.


 Andrei

 On Mon, Dec 5, 2011 at 12:25 AM, Wilhelmsen Tor Iver 
 toriv...@arrive.nowrote:

 script
 .templated code.
 /script

 I tend to use a Label for that kind of scenario, where the Label's model
 uses some other templating engine, anything from a simple String.format()
 to a more complex beast like Velocity (or FreeMarker).

 script wicket:id=complexScript
 /script

 - Tor Iver

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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



IRequestMapper that ignores page version

2011-12-05 Thread Allen Gilbert
Hello,

I have a problem similar to the one outlined here:
http://apache-wicket.1842946.n4.nabble.com/Migrating-from-1-4-16-to-1-5-RC3-problem-when-trying-to-avoid-pages-caching-not-calling-the-construc-td3463183.html.
I have a page that uses a lot of Ajax (and is thus stateful/versioned), but
I need its constructor to be called any time the page is requested.
 Otherwise, if the user lands on the page via the back button, it will not
be rendered correctly.  Anyway, I'm looking into creating a custom
IRequestMapper, per Martin's suggestion in the Nabble thread.  However, I
don't know where to start. Should I extend one of the existing mappers
(e.g. MountedMapper), or should I create an entirely new implementation of
IRequestMapper?  In either case, how do I make sure that I don't screw up
handling of listener links for ajax actions on the page?  In other words,
how do I create a reliable IRequestMapper for a page that, when requested,
always re-renders itself?

If there's a different way to accomplish this (i.e. without creating a
custom IRequestMapper or making the page stateless), I'd love to know.

Thanks for your help!

-Allen


Re: urlFor()

2011-12-05 Thread John Toncart

Martin, mea culpa, I overlook PageParams in urlFor(). Thanks for your
hint.


Martin Grigorov wrote:

Why don't use an IDE. It gives you the method signature and even suggests fixes:

RequestCycle.get().urlFor(imageResource, null).toString();

On Mon, Dec 5, 2011 at 7:26 PM, John Toncart john.tonc...@gmail.com wrote:

PackageResourceReference resourceImg = new PackageResourceReference(name +
.jpg);
String urlString = RequestCycle.get().urlFor(imageResource).toString();

gives me error:
The method urlFor(IRequestHandler) in the type RequestCycle is not
applicable for the arguments (PackageResourceReference)

which is exact problem I have :-( So exact question is: how to get url from
PackageResourceReference? 1.4 method won't work anymore or I miss
somethink.



Martin Grigorov wrote:


org.apache.wicket.request.resource.PackageResourceReference.PackageResourceReference(String)


2011/12/5 John Toncart john.tonc...@gmail.com:

Hi guys,

with 1.4 I was doing: ResourceReference resourceImg = new
ResourceReference(name + .jpg); String urlString =
RequestCycle.get().urlFor(imageResource).toString();

Now with 1.5 I can't do this, not know where is problem.

Does anyone know how to do this in 1.5 please?

John

-
 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: IRequestMapper that ignores page version

2011-12-05 Thread Martin Grigorov
Hi,

Here is an idea (again from me:-) ):

Override MountedMapper and in #mapRequest(Request) do:

if (((WebRequest) request).isAjax()) return super.mapRequest(request);

// else
url = request.getUrl();
info = getPageComponentInfo(url);
if (info != null) url.removeQueryParam(info.toString());

return super.mapRequest(request)

This will cut the special parameter that brings the page info

On Mon, Dec 5, 2011 at 8:08 PM, Allen Gilbert allen.gilb...@doane.edu wrote:
 Hello,

 I have a problem similar to the one outlined here:
 http://apache-wicket.1842946.n4.nabble.com/Migrating-from-1-4-16-to-1-5-RC3-problem-when-trying-to-avoid-pages-caching-not-calling-the-construc-td3463183.html.
 I have a page that uses a lot of Ajax (and is thus stateful/versioned), but
 I need its constructor to be called any time the page is requested.
  Otherwise, if the user lands on the page via the back button, it will not
 be rendered correctly.  Anyway, I'm looking into creating a custom
 IRequestMapper, per Martin's suggestion in the Nabble thread.  However, I
 don't know where to start. Should I extend one of the existing mappers
 (e.g. MountedMapper), or should I create an entirely new implementation of
 IRequestMapper?  In either case, how do I make sure that I don't screw up
 handling of listener links for ajax actions on the page?  In other words,
 how do I create a reliable IRequestMapper for a page that, when requested,
 always re-renders itself?

 If there's a different way to accomplish this (i.e. without creating a
 custom IRequestMapper or making the page stateless), I'd love to know.

 Thanks for your help!

 -Allen



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Model Not Updated for Empty Fields

2011-12-05 Thread Richard W. Adams
For some  reason my data model is not being updated when I completely 
erase an input text field.

 I'm submitting the form via an AjaxSubmitLink, and the model shows 
changes to the contents when there ARE contents. And the model correctly 
shows changes to the field contents when I change the contents. But if 
completely ERASE the field content, the model does NOT show an empty 
string. Instead it shows the value before the erasure. The problem occurs 
regardless TextField.setConvertEmptyInputStringToNull is set to true or 
false.



**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**


Re: Model Not Updated for Empty Fields

2011-12-05 Thread Jeremy Thomerson
On Mon, Dec 5, 2011 at 4:31 PM, Richard W. Adams rwada...@up.com wrote:

 For some  reason my data model is not being updated when I completely
 erase an input text field.

  I'm submitting the form via an AjaxSubmitLink, and the model shows
 changes to the contents when there ARE contents. And the model correctly
 shows changes to the field contents when I change the contents. But if
 completely ERASE the field content, the model does NOT show an empty
 string. Instead it shows the value before the erasure. The problem occurs
 regardless TextField.setConvertEmptyInputStringToNull is set to true or
 false.


Is that field required?  If you've called setRequired(true) it will not
blank it out because that's a validation error.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


CSRF protection and preserving page mount names

2011-12-05 Thread Dan Alvizu
Hello,

I'm migrating from wicket 1.4 to 1.5 and I am looking to port the cross
site request forgery (CSRF) protection from wicket 1.4.

In 1.4, the recommended way[1] is to use CryptedUrlWebRequestCodingStrategy:

// MyWebApplication.java

@Override
protected IRequestCycleProcessor newRequestCycleProcessor()
{
return new WebRequestCycleProcessor()
{
protected IRequestCodingStrategy newRequestCodingStrategy()
{
return new CryptedUrlWebRequestCodingStrategy(new
WebRequestCodingStrategy());
}
};
}

In 1.5, this has been removed and we're asked to use
org.apache.wicket.request.mapper.CryptoMapper[2]
instead:

// MyWebApplication.java
@Override
protected void init()
{
...
mountPage(login, LoginPage.class);
...
// must be last call in init()
IRequestMapper cryptoMapper = new
CryptoMapper(getRootRequestMapper(), this);
setRootRequestMapper(cryptoMapper);
}

While this solves the CSRF problem, there is a big issue with this: there
is no longer a page mapped to login. If this were a quickstart,
http://localhost:8080/login gives a 404.

In wicket 1.4, LoginPage would be accessible via http://localhost:8080/login,
and any other page similarly mounted would give a friendly URL if you
landed on it. The only time anything would be encrypted would be during
form posts, which was perfect because that was the only time I'd need it.

In wicket 1.5, is there a way to bring this behavior back? Or am I doing
something wrong? Or is there another recommended way of protecting against
CSRF attacks?

Thanks for any help,

- Dan

[1]
From comments in https://issues.apache.org/jira/browse/WICKET-1885
[2]
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-Listofrenamedclassesandmethods


ConcurrentModificationException

2011-12-05 Thread Fang Lin
When clicking on a link (i.e., ?5-1.ILinkListener-...) after a session expired, 
this error page shows up on my browser window:
Exception report
message
description The server encountered an internal error () that prevented it from 
fulfilling this request.
exception
java.util.ConcurrentModificationException

java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
java.util.AbstractList$Itr.next(AbstractList.java:343)

org.apache.wicket.request.RequestHandlerStack.detach(RequestHandlerStack.java:176)

org.apache.wicket.request.cycle.RequestCycle.onDetach(RequestCycle.java:565)

org.apache.wicket.request.cycle.RequestCycle.detach(RequestCycle.java:508)

org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:284)

org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)

org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at 
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:662)
This ConcurrentModificationException occurs about 70+ times on an application 
server daily.
Wicket version 1.5.3.
Any suggestion on how to avoid this?
In the init method of sub-class of the WebApplication , I have:
   IApplicationSettings settings = getApplicationSettings();
settings.setAccessDeniedPage(AccessErr.class);
settings.setPageExpiredErrorPage(SessionErr.class);
settings.setInternalErrorPage(InternalErr.class);
When a session expired, should it invoke the PageExpiredErrorPage?
-Fang




Re: IRequestMapper that ignores page version

2011-12-05 Thread Allen Gilbert
Martin,

I had to modify your example to get it to work, as request.getUrl()
actually returns a new Url instance when it's called.  Here's what I
settled on:

@Override
public IRequestHandler mapRequest(Request request) {
Request requestToMap = request;
if ((request instanceof WebRequest)  !((WebRequest) request).isAjax()) {
PageComponentInfo info = getPageComponentInfo(request.getUrl());
if (info != null) {
Url url = request.getUrl();
url.removeQueryParameters(info.toString());
requestToMap = request.cloneWithUrl(url);
}
}
return super.mapRequest(requestToMap);
}

Does anyone see any issues with this approach?

Thanks!

-Allen

On Mon, Dec 5, 2011 at 2:28 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 Here is an idea (again from me:-) ):

 Override MountedMapper and in #mapRequest(Request) do:

 if (((WebRequest) request).isAjax()) return super.mapRequest(request);

 // else
 url = request.getUrl();
 info = getPageComponentInfo(url);
 if (info != null) url.removeQueryParam(info.toString());

 return super.mapRequest(request)

 This will cut the special parameter that brings the page info

 On Mon, Dec 5, 2011 at 8:08 PM, Allen Gilbert allen.gilb...@doane.edu
 wrote:
  Hello,
 
  I have a problem similar to the one outlined here:
 
 http://apache-wicket.1842946.n4.nabble.com/Migrating-from-1-4-16-to-1-5-RC3-problem-when-trying-to-avoid-pages-caching-not-calling-the-construc-td3463183.html
 .
  I have a page that uses a lot of Ajax (and is thus stateful/versioned),
 but
  I need its constructor to be called any time the page is requested.
   Otherwise, if the user lands on the page via the back button, it will
 not
  be rendered correctly.  Anyway, I'm looking into creating a custom
  IRequestMapper, per Martin's suggestion in the Nabble thread.  However, I
  don't know where to start. Should I extend one of the existing mappers
  (e.g. MountedMapper), or should I create an entirely new implementation
 of
  IRequestMapper?  In either case, how do I make sure that I don't screw up
  handling of listener links for ajax actions on the page?  In other words,
  how do I create a reliable IRequestMapper for a page that, when
 requested,
  always re-renders itself?
 
  If there's a different way to accomplish this (i.e. without creating a
  custom IRequestMapper or making the page stateless), I'd love to know.
 
  Thanks for your help!
 
  -Allen



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

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




Hide page version query parameters

2011-12-05 Thread Allen Gilbert
Is there a built-in way to hide page version parameters (e.g. ?12) in
Wicket 1.5?  If not, is it possible to write a custom IRequestMapper that
does so without screwing up proper request handling?

-Allen


Re: ConcurrentModificationException

2011-12-05 Thread Martin Grigorov
Hi,

I don't see how this may happen.
The execution of RequestCycle is single threaded.
Do you have RequestCycleListener or something similar where you start
another thread and you use the same instance of RequestCycle ?

On Tue, Dec 6, 2011 at 2:31 AM, Fang Lin fang...@u.washington.edu wrote:
 When clicking on a link (i.e., ?5-1.ILinkListener-...) after a session 
 expired, this error page shows up on my browser window:
 Exception report
 message
 description The server encountered an internal error () that prevented it 
 from fulfilling this request.
 exception
 java.util.ConcurrentModificationException
                    
 java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
                    java.util.AbstractList$Itr.next(AbstractList.java:343)
                    
 org.apache.wicket.request.RequestHandlerStack.detach(RequestHandlerStack.java:176)
                    
 org.apache.wicket.request.cycle.RequestCycle.onDetach(RequestCycle.java:565)
                    
 org.apache.wicket.request.cycle.RequestCycle.detach(RequestCycle.java:508)
                    
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:284)
                    
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
                    
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
         at 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at 
 org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
        at 
 org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
        at 
 org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
        at 
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
        at java.lang.Thread.run(Thread.java:662)
 This ConcurrentModificationException occurs about 70+ times on an application 
 server daily.
 Wicket version 1.5.3.
 Any suggestion on how to avoid this?
 In the init method of sub-class of the WebApplication , I have:
   IApplicationSettings settings = getApplicationSettings();
    settings.setAccessDeniedPage(AccessErr.class);
    settings.setPageExpiredErrorPage(SessionErr.class);
 settings.setInternalErrorPage(InternalErr.class);
 When a session expired, should it invoke the PageExpiredErrorPage?

Yes. You make a request to a page, Wicket searches for this page in
the stores, doesn't find it and throws PageExpiredException.
But, if the request url has the mount path then Wicket will create a
new Page instance instead. If you have authentication strategy set up
then you go to the Login page, otherwise this page will be rendered.

If you are able to reproduce the problem in a quickstart attach it to
Jira so we can debug it.
Thanks!

 -Fang





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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