Doing an action on press of key in a form

2012-01-18 Thread Krishna Mohan
I have a form, few panels in it.

In one of the panel i have few fields and in other panel a search button.

I have requirement wherein after entering text in the field on press of Enter 
button search should be performed with out click of search button.

To achieve this i tried following snippet

 add(new AjaxEventBehavior(onkeypress)
  {
@Override protected CharSequence getCallbackScript(boolean 
onlyTargetActivePage)
{
  return generateCallbackScript(wicketAjaxGet(' + 
getCallbackUrl(onlyTargetActivePage) +  + KEYPRESS_PARAM + 
='+wicketKeyCode(event));
}


@Override protected void onEvent(AjaxRequestTarget target)
{
  String paramValue = 
RequestCycle.get().getRequest().getParameter(KEYPRESS_PARAM);
  int key = Integer.parseInt(paramValue);
if (key == 13)
{
   submitSearchForm();
 }
}

});
but using above the text in the field is cleared and get wrong search. but when 
i remove focus from the field and press Enter i get desired result.

My question here is how to perform search, remaining in the field(with focus in 
the field)

or their any other approach to get my requirement 

i also tried
 Form form = findParent(Form.class);
if (form != null)
{
  form.setDefaultButton(searchButton);
}

but form is always null for me

Regards
Krishna



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



Re: CompoundPropertyModel and FormComponent

2012-01-18 Thread Andrea Del Bene
At this point I would override/debug method updateModel() inside 
AddressPanel to see if model's object is modified by this method .

Just my 2 cents...

Yes, I think you are doing it the Wicket way, but your snippet and
mine should work. Do you modify components' model somewhere else?

No, I don't think so. The page to which the component is added is constructed 
as follows:

CompoundPropertyModelHomePage  model = new 
CompoundPropertyModelHomePage(this);
FormHomePage  form = new FormHomePage(form, model);
form.add(new TextFieldString(person.firstname));
form.add(new AdresPanel(person.adres));

No other code modifies the model.


Which model do you get if you call getDefaultModel() inside oninitialize?

The result of getDefaultModel() is an instance of 
CompoundPropertyModel$AttachedCompoundPropertyModel, with owner set to the 
AdresPanel and with target set to a CompoundPropertyModel which in turn has 
target HomePage.

I noticed that upon initializing the model is set correctly. However when 
inspecting the model in onBeforeRender() during the submit request the target 
of the model of the AddressPanel.street model is set to HomePage.


Thanks for your reply. I've tried it but it still gave the same error.

However I also tried the following modified version of your idea:

In AddressPanel.java:

@Override
protected void onInitialize() {
super.onInitialize();
 Object o = getDefaultModelObject();

 setDefaultModel(new CompoundPropertyModel(getDefaultModelObject()));
}

With the above code I can now load the page, also the

getDefaultModelObject() returns the correct Address instance. Unfortunately
upon submitting the form I get the same exception again (No get method
defined for class: class foo.HomePage expression: street).

By the way: am I doing things the Wicket way? Is this how you would reuse

parts of a form in Wicket?



Best regards,

Bob



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



Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.



-
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: Update component after background thread is finished

2012-01-18 Thread humcasma

Martin Grigorov-4 wrote
 
 Pastebin you code.
 

While cleaning up the code to post it here I found a timer.stop() where it
should not be. After removing it, everything works as it should do. That is,
I create a new timer whenever the form is submitted, and add it to my
textarea component. The timer starts working, as well as the background
thread. When the latter is finished, I stop the timer and remove it from the
textarea from within the timer's onTimer() method. 
I have noted that I need to stop the timer before I remove it. Otherwise I
get the exception below. It is really not a problem to stop the timer, but
since I am removing it anyway, I wonder if it should strictly be necessary
to do it. 

Cheers,
Humberto


ERROR - DefaultExceptionMapper - Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Method onRequest of interface
org.apache.wicket.behavior.IBehaviorListener targeted at
com.telenor.claudia.web.gui.Index$StatusTimer@95ef17 on component [TextArea
[Component id = feedbackPanel]] threw an exception
at
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:270)
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:255)
at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
... 25 more
Caused by: java.lang.IllegalStateException: Behavior must be added to
component before its id can be generated. Behavior:
com.telenor.claudia.web.gui.Index$StatusTimer@95ef17, Component:
org.apache.wicket.Behaviors@d91987
at org.apache.wicket.Behaviors.getBehaviorId(Behaviors.java:252)
at org.apache.wicket.Component.getBehaviorId(Component.java:4436)
at org.apache.wicket.Component.urlFor(Component.java:3292)
at
org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractAjaxBehavior.java:89)
at
org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(AbstractAjaxTimerBehavior.java:125)
at
org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(AbstractAjaxTimerBehavior.java:118)
at
org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTimerBehavior.java:155)
at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:316)
... 29 more


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Update-component-after-background-thread-is-finished-tp4300126p4306383.html
Sent from the Users forum mailing 

Re: Wicket spring security sample app

2012-01-18 Thread James Carman
Either way, you can open it in your IDE and run the jetty test server
that's included.  That's how I run it usually so that I can easily
debug and play around.

On Wed, Jan 18, 2012 at 6:57 AM, James Carman
ja...@carmanconsulting.com wrote:
 I don't know if the plugin is turned on for the example application.
 But, you'd need to make sure you are in the example module before you
 try.

 On Wed, Jan 18, 2012 at 1:15 AM, Brian Lavender br...@brie.com wrote:
 On Sun, Jan 15, 2012 at 12:36:48PM +0200, Martin Grigorov wrote:
 See https://github.com/jwcarman/Wicketopia

 Maybe I missed something, but I wasn't able to do a

 mvn jetty:run

 or did the war package run after generating a war file.

 brian
 --
 Brian Lavender
 http://www.brie.com/brian/

 There are two ways of constructing a software design. One way is to
 make it so simple that there are obviously no deficiencies. And the other
 way is to make it so complicated that there are no obvious deficiencies.

 Professor C. A. R. Hoare
 The 1980 Turing award lecture

 -
 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: Auto Create of resource references fails

2012-01-18 Thread Martin Grigorov
Do you have any modifications in AbstractDefaultAjaxBehavior.java locally ?
The resource reference for indicator.gif should be auto registered and
always available ...

On Wed, Jan 18, 2012 at 12:59 AM, Chris Colman chr...@stepaheadsoftware.com
 wrote:

 ** **

 Using 1.5-SNAPSHOT and I just noticed these messages in the log ever since
 switching to 1.5. I checked the log history and these types of errors never
 appeared in the 1.4 based app:

 ** **

 2012/01/18 10:54:51.840 WARN  - ResourceReferenceRegistry  - Asked to
 auto-create a ResourceReference, but
 ResourceReferenceRegistry.createDefaultResourceReference() return null.  [
 scope: org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; name:
 indicator-ver-1326193494000.gif; locale: null; style: null; variation: null]
 

 ** **

 When this is requested:

 ** **


 /wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/indicator-ver-1326193494000.gif
 

 ** **

 It is completely repeatable.

 ** **

 Yours sincerely,

 ** **

 Chris Colman

  

 Pagebloom Team Leader,

 Step Ahead Software

 

 pagebloom - your business  your website growing together

 ** **

 **Sydney**: (+61 2) 9656 1278 Canberra: (+61 2) 6100 2120
 

 Email: chr...@stepahead.com.au //chr...@stepahead.com.au

 Website:

 http://www.pagebloom.com

 http://develop.stepaheadsoftware.com

  

 ** **




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


Re: Update component after background thread is finished

2012-01-18 Thread humcasma

Martin Grigorov-4 wrote
 
 On Wed, Jan 18, 2012 at 12:39 PM, humcasma lt;humcasma@gt; wrote:

 Martin Grigorov-4 wrote

 Pastebin you code.


 While cleaning up the code to post it here I found a timer.stop() where
 it
 should not be. After removing it, everything works as it should do. That
 is,
 I create a new timer whenever the form is submitted, and add it to my
 textarea component. The timer starts working, as well as the background
 thread. When the latter is finished, I stop the timer and remove it from
 the
 textarea from within the timer's onTimer() method.
 I have noted that I need to stop the timer before I remove it. Otherwise
 I
 get the exception below. It is really not a problem to stop the timer,
 but
 since I am removing it anyway, I wonder if it should strictly be
 necessary
 to do it.

 Cheers,
 Humberto


 ERROR - DefaultExceptionMapper     - Unexpected error occurred
 org.apache.wicket.WicketRuntimeException: Method onRequest of interface
 org.apache.wicket.behavior.IBehaviorListener targeted at
 com.telenor.claudia.web.gui.Index$StatusTimer@95ef17 on component
 [TextArea
 [Component id = feedbackPanel]] threw an exception
        at
 org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:270)
        at
 org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
        at
 org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:255)
        at
 org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
        at
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
        at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
        at
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
        at
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
        at
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
        at
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
        at
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
        at
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
        at
 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
        at
 org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at
 org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
        at
 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
        at
 org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
        at
 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at
 org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
        at
 org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
        at
 org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
        at
 org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
        at
 org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
        at
 org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
 Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
 org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
        ... 25 more
 Caused by: java.lang.IllegalStateException: Behavior must be added to
 component before its id can be generated. Behavior:
 com.telenor.claudia.web.gui.Index$StatusTimer@95ef17, Component:
 org.apache.wicket.Behaviors@d91987
        at org.apache.wicket.Behaviors.getBehaviorId(Behaviors.java:252)
        at org.apache.wicket.Component.getBehaviorId(Component.java:4436)
        at org.apache.wicket.Component.urlFor(Component.java:3292)
        at
 org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractAjaxBehavior.java:89)
        at
 org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(AbstractAjaxTimerBehavior.java:125)
        at
 
 If you stop the timer behavior in onTimer() then #getJsTimeoutCall()
 wont be called at all.
 Check your code again and attach the debugger to see what happens.
 
 org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(AbstractAjaxTimerBehavior.java:118)
 

I consistently get the same problem. After the onTimer() method finishes,
the focus of control goes to the 

Re: wicket appl architecture

2012-01-18 Thread Russell Pitre
Separate front-end sounds fine. Use a REST architecture with JSON as the
data exchange format. I'm pretty Spring MVC supports this through the use
Jackson JSON library. Its something to add to your list of possible options.




On Wed, Jan 18, 2012 at 2:38 AM, nazeem md.naz...@gmail.com wrote:

 Hi

 I am currently developing an application using Wicket + Spring + Hibernate.
 So far everything is smooth and I use a lot of Ajax which works perfectly
 fine. Now I need to provide options for data entry via mobile devices like
 Andriod (Samsing Tab) + iOS (iPad).  My initial plan was to develop web
 based UI specific to suit these devices so that it reduces the complexity
 of
 developing for multiple platform. But now, I need offline usage as the
 signal strength can vary from place to place, so web based option is ruled
 out. (not sure if options like gears for offline usage will work in mobile
 devices).

 Also I need to use device specific native features like camera to upload
 photos from the device. So I am planning to develop separate front end for
 iOS  Andrioid. Is this the right approach ?

 What will be the communication layer between Server  Mobile applications ?
 REST ? If not what else. Please suggest.

 Also advice on the libraries that will help me get there..

 regards,
 nazeem



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/wicket-appl-architecture-tp4305917p4305917.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: Trying get Spring security working

2012-01-18 Thread Russell Pitre
Look here for more info on Spring and logging.

From section 1.3.2.x of
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/overview.html

   dependency
  groupIdorg.slf4j/groupId
  artifactIdjcl-over-slf4j/artifactId
  version1.5.8/version
   /dependency
   dependency
  groupIdorg.slf4j/groupId
  artifactIdslf4j-api/artifactId
  version1.5.8/version
   /dependency
   dependency
  groupIdorg.slf4j/groupId
  artifactIdslf4j-log4j12/artifactId
  version1.5.8/version
   /dependency
   dependency
  groupIdlog4j/groupId
  artifactIdlog4j/artifactId
  version1.2.14/version
   /dependency




On Wed, Jan 18, 2012 at 1:08 AM, Brian Lavender br...@brie.com wrote:

 Can someone tell me what I am missing with my Spring Security integration?
 I attached
 the source. In case the attachment doesn't go through, here it is.
 http://brie.com/brian/wicket/authbar.zip

 https://cwiki.apache.org/WICKET/spring-security-and-wicket-auth-roles.html

 I get the following error.
 Caused by: java.lang.ClassNotFoundException:
 org.apache.commons.logging.LogFactory

 I took the sample from the examples on Wicket-auth-roles and I tried adding
 in the spring security and I get a whole stack trace complaining about
 unable to
 get a log factory.

 brian
 --
 Brian Lavender
 http://www.brie.com/brian/

 There are two ways of constructing a software design. One way is to
 make it so simple that there are obviously no deficiencies. And the other
 way is to make it so complicated that there are no obvious deficiencies.

 Professor C. A. R. Hoare
 The 1980 Turing award lecture


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



Re: wicket appl architecture

2012-01-18 Thread Arjun Dhar
JSON Library + CXF wtf!


... This is a pretty good combination thant I've been playing with for over
some time.

-
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-appl-architecture-tp4305917p4306850.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: Doing an action on press of key in a form

2012-01-18 Thread Igor Vaynberg
use FormComponentUpdatingBehavior instead

-igor

On Wed, Jan 18, 2012 at 2:12 AM, Krishna Mohan
k.krishnamoha...@gmail.com wrote:
 I have a form, few panels in it.

 In one of the panel i have few fields and in other panel a search button.

 I have requirement wherein after entering text in the field on press of 
 Enter
 button search should be performed with out click of search button.

 To achieve this i tried following snippet

  add(new AjaxEventBehavior(onkeypress)
      {
        @Override protected CharSequence getCallbackScript(boolean
 onlyTargetActivePage)
        {
          return generateCallbackScript(wicketAjaxGet(' +
 getCallbackUrl(onlyTargetActivePage) +  + KEYPRESS_PARAM +
 ='+wicketKeyCode(event));
        }


        @Override protected void onEvent(AjaxRequestTarget target)
        {
          String paramValue =
 RequestCycle.get().getRequest().getParameter(KEYPRESS_PARAM);
  int key = Integer.parseInt(paramValue);
            if (key == 13)
            {
               submitSearchForm();
             }
        }

    });
 but using above the text in the field is cleared and get wrong search. but 
 when
 i remove focus from the field and press Enter i get desired result.

 My question here is how to perform search, remaining in the field(with focus 
 in
 the field)

 or their any other approach to get my requirement

 i also tried
  Form form = findParent(Form.class);
    if (form != null)
    {
      form.setDefaultButton(searchButton);
    }

 but form is always null for me

 Regards
 Krishna



 -
 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: Intermittent issue of data overwriting between browser tabs in a multi window session with forms

2012-01-18 Thread T A
Hi,

I posted this issue a week ago and have not gotten any response yet.


Is there no one in the community that has every had any issues with multiple 
windows and form data getting mixed up between them in the 1.3 stream?

Any words of wisdom wicket developers out there would be very helpfulor at 
the very least a candid we don't know what to tell you would be appreciated.

Ted




 From: T A teda...@yahoo.com
To: users@wicket.apache.org users@wicket.apache.org 
Sent: Wednesday, January 11, 2012 4:13 PM
Subject: Intermittent issue of data overwriting between browser tabs in a multi 
window session with forms
 

Hi,

I am relatively new to Wicket and working on maintenance of a 1.3.7 Wicket 
application.

The application is a CMS and there is a very intermittent issue, but serious 
issue, that I am trying to reproduce and diagnose. It appears that updates to 
content in one application window is overwriting content in another 
applilcation window.


I would be very thankful for any words of wisdom from the community as far as 
any leads on what to investigate.


My best guess of the use case from talking to users is as follows

1-Login to the application.

2-Click on a link on the application homepage that take you to versioned 
content. The URL of this content is set via HybridUrlCodingStrategy, like this


mount(new HybridUrlCodingStrategy(/content/Edit, ContentEdit.class, true));


3-Start to edit the content by unlocking it and when done, save content, and 
(most likely) release the lock.


4-From clicking a link in an email , open another URL of the application, that 
is also set via HybridUrlCodingStrategy, but without the last parameter for 
redirectOnBookmarkableRequest

mount(new HybridUrlCodingStrategy(/memo, MarkMemoRead.class));

5-In this second browser window, the application takes the the URL that was 
pasted in and redirects to another URL to edit a different piece of versioned 
content. This other URL is the same as mounted in step 2 above, so it is also a 
HybridUrlCodingStrategy. The way it redirects is like

    setResponsePage(getPageClass(), getParams());
    setRedirect(true);


6-Unlock the content in the second browser window, makes changes and save, 
and (most likely) unlock it.


7-Return to the first content, either by refreshing the first window, or even 
by logging out and going back to it. The first content has been overwritten by 
the content from the second browser window.

Both content windows have forms and do use Ajax to make updates on save.


I have not yet been able to reproduce the error myself.

My thinking from looking at the code and the past issues in the user forum is 
that there is some issue with the second browser window not getting it's own 
PageMap, but instead getting the first page's, or something to that effect. I 
can't understand why it happens very intermittently.

I have seen there are/were known issues with multiple window, page maps, and 
sessions in the 1.3 stream, so I am inclined to think this issue is in that 
realm.


I also see that the application code is not explicitly setting the method  
setAutomaticMultiWindowSupport anywhere, but I think it must be defaulting to 
true, otherwise the issue would happen more than rarely considering how much 
use the application gets without incident.

Really appreciate any advice from those with more experience with wicket.

Ted

Re: autocomplete js error in IE

2012-01-18 Thread maro
I found workaround.
There is domready problem in IE.
I used jquery ready()



/body

and added:

field.setOutputMarkupId(true);
field.setMarkupId(searchInput);
field.setOutputMarkupPlaceholderTag(true);



Andrea Del Bene-2 wrote
 
 ooops, I was wrong. I got the same problem.
 I also see this error on the specified page with Internet Explorer 8 
 (WinXP SP3)
 It does not matter if I enable or disable the compatibility feature.

 Matt

 On 2011-10-20 13:54, Martin Grigorov wrote:
 Works OK for me.
 No JS errors. Tested with IE9 in different browser modes and document
 modes. Including Quirks.
 Is it possible that it is some IE setting ?

 On Thu, Oct 20, 2011 at 2:49 PM, Ann Baertlt;ann.baert@gt;  wrote:
 A wicket autocomplete gives errors in Internet Explorer. The error 
 is on
 line 42 of wicket-autocomplete.js.
 On that line stands the following code: objonkeyup=obj.onkeyup;
 I'm using Wicket 1.5.1. And you can reproduce the problem on the wicket
 examples: 
 http://www.wicket-library.com/wicket-examples/ajax/autocomplete

 I created a jira issue for this:
 https://issues.apache.org/jira/browse/WICKET-4150


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


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/autocomplete-js-error-in-IE-tp3921638p4306459.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: Modal Window does not open second time

2012-01-18 Thread mjop
I have the same problem. Really nobody doesn't know the solution?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Modal-Window-does-not-open-second-time-tp3824184p4306315.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: Modal Window does not open second time

2012-01-18 Thread Igor Vaynberg
try with latest snapshot

-igor

On Wed, Jan 18, 2012 at 3:05 AM, mjop mat.j...@gmail.com wrote:
 I have the same problem. Really nobody doesn't know the solution?

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Modal-Window-does-not-open-second-time-tp3824184p4306315.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: context-relative CSS-Url wrong in styled/variant HTML page

2012-01-18 Thread datazuul
finally I solved it:
it was AGAIN this old (tomcat) bug:
https://issues.apache.org/jira/browse/WICKET-1205

I had an index.jsp in my root context. After removing it all links were
rendered correctly!!! 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/context-relative-CSS-Url-wrong-in-styled-variant-HTML-page-tp4304686p4307733.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: Controlling URL of static cacheable resources

2012-01-18 Thread Peter Ertl
I you are really pedantic you put a a caching front-end proxy before your 
actual application server.

By default wicket package resources (css/js/images) are delivered with a cache 
expiry of one year. By using fingerprinted filenames (through 
IResourceCachingStrategy) this will work flawlessly when resources are 
outdated. This is the default behavior and will also work in a cluster.

Your front end proxy should be setup to cache these resources (I personally 
recommend nginx). Your java app server will not even be hit when requesting 
resources like .css and .js once they got loaded into the cache. Servers like 
nginx are by far more efficient in serving these kind of resources than any 
java app server.

Unless you want to host facebook.com this setup should be more than sufficient.

No need to twiddle around with filenames and 'static/'

Cheers 
Peter

Am 17.01.2012 um 14:52 schrieb Chris Colman:

 Maybe I am getting pedantic as I was thinking in terms of speed of
 operation for a server that's getting hammered with thousands of hits
 per hour.
 
 It's quicker to test the first few chars of a URL string for a match
 with 'startsWith' than it is to iterate through to almost the end of
 each URL string to see if it 'contains' a substring. Any URL will fail
 to match on comparison of the first character if they don't have a 'w'
 at the beginning which makes startsWith a 'fast fail' test for most URLs
 it processes.
 
 I think that's probably why the Servlet Spec chooses to do filter and
 servlet path matching via a 'starts with' strategy without support for
 wildcards except at the very end of a pattern.
 
 Many of the URLs requested are very long and I try to avoid string
 parsing of lots of thousands of long strings wherever I can - there's
 already enough of that going on without adding to the work load.
 
 -Original Message-
 From: Martin Grigorov [mailto:mgrigo...@apache.org]
 Sent: Tuesday, 17 January 2012 7:08 PM
 To: users@wicket.apache.org
 Subject: Re: Controlling URL of static cacheable resources
 
 Hi Chris,
 
 With IResourceCachingStrategy you can pre/suf-fix the resource name
 with
 my.namespace.static, for example.
 This way your filter will be able to recognize it. It is the same as
 adding
 the /static/ segment. Just at different place.
 
 On Mon, Jan 16, 2012 at 10:49 PM, Chris Colman
 chr...@stepaheadsoftware.com
 wrote:
 
 ** **
 
 I'm trying to make static resources have a distinguishable part of
 their
 URL near the beginning of the URL to enable easy configuration of
 third
 party filters that need to ignore requests for static resources and
 just
 proceed along the filter chain.
 
 ** **
 
 I've looked up the operation of
 
 org.apache.wicket.request.resource.caching.IResourceCachingStrategy#dec
 orat
 eUrl
 but it appears that it only has the ability to make changes near the
 end
 of
 the resource URL after all the major segments of the URL have already
 been
 set ie., after this part
 
 ** **
 
 /wicket/resource/org.apache.wicket rest of pathname.ClassName
 
 ** **
 
 What I am trying to do is get all static resources to end up with a
 distinguishable URL that starts off something like:
 
 ** **
 
 /wicket/resource/static/pathname.ClassName
 
 ** **
 
 so I can configure a filter to ignore /wicket/resource/static/*
 
 ** **
 
 In BasicResourceReferenceHandler.mapHandler() perhaps after adding
 the
 resource identifier segment:
 
 ** **
 
 segments.add(getContext().getResourceIdentifier());
 
 ** **
 
 it could append an extra segment for static resources:
 
 ** **
 
 final IResource resource = reference.getResource();
 
 ** **
 
 // if static resource
 
 if (resource instanceof IStaticCacheableResource)
 
 {
 
 segments.add(static);
 
 }
 
 ** **
 
 And so end up with /wicket/resource/static/org.apache.wicket ...
 
 ** **
 
 ** **
 
 ** **
 
 I also observed that Wicketstuff resources don't use the /wicket
 namespace prefix. They just start out at 
 
 ** **
 
 /resources/org.name.project.MyClass.script.js
 
 ** **
 
 So they'd need a separate ignore entry in the filter.
 
 ** **
 
 ** **
 
 Yours sincerely,
 
 ** **
 
 Chris Colman
 
 
 
 Pagebloom Team Leader,
 
 Step Ahead Software
 
 
 
 pagebloom - your business  your website growing together
 
 ** **
 
 **Sydney**: (+61 2) 9656 1278 Canberra: (+61 2) 6100 2120
 
 
 Email: chr...@stepahead.com.au //chr...@stepahead.com.au
 
 Website:
 
 http://www.pagebloom.com
 
 http://develop.stepaheadsoftware.com
 
 
 
 ** **
 
 
 
 
 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 



Re: wicket appl architecture

2012-01-18 Thread nazeem

Russell Pitre wrote
 
 Separate front-end sounds fine. Use a REST architecture with JSON as the
 data exchange format. I'm pretty Spring MVC supports this through the use
 Jackson JSON library. Its something to add to your list of possible
 options.
 

Wicket is component based and differs from Spring MVC. So do you mean you
are using component based hierarchy for the user interface and spring mvc
for the REST services exposed for external communication ? Is it possible ?


Arjun Dhar wrote
 
 JSON Library + CXF wtf! 
 

Arjun, thank you for the input. Will try CXF, I haven't used it so far.
Going thru the doc it looks promising with wide support.  By the what do you
mean by wtf! ?









--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-appl-architecture-tp4305917p4308822.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: Best practice for returning to calling page after submitting a form page

2012-01-18 Thread Jeff Schneller
You could make the address form have an abstract method to determine where to 
redirect to. In the form submit call the abstract method  The the page 
constructor could take a param to tell which page to redirect to.  Define the 
abstract method on the page to do the redirect based on the parameter passed to 
the page. Or you could have individual pages that all use the same address 
form. 

On Jan 18, 2012, at 8:39 PM, Chris Colman chr...@stepaheadsoftware.com 
wrote:

 I often use modal forms/dialogs so this issue is not a problem: In a modal 
 scenario when the user submits a modal the page they called the modal form 
 from is just sitting there behind the form when it closes – no need for 
 redirection to the ‘calling page’ as it’s redundant.
  
 In scenarios where some customers prefer not to have modal forms the forms 
 have to be pages in their own right and involve the ‘browser page change’ 
 dance.
  
 Is there a best practice in Wicket for making reusable page forms that 
 remember which page called them and return to that page after submit or 
 cancel? Or is there a Wicket class that manages this?
  
 Example scenario for  Reusable Address form
  
 Scenario 1
  
 Page A shows supplier’s data with a panel displaying their address which 
 includes a ‘Change’ button.
  
 User clicks change and is taken to Address form page.
  
 User makes changes and hits ok. The browser returns to page A.
  
 Scenario 2
  
 Page B shows customer’s data with a panel display their address which 
 includes a ‘Change’ button.
  
 User clicks change and is taken to Address form page.
  
 User makes changes and hits ok. The browser returns to page B.
  
  
 Yours sincerely,
  
 Chris Colman
  
 Pagebloom Team Leader,
 Step Ahead Software
 
 
 pagebloom - your business  your website growing together
  
 Sydney: (+61 2) 9656 1278 Canberra: (+61 2) 6100 2120 
 Email: chr...@stepahead.com.au
 Website:
 http://www.pagebloom.com
 http://develop.stepaheadsoftware.com
  
  


does the breadcrumb extension support bookmarkable links?

2012-01-18 Thread Daniel Watrous
I've been working with the breadcrumb components in the extensions
library today. Now that I have it working the way I need it to, I
noticed that none of the links are bookmarkable. I wondered if it were
possible to use this feature and still have links be bookmarkable?

I did some searching and found only a handful of references to
creating bookmarkable pages instead of panels, but before I went too
far down that road I wanted to ask if it's possible and straight
forward.

Thanks,
Daniel

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



ListView not refreshed after a new row is inserted with EJB3 as its backend data

2012-01-18 Thread x.yang
Hello, Everyone,

I am trying to build a web app with Wicket, EJB3, and MySQL. My IDE is
Netbeans 6.9.1 and the server is Glassfish 3.1. 

I have created two entity beans 'Centre' and 'User', and one Centre has many
User(s). I also created two Facades for them.

The Wicket page used to list the Users is as below:


class ListUsers extends WebPage {

@EJB(name = UserFacade)
private UserFacade userFacade;

public ListUsers(Centre c) {
ListUser users;
if (c == null) {
users = userFacade.findAll();
} else {
users = new ArrayListUser(c.getUserCollection());
}
final ListViewUser list = new ListViewUser(eachUser, users) {

@Override
protected void populateItem(ListItem item) {
final User user = (User) item.getModelObject();
item.add(new Label(username, user.getUsername()));
item.add(new Label(fullname, user.getFullname()));
item.add(new Label(email, user.getEmail()));
item.add(new Label(centreid, user.getCentre().getName()));
}
};
add(list);
}
}
-

The page to add a User is following:


public AddUser(Centre c) {
user = new User();
user.setCentre(c);
FormAddUser form = new FormAddUser(AddUser) {

@Override
protected void onSubmit() {
userFacade.create(user);
}
};

form.add(new TextFieldString(username,
new PropertyModel(user, username)).setRequired(true));

PasswordTextField tf_password = new PasswordTextField(password,
new PropertyModel(user, hashedPassword));
form.add(tf_password);

form.add(new TextFieldString(fullname,
new PropertyModel(user, fullname)).setRequired(true));

TextField tf_email = new TextFieldString(email,
new PropertyModel(user, email));
form.add(tf_email);

LoadableDetachableModel centres = new LoadableDetachableModel() {

@Override
protected Object load() {
return centreFacade.findAll();
}
};
DropDownChoiceCentre ddc = new DropDownChoiceCentre(centreid,
new PropertyModelCentre(user, centre), centres,
new ChoiceRendererCentre(name, name));

form.add(ddc.setRequired(true));

add(form);
}
}



The problem is I can't see the newly added User in the list with
getUserCollection() method of Centre, but I do see the new User if I use
userFacade.findAll() method. Could you please help me and point me to the
right direction? I am quite new to Wicket and EJB3. Any comments are welcom.
Thanks a lot.

Yang



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-not-refreshed-after-a-new-row-is-inserted-with-EJB3-as-its-backend-data-tp4309318p4309318.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: CompoundPropertyModel and FormComponent

2012-01-18 Thread Schlärmann , Bob
Thanks for your response. After some more debugging I've found the cause and 
also found a solution.

The cause is that models of intermediate components, such as the Panel in my 
case, are never initialized if they do not already have a model. 

The parent's model is looked up in Component.initModel(), however this method 
uses a special method for getting the model of the parent that does not 
initialize the parent's model if it is not already initialized. The behaviour 
is intentional as there is a comment on this line:

// Get model
// Don't call the getModel() that could initialize many inbetween
// completely useless models.
// IModel model = current.getModel();
IModel? model = current.getModelImpl();

In my case I think this intermediate the inbetween model should get 
initialized. 

The workaround is to initialize the model in onBeforeRender(), before calling 
super.onBeforeRender(), and let the Panel implement the IFormVisitorParticipant 
interface. Then in IFormVisitorParticipant.processChildren() initialize the 
model again (by just calling getDefaultModel()). This last trick is needed in 
order to get the model initialized before it's children are submitted.

The complete class is as follows:

public class AddressPanel extends Panel implements IFormVisitorParticipant {
public AddressPanel(String id) {
super(id);

add(new TextFieldString(street));
}

protected IModel? initModel() {
IModel? model = super.initModel();

return new CompoundPropertyModelObject(model);
}

protected void onBeforeRender() {
getDefaultModel(); // getDefaultModel initialized model if not yet 
initialized

   super.onBeforeRender();
}

public boolean processChildren() {
getDefaultModel();

return true;
}
}

In SomePage.class you can bind the panel to an Address property:

Address address; // consists of a single property named street

SomePage() {
   FormSomePage form = new FormSomePage(form, new 
CompoundPropertyModel(this));
   form.add(new AddressPanel(address));
   add(form);
}


This solution seems a bit awkward though so I'm using a constructor with model 
solution in my application.

Best regards,

Bob


 At this point I would override/debug method updateModel() inside
 AddressPanel to see if model's object is modified by this method .
 Just my 2 cents...
  Yes, I think you are doing it the Wicket way, but your snippet and
  mine should work. Do you modify components' model somewhere else?
  No, I don't think so. The page to which the component is added is
 constructed as follows:
 
  CompoundPropertyModelHomePage  model = new
 CompoundPropertyModelHomePage(this);
  FormHomePage  form = new FormHomePage(form, model);
  form.add(new TextFieldString(person.firstname));
  form.add(new AdresPanel(person.adres));
 
  No other code modifies the model.
 
  Which model do you get if you call getDefaultModel() inside oninitialize?
  The result of getDefaultModel() is an instance of
 CompoundPropertyModel$AttachedCompoundPropertyModel, with owner set to the
 AdresPanel and with target set to a CompoundPropertyModel which in turn has
 target HomePage.
 
  I noticed that upon initializing the model is set correctly. However when
 inspecting the model in onBeforeRender() during the submit request the target
 of the model of the AddressPanel.street model is set to HomePage.
 
  Thanks for your reply. I've tried it but it still gave the same error.
 
  However I also tried the following modified version of your idea:
 
  In AddressPanel.java:
 
  @Override
  protected void onInitialize() {
super.onInitialize();
   Object o = getDefaultModelObject();
 
   setDefaultModel(new
 CompoundPropertyModel(getDefaultModelObject()));
  }
 
  With the above code I can now load the page, also the
  getDefaultModelObject() returns the correct Address instance. Unfortunately
  upon submitting the form I get the same exception again (No get method
  defined for class: class foo.HomePage expression: street).
  By the way: am I doing things the Wicket way? Is this how you would
 reuse
  parts of a form in Wicket?
 
 
  Best regards,
 
  Bob
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
  Think green - keep it on the screen.
 
  This e-mail and any attachment is for authorised use by the intended
 recipient(s) only. It may contain proprietary material, confidential
 information and/or be subject to legal privilege. It should not be copied,
 disclosed to, retained or used by, any other party. If you are not an intended
 recipient then please promptly delete this e-mail and any attachment and all
 copies and inform the sender. Thank you.
 
 
 
  -
  To unsubscribe, e-mail: