You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by smithfox <ss...@gmail.com> on 2007/08/22 07:55:34 UTC

How to set wicket's locale?

I used RequiredTextField, when the field is empty, the feedback show some
meesage in English, How to  change it to Chinese. 
-- 
View this message in context: http://www.nabble.com/How-to-set-wicket%27s-locale--tf4309547.html#a12268483
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Antwort: Re: unknown Exception how to solve (solved)

Posted by fh...@s-und-n.de.
The problem with this exception was the "double" refresh of components.
I tried it this way:

protected void onSubmit(AjaxRequestTarget target) {
        [...]
 
        target.addComponent(field);
        target.addComponent(form);
}

This throws the exception.

Just refresh the whole form and everything works fine.

Freundliche Grüße / With kind regards
Fabian Hagen

S&N AG
Klingenderstr. 5
D 33100 Paderborn

voice     +49 5251/1581- 862
fax       +49 5251/1581-71
eMail     fhagen@s-und-n.de
web       http://www.s-und-n.de

Vorstand
Klaus Beverungen
Josef Tillmann 

Vorsitzender des Aufsichtsrates
Heinz-Dieter Wendorff

Handelsregister
Amtsgericht Paderborn HRB 3270 



"Igor Vaynberg" <ig...@gmail.com> 
22.08.2007 17:27
Bitte antworten an
users@wicket.apache.org


An
users@wicket.apache.org
Kopie

Thema
Re: unknown Exception how to solve






looks like you are adding a component to the target that doesnt have a 
page?
you have to add the component first to the page hierarchy in the proper
place, and then also to the ajax target. ajax target is just a list of
components that need to be repainted.

-igor


On 8/22/07, fhagen@s-und-n.de <fh...@s-und-n.de> wrote:
>
> Hi,
>
> in my app i have a RefreshingView that gets a label an a TextField
> subclass MyAjaxTextField.
>
> <form wicket:id="form">
>         <table cellspacing="0" class="dataview">
>     <tr>
>         <th>Beschreibung</th>
>         <th>2004</th>
>     </tr>
>     <tr wicket:id="simple">
>         <td><span wicket:id="description">[description]</span></td>
>         <td><input type="text" wicket:id="value"></input> </td>
>     </tr>
>         </table>
> </form>
>
>
> 
##################################################################################
> public class MyRefrechingView extends RefreshingView{
> [...]
> protected void populateItem(Item item) {
>                  // populate the row of the repeater
>                 MyForm form = (MyForm)this.getParent();
>         IModel position = item.getModel();
>
>         final Label description = new Label("description", new
> PropertyModel(position, "description"));
>         item.add(description);
>
>         final MyAjaxTextField valueField = new MyAjaxTextField("value",
> new PropertyModel(position,"output"));
>         valueField.add(new MyAjaxFormSubmitBehavior(form,"onchange"));
>         valueField.setOutputMarkupId(true);
>         item.add(valueField);
>         }
>
> }
>
>
>
> 
##############################################################################
>
> public class MyAjaxTextField extends TextField{
>
>         MyOnChangeAjaxBehavior ajaxBehavior = new
> MyOnChangeAjaxBehavior();
>
>         public MyAjaxTextField(String arg0) {
>                 super(arg0);
>
>         }
>         public MyAjaxTextField(String arg0, IModel model) {
>                 super(arg0,model);
>                 //this.add(ajaxBehavior);
>                 PropertyModel pm = (PropertyModel)model;
>                 Position position = (Position)pm.getTarget();
>
>                 if(position.hasFormula()){
>                         this.add(new MyAjaxOnClickEvent("onclick"));
>                         this.add(new MyAjaxOnBlurEvent("onblur"));
>                 }
>         }
> }
>
> The Value of the TextField depends on some data stored at Position. It
> could be a normal double value or a formula.
> If i run the app, everything seems fine and all calculations and ajax
> updateing seems to work but i got this exception:
>
> 58023 [http-8080-Processor25] ERROR org.apache.wicket.RequestCycle - 
there
> was an error cleaning up target [AjaxRequestTarget@1723691750
> markupIdToComponent [{value6=[MarkupContainer [Component id = value, 
page
> = <No Page>, path = 1:value.MyAjaxTextField]], form5=[MarkupContainer
> [Component id = form, page = pages.ConfirmPage, path =
> 1:tabs:panel:form.MyForm, isVisible = true, isVersioned = false]]}],
> prependJavascript [[]], appendJavascript [[]].
> java.lang.IllegalStateException: No Page found for component
> [MarkupContainer [Component id = value, page = <No Page>, path =
> 1:value.MyAjaxTextField]]
>         at org.apache.wicket.Component.getPage(Component.java:1343)
>         at org.apache.wicket.ajax.AjaxRequestTarget.detach(
> AjaxRequestTarget.java:436)
>         at org.apache.wicket.RequestCycle.detach(RequestCycle.java:911)
>         at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1194)
>         at org.apache.wicket.RequestCycle.request(RequestCycle.java:499)
>         at org.apache.wicket.protocol.http.WicketFilter.doGet(
> WicketFilter.java:257)
>         at org.apache.wicket.protocol.http.WicketServlet.doPost(
> WicketServlet.java:144)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:173)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:213)
>         at org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:178)
>         at org.apache.catalina.core.StandardHostValve.invoke(
> StandardHostValve.java:126)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(
> ErrorReportValve.java:105)
>         at org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:107)
>         at org.apache.catalina.connector.CoyoteAdapter.service(
> CoyoteAdapter.java:148)
>         at org.apache.coyote.http11.Http11Processor.process(
> Http11Processor.java:868)
>         at
>
> 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> (
> Http11BaseProtocol.java:663)
>         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> PoolTcpEndpoint.java:527)
>         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> LeaderFollowerWorkerThread.java:80)
>         at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:684)
>         at java.lang.Thread.run(Unknown Source)
>
>
>
> What do i have to change to avoid these exception. I don't have a clue
> where it comes from. Even the debugger doesn't help.
>
> Hope one of you could?
>
> Fabian


Re: unknown Exception how to solve

Posted by Igor Vaynberg <ig...@gmail.com>.
looks like you are adding a component to the target that doesnt have a page?
you have to add the component first to the page hierarchy in the proper
place, and then also to the ajax target. ajax target is just a list of
components that need to be repainted.

-igor


On 8/22/07, fhagen@s-und-n.de <fh...@s-und-n.de> wrote:
>
> Hi,
>
> in my app i have a RefreshingView that gets a label an a TextField
> subclass MyAjaxTextField.
>
> <form wicket:id="form">
>         <table cellspacing="0" class="dataview">
>     <tr>
>         <th>Beschreibung</th>
>         <th>2004</th>
>     </tr>
>     <tr wicket:id="simple">
>         <td><span wicket:id="description">[description]</span></td>
>         <td><input type="text" wicket:id="value"></input> </td>
>     </tr>
>         </table>
> </form>
>
>
> ##################################################################################
> public class MyRefrechingView extends RefreshingView{
> [...]
> protected void populateItem(Item item) {
>                  // populate the row of the repeater
>                 MyForm form = (MyForm)this.getParent();
>         IModel position = item.getModel();
>
>         final Label description = new Label("description", new
> PropertyModel(position, "description"));
>         item.add(description);
>
>         final MyAjaxTextField valueField = new MyAjaxTextField("value",
> new PropertyModel(position,"output"));
>         valueField.add(new MyAjaxFormSubmitBehavior(form,"onchange"));
>         valueField.setOutputMarkupId(true);
>         item.add(valueField);
>         }
>
> }
>
>
>
> ##############################################################################
>
> public class MyAjaxTextField extends TextField{
>
>         MyOnChangeAjaxBehavior ajaxBehavior = new
> MyOnChangeAjaxBehavior();
>
>         public MyAjaxTextField(String arg0) {
>                 super(arg0);
>
>         }
>         public MyAjaxTextField(String arg0, IModel model) {
>                 super(arg0,model);
>                 //this.add(ajaxBehavior);
>                 PropertyModel pm = (PropertyModel)model;
>                 Position position = (Position)pm.getTarget();
>
>                 if(position.hasFormula()){
>                         this.add(new MyAjaxOnClickEvent("onclick"));
>                         this.add(new MyAjaxOnBlurEvent("onblur"));
>                 }
>         }
> }
>
> The Value of the TextField depends on some data stored at Position. It
> could be a normal double value or a formula.
> If i run the app, everything seems fine and all calculations and ajax
> updateing seems to work but i got this exception:
>
> 58023 [http-8080-Processor25] ERROR org.apache.wicket.RequestCycle - there
> was an error cleaning up target [AjaxRequestTarget@1723691750
> markupIdToComponent [{value6=[MarkupContainer [Component id = value, page
> = <No Page>, path = 1:value.MyAjaxTextField]], form5=[MarkupContainer
> [Component id = form, page = pages.ConfirmPage, path =
> 1:tabs:panel:form.MyForm, isVisible = true, isVersioned = false]]}],
> prependJavascript [[]], appendJavascript [[]].
> java.lang.IllegalStateException: No Page found for component
> [MarkupContainer [Component id = value, page = <No Page>, path =
> 1:value.MyAjaxTextField]]
>         at org.apache.wicket.Component.getPage(Component.java:1343)
>         at org.apache.wicket.ajax.AjaxRequestTarget.detach(
> AjaxRequestTarget.java:436)
>         at org.apache.wicket.RequestCycle.detach(RequestCycle.java:911)
>         at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1194)
>         at org.apache.wicket.RequestCycle.request(RequestCycle.java:499)
>         at org.apache.wicket.protocol.http.WicketFilter.doGet(
> WicketFilter.java:257)
>         at org.apache.wicket.protocol.http.WicketServlet.doPost(
> WicketServlet.java:144)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:173)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:213)
>         at org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:178)
>         at org.apache.catalina.core.StandardHostValve.invoke(
> StandardHostValve.java:126)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(
> ErrorReportValve.java:105)
>         at org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:107)
>         at org.apache.catalina.connector.CoyoteAdapter.service(
> CoyoteAdapter.java:148)
>         at org.apache.coyote.http11.Http11Processor.process(
> Http11Processor.java:868)
>         at
>
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> (
> Http11BaseProtocol.java:663)
>         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> PoolTcpEndpoint.java:527)
>         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> LeaderFollowerWorkerThread.java:80)
>         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:684)
>         at java.lang.Thread.run(Unknown Source)
>
>
>
> What do i have to change to avoid these exception. I don't have a clue
> where it comes from. Even the debugger doesn't help.
>
> Hope one of you could?
>
> Fabian

Re: How to set wicket's locale?

Posted by Johan Compagner <jc...@gmail.com>.
with 1.2 you can have your session factory and after you created the session
call setLocale

On 9/3/07, Gabor Szokoli <sz...@gmail.com> wrote:
>
> On 8/22/07, Nino Saturnino Martinez Vazquez Wael
> <ni...@jayway.dk> wrote:
> > There are some different approaches you could use...
> >
> > But why not make a parent page class where you do it in? And then
> > inherit from that? Or just use a custom session which does it by it
> > self(check out the quickstart project to see how to create a session
> class).
>
>
> I saved this message from a few weeks ago, and I finally got around to
> localize my application.
>
> I use wicket 1.2 for now.
>
> I extended the wicket.WebSession class, and set the locale in its
> constructor, just to see if it works.
> It does not: the request overrides my setting, so I get my pages in
> the language I configured the browser to prefer.
> I do not want this, think internet cafes or locked down corporate
> machines.
> I can't override setLocale/1 to disable this feature, because it is
> declared final in wicket.Session.
> So what is the wicket way to make my application ignore the locale in
> the request?
>
>
> Thanks in advance, and thanks for the great framework!
>
> Gabor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How to set wicket's locale?

Posted by Gabor Szokoli <sz...@gmail.com>.
On 9/6/07, Martijn Dashorst <ma...@gmail.com> wrote:
> new PropertyModel(Page.this, "session.foo.sushi.bar");
>
> ?

Wow.

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


Re: How to set wicket's locale?

Posted by Gabor Szokoli <sz...@gmail.com>.
I'm planing to have a little celebration in our office when our webapp
is officially released to customers.
I was thinking about ordering pizza to be delivered to the wicket
developers who have helped us so much here on the list, so they can
share our joy, not just our problems.
How hard can it be to order pizza online in any language, I thought.
But sushi is probably a bit more tricky, and you miss all the
atmosphere if you just have it delivered, so I might have to ask you
guys to go out to have some, and send us the bill :-)


Gabor

On 9/6/07, Johan Compagner <jc...@gmail.com> wrote:
> can you send some over?
>
> On 9/6/07, Evan Chooly <ev...@gmail.com> wrote:
> >
> > T-37 minutes until sushi time!
> >
> > On 9/6/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > >
> > > mmmmmmmm sushi
> > >
> > >
> > > -igor
> > >
> > >
> > > On 9/6/07, Martijn Dashorst <ma...@gmail.com> wrote:
> > > >
> > > > new PropertyModel(Page.this, "session.foo.sushi.bar");
> > > >
> > > > ?
> > > >
> > > >
> > > > On 9/6/07, Gabor Szokoli <sz...@gmail.com> wrote:
> > > > > On 9/5/07, Johan Compagner <jc...@gmail.com> wrote:
> > > > > > can  you make an jira issue for this?
> > > > >
> > > > > https://issues.apache.org/jira/browse/WICKET-936
> > > > >
> > > > > Any ideas on encapsulating the session as a propertymodel for
> > > components
> > > > in 1.2?
> > > > >
> > > > >
> > > > > Gabor
> > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Buy Wicket in Action: http://manning.com/dashorst
> > > > Apache Wicket 1.3.0-beta3 is released
> > > > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> >
>

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


Re: How to set wicket's locale?

Posted by Johan Compagner <jc...@gmail.com>.
can you send some over?

On 9/6/07, Evan Chooly <ev...@gmail.com> wrote:
>
> T-37 minutes until sushi time!
>
> On 9/6/07, Igor Vaynberg <ig...@gmail.com> wrote:
> >
> > mmmmmmmm sushi
> >
> >
> > -igor
> >
> >
> > On 9/6/07, Martijn Dashorst <ma...@gmail.com> wrote:
> > >
> > > new PropertyModel(Page.this, "session.foo.sushi.bar");
> > >
> > > ?
> > >
> > >
> > > On 9/6/07, Gabor Szokoli <sz...@gmail.com> wrote:
> > > > On 9/5/07, Johan Compagner <jc...@gmail.com> wrote:
> > > > > can  you make an jira issue for this?
> > > >
> > > > https://issues.apache.org/jira/browse/WICKET-936
> > > >
> > > > Any ideas on encapsulating the session as a propertymodel for
> > components
> > > in 1.2?
> > > >
> > > >
> > > > Gabor
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Buy Wicket in Action: http://manning.com/dashorst
> > > Apache Wicket 1.3.0-beta3 is released
> > > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>

Re: How to set wicket's locale?

Posted by Igor Vaynberg <ig...@gmail.com>.
you suck!

-igor


On 9/6/07, Evan Chooly <ev...@gmail.com> wrote:
>
> T-37 minutes until sushi time!
>
> On 9/6/07, Igor Vaynberg <ig...@gmail.com> wrote:
> >
> > mmmmmmmm sushi
> >
> >
> > -igor
> >
> >
> > On 9/6/07, Martijn Dashorst <ma...@gmail.com> wrote:
> > >
> > > new PropertyModel(Page.this, "session.foo.sushi.bar");
> > >
> > > ?
> > >
> > >
> > > On 9/6/07, Gabor Szokoli <sz...@gmail.com> wrote:
> > > > On 9/5/07, Johan Compagner <jc...@gmail.com> wrote:
> > > > > can  you make an jira issue for this?
> > > >
> > > > https://issues.apache.org/jira/browse/WICKET-936
> > > >
> > > > Any ideas on encapsulating the session as a propertymodel for
> > components
> > > in 1.2?
> > > >
> > > >
> > > > Gabor
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Buy Wicket in Action: http://manning.com/dashorst
> > > Apache Wicket 1.3.0-beta3 is released
> > > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>

Re: How to set wicket's locale?

Posted by Evan Chooly <ev...@gmail.com>.
T-37 minutes until sushi time!

On 9/6/07, Igor Vaynberg <ig...@gmail.com> wrote:
>
> mmmmmmmm sushi
>
>
> -igor
>
>
> On 9/6/07, Martijn Dashorst <ma...@gmail.com> wrote:
> >
> > new PropertyModel(Page.this, "session.foo.sushi.bar");
> >
> > ?
> >
> >
> > On 9/6/07, Gabor Szokoli <sz...@gmail.com> wrote:
> > > On 9/5/07, Johan Compagner <jc...@gmail.com> wrote:
> > > > can  you make an jira issue for this?
> > >
> > > https://issues.apache.org/jira/browse/WICKET-936
> > >
> > > Any ideas on encapsulating the session as a propertymodel for
> components
> > in 1.2?
> > >
> > >
> > > Gabor
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Buy Wicket in Action: http://manning.com/dashorst
> > Apache Wicket 1.3.0-beta3 is released
> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

Re: How to set wicket's locale?

Posted by Igor Vaynberg <ig...@gmail.com>.
mmmmmmmm sushi


-igor


On 9/6/07, Martijn Dashorst <ma...@gmail.com> wrote:
>
> new PropertyModel(Page.this, "session.foo.sushi.bar");
>
> ?
>
>
> On 9/6/07, Gabor Szokoli <sz...@gmail.com> wrote:
> > On 9/5/07, Johan Compagner <jc...@gmail.com> wrote:
> > > can  you make an jira issue for this?
> >
> > https://issues.apache.org/jira/browse/WICKET-936
> >
> > Any ideas on encapsulating the session as a propertymodel for components
> in 1.2?
> >
> >
> > Gabor
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-beta3 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How to set wicket's locale?

Posted by Martijn Dashorst <ma...@gmail.com>.
new PropertyModel(Page.this, "session.foo.sushi.bar");

?


On 9/6/07, Gabor Szokoli <sz...@gmail.com> wrote:
> On 9/5/07, Johan Compagner <jc...@gmail.com> wrote:
> > can  you make an jira issue for this?
>
> https://issues.apache.org/jira/browse/WICKET-936
>
> Any ideas on encapsulating the session as a propertymodel for components in 1.2?
>
>
> Gabor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

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


Re: How to set wicket's locale?

Posted by Gabor Szokoli <sz...@gmail.com>.
On 9/5/07, Johan Compagner <jc...@gmail.com> wrote:
> can  you make an jira issue for this?

https://issues.apache.org/jira/browse/WICKET-936

Any ideas on encapsulating the session as a propertymodel for components in 1.2?


Gabor

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


Re: How to set wicket's locale?

Posted by Johan Compagner <jc...@gmail.com>.
can  you make an jira issue for this?

On 9/4/07, Gabor Szokoli <sz...@gmail.com> wrote:
>
> Uh, oh, one more quick thing:
>
> I'm still on wicket 1.2, and my wicket:message labels retain their
> text in the locale they were first rendered in.
>
> Is there anything I can do on locale changes to make them change their
> text?
>
> Is this behavior the same under 1.3?
>
>
> Gabor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How to set wicket's locale?

Posted by Gabor Szokoli <sz...@gmail.com>.
Uh, oh, one more quick thing:

I'm still on wicket 1.2, and my wicket:message labels retain their
text in the locale they were first rendered in.

Is there anything I can do on locale changes to make them change their text?

Is this behavior the same under 1.3?


Gabor

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


Re: How to set wicket's locale?

Posted by Gabor Szokoli <sz...@gmail.com>.
On 9/3/07, Eelco Hillenius <ee...@gmail.com> wrote:

> Just go with overriding getLocale on your custom session object. If
> you need to support just one locale, that's easy: just always let it
> return that locale. Otherwise, you'll have to do some more work (e.g.
> using request.getLocale()), but it shouldn't be very difficult.

Hardcoding a locale was just an experiment, but I might end up using it :-)

I'd like your input on where my SessionModel approach goes wrong?


Gabor

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


Re: How to set wicket's locale?

Posted by Eelco Hillenius <ee...@gmail.com>.
> Thanks for the  support and ideas.
> But for the record:
> Overriding getLocale() would surely work, but sounds like even worse
> of a hack than setLocale(_)

No, if you override it, it will *always* return the value you provide.
The locale member obviously wouldn't be use unless you yourself use
it.

, and when I set the locale in the
> ISessionFactory it gets reset by the locale in the request just like
> when I set it in the session constructor. (which is to be expected,
> really.)

Yeah, sorry about that. Forgot that that was a mess to start with
(which is why we refactored it).

Just go with overriding getLocale on your custom session object. If
you need to support just one locale, that's easy: just always let it
return that locale. Otherwise, you'll have to do some more work (e.g.
using request.getLocale()), but it shouldn't be very difficult.

Eelco

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


Re: How to set wicket's locale?

Posted by Gabor Szokoli <sz...@gmail.com>.
On 9/3/07, Eelco Hillenius <ee...@gmail.com> wrote:
> > I use wicket 1.2 for now.
>
> Yeah, unfortunately it doesn't work for 1.2. It's one of the
> improvements for 1.3.

We'll upgrade for the next release once this one is out...

> But either override getLocale in your session, or set it using a
> custom session factory.

Thanks for the  support and ideas.
But for the record:
Overriding getLocale() would surely work, but sounds like even worse
of a hack than setLocale(_), and when I set the locale in the
ISessionFactory it gets reset by the locale in the request just like
when I set it in the session constructor. (which is to be expected,
really.)

Here's my current plan to manage the locale (and to display the logged
in user while I'm at it), please tell me what's wrong with it, I get
an exception about the model being a null object:

public class DetachableSessionModel extends LoadableDetachableModel {

	@Override
	protected Object load() {
		return Session.get();
	}
}

public class LocalePanel extends MCCNPanel {

	public LocalePanel(String id) {
		super(id);

		Form form = new Form("form");
		add(form);

		form.setModel(new DetachableSessionModel());
		
		List<Locale> locales = new Vector<Locale>();
		locales.add(new Locale("hu"));
		locales.add(new Locale("sr"));
		locales.add(CentrexSession.get().getLocale());

		form.add(new DropDownChoice("locale", locales, new
ChoiceRenderer("language", "language") ));

		form.add(new Button("submit"));

	}
}

When I submit:

java.lang.IllegalStateException: Attempt to set model object on null
model of component: topLeftPanel:form:locale
at wicket.Component.setModelObject(Component.java:2013)
at wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:840)
at wicket.markup.html.form.Form$11.formComponent(Form.java:923)
at wicket.markup.html.form.Form$4.component(Form.java:465)
at wicket.MarkupContainer.visitChildren(MarkupContainer.java:744)
at wicket.markup.html.form.Form.visitFormComponents(Form.java:461)
at wicket.markup.html.form.Form.updateFormComponentModels(Form.java:914)
at wicket.markup.html.form.Form.process(Form.java:896)
at wicket.markup.html.form.Form.onFormSubmitted(Form.java:310)
at java.lang.reflect.Method.invoke(Method.java:597)
at wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:187)
at wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:74)
at wicket.request.compound.DefaultEventProcessorStrategy.processEvents(DefaultEventProcessorStrategy.java:65)
at wicket.request.compound.AbstractCompoundRequestCycleProcessor.processEvents(AbstractCompoundRequestCycleProcessor.java:57)
at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:896)
at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:929)
at wicket.RequestCycle.step(RequestCycle.java:1010)
at wicket.RequestCycle.steps(RequestCycle.java:1084)
at wicket.RequestCycle.request(RequestCycle.java:454)
at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219)
at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:262)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:268)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

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


Re: How to set wicket's locale?

Posted by Eelco Hillenius <ee...@gmail.com>.
> I use wicket 1.2 for now.

Yeah, unfortunately it doesn't work for 1.2. It's one of the
improvements for 1.3.

But either override getLocale in your session, or set it using a
custom session factory.

Eelco

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


RE: How to set wicket's locale?

Posted by David Leangen <wi...@leangen.net>.
Why don't you just:

@Override
public Locale getLocale()
{
    return Locale.ENGLISH;
}


?




> -----Original Message-----
> From: Gabor Szokoli [mailto:szocske@gmail.com]
> Sent: 3 September 2007 21:04
> To: users@wicket.apache.org
> Subject: Re: How to set wicket's locale?
> 
> 
> On 8/22/07, Nino Saturnino Martinez Vazquez Wael
> <ni...@jayway.dk> wrote:
> > There are some different approaches you could use...
> >
> > But why not make a parent page class where you do it in? And then
> > inherit from that? Or just use a custom session which does it by it
> > self(check out the quickstart project to see how to create a 
> session class).
> 
> 
> I saved this message from a few weeks ago, and I finally got around to
> localize my application.
> 
> I use wicket 1.2 for now.
> 
> I extended the wicket.WebSession class, and set the locale in its
> constructor, just to see if it works.
> It does not: the request overrides my setting, so I get my pages in
> the language I configured the browser to prefer.
> I do not want this, think internet cafes or locked down corporate 
> machines.
> I can't override setLocale/1 to disable this feature, because it is
> declared final in wicket.Session.
> So what is the wicket way to make my application ignore the locale in
> the request?
> 
> 
> Thanks in advance, and thanks for the great framework!
> 
> Gabor
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 

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


Re: How to set wicket's locale?

Posted by Gabor Szokoli <sz...@gmail.com>.
On 8/22/07, Nino Saturnino Martinez Vazquez Wael
<ni...@jayway.dk> wrote:
> There are some different approaches you could use...
>
> But why not make a parent page class where you do it in? And then
> inherit from that? Or just use a custom session which does it by it
> self(check out the quickstart project to see how to create a session class).


I saved this message from a few weeks ago, and I finally got around to
localize my application.

I use wicket 1.2 for now.

I extended the wicket.WebSession class, and set the locale in its
constructor, just to see if it works.
It does not: the request overrides my setting, so I get my pages in
the language I configured the browser to prefer.
I do not want this, think internet cafes or locked down corporate machines.
I can't override setLocale/1 to disable this feature, because it is
declared final in wicket.Session.
So what is the wicket way to make my application ignore the locale in
the request?


Thanks in advance, and thanks for the great framework!

Gabor

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


unknown Exception how to solve

Posted by fh...@s-und-n.de.
Hi, 

in my app i have a RefreshingView that gets a label an a TextField 
subclass MyAjaxTextField.

<form wicket:id="form">
        <table cellspacing="0" class="dataview">
    <tr>
        <th>Beschreibung</th>
        <th>2004</th>
    </tr>
    <tr wicket:id="simple">
        <td><span wicket:id="description">[description]</span></td>
        <td><input type="text" wicket:id="value"></input> </td>
    </tr>
        </table>
</form>

##################################################################################
public class MyRefrechingView extends RefreshingView{
[...]
protected void populateItem(Item item) {
                 // populate the row of the repeater
                MyForm form = (MyForm)this.getParent();
        IModel position = item.getModel();
 
        final Label description = new Label("description", new 
PropertyModel(position, "description"));
        item.add(description);
 
        final MyAjaxTextField valueField = new MyAjaxTextField("value", 
new PropertyModel(position,"output"));
        valueField.add(new MyAjaxFormSubmitBehavior(form,"onchange"));
        valueField.setOutputMarkupId(true);
        item.add(valueField);
        }

}
 

##############################################################################

public class MyAjaxTextField extends TextField{

        MyOnChangeAjaxBehavior ajaxBehavior = new 
MyOnChangeAjaxBehavior();
 
        public MyAjaxTextField(String arg0) {
                super(arg0);
 
        }
        public MyAjaxTextField(String arg0, IModel model) {
                super(arg0,model);
                //this.add(ajaxBehavior);
                PropertyModel pm = (PropertyModel)model;
                Position position = (Position)pm.getTarget();

                if(position.hasFormula()){
                        this.add(new MyAjaxOnClickEvent("onclick"));
                        this.add(new MyAjaxOnBlurEvent("onblur"));
                }
        }
}

The Value of the TextField depends on some data stored at Position. It 
could be a normal double value or a formula.
If i run the app, everything seems fine and all calculations and ajax 
updateing seems to work but i got this exception:

58023 [http-8080-Processor25] ERROR org.apache.wicket.RequestCycle - there 
was an error cleaning up target [AjaxRequestTarget@1723691750 
markupIdToComponent [{value6=[MarkupContainer [Component id = value, page 
= <No Page>, path = 1:value.MyAjaxTextField]], form5=[MarkupContainer 
[Component id = form, page = pages.ConfirmPage, path = 
1:tabs:panel:form.MyForm, isVisible = true, isVersioned = false]]}], 
prependJavascript [[]], appendJavascript [[]].
java.lang.IllegalStateException: No Page found for component 
[MarkupContainer [Component id = value, page = <No Page>, path = 
1:value.MyAjaxTextField]]
        at org.apache.wicket.Component.getPage(Component.java:1343)
        at org.apache.wicket.ajax.AjaxRequestTarget.detach(
AjaxRequestTarget.java:436)
        at org.apache.wicket.RequestCycle.detach(RequestCycle.java:911)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1194)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:499)
        at org.apache.wicket.protocol.http.WicketFilter.doGet(
WicketFilter.java:257)
        at org.apache.wicket.protocol.http.WicketServlet.doPost(
WicketServlet.java:144)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:178)
        at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java:868)
        at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(
Http11BaseProtocol.java:663)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:684)
        at java.lang.Thread.run(Unknown Source)



What do i have to change to avoid these exception. I don't have a clue 
where it comes from. Even the debugger doesn't help.

Hope one of you could?

Fabian

Re: How to set wicket's locale?

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
There are some different approaches you could use...

But why not make a parent page class where you do it in? And then 
inherit from that? Or just use a custom session which does it by it 
self(check out the quickstart project to see how to create a session class).

regards Nino

smithfox wrote:
> I have solved the problem with your help.:jumping:
> Thanks
>
> But I must set locale in every Page java class.
> Is there a uniform configuration to set it?
>
>
>
> Eelco Hillenius wrote:
>   
>> On 8/21/07, Johan Compagner <jc...@gmail.com> wrote:
>>     
>>> then you browser tells wicket that it should use English .
>>> But you can set it yourself: Session.setLocale()
>>>       
>> Or if for instance you want to fix the locale to always use a certain
>> one, use a custom session and set the locale it's constructor.
>>
>> Eelco
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>>     
>
>   

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


Re: How to set wicket's locale?

Posted by smithfox <ss...@gmail.com>.
I have solved the problem with your help.:jumping:
Thanks

But I must set locale in every Page java class.
Is there a uniform configuration to set it?



Eelco Hillenius wrote:
> 
> On 8/21/07, Johan Compagner <jc...@gmail.com> wrote:
>> then you browser tells wicket that it should use English .
>> But you can set it yourself: Session.setLocale()
> 
> Or if for instance you want to fix the locale to always use a certain
> one, use a custom session and set the locale it's constructor.
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-set-wicket%27s-locale--tf4309547.html#a12269046
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: How to set wicket's locale?

Posted by Eelco Hillenius <ee...@gmail.com>.
On 8/21/07, Johan Compagner <jc...@gmail.com> wrote:
> then you browser tells wicket that it should use English .
> But you can set it yourself: Session.setLocale()

Or if for instance you want to fix the locale to always use a certain
one, use a custom session and set the locale it's constructor.

Eelco

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


Re: How to set wicket's locale?

Posted by Johan Compagner <jc...@gmail.com>.
then you browser tells wicket that it should use English .
But you can set it yourself: Session.setLocale()

johan


On 8/22/07, smithfox <ss...@gmail.com> wrote:
>
>
> I used RequiredTextField, when the field is empty, the feedback show some
> meesage in English, How to  change it to Chinese.
> --
> View this message in context:
> http://www.nabble.com/How-to-set-wicket%27s-locale--tf4309547.html#a12268483
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>