Re: Wicket 6 trees

2012-10-19 Thread Sven Meier

Hi,

by default the new tree implementation uses CSS classes, see

org.apache.wicket.extensions.markup.html.repeater.tree.content.Folder

Of course you can still use images (like LabelIconPanel did):
Overwrite AbstractTree#newContentComponent() creating your own component 
to represent a node's content.


Hope this helps
Sven

On 10/19/2012 08:28 AM, Peter Diefenthaeler wrote:

Hi Sven,
thanks for your reply. The next thing is using different customized icons
for the nodes and leaves dependent on the object's state. In my old Wicket
1.4.x tree this was simply done by overriding PackageResourceReference
getResourceFolderClosed(Object node) for instance.
Is there a solution in Wicket 6 trees also?

Thanks, Peter

http://markmail.org/message/5at4m5uohfpawyck




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



Re: show message to user when session about to expire

2012-10-19 Thread Martin Grigorov
Hi,

Here is an idea how to do it:
when rendering your page use
http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpSession.html#getMaxInactiveInterval()
to get what is the value of session-timeout in seconds. Use this
value as a counter and count down with pure JavaScript. When you reach
your threshold show the dialog. If the user confirm then just make a
simple Ajax request to the server to mark the session as active, reset
the counter in the page and restart the JavaScript count down.

On Fri, Oct 19, 2012 at 7:48 AM, _kl_ kriti@igate.com wrote:
 Hi,

 I am working on a complex web application and one of its requirement is,when
 session is about to expire user should see a confirmation pop up asking him
 Your session is about to expire.Do you want to continue? if user click
 yes then the session should continue else he should be logged out.
 Searched a lot but did not find any proper solution for this.Please help.

 Thanks in advance!



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/show-message-to-user-when-session-about-to-expire-tp4653081.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: UrlRenderer renders wrong HTTPS links

2012-10-19 Thread Martin Grigorov
Hi,

To avoid such problems in the future I suggest you to setup Apache
HTTPD in your development setup so it looks like your production one.

On Fri, Oct 19, 2012 at 7:28 AM, Dirk Forchel dirk.forc...@exedio.com wrote:
 Hallo Sven,
 I doubt it. I don't wanna blame the HttpsMapper as the mapping is done in
 the usual way as RootRequestMapper:

 Application#init()


 There is no magic and there were no changes at all. Since we upgraded our
 application from Wicket 1.5.5 to Wicket 1.5.8 and/or Wicket 6 (NOTE: we have
 the same application on two branches with different Wicket verions) we have
 this problem with wrong rendered secure Links.
 As mentioned above, I've adapted your solution to pre-save the protocol and
 the port and this solution works on my local developer machine running with
 Tomcat on http://localhost:8080/ and https://localhost:8443/ respectively.
 But if we deploy this application on another machine with Tomcat and an
 Apache WebServer (connected to Tomcat via AJP connector) in front, we got
 these wrong rendered links. The request Urls to the Apache WebServer look
 like http://mydomain.com/ and https://mydomain.com/. Note: there are no
 ports in the requests, needless to say that Tomcat listens on port 80 and
 443.

I guess you made mistake here. HTTPD is listening at ports 80/443 and
Tomcat at 8080/8443, right ?


 I could figure out, that on the remote machine, the pre-served port value is
 'null' and not '443' as it should be. Why?! On my local machine the
 pre-served port is '8443'. If the pre-served port value is null, the method
 resolvePort(url) returns '80' as resolved port value, which is WRONG!!!

AJP has its own connector in Tomcat, by default listening on port 8009.
Most probably this is the reason why #getServerPort() returns the wrong value.

You can create a ticket with detailed description how to setup the
same environment as yours and I can take a look. Just provide your
Tomcat server.xml and AJP related conf for HTTPD. And a Wicket
quickstart, of course.




 The returned port value in this case is the second fallback (
 request.getClientUrl().getPort() ).
 Do you have any idea why 'null' is pre-served and not '443'?



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/UrlRenderer-renders-wrong-HTTPS-links-tp4653059p4653080.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: Behavior modifying component body

2012-10-19 Thread Martin Grigorov
Hi Jesse,

I see what you mean and I agree it will work and will be a simple
solution for such requirements.
My only concern is that the API of Behavior becomes bigger and
component rendering will do some more things. Most of the time these
methods will do nothing.

Have you considered using
org.apache.wicket.markup.transformer.AbstractTransformerBehavior for
this ?
I see how this is more cumbersome too:
- you will need to inject some markup in another markup
- you will need to add two behaviors to the component (I guess you use
ButtonBehavior from wicket-bootstrap already)

P.S. I've included dev@ so more Wicket devs can give their opinion on this.

On Thu, Oct 18, 2012 at 11:27 PM, Jesse Long j...@unknown.za.net wrote:
 Hi Wicket Community,

 I would like to modify the body of a Component from a Behavior.
 Specifically, I want to add:

 i class=icon icon-calendar/i

 To the beginning of the of the body of a link, eg:

 a href=#[here] Some other body/a

 I dont want to extend AbstractLink etc, I want to add this functionality as
 a Behavior.

 I cannot see a way to do this without modifying Behavior and Component. Am I
 missing something? Is there a way I can do this without patching the code?

 If not, if we must modify the code, how about the patch at the bottom of
 this mail?

 1. Behavior gets two new methods, onBeforeComponentTagBody and
onAfterComponentTagBody, similar to onComponentTag.
 2. These new methods take a ComponentTag argument. Is it conceivable
that the behavior will need to mess around with the ComponentTag,
especially after renderComponentTag is already called?
 3. The Behavior does not get the MarkupStream, because I image we dont
want the Behavior messing around with it?
 4. I think its pretty safe to implement these calles in
Component#internalRenderComponent. It is usually called from
onRender(), and pretty much everything that overrides onRender calls
it. Right?
 5. #internalRenderComponent calls onComponentTagBody inside a if
(tag.isOpen()){} block. Immediately there after, it closes the tag
in a separate if (tag.isOpen()){} block. This seems to insinuate
that there is a possibility of onComponentTagBody modifying the
ComponentTag in some way, possibly leaving is not open. I dont think
that that should happen, but if it does it could make the calls to
Bahavior#onAfterComponentTagBody invalid, especially if
Behavior#onAfterComponentTagBody appends HTML to the response. Thoughts?
 6. I call Behaviour#onAfterComponentTagBody on the behaviors in reverse
order, so that we can have multiple behaviors that add content
before (open tag) and after (close tag) the body. It should be noted
that Component#notifyBehaviorsComponentRendered() does not do this,
which may lead to problems if the behaviors add content before and
after the component.

 Thanks,
 Jesse


 diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java
 b/wicket-core/src/main/java/org/apache/wicket/Component.java
 index 26bd055..9495dae 100644
 --- a/wicket-core/src/main/java/org/apache/wicket/Component.java
 +++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
 @@ -22,6 +22,7 @@ import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Iterator;
  import java.util.List;
 +import java.util.ListIterator;
  import java.util.Locale;

  import org.apache.wicket.ajax.IAjaxRegionMarkupIdProvider;
 @@ -2530,9 +2531,27 @@ public abstract class Component
  // Render the body only if open-body-close. Do not render if
 open-close.
  if (tag.isOpen())
  {
 +for (Behavior b : getBehaviors())
 +{
 +if (isBehaviorAccepted(b))
 +{
 +b.onBeforeComponentTagBody(this, tag);
 +}
 +}
 +
  // Render the body. The default strategy will simply call
 the component's
  // onComponentTagBody() implementation.
 getMarkupSourcingStrategy().onComponentTagBody(this, markupStream, tag);
 +
 +ListIterator? extends Behavior it =
 getBehaviors().listIterator();
 +while (it.hasPrevious())
 +{
 +Behavior b = it.previous();
 +if (isBehaviorAccepted(b))
 +{
 +b.onAfterComponentTagBody(this, tag);
 +}
 +}
  }

  // Render close tag
 diff --git
 a/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java
 b/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java
 index c916b7d..d9ea133 100644
 --- a/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java
 +++ b/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java
 @@ -182,6 +182,14 @@ public abstract class Behavior
  public void onComponentTag(Component component, 

Re: performance on nested dataviews

2012-10-19 Thread Martin Grigorov
Hi,

This wont be very easy :-/

The problem is that you will need to provide MarkupStream which index
is set at the proper position for the markup of the label.
If you make this working then you need to do:

StringResponse tempResponse = new StringResponse();
Response oldResponse = requestCycle.setResponse(tempResponse);
String labelMarkup = ;
try {
   // set markupStream index
   label.render();
} finally {
   requestCycle.setResponse(oldResponse);
   labelMarkup = tempResponse.getContent();
}

and finally use 'labelMarkup' when constructing the body of MyMatrix.

As I said - it wont be easy. But it is not impossible too.

On Thu, Oct 18, 2012 at 10:04 PM, lukuperman lukuper...@hotmail.com wrote:
 Martin,
 the webmarkupcontainer I created looks like this:

 public class MyMatrix extends WebMarkupContainer {
...
@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
 openTag) {
   StringBuilder body = new StringBuilder();
   ...
   replaceComponentTagBody(markupStream, openTag, body);
}
 }

 And I would like to reuse a custom label I created and append it to the body
 string. My label looks like:

 public class AbbreviatedLabel extends Label
...
@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
 openTag) {
   StringBuffer label = new StringBuffer();
   some string manipulation
   replaceComponentTagBody(markupStream, openTag, label);
}
 }


 Thanks in advance



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673p4653074.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: UrlRenderer renders wrong HTTPS links

2012-10-19 Thread Sven Meier
I was able to reproduce the problem here on Tomcat (without Apache in 
front of it).

It seems it has something to do with standard ports 80/443.

I'll debug the problem now.

Regards
Sven

On 10/19/2012 09:27 AM, Martin Grigorov wrote:

Hi,

To avoid such problems in the future I suggest you to setup Apache
HTTPD in your development setup so it looks like your production one.

On Fri, Oct 19, 2012 at 7:28 AM, Dirk Forchel dirk.forc...@exedio.com wrote:

Hallo Sven,
I doubt it. I don't wanna blame the HttpsMapper as the mapping is done in
the usual way as RootRequestMapper:

Application#init()


There is no magic and there were no changes at all. Since we upgraded our
application from Wicket 1.5.5 to Wicket 1.5.8 and/or Wicket 6 (NOTE: we have
the same application on two branches with different Wicket verions) we have
this problem with wrong rendered secure Links.
As mentioned above, I've adapted your solution to pre-save the protocol and
the port and this solution works on my local developer machine running with
Tomcat on http://localhost:8080/ and https://localhost:8443/ respectively.
But if we deploy this application on another machine with Tomcat and an
Apache WebServer (connected to Tomcat via AJP connector) in front, we got
these wrong rendered links. The request Urls to the Apache WebServer look
like http://mydomain.com/ and https://mydomain.com/. Note: there are no
ports in the requests, needless to say that Tomcat listens on port 80 and
443.

I guess you made mistake here. HTTPD is listening at ports 80/443 and
Tomcat at 8080/8443, right ?


I could figure out, that on the remote machine, the pre-served port value is
'null' and not '443' as it should be. Why?! On my local machine the
pre-served port is '8443'. If the pre-served port value is null, the method
resolvePort(url) returns '80' as resolved port value, which is WRONG!!!

AJP has its own connector in Tomcat, by default listening on port 8009.
Most probably this is the reason why #getServerPort() returns the wrong value.

You can create a ticket with detailed description how to setup the
same environment as yours and I can take a look. Just provide your
Tomcat server.xml and AJP related conf for HTTPD. And a Wicket
quickstart, of course.




The returned port value in this case is the second fallback (
request.getClientUrl().getPort() ).
Do you have any idea why 'null' is pre-served and not '443'?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/UrlRenderer-renders-wrong-HTTPS-links-tp4653059p4653080.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



js

2012-10-19 Thread Jordi Deu-Pons
 Hi,

 when cookies are disable Wicket 6 attach the jsessionid in the URL like this:

 [app_path];jsessionid=1pwfo2de689mq100bkdc8i4jhy?[app_parameters]

 I'm having problems with an application that runs behind an apache proxy pass.

 So I wonder if somebody knows,

 why is not using a normal URL parameter after the question mark?

 and

 is it possible to change this behaviour and force wicket to use a
normal URL parameter?

 Thanks.

-- 
a10! i fins aviat.
J:-Deu

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



Re: js

2012-10-19 Thread Martin Grigorov
Hi,

This is done by the web container (Tomcat, Jetty, ...), not by Wicket itself.
See 
http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)

On Fri, Oct 19, 2012 at 10:51 AM, Jordi Deu-Pons jo...@jordeu.net wrote:
  Hi,

  when cookies are disable Wicket 6 attach the jsessionid in the URL like this:

  [app_path];jsessionid=1pwfo2de689mq100bkdc8i4jhy?[app_parameters]

  I'm having problems with an application that runs behind an apache proxy 
 pass.

  So I wonder if somebody knows,

  why is not using a normal URL parameter after the question mark?

  and

  is it possible to change this behaviour and force wicket to use a
 normal URL parameter?

  Thanks.

 --
 a10! i fins aviat.
 J:-Deu

 -
 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: js

2012-10-19 Thread Jordi Deu-Pons
Ok,

 thanks Martin.

On Fri, Oct 19, 2012 at 10:54 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 This is done by the web container (Tomcat, Jetty, ...), not by Wicket itself.
 See 
 http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)

 On Fri, Oct 19, 2012 at 10:51 AM, Jordi Deu-Pons jo...@jordeu.net wrote:
  Hi,

  when cookies are disable Wicket 6 attach the jsessionid in the URL like 
 this:

  [app_path];jsessionid=1pwfo2de689mq100bkdc8i4jhy?[app_parameters]

  I'm having problems with an application that runs behind an apache proxy 
 pass.

  So I wonder if somebody knows,

  why is not using a normal URL parameter after the question mark?

  and

  is it possible to change this behaviour and force wicket to use a
 normal URL parameter?

  Thanks.

 --
 a10! i fins aviat.
 J:-Deu

 -
 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




-- 
a10! i fins aviat.
J:-Deu

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



Re: js

2012-10-19 Thread Wujek Srujek
This works more or less the following way in servlet containers: when the
first request comes to the server, it doesn't know if cookies are supported
or not on the client, so it sets both the cookie and appends the jsessionid
thingy that you see. Then, on another request, the container checks whether
a cookie is there, and now it can use the following logic:
1. the cookie is there: the client sent this cookie, so it supports cookies
- there is no need to append jsessionid every time, so the encodeUrl
methods don't do it any more
2. the cookie is not there, but the jsessionid part is - this must be the
second (or later) requrest, but cookies are not supported by the client -
encodeUrl will now encode each url you give it to add the jsessionid part
3. neither the cookie nor the jsessionid part is there - this is the first
request in this session, so maybe create one (depends whether the app needs
one): set the cookie, append jsessionid and send it - this basically starts
the whole process again, when the server got the initial request

Which means: if you disable cookies, your only option is to have jsessionid
encoded in the url. If you disabled cookies, and don't allow jsessionid to
be put (there are filters in SpringSecurity or custom solutions that strip
this) your application basically doesn't allow session tracking, which
makes it stateless and most of the time pretty much useless except for
simplest kinds.

As said before, this is all done by the container; Wicket (and all other
frameworks, for that matter) just use sessions.

wujek


On Fri, Oct 19, 2012 at 10:54 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 This is done by the web container (Tomcat, Jetty, ...), not by Wicket
 itself.
 See
 http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)

 On Fri, Oct 19, 2012 at 10:51 AM, Jordi Deu-Pons jo...@jordeu.net wrote:
   Hi,
 
   when cookies are disable Wicket 6 attach the jsessionid in the URL like
 this:
 
   [app_path];jsessionid=1pwfo2de689mq100bkdc8i4jhy?[app_parameters]
 
   I'm having problems with an application that runs behind an apache
 proxy pass.
 
   So I wonder if somebody knows,
 
   why is not using a normal URL parameter after the question mark?
 
   and
 
   is it possible to change this behaviour and force wicket to use a
  normal URL parameter?
 
   Thanks.
 
  --
  a10! i fins aviat.
  J:-Deu
 
  -
  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: js

2012-10-19 Thread Martin Grigorov
Hi,

On Fri, Oct 19, 2012 at 11:04 AM, Wujek Srujek wujek.sru...@gmail.com wrote:
 This works more or less the following way in servlet containers: when the
 first request comes to the server, it doesn't know if cookies are supported
 or not on the client, so it sets both the cookie and appends the jsessionid

I think there is a small optimization here.
The first request may come with a cookie if it is not yet expired and
then it will not encode jsessionid in the Url at all.

 thingy that you see. Then, on another request, the container checks whether
 a cookie is there, and now it can use the following logic:
 1. the cookie is there: the client sent this cookie, so it supports cookies
 - there is no need to append jsessionid every time, so the encodeUrl
 methods don't do it any more
 2. the cookie is not there, but the jsessionid part is - this must be the
 second (or later) requrest, but cookies are not supported by the client -
 encodeUrl will now encode each url you give it to add the jsessionid part
 3. neither the cookie nor the jsessionid part is there - this is the first
 request in this session, so maybe create one (depends whether the app needs
 one): set the cookie, append jsessionid and send it - this basically starts
 the whole process again, when the server got the initial request

 Which means: if you disable cookies, your only option is to have jsessionid
 encoded in the url. If you disabled cookies, and don't allow jsessionid to
 be put (there are filters in SpringSecurity or custom solutions that strip
 this) your application basically doesn't allow session tracking, which
 makes it stateless and most of the time pretty much useless except for
 simplest kinds.

 As said before, this is all done by the container; Wicket (and all other
 frameworks, for that matter) just use sessions.

 wujek


 On Fri, Oct 19, 2012 at 10:54 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 This is done by the web container (Tomcat, Jetty, ...), not by Wicket
 itself.
 See
 http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)

 On Fri, Oct 19, 2012 at 10:51 AM, Jordi Deu-Pons jo...@jordeu.net wrote:
   Hi,
 
   when cookies are disable Wicket 6 attach the jsessionid in the URL like
 this:
 
   [app_path];jsessionid=1pwfo2de689mq100bkdc8i4jhy?[app_parameters]
 
   I'm having problems with an application that runs behind an apache
 proxy pass.
 
   So I wonder if somebody knows,
 
   why is not using a normal URL parameter after the question mark?
 
   and
 
   is it possible to change this behaviour and force wicket to use a
  normal URL parameter?
 
   Thanks.
 
  --
  a10! i fins aviat.
  J:-Deu
 
  -
  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





-- 
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: Behavior modifying component body

2012-10-19 Thread Martin Grigorov
Another way is by using BorderBehavior.
See org.apache.wicket.examples.forminput.BeforeAndAfterBorder for an example.
The drawback here is that you will need an additional .java + .html
pair for each icon type and you'll need to apply it on the
Link/Button's label, so you cannot use AbstractLink#setBody(IModel)
:-/

On Fri, Oct 19, 2012 at 9:37 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi Jesse,

 I see what you mean and I agree it will work and will be a simple
 solution for such requirements.
 My only concern is that the API of Behavior becomes bigger and
 component rendering will do some more things. Most of the time these
 methods will do nothing.

 Have you considered using
 org.apache.wicket.markup.transformer.AbstractTransformerBehavior for
 this ?
 I see how this is more cumbersome too:
 - you will need to inject some markup in another markup
 - you will need to add two behaviors to the component (I guess you use
 ButtonBehavior from wicket-bootstrap already)

 P.S. I've included dev@ so more Wicket devs can give their opinion on this.

 On Thu, Oct 18, 2012 at 11:27 PM, Jesse Long j...@unknown.za.net wrote:
 Hi Wicket Community,

 I would like to modify the body of a Component from a Behavior.
 Specifically, I want to add:

 i class=icon icon-calendar/i

 To the beginning of the of the body of a link, eg:

 a href=#[here] Some other body/a

 I dont want to extend AbstractLink etc, I want to add this functionality as
 a Behavior.

 I cannot see a way to do this without modifying Behavior and Component. Am I
 missing something? Is there a way I can do this without patching the code?

 If not, if we must modify the code, how about the patch at the bottom of
 this mail?

 1. Behavior gets two new methods, onBeforeComponentTagBody and
onAfterComponentTagBody, similar to onComponentTag.
 2. These new methods take a ComponentTag argument. Is it conceivable
that the behavior will need to mess around with the ComponentTag,
especially after renderComponentTag is already called?
 3. The Behavior does not get the MarkupStream, because I image we dont
want the Behavior messing around with it?
 4. I think its pretty safe to implement these calles in
Component#internalRenderComponent. It is usually called from
onRender(), and pretty much everything that overrides onRender calls
it. Right?
 5. #internalRenderComponent calls onComponentTagBody inside a if
(tag.isOpen()){} block. Immediately there after, it closes the tag
in a separate if (tag.isOpen()){} block. This seems to insinuate
that there is a possibility of onComponentTagBody modifying the
ComponentTag in some way, possibly leaving is not open. I dont think
that that should happen, but if it does it could make the calls to
Bahavior#onAfterComponentTagBody invalid, especially if
Behavior#onAfterComponentTagBody appends HTML to the response. Thoughts?
 6. I call Behaviour#onAfterComponentTagBody on the behaviors in reverse
order, so that we can have multiple behaviors that add content
before (open tag) and after (close tag) the body. It should be noted
that Component#notifyBehaviorsComponentRendered() does not do this,
which may lead to problems if the behaviors add content before and
after the component.

 Thanks,
 Jesse


 diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java
 b/wicket-core/src/main/java/org/apache/wicket/Component.java
 index 26bd055..9495dae 100644
 --- a/wicket-core/src/main/java/org/apache/wicket/Component.java
 +++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
 @@ -22,6 +22,7 @@ import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Iterator;
  import java.util.List;
 +import java.util.ListIterator;
  import java.util.Locale;

  import org.apache.wicket.ajax.IAjaxRegionMarkupIdProvider;
 @@ -2530,9 +2531,27 @@ public abstract class Component
  // Render the body only if open-body-close. Do not render if
 open-close.
  if (tag.isOpen())
  {
 +for (Behavior b : getBehaviors())
 +{
 +if (isBehaviorAccepted(b))
 +{
 +b.onBeforeComponentTagBody(this, tag);
 +}
 +}
 +
  // Render the body. The default strategy will simply call
 the component's
  // onComponentTagBody() implementation.
 getMarkupSourcingStrategy().onComponentTagBody(this, markupStream, tag);
 +
 +ListIterator? extends Behavior it =
 getBehaviors().listIterator();
 +while (it.hasPrevious())
 +{
 +Behavior b = it.previous();
 +if (isBehaviorAccepted(b))
 +{
 +b.onAfterComponentTagBody(this, tag);
 +}
 +}
  }

  // Render close tag
 diff --git
 

Re: js

2012-10-19 Thread Wujek Srujek
Does the cookie come with the session id inside? I'm not sure this works
this way - the value of the session id will most likely be wrong for a
request one month after the last time the application was used even though
the cookie itself is still valid; the session will just not exist any more
on the server (unless you told tomcat / whatever to preserve sessions that
long ;d).
But you may be right - maybe the server can check if there is _any_ cookie
to know the client supports them. When cookies come with the first request,
it is the same as if it were the nth request in a series - the server can't
know that. That's what sessions are for ;d

wujek

On Fri, Oct 19, 2012 at 11:10 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 On Fri, Oct 19, 2012 at 11:04 AM, Wujek Srujek wujek.sru...@gmail.com
 wrote:
  This works more or less the following way in servlet containers: when the
  first request comes to the server, it doesn't know if cookies are
 supported
  or not on the client, so it sets both the cookie and appends the
 jsessionid

 I think there is a small optimization here.
 The first request may come with a cookie if it is not yet expired and
 then it will not encode jsessionid in the Url at all.

  thingy that you see. Then, on another request, the container checks
 whether
  a cookie is there, and now it can use the following logic:
  1. the cookie is there: the client sent this cookie, so it supports
 cookies
  - there is no need to append jsessionid every time, so the encodeUrl
  methods don't do it any more
  2. the cookie is not there, but the jsessionid part is - this must be the
  second (or later) requrest, but cookies are not supported by the client -
  encodeUrl will now encode each url you give it to add the jsessionid part
  3. neither the cookie nor the jsessionid part is there - this is the
 first
  request in this session, so maybe create one (depends whether the app
 needs
  one): set the cookie, append jsessionid and send it - this basically
 starts
  the whole process again, when the server got the initial request
 
  Which means: if you disable cookies, your only option is to have
 jsessionid
  encoded in the url. If you disabled cookies, and don't allow jsessionid
 to
  be put (there are filters in SpringSecurity or custom solutions that
 strip
  this) your application basically doesn't allow session tracking, which
  makes it stateless and most of the time pretty much useless except for
  simplest kinds.
 
  As said before, this is all done by the container; Wicket (and all other
  frameworks, for that matter) just use sessions.
 
  wujek
 
 
  On Fri, Oct 19, 2012 at 10:54 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
 
  Hi,
 
  This is done by the web container (Tomcat, Jetty, ...), not by Wicket
  itself.
  See
 
 http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)
 
  On Fri, Oct 19, 2012 at 10:51 AM, Jordi Deu-Pons jo...@jordeu.net
 wrote:
Hi,
  
when cookies are disable Wicket 6 attach the jsessionid in the URL
 like
  this:
  
[app_path];jsessionid=1pwfo2de689mq100bkdc8i4jhy?[app_parameters]
  
I'm having problems with an application that runs behind an apache
  proxy pass.
  
So I wonder if somebody knows,
  
why is not using a normal URL parameter after the question mark?
  
and
  
is it possible to change this behaviour and force wicket to use a
   normal URL parameter?
  
Thanks.
  
   --
   a10! i fins aviat.
   J:-Deu
  
   -
   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
 
 



 --
 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: js

2012-10-19 Thread Martin Grigorov
On Fri, Oct 19, 2012 at 11:21 AM, Wujek Srujek wujek.sru...@gmail.com wrote:
 Does the cookie come with the session id inside? I'm not sure this works
 this way - the value of the session id will most likely be wrong for a
 request one month after the last time the application was used even though
 the cookie itself is still valid; the session will just not exist any more
 on the server (unless you told tomcat / whatever to preserve sessions that
 long ;d).
 But you may be right - maybe the server can check if there is _any_ cookie
 to know the client supports them. When cookies come with the first request,
 it is the same as if it were the nth request in a series - the server can't
 know that. That's what sessions are for ;d

Yes, it just needs to see that there are cookies in the request.
This is enough to know that cookies are enabled and it should write
back a cookie (a new one or the old one if it is still valid).


 wujek

 On Fri, Oct 19, 2012 at 11:10 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 On Fri, Oct 19, 2012 at 11:04 AM, Wujek Srujek wujek.sru...@gmail.com
 wrote:
  This works more or less the following way in servlet containers: when the
  first request comes to the server, it doesn't know if cookies are
 supported
  or not on the client, so it sets both the cookie and appends the
 jsessionid

 I think there is a small optimization here.
 The first request may come with a cookie if it is not yet expired and
 then it will not encode jsessionid in the Url at all.

  thingy that you see. Then, on another request, the container checks
 whether
  a cookie is there, and now it can use the following logic:
  1. the cookie is there: the client sent this cookie, so it supports
 cookies
  - there is no need to append jsessionid every time, so the encodeUrl
  methods don't do it any more
  2. the cookie is not there, but the jsessionid part is - this must be the
  second (or later) requrest, but cookies are not supported by the client -
  encodeUrl will now encode each url you give it to add the jsessionid part
  3. neither the cookie nor the jsessionid part is there - this is the
 first
  request in this session, so maybe create one (depends whether the app
 needs
  one): set the cookie, append jsessionid and send it - this basically
 starts
  the whole process again, when the server got the initial request
 
  Which means: if you disable cookies, your only option is to have
 jsessionid
  encoded in the url. If you disabled cookies, and don't allow jsessionid
 to
  be put (there are filters in SpringSecurity or custom solutions that
 strip
  this) your application basically doesn't allow session tracking, which
  makes it stateless and most of the time pretty much useless except for
  simplest kinds.
 
  As said before, this is all done by the container; Wicket (and all other
  frameworks, for that matter) just use sessions.
 
  wujek
 
 
  On Fri, Oct 19, 2012 at 10:54 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
 
  Hi,
 
  This is done by the web container (Tomcat, Jetty, ...), not by Wicket
  itself.
  See
 
 http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)
 
  On Fri, Oct 19, 2012 at 10:51 AM, Jordi Deu-Pons jo...@jordeu.net
 wrote:
Hi,
  
when cookies are disable Wicket 6 attach the jsessionid in the URL
 like
  this:
  
[app_path];jsessionid=1pwfo2de689mq100bkdc8i4jhy?[app_parameters]
  
I'm having problems with an application that runs behind an apache
  proxy pass.
  
So I wonder if somebody knows,
  
why is not using a normal URL parameter after the question mark?
  
and
  
is it possible to change this behaviour and force wicket to use a
   normal URL parameter?
  
Thanks.
  
   --
   a10! i fins aviat.
   J:-Deu
  
   -
   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
 
 



 --
 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





-- 
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: UrlRenderer renders wrong HTTPS links

2012-10-19 Thread Sven Meier

Hi Dirk

I fixed the problem on master:
https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=ad849602

Could you please try out the change and report back?

Thanks
Sven

On 10/18/2012 02:45 PM, Sven Meier wrote:

UrlRenderer is just preserving protocol and port now.
If the port is wrong in the final URL, it seems HttpsMapper is 
requesting the wrong port.


How do you set up your mappers?

Regards
Sven

On 10/18/2012 02:01 PM, Dirk Forchel wrote:
First of all, sorry for messing up the Core Developer Forum with my 
question

as well.
By the way, have a look at issue
https://issues.apache.org/jira/browse/WICKET-4776 first.
I've adapted the solution to preserve the port and the protocol in the
UrlRender in our UrlRender subclass and at the first glance it might 
work.

On my local developer machine running our webapplication on a Tomcat
webserver the generated links to secure pages seem to be correct, e.g.
requesting the Home Page Url http://localhost:8080/home.html now 
contains
links to secure pages like https://localhost:8443/account.html with 
correct

Urls.
But running the same application on a Tomcat server with an Apache Http
Server (with an AJP connector and the default ports 80/443) results 
in wrong

rendered Https links.
The Home Page with the Url http://domainname.com/home.html now 
contains the

wrong link https://domainname.com:80/account.html.
I reckon the preserved Http port (Http port 80) leads to this 
problem. I'm
not sure, whether a prober solution would be to check the HTTP header 
first.

If the HTTP header contains a port, preserve it, otherwise not.

In addition: I could figure out, that on my local machine, the preserved
values for protocol and port are 'https' and '8443' which is correct, 
but on
the system with the Apache webserver and Tomcat the values are 
'https' and
'null'. With these values, the method resolvePort(Url) returns the 
value for

fallback2, which is '80' and not the right one.
Why is the preserved value 'null'?

@Override
 public String renderUrl(final Url url)
 {
 final String renderedUrl;
 if (shouldRenderAsFull(url))
 {
 if (url.isAbsolute()==false)
 {
 // relative Url
 String relativeUrl = 
renderRelativeUrl(url);

 Url relative = Url.parse(relativeUrl,
url.getCharset());
 // intermediate relative url is 
missing port

and protocol preserve it
 // see
https://issues.apache.org/jira/browse/WICKET-4776
 LOGGER.debug( Preserve Protocol: {} 
Port:

{} , url.getProtocol(), url.getPort());
relative.setPort(url.getPort());
relative.setProtocol(url.getProtocol());
 renderedUrl = renderFullUrl(relative);
 LOGGER.debug( Relative render as full
renderedUrl: {} = {}, url, renderedUrl );
 }
 else
 {
 renderedUrl = renderFullUrl(url);
 LOGGER.debug( Absolute render as full
renderedUrl: {} = {}, url, renderedUrl );
 }
 }
 else
 {
 renderedUrl = renderRelativeUrl(url);
 LOGGER.debug( Relative renderedUrl: {} = 
{},url,

renderedUrl );
 }
 return renderedUrl;
 }

 @Override
 protected Integer resolvePort(final Url url)
 {
 LOGGER.info( Resolve Port: +url.getPort()+ Base Url:
+getBaseUrl().getPort()+ ClientUrl: 
+request.getClientUrl().getPort() );

 return choose(url.getPort(), getBaseUrl().getPort(),
request.getClientUrl().getPort());
 }




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/UrlRenderer-renders-wrong-HTTPS-links-tp4653059.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




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



Re: UrlRenderer renders wrong HTTPS links

2012-10-19 Thread Dirk Forchel
Okay, I'll try out the change in a couple of minutes and give you a feedback.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/UrlRenderer-renders-wrong-HTTPS-links-tp4653059p4653100.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: ResourceReference wont be created

2012-10-19 Thread Martin Grigorov
There is no such resource in
http://central.maven.org/maven2/org/wicketstuff/wicketstuff-inmethod-grid/1.5.8/wicketstuff-inmethod-grid-1.5.8.jar
Check in Git logs what have happened with it.

It could be that your style.css have a relative url to it.

On Fri, Oct 19, 2012 at 1:13 PM, Chris Colman
chr...@stepaheadsoftware.com wrote:
 Since a recent update to latest 1.5 code from github I now get this when
 using the inmethod-grid:

 WARN  - ResourceReferenceRegistry  - A ResourceReference wont be created
 for a resource with key [scope: com.inmethod.grid.common.AbstractGrid;
 name: res/wicket-logo.png; locale: null; style: null; variation: null]
 because it cannot be located.

 I immediately updated inmethod to the latest source and rebuilt it but
 the warning still appears.

 Any idea what change could have caused this or what I might need to do
 to resolve it?

 Regards,
 Chris



-- 
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: UrlRenderer renders wrong HTTPS links

2012-10-19 Thread Dirk Forchel
Hi Sven,
it works!!! Yep. You safed my day ... almost ;-)
Dirk



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/UrlRenderer-renders-wrong-HTTPS-links-tp4653059p4653104.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: Load table rows lazy when click browser scrollbar

2012-10-19 Thread vineet semwal
you are welcome..
sorry for the delay ,i made some improvements in the internal in last few days.
i have also added the scroll behaviors for 1.5 today and their corresponding
examples.i have created new tags 1.5.8.1 and 6.1.1 today.
you can download from the below link
https://github.com/vineetsemwal/quickview/tags
martin-g has already told you but i am repeating again to avoid any confusion
for you .
every version of quickview package depends on the same version of wicket
mostly.

quickview 1.5.8.1 depends on wicket 1.5.8(because there is no wicket 1.5.8.1)
quickview 6.1.1depends  on wicket 6.1.1

since you are on wicket 1.5.6 ,i recommend you to at least upgrade to 1.5.8
to use quickview.

On Tue, Oct 16, 2012 at 2:25 PM, steven.li steven...@skyworthglobal.com wrote:
 Thank you very much !



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Load-table-rows-lazy-when-click-browser-scrollbar-tp4652541p4653003.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




-- 
regards,

Vineet Semwal

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



Re: Netbeans + Wicket 6 + Atmosphere

2012-10-19 Thread Mats
I'm still struggeling with this...

First I got this runtime error:
/java.lang.NoClassDefFoundError: com/google/common/collect/Multimap/
I have tried to include all 6.1.1 jars in the project (instead of 1.6.0
provided by the NetBeans plugin). I have also tried to include only the
needed jars. I guess something still is missing on the server side when I
deploy... Or is it the xml configuration files below that is wrong...

There is probably something wrong with my /web.xml /and /atmosphere.xml/...
Can anyone see if something is obvious wrong?
atmosphere.xml
http://apache-wicket.1842946.n4.nabble.com/file/n4653106/atmosphere.xml  
web.xml http://apache-wicket.1842946.n4.nabble.com/file/n4653106/web.xml  

Please someone...

(Probably I'm beeing to stupid to get some help here, or I'm being to
unprecise when asking for help. All answers in simular threads just points
out that it is just to look into the examples. Well, I have tried to do
that... I probably would need a basic working atmosphere NetBeans project to
start with...)



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Netbeans-Wicket-6-Atmosphere-tp4653055p4653106.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: Netbeans + Wicket 6 + Atmosphere

2012-10-19 Thread Martin Grigorov
Hi,

Do you really need the NetBeans plugin for Wicket ?
It looks like you don't know very well your IDE, so you better drop
this plugin altogether.

Here is a quickstart: https://github.com/papegaaij/wicket-atmosphere-quickstart

Just load it in NetBeans as you load any other Maven based project.

On Fri, Oct 19, 2012 at 2:40 PM, Mats mats.gudmunds...@delaval.com wrote:
 I'm still struggeling with this...

 First I got this runtime error:
 /java.lang.NoClassDefFoundError: com/google/common/collect/Multimap/
 I have tried to include all 6.1.1 jars in the project (instead of 1.6.0
 provided by the NetBeans plugin). I have also tried to include only the
 needed jars. I guess something still is missing on the server side when I
 deploy... Or is it the xml configuration files below that is wrong...

 There is probably something wrong with my /web.xml /and /atmosphere.xml/...
 Can anyone see if something is obvious wrong?
 atmosphere.xml
 http://apache-wicket.1842946.n4.nabble.com/file/n4653106/atmosphere.xml
 web.xml http://apache-wicket.1842946.n4.nabble.com/file/n4653106/web.xml

 Please someone...

 (Probably I'm beeing to stupid to get some help here, or I'm being to
 unprecise when asking for help. All answers in simular threads just points
 out that it is just to look into the examples. Well, I have tried to do
 that... I probably would need a basic working atmosphere NetBeans project to
 start with...)



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Netbeans-Wicket-6-Atmosphere-tp4653055p4653106.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



modal window before submitting ajax-less form

2012-10-19 Thread lukuperman
Hi.
I need guidance on how to achieve the following: there is a page in my
application that has a StatelessForm with several Checks. The checks allow
to select rows in a table to be deleted when the form is submitted. Now the
customer had requested to have another button that when clicked, a modal
should appear letting the user add some input (select a dropdown option for
example) and then the form be submitted. That input is to be applied to the
selected rows, so I need the checks, which makes me think I need to submit
the form when closing the modal. I don't know how should I:
- 'pass' the dropdown option selected from the modal to its containing page
- programatically submit the statelessform when closing the modal

Any guidance would be appreciated.

Lucas Kuperman



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/modal-window-before-submitting-ajax-less-form-tp4653108.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: Netbeans + Wicket 6 + Atmosphere

2012-10-19 Thread Mats
Thanks,

No problem to just open and build.

To run it seems not working direct

First I had to remove the line
async-supportedtrue/async-supported
from the web.xml file since it was not recognized

Then I get a bit further...

INFO: Running GlassFish Version: GlassFish Server Open Source Edition 3.1.2
(build 23)
INFO: Grizzly Framework 1.9.46 started in: 72ms - bound to [0.0.0.0:8080]
INFO: Grizzly Framework 1.9.46 started in: 28ms - bound to [0.0.0.0:8181]
INFO: Grizzly Framework 1.9.46 started in: 15ms - bound to [0.0.0.0:4848]
INFO: Grizzly Framework 1.9.46 started in: 11ms - bound to [0.0.0.0:3700]
INFO: Grizzly Framework 1.9.46 started in: 15ms - bound to [0.0.0.0:7676]
INFO: The Admin Console is already installed, but not yet loaded.
INFO: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy
for persistence-type = replicated in BackingStoreFactoryRegistry
INFO: SEC1002: Security Manager is OFF.
INFO: SEC1010: Entering Security Startup Service
INFO: SEC1143: Loading policy provider
com.sun.enterprise.security.provider.PolicyWrapper.
INFO: SEC1115: Realm [admin-realm] of classtype
[com.sun.enterprise.security.auth.realm.file.FileRealm] successfully
created.
INFO: SEC1115: Realm [file] of classtype
[com.sun.enterprise.security.auth.realm.file.FileRealm] successfully
created.
INFO: SEC1115: Realm [certificate] of classtype
[com.sun.enterprise.security.auth.realm.certificate.CertificateRealm]
successfully created.
INFO: SEC1011: Security Service(s) Started Successfully
INFO: WEB0169: Created HTTP listener [http-listener-1] on host/port
[0.0.0.0:8080]
INFO: WEB0169: Created HTTP listener [http-listener-2] on host/port
[0.0.0.0:8181]
INFO: WEB0169: Created HTTP listener [admin-listener] on host/port
[0.0.0.0:4848]
INFO: WEB0171: Created virtual server [server]
INFO: WEB0171: Created virtual server [__asadmin]
INFO: WEB0172: Virtual server [server] loaded default web module []
INFO: INFO  - AtmosphereFramework- Installed AtmosphereHandler
ReflectorServletProcessor mapped to context-path: /*

INFO: INFO  - AtmosphereFramework- Auto detecting WebSocketHandler
in /WEB-INF/classes/

INFO: INFO  - AtmosphereFramework- Atmosphere is using async
support: org.atmosphere.container.GlassFishWebSocketSupport running under
container: GlassFish Server Open Source Edition 3.1.2 with WebSocket
enabled.

INFO: INFO  - AtmosphereFramework- Installed WebSocketProtocol
org.atmosphere.websocket.protocol.EchoProtocol 

INFO: INFO  - ReflectorServletProcessor  - Installing Servlet null

INFO: INFO  - ReflectorServletProcessor  - Installing Filter
com.mycompany.WicketApplication

INFO: INFO  - Application- [com.mycompany.WicketApplication]
init: Wicket core library initializer

INFO: INFO  - RequestListenerInterface   - registered listener interface
[RequestListenerInterface name=IBehaviorListener, method=public abstract
void org.apache.wicket.behavior.IBehaviorListener.onRequest()]

INFO: INFO  - RequestListenerInterface   - registered listener interface
[RequestListenerInterface name=IFormSubmitListener, method=public abstract
void
org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]

INFO: INFO  - RequestListenerInterface   - registered listener interface
[RequestListenerInterface name=ILinkListener, method=public abstract void
org.apache.wicket.markup.html.link.ILinkListener.onLinkClicked()]

INFO: INFO  - RequestListenerInterface   - registered listener interface
[RequestListenerInterface name=IOnChangeListener, method=public abstract
void
org.apache.wicket.markup.html.form.IOnChangeListener.onSelectionChanged()]

INFO: INFO  - RequestListenerInterface   - registered listener interface
[RequestListenerInterface name=IRedirectListener, method=public abstract
void org.apache.wicket.IRedirectListener.onRedirect()]

INFO: INFO  - RequestListenerInterface   - registered listener interface
[RequestListenerInterface name=IResourceListener, method=public abstract
void org.apache.wicket.IResourceListener.onResourceRequested()]

INFO: INFO  - WebApplication - [com.mycompany.WicketApplication]
Started Wicket version 6.0.0 in DEVELOPMENT mode

SEVERE: 
*** WARNING: Wicket is running in DEVELOPMENT mode.  ***
***   ^^^***
*** Do NOT deploy to your live server(s) without changing this.  ***
*** See Application#getConfigurationType() for more information. ***


INFO: INFO  - AtmosphereFramework- Installed Default
AtmosphereInterceptor [Android Interceptor Support, SSE Interceptor Support,
JSONP Interceptor Support]. Set
org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults in your xml to
disable them.

INFO: WARN  - AtmosphereFramework- No BroadcasterCache configured.
Broadcasted message between client reconnection will be 

Re: Unit testing with Spring injected Application

2012-10-19 Thread Nick Pratt
Ill finish that email now...

Im running in to a problem with unit tests when I inject my Application:


@ContextConfiguration( classpath:junit-web-context.xml )

 @TransactionConfiguration( transactionManager = txManager )
 public class CreateFirstUserPageTest extends
 AbstractJUnit4SpringContextTests
 {
 @Autowired
 private MyApplication app;
 private WicketTester tester;
  @Autowired
 private UserRepository userRepo;


  @Before
 public void setUp()
 {
  tester = new WicketTester( app );
 }

 test cases here

}

When I run a single test case, everything works fine.  When I run  1, I
hit this:
java.lang.IllegalStateException: Application name can only be set once.

How do people resolve this?

Ive tried destroying the application in a tearDown method, and while the
internal applicationKeyToApplication map gets cleaned up (along with
everything else), Application.name remains set, and cant be set again on
the 2nd test execution.  Is there a better way?

Nick


Re: Behavior modifying component body

2012-10-19 Thread Sven Meier
Why should we introduce a new API to just render *before* and *after* 
the body?
AbstractTransformerBehavior offers a solution for this and allows you to 
do even more with the body.


Best regards
Sven

On 10/19/2012 11:19 AM, Martin Grigorov wrote:

Another way is by using BorderBehavior.
See org.apache.wicket.examples.forminput.BeforeAndAfterBorder for an example.
The drawback here is that you will need an additional .java + .html
pair for each icon type and you'll need to apply it on the
Link/Button's label, so you cannot use AbstractLink#setBody(IModel)
:-/

On Fri, Oct 19, 2012 at 9:37 AM, Martin Grigorov mgrigo...@apache.org wrote:

Hi Jesse,

I see what you mean and I agree it will work and will be a simple
solution for such requirements.
My only concern is that the API of Behavior becomes bigger and
component rendering will do some more things. Most of the time these
methods will do nothing.

Have you considered using
org.apache.wicket.markup.transformer.AbstractTransformerBehavior for
this ?
I see how this is more cumbersome too:
- you will need to inject some markup in another markup
- you will need to add two behaviors to the component (I guess you use
ButtonBehavior from wicket-bootstrap already)

P.S. I've included dev@ so more Wicket devs can give their opinion on this.

On Thu, Oct 18, 2012 at 11:27 PM, Jesse Long j...@unknown.za.net wrote:

Hi Wicket Community,

I would like to modify the body of a Component from a Behavior.
Specifically, I want to add:

i class=icon icon-calendar/i

To the beginning of the of the body of a link, eg:

a href=#[here] Some other body/a

I dont want to extend AbstractLink etc, I want to add this functionality as
a Behavior.

I cannot see a way to do this without modifying Behavior and Component. Am I
missing something? Is there a way I can do this without patching the code?

If not, if we must modify the code, how about the patch at the bottom of
this mail?

1. Behavior gets two new methods, onBeforeComponentTagBody and
onAfterComponentTagBody, similar to onComponentTag.
2. These new methods take a ComponentTag argument. Is it conceivable
that the behavior will need to mess around with the ComponentTag,
especially after renderComponentTag is already called?
3. The Behavior does not get the MarkupStream, because I image we dont
want the Behavior messing around with it?
4. I think its pretty safe to implement these calles in
Component#internalRenderComponent. It is usually called from
onRender(), and pretty much everything that overrides onRender calls
it. Right?
5. #internalRenderComponent calls onComponentTagBody inside a if
(tag.isOpen()){} block. Immediately there after, it closes the tag
in a separate if (tag.isOpen()){} block. This seems to insinuate
that there is a possibility of onComponentTagBody modifying the
ComponentTag in some way, possibly leaving is not open. I dont think
that that should happen, but if it does it could make the calls to
Bahavior#onAfterComponentTagBody invalid, especially if
Behavior#onAfterComponentTagBody appends HTML to the response. Thoughts?
6. I call Behaviour#onAfterComponentTagBody on the behaviors in reverse
order, so that we can have multiple behaviors that add content
before (open tag) and after (close tag) the body. It should be noted
that Component#notifyBehaviorsComponentRendered() does not do this,
which may lead to problems if the behaviors add content before and
after the component.

Thanks,
Jesse


diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java
b/wicket-core/src/main/java/org/apache/wicket/Component.java
index 26bd055..9495dae 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Iterator;
  import java.util.List;
+import java.util.ListIterator;
  import java.util.Locale;

  import org.apache.wicket.ajax.IAjaxRegionMarkupIdProvider;
@@ -2530,9 +2531,27 @@ public abstract class Component
  // Render the body only if open-body-close. Do not render if
open-close.
  if (tag.isOpen())
  {
+for (Behavior b : getBehaviors())
+{
+if (isBehaviorAccepted(b))
+{
+b.onBeforeComponentTagBody(this, tag);
+}
+}
+
  // Render the body. The default strategy will simply call
the component's
  // onComponentTagBody() implementation.
getMarkupSourcingStrategy().onComponentTagBody(this, markupStream, tag);
+
+ListIterator? extends Behavior it =
getBehaviors().listIterator();
+while (it.hasPrevious())
+{
+Behavior b = it.previous();
+if (isBehaviorAccepted(b))
+  

Re: Unit testing with Spring injected Application

2012-10-19 Thread Sven Meier
Wicket tester assignes a unique name to the wicket application, thus it 
cannot be reused:


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

You can put @DirtiesContext on your test methods.

Sven

On 10/19/2012 03:46 PM, Nick Pratt wrote:

java.lang.IllegalStateException: Application name can only be set once.



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



Re: modal window before submitting ajax-less form

2012-10-19 Thread Sven Meier
You could include the form components in the stateless form, just hiding 
them with CSS.
Then just show them via javascript (let it look like a modal window if 
required).


Sven


On 10/19/2012 03:13 PM, lukuperman wrote:

Hi.
I need guidance on how to achieve the following: there is a page in my
application that has a StatelessForm with several Checks. The checks allow
to select rows in a table to be deleted when the form is submitted. Now the
customer had requested to have another button that when clicked, a modal
should appear letting the user add some input (select a dropdown option for
example) and then the form be submitted. That input is to be applied to the
selected rows, so I need the checks, which makes me think I need to submit
the form when closing the modal. I don't know how should I:
- 'pass' the dropdown option selected from the modal to its containing page
- programatically submit the statelessform when closing the modal

Any guidance would be appreciated.

Lucas Kuperman



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/modal-window-before-submitting-ajax-less-form-tp4653108.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: Unit testing with Spring injected Application

2012-10-19 Thread Nick Pratt
No other way? Destroying the context and recreating for every unit test
really slows things down.

I guess I can manually set the various Beans inside of my Application
(assuming I instantiate the App, rather than letting Spring create it for
me)

N

On Fri, Oct 19, 2012 at 10:06 AM, Sven Meier s...@meiers.net wrote:

 Wicket tester assignes a unique name to the wicket application, thus it
 cannot be reused:

 
 https://issues.apache.org/**jira/browse/WICKET-4712https://issues.apache.org/jira/browse/WICKET-4712

 You can put @DirtiesContext on your test methods.

 Sven

 On 10/19/2012 03:46 PM, Nick Pratt wrote:

 java.lang.**IllegalStateException: Application name can only be set once.



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




Re: modal window before submitting ajax-less form

2012-10-19 Thread lukuperman
Thanks Sven, I'll have that in mind. 
Do you think there are other options? It sounds to me I would not be
exploiting the framework too much in that case (I would have to take care of
the hiding, modal-like appearance, etc?). Thanks

Lucas Kuperman



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/modal-window-before-submitting-ajax-less-form-tp4653108p4653116.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 before submitting ajax-less form

2012-10-19 Thread Sven Meier

Occasionally it's better to do some things on the client side only.

IMHO this is the easiest solution for a stateless form.

Sven

On 10/19/2012 04:18 PM, lukuperman wrote:

Thanks Sven, I'll have that in mind.
Do you think there are other options? It sounds to me I would not be
exploiting the framework too much in that case (I would have to take care of
the hiding, modal-like appearance, etc?). Thanks

Lucas Kuperman



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/modal-window-before-submitting-ajax-less-form-tp4653108p4653116.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: Unit testing with Spring injected Application

2012-10-19 Thread Sven Meier

There's a FIXME in BaseWicketTester's constructor.

Perhaps you can suggest a better solution?

Sven

On 10/19/2012 04:11 PM, Nick Pratt wrote:

No other way? Destroying the context and recreating for every unit test
really slows things down.

I guess I can manually set the various Beans inside of my Application
(assuming I instantiate the App, rather than letting Spring create it for
me)

N

On Fri, Oct 19, 2012 at 10:06 AM, Sven Meier s...@meiers.net wrote:


Wicket tester assignes a unique name to the wicket application, thus it
cannot be reused:

 
https://issues.apache.org/**jira/browse/WICKET-4712https://issues.apache.org/jira/browse/WICKET-4712

You can put @DirtiesContext on your test methods.

Sven

On 10/19/2012 03:46 PM, Nick Pratt wrote:


java.lang.**IllegalStateException: Application name can only be set once.



--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.orgusers-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: Unit testing with Spring injected Application

2012-10-19 Thread Nick Pratt
So I dug around for a while, and this is what I came up with (that doesn't
involve destroying the context after every test method via @DirtiesContext):

@Before
 public void setUp()
{
 MyApp application = new MyApp();
// applicationContext is injected by Spring as my test class
extends AbstractJUnit4SpringContextTests
 AutowireCapableBeanFactory autowireCapableBeanFactory = *applicationContext
*.getAutowireCapableBeanFactory();
 autowireCapableBeanFactory.autowireBeanProperties( application,
AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, false );
 *tester* = new WicketTester( application );
}

Since MyApp contains a few injected beans, I'd like Spring to set them up
for me. However, I need to create a new Wicket Application for every test
(so I dont run in to the 'name' already set problem).  If you create new
MyApp(), this is typically outside of Spring's control, so none of your
properties will be set etc.  The code above allows me to create a new
Application for every test, and have Spring inject all the required beans
(authentication, authorization, config etc.) in to my Wicket Application.

This approach (vs @DirtiesContext) improves test execution time  40% on my
test suite, and I'd expect that to improve as I add more tests.

Hope this helps.

N


On Fri, Oct 19, 2012 at 10:11 AM, Nick Pratt nbpr...@gmail.com wrote:

 No other way? Destroying the context and recreating for every unit test
 really slows things down.

 I guess I can manually set the various Beans inside of my Application
 (assuming I instantiate the App, rather than letting Spring create it for
 me)

 N

 On Fri, Oct 19, 2012 at 10:06 AM, Sven Meier s...@meiers.net wrote:

 Wicket tester assignes a unique name to the wicket application, thus it
 cannot be reused:

 
 https://issues.apache.org/**jira/browse/WICKET-4712https://issues.apache.org/jira/browse/WICKET-4712

 You can put @DirtiesContext on your test methods.

 Sven

 On 10/19/2012 03:46 PM, Nick Pratt wrote:

 java.lang.**IllegalStateException: Application name can only be set
 once.



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





Re: Behavior modifying component body

2012-10-19 Thread Jesse Long

Hi Martin, Sven,

Thank you both for your feedback.

I had not tried AbstractTransformerBehavior because I didn't know about 
it, and because when I looked at the Behavior API it was clear that 
there was no way for any Behavior to modify ONLY the body.


Having said that, I have done some tests with 
AbstractTransformingBehavior. The problem with it is that it gives me 
the the output for the whole component, not just the body. I would still 
need to parse that output in order to insert content into the body, but 
it is workable.


I can solve my problem by parsing the output with 
AbstractTransformingBehavior and inserting some html after the opening tag.


Thanks again for your feedback,
Jesse

On 19/10/2012 15:56, Sven Meier wrote:
Why should we introduce a new API to just render *before* and *after* 
the body?
AbstractTransformerBehavior offers a solution for this and allows you 
to do even more with the body.


Best regards
Sven

On 10/19/2012 11:19 AM, Martin Grigorov wrote:

Another way is by using BorderBehavior.
See org.apache.wicket.examples.forminput.BeforeAndAfterBorder for an 
example.

The drawback here is that you will need an additional .java + .html
pair for each icon type and you'll need to apply it on the
Link/Button's label, so you cannot use AbstractLink#setBody(IModel)
:-/

On Fri, Oct 19, 2012 at 9:37 AM, Martin Grigorov 
mgrigo...@apache.org wrote:

Hi Jesse,

I see what you mean and I agree it will work and will be a simple
solution for such requirements.
My only concern is that the API of Behavior becomes bigger and
component rendering will do some more things. Most of the time these
methods will do nothing.

Have you considered using
org.apache.wicket.markup.transformer.AbstractTransformerBehavior for
this ?
I see how this is more cumbersome too:
- you will need to inject some markup in another markup
- you will need to add two behaviors to the component (I guess you use
ButtonBehavior from wicket-bootstrap already)

P.S. I've included dev@ so more Wicket devs can give their opinion 
on this.


On Thu, Oct 18, 2012 at 11:27 PM, Jesse Long j...@unknown.za.net 
wrote:

Hi Wicket Community,

I would like to modify the body of a Component from a Behavior.
Specifically, I want to add:

i class=icon icon-calendar/i

To the beginning of the of the body of a link, eg:

a href=#[here] Some other body/a

I dont want to extend AbstractLink etc, I want to add this 
functionality as

a Behavior.

I cannot see a way to do this without modifying Behavior and 
Component. Am I
missing something? Is there a way I can do this without patching 
the code?


If not, if we must modify the code, how about the patch at the 
bottom of

this mail?

1. Behavior gets two new methods, onBeforeComponentTagBody and
onAfterComponentTagBody, similar to onComponentTag.
2. These new methods take a ComponentTag argument. Is it conceivable
that the behavior will need to mess around with the ComponentTag,
especially after renderComponentTag is already called?
3. The Behavior does not get the MarkupStream, because I image we dont
want the Behavior messing around with it?
4. I think its pretty safe to implement these calles in
Component#internalRenderComponent. It is usually called from
onRender(), and pretty much everything that overrides onRender 
calls

it. Right?
5. #internalRenderComponent calls onComponentTagBody inside a if
(tag.isOpen()){} block. Immediately there after, it closes the tag
in a separate if (tag.isOpen()){} block. This seems to insinuate
that there is a possibility of onComponentTagBody modifying the
ComponentTag in some way, possibly leaving is not open. I dont 
think

that that should happen, but if it does it could make the calls to
Bahavior#onAfterComponentTagBody invalid, especially if
Behavior#onAfterComponentTagBody appends HTML to the response. 
Thoughts?
6. I call Behaviour#onAfterComponentTagBody on the behaviors in 
reverse

order, so that we can have multiple behaviors that add content
before (open tag) and after (close tag) the body. It should be 
noted
that Component#notifyBehaviorsComponentRendered() does not do 
this,

which may lead to problems if the behaviors add content before and
after the component.

Thanks,
Jesse


diff --git 
a/wicket-core/src/main/java/org/apache/wicket/Component.java

b/wicket-core/src/main/java/org/apache/wicket/Component.java
index 26bd055..9495dae 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Iterator;
  import java.util.List;
+import java.util.ListIterator;
  import java.util.Locale;

  import org.apache.wicket.ajax.IAjaxRegionMarkupIdProvider;
@@ -2530,9 +2531,27 @@ public abstract class Component
  // Render the body only if open-body-close. Do not 
render if

open-close.
 

Migration from 1.5.8 to 6.1

2012-10-19 Thread Marco Di Sabatino Di Diodoro
Hi all,  

How can i convert this code into wicket 6.1. 

   item.add(new AjaxDecoratedCheckbox(toRemove, new 
ModelBoolean(Boolean.FALSE)) {

 @Override
 protected void onUpdate(final AjaxRequestTarget target) {
entityTO.getDerivedAttributes().remove(attributeTO);
target.add(attributesContainer);
}

 @Override
  protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) 
{

 @Override
 public CharSequence preDecorateScript(final CharSequence script) {
 return if (confirm(' + getString(confirmDelete) + ')) + { + 
script + } 
 + else {this.checked = false;};
}
};
 }
 });

I see the migration doc, but i not found a solution.

Thanks
M


--

Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PPMC Member
http://people.apache.org/~mdisabatino






wicket-tree with two Hibernate entities

2012-10-19 Thread Sandor Feher
Hi,

I dig myself into wicket-tree. 

I store my files in an entity by categories. Categories listed in another
entity. I would like the files get listed by category in a TableTree.
Nothing tricky just two levels. Roots are the categories, children are files
belong to categories.
As I followed the examples realized that the listed items belongs to the
same class. Should I create a helper class based on a view  ?  
I would like to find the best approach if possible.


thnx., Sandor



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-tree-with-two-Hibernate-entities-tp4653122.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: Unit testing with Spring injected Application

2012-10-19 Thread Sven Meier

Hope this helps.

Thanks.
Sven


On 10/19/2012 04:41 PM, Nick Pratt wrote:

So I dug around for a while, and this is what I came up with (that doesn't
involve destroying the context after every test method via @DirtiesContext):

@Before
  public void setUp()
{
  MyApp application = new MyApp();
// applicationContext is injected by Spring as my test class
extends AbstractJUnit4SpringContextTests
  AutowireCapableBeanFactory autowireCapableBeanFactory = *applicationContext
*.getAutowireCapableBeanFactory();
  autowireCapableBeanFactory.autowireBeanProperties( application,
AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, false );
  *tester* = new WicketTester( application );
}

Since MyApp contains a few injected beans, I'd like Spring to set them up
for me. However, I need to create a new Wicket Application for every test
(so I dont run in to the 'name' already set problem).  If you create new
MyApp(), this is typically outside of Spring's control, so none of your
properties will be set etc.  The code above allows me to create a new
Application for every test, and have Spring inject all the required beans
(authentication, authorization, config etc.) in to my Wicket Application.

This approach (vs @DirtiesContext) improves test execution time  40% on my
test suite, and I'd expect that to improve as I add more tests.

Hope this helps.

N


On Fri, Oct 19, 2012 at 10:11 AM, Nick Pratt nbpr...@gmail.com wrote:


No other way? Destroying the context and recreating for every unit test
really slows things down.

I guess I can manually set the various Beans inside of my Application
(assuming I instantiate the App, rather than letting Spring create it for
me)

N

On Fri, Oct 19, 2012 at 10:06 AM, Sven Meier s...@meiers.net wrote:


Wicket tester assignes a unique name to the wicket application, thus it
cannot be reused:

 
https://issues.apache.org/**jira/browse/WICKET-4712https://issues.apache.org/jira/browse/WICKET-4712

You can put @DirtiesContext on your test methods.

Sven

On 10/19/2012 03:46 PM, Nick Pratt wrote:


java.lang.**IllegalStateException: Application name can only be set
once.



--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.orgusers-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: Unit testing with Spring injected Application

2012-10-19 Thread Sven Meier

Hope this helps.

Thanks.
Sven


On 10/19/2012 04:41 PM, Nick Pratt wrote:

So I dug around for a while, and this is what I came up with (that doesn't
involve destroying the context after every test method via @DirtiesContext):

@Before
  public void setUp()
{
  MyApp application = new MyApp();
// applicationContext is injected by Spring as my test class
extends AbstractJUnit4SpringContextTests
  AutowireCapableBeanFactory autowireCapableBeanFactory = *applicationContext
*.getAutowireCapableBeanFactory();
  autowireCapableBeanFactory.autowireBeanProperties( application,
AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, false );
  *tester* = new WicketTester( application );
}

Since MyApp contains a few injected beans, I'd like Spring to set them up
for me. However, I need to create a new Wicket Application for every test
(so I dont run in to the 'name' already set problem).  If you create new
MyApp(), this is typically outside of Spring's control, so none of your
properties will be set etc.  The code above allows me to create a new
Application for every test, and have Spring inject all the required beans
(authentication, authorization, config etc.) in to my Wicket Application.

This approach (vs @DirtiesContext) improves test execution time  40% on my
test suite, and I'd expect that to improve as I add more tests.

Hope this helps.

N


On Fri, Oct 19, 2012 at 10:11 AM, Nick Pratt nbpr...@gmail.com wrote:


No other way? Destroying the context and recreating for every unit test
really slows things down.

I guess I can manually set the various Beans inside of my Application
(assuming I instantiate the App, rather than letting Spring create it for
me)

N

On Fri, Oct 19, 2012 at 10:06 AM, Sven Meier s...@meiers.net wrote:


Wicket tester assignes a unique name to the wicket application, thus it
cannot be reused:

 
https://issues.apache.org/**jira/browse/WICKET-4712https://issues.apache.org/jira/browse/WICKET-4712

You can put @DirtiesContext on your test methods.

Sven

On 10/19/2012 03:46 PM, Nick Pratt wrote:


java.lang.**IllegalStateException: Application name can only be set
once.



--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.orgusers-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: Behavior modifying component body

2012-10-19 Thread Sven Meier
 AbstractTransformingBehavior ... gives me the the output for the 
whole component, not just the body


Oh, I didn't think of that.

 I would still need to parse that output

I agree that this is not so nice :/.

Sven


On 10/19/2012 05:15 PM, Jesse Long wrote:

Hi Martin, Sven,

Thank you both for your feedback.

I had not tried AbstractTransformerBehavior because I didn't know 
about it, and because when I looked at the Behavior API it was clear 
that there was no way for any Behavior to modify ONLY the body.


Having said that, I have done some tests with 
AbstractTransformingBehavior. The problem with it is that it gives me 
the the output for the whole component, not just the body. I would 
still need to parse that output in order to insert content into the 
body, but it is workable.


I can solve my problem by parsing the output with 
AbstractTransformingBehavior and inserting some html after the opening 
tag.


Thanks again for your feedback,
Jesse

On 19/10/2012 15:56, Sven Meier wrote:
Why should we introduce a new API to just render *before* and *after* 
the body?
AbstractTransformerBehavior offers a solution for this and allows you 
to do even more with the body.


Best regards
Sven

On 10/19/2012 11:19 AM, Martin Grigorov wrote:

Another way is by using BorderBehavior.
See org.apache.wicket.examples.forminput.BeforeAndAfterBorder for an 
example.

The drawback here is that you will need an additional .java + .html
pair for each icon type and you'll need to apply it on the
Link/Button's label, so you cannot use AbstractLink#setBody(IModel)
:-/

On Fri, Oct 19, 2012 at 9:37 AM, Martin Grigorov 
mgrigo...@apache.org wrote:

Hi Jesse,

I see what you mean and I agree it will work and will be a simple
solution for such requirements.
My only concern is that the API of Behavior becomes bigger and
component rendering will do some more things. Most of the time these
methods will do nothing.

Have you considered using
org.apache.wicket.markup.transformer.AbstractTransformerBehavior for
this ?
I see how this is more cumbersome too:
- you will need to inject some markup in another markup
- you will need to add two behaviors to the component (I guess you use
ButtonBehavior from wicket-bootstrap already)

P.S. I've included dev@ so more Wicket devs can give their opinion 
on this.


On Thu, Oct 18, 2012 at 11:27 PM, Jesse Long j...@unknown.za.net 
wrote:

Hi Wicket Community,

I would like to modify the body of a Component from a Behavior.
Specifically, I want to add:

i class=icon icon-calendar/i

To the beginning of the of the body of a link, eg:

a href=#[here] Some other body/a

I dont want to extend AbstractLink etc, I want to add this 
functionality as

a Behavior.

I cannot see a way to do this without modifying Behavior and 
Component. Am I
missing something? Is there a way I can do this without patching 
the code?


If not, if we must modify the code, how about the patch at the 
bottom of

this mail?

1. Behavior gets two new methods, onBeforeComponentTagBody and
onAfterComponentTagBody, similar to onComponentTag.
2. These new methods take a ComponentTag argument. Is it conceivable
that the behavior will need to mess around with the ComponentTag,
especially after renderComponentTag is already called?
3. The Behavior does not get the MarkupStream, because I image we 
dont

want the Behavior messing around with it?
4. I think its pretty safe to implement these calles in
Component#internalRenderComponent. It is usually called from
onRender(), and pretty much everything that overrides onRender 
calls

it. Right?
5. #internalRenderComponent calls onComponentTagBody inside a if
(tag.isOpen()){} block. Immediately there after, it closes the 
tag

in a separate if (tag.isOpen()){} block. This seems to insinuate
that there is a possibility of onComponentTagBody modifying the
ComponentTag in some way, possibly leaving is not open. I dont 
think
that that should happen, but if it does it could make the 
calls to

Bahavior#onAfterComponentTagBody invalid, especially if
Behavior#onAfterComponentTagBody appends HTML to the response. 
Thoughts?
6. I call Behaviour#onAfterComponentTagBody on the behaviors in 
reverse

order, so that we can have multiple behaviors that add content
before (open tag) and after (close tag) the body. It should be 
noted
that Component#notifyBehaviorsComponentRendered() does not do 
this,
which may lead to problems if the behaviors add content before 
and

after the component.

Thanks,
Jesse


diff --git 
a/wicket-core/src/main/java/org/apache/wicket/Component.java

b/wicket-core/src/main/java/org/apache/wicket/Component.java
index 26bd055..9495dae 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Iterator;
  import java.util.List;

Re: wicket-tree with two Hibernate entities

2012-10-19 Thread Sven Meier
Either you have a common super-class already or just use 
ITreeProviderObject.


Introducing a helper class might save you some instanceof checks though.

Sven


On 10/19/2012 05:18 PM, Sandor Feher wrote:

Hi,

I dig myself into wicket-tree.

I store my files in an entity by categories. Categories listed in another
entity. I would like the files get listed by category in a TableTree.
Nothing tricky just two levels. Roots are the categories, children are files
belong to categories.
As I followed the examples realized that the listed items belongs to the
same class. Should I create a helper class based on a view  ?
I would like to find the best approach if possible.


thnx., Sandor



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-tree-with-two-Hibernate-entities-tp4653122.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: Migration from 1.5.8 to 6.1

2012-10-19 Thread vineet semwal
iajaxcalldecorator is replaced with
iajaxcalllistener,ajaxcalllistener(dummy implementation)
is what you can extend for your use ,override
ajaxcheckbox#updateAjaxAttributes(attributes)
like below
  @Override
protected void updateAjaxAttributes(AjaxRequestAttributes
attributes) {
attributes.getAjaxCallListeners().add(new AjaxCallListener(){
@Override
public CharSequence getPrecondition(Component component) {
return if (!confirm(' +
getString(confirmDelete) + ')) + { return false; }  ;
}
});
}

On Fri, Oct 19, 2012 at 8:47 PM, Marco Di Sabatino Di Diodoro
marco.disabat...@tirasa.net wrote:
 Hi all,

 How can i convert this code into wicket 6.1.

item.add(new AjaxDecoratedCheckbox(toRemove, new 
 ModelBoolean(Boolean.FALSE)) {

  @Override
  protected void onUpdate(final AjaxRequestTarget target) {
 entityTO.getDerivedAttributes().remove(attributeTO);
 target.add(attributesContainer);
 }

  @Override
   protected IAjaxCallDecorator getAjaxCallDecorator() {
 return new 
 AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) {

  @Override
  public CharSequence preDecorateScript(final CharSequence script) {
  return if (confirm(' + getString(confirmDelete) + ')) + { + 
 script + } 
  + else {this.checked = false;};
 }
 };
  }
  });

 I see the migration doc, but i not found a solution.

 Thanks
 M


 --

 Dott. Marco Di Sabatino Di Diodoro
 Tel. +39 3939065570

 Tirasa S.r.l.
 Viale D'Annunzio 267 - 65127 Pescara
 Tel +39 0859116307 / FAX +39 085973
 http://www.tirasa.net

 Apache Syncope PPMC Member
 http://people.apache.org/~mdisabatino







-- 
regards,

Vineet Semwal

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



Re: modal window before submitting ajax-less form

2012-10-19 Thread lukuperman
Makes sense. In that case, Sven, how can I have a modal window rendered
before hand so I can hide/show as needed, something like an ajax-less modal?
I wouldn't like to duplicate the effort of rendering a modal window myself.
Any idea?

Lucas



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/modal-window-before-submitting-ajax-less-form-tp4653108p4653128.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: wicket-tree with two Hibernate entities

2012-10-19 Thread Sandor Feher
Hi Sven,

Thank you for the prompt answer. Please make me sure if I do it well.

FileHelper.class

import java.util.Collections;
import java.util.List;


public class FileTreeHelper implements Serializable {



private HrpBbfparam parent; // this is the dictionary class with fields
Id and Name

public HrpBbfparam getParent() {
return parent;
}

public void setParent(HrpBbfparam parent) {
this.parent = parent;
}

private ListHrpFiles children; // files belong to parent

public ListHrpFiles getChildren() {
return children;
}

public void setChildren(ListHrpFiles children) {
this.children = children;
}


}

thnx., Sandor



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-tree-with-two-Hibernate-entities-tp4653122p4653130.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



Upgrade Advice

2012-10-19 Thread Jered Myers
I am working on migrating a large application from Wicket 1.4.18 to 
Wicket 6.x.  Is it better to convert to 1.5 first and then to 6.x or to 
just go straight to 6.x?  Thanks.  Also, an early thanks to everybody 
who took the time to write the migration guides!


Jered


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



Re: modal window before submitting ajax-less form

2012-10-19 Thread lukuperman
Thanks Eduardo! It looks like what I need!! But when trying to go step by
step, trying the OpenOnLoadModalWindow as-is, I get the following exception:

ERROR [1534679929@qtp-1426937101-4] (RequestCycle.java:1529) - Error
creating page for modal dialog.
org.apache.wicket.WicketRuntimeException: Error creating page for modal
dialog.
at
org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.getWindowOpenJavascript(ModalWindow.java:1092)

On my page I simply added the window like this:
add(new OpenOnLoadModalWindow(changeTaskTypeModalWindow));

Not sure what I'm missing. Any idea?

Lucas Kuperman



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/modal-window-before-submitting-ajax-less-form-tp4653108p4653136.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



Which github branch

2012-10-19 Thread Chris Colman
I'm trying to work out which github branch to choose to stay up to date
with the latest 1.6.x code.
 
For wicket 1.5 I've just stuck with the 1.5.x branch and that worked
well. There doesn't seem to be a 1.6.x - is this because 1.6 is the
'trunk' (in SVN speak).
 
Wicket github has both a 'master'  'trunk'. Which one should I choose?
(or is there something else for 'latest 1.6.x code'?)
 
Yours sincerely,
 
Chris Colman