Re: highlight invalid fields with custom Validation Framework?

2012-11-25 Thread James Selvakumar
Thanks.


On Mon, Nov 26, 2012 at 2:11 PM, Martin Grigorov wrote:

> On Mon, Nov 26, 2012 at 4:50 AM, James Selvakumar  >wrote:
>
> > Martin,
> >
> > Thank you so much. I was exactly in the position where delta458 was and
> > almost got through with it.
> > After following your suggestions, the ValidationMsgBehavior looks like
> > this:
> >
> > 
> > public class ValidationMsgBehavior extends Behavior
> > {
> > @Override
> > public void onRendered(Component c)
> > {
> > FormComponent fc = (FormComponent) c;
> > if (!fc.isValid()) {
> > String error;
> > if (fc.hasFeedbackMessage()) {
> > error =
> > fc.getFeedbackMessages().first(FeedbackMessage.ERROR).toString();
> > } else {
> > error = "Your input is invalid.";
> > }
> > fc.getResponse().write(
> > "" + error +
> > "");
> > }
> > }
> > }
> > 
> >
> >
>
> > I'm using Wicket 6.3.0 and there is no "onRendered" method in Behavior.
> > I should be using "afterRender(Component component)" now, right?
> >
>
> Right.
>
>
> > That will make this code compatible with the latest wicket version.
> >
> >
> > On Wed, Oct 17, 2012 at 3:07 PM, Martin Grigorov  > >wrote:
> >
> > > On Wed, Oct 17, 2012 at 8:22 AM, delta458 
> wrote:
> > > > Hi Martin,
> > > > thanks so much for the replies... almost done, some little questions
> > > still
> > > > there.. I got it working, could you verify that its right what I
> made?
> > :)
> > > >
> > > > 1)
> > > > *//Had Error: Wrong number of type arguments, required 2 - It works
> > when
> > > I
> > > > do  IVisitor ;-)
> > >
> > > Trust the compiler and follow his recommendations ;-)
> > >
> > > > public class ShinyFormVisitor implements
> > > IVisitor,Serializable {*
> > > >
> > > > Set visited = new HashSet();
> > > >
> > > > public void component(final Component c, final IVisit visit
> > > > /*[2]*/) {
> > > > if (!visited.contains(c)) {
> > > > visited.add(c);
> > > > c.add(new RequiredBorder());
> > > > c.add(new ValidationMsgBehavior());
> > > > c.add(new ErrorHighlightBehavior());
> > > > }
> > > > }
> > > >
> > > > ...
> > > >
> > > > private class ValidationMsgBehavior extends Behavior {
> > > >
> > > > public void onRendered(Component c) {
> > > > FormComponent fc = (FormComponent) c;
> > > > if (!fc.isValid()) {
> > > > String error;
> > > > if (fc.hasFeedbackMessage()) {
> > > >   * //Had error, now working with this.. thats right?
> > > > error =
> > > > fc.getFeedbackMessages().first().getLevelAsString();*
> > >
> > > fc.getFeedbackMessages().first(FeedbackMessage.LEVEL_ERROR).toString();
> > >
> > > Or you may use the default registered converter to transform it to
> > > String. But this is more advanced and most probably you don't need it.
> > >
> > > >
> > > > } else {
> > > > error = "Your input is invalid.";
> > > > }
> > > > fc.getResponse().write(
> > > > "" + error +
> > > "");
> > > > }
> > > > }
> > > > }
> > > > }
> > > >
> > > >
> > > > 2) Do you know any good wicket tutorials/example where I can learn
> how
> > to
> > > > work with customized FeedbackMessages?
> > >
> > > The source code is the best. It is really simple.
> > > Check
> > >
> >
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
> > >
> > > >
> > > > thanks..
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4653024.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
> > >
> > >
> >
> >
> > --
> > Thanks & regards
> > James Selvakumar
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com 
>



-- 
Thanks & regards
James Selvakumar


Re: Wicket Editable datagrid with add/edit/delete functionality at once

2012-11-25 Thread Martin Grigorov
Take a look at http://www.wicket-library.com/inmethod-grid
Sources at
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/inmethod-grid-parent


On Mon, Nov 26, 2012 at 7:49 AM, rsasanulu  wrote:

> Hi,
>
> I am newbie to the wicket. I am looking for the same component for my
> project.
>
> Can you please help me how to build this editable datagrid in wicket6
> because lot of changes happened in the wicket from 1.3.5.
>
> can you please help me on this?
>
> Thanks
> Rajitha
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-Editable-datagrid-with-add-edit-delete-functionality-at-once-tp3326177p4654194.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 


Re: Wicket Editable datagrid with add/edit/delete functionality at once

2012-11-25 Thread rsasanulu
Hi,

I am newbie to the wicket. I am looking for the same component for my
project.

Can you please help me how to build this editable datagrid in wicket6
because lot of changes happened in the wicket from 1.3.5.

can you please help me on this?

Thanks
Rajitha



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Editable-datagrid-with-add-edit-delete-functionality-at-once-tp3326177p4654194.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: highlight invalid fields with custom Validation Framework?

2012-11-25 Thread Martin Grigorov
On Mon, Nov 26, 2012 at 4:50 AM, James Selvakumar wrote:

> Martin,
>
> Thank you so much. I was exactly in the position where delta458 was and
> almost got through with it.
> After following your suggestions, the ValidationMsgBehavior looks like
> this:
>
> 
> public class ValidationMsgBehavior extends Behavior
> {
> @Override
> public void onRendered(Component c)
> {
> FormComponent fc = (FormComponent) c;
> if (!fc.isValid()) {
> String error;
> if (fc.hasFeedbackMessage()) {
> error =
> fc.getFeedbackMessages().first(FeedbackMessage.ERROR).toString();
> } else {
> error = "Your input is invalid.";
> }
> fc.getResponse().write(
> "" + error +
> "");
> }
> }
> }
> 
>
>

> I'm using Wicket 6.3.0 and there is no "onRendered" method in Behavior.
> I should be using "afterRender(Component component)" now, right?
>

Right.


> That will make this code compatible with the latest wicket version.
>
>
> On Wed, Oct 17, 2012 at 3:07 PM, Martin Grigorov  >wrote:
>
> > On Wed, Oct 17, 2012 at 8:22 AM, delta458  wrote:
> > > Hi Martin,
> > > thanks so much for the replies... almost done, some little questions
> > still
> > > there.. I got it working, could you verify that its right what I made?
> :)
> > >
> > > 1)
> > > *//Had Error: Wrong number of type arguments, required 2 - It works
> when
> > I
> > > do  IVisitor ;-)
> >
> > Trust the compiler and follow his recommendations ;-)
> >
> > > public class ShinyFormVisitor implements
> > IVisitor,Serializable {*
> > >
> > > Set visited = new HashSet();
> > >
> > > public void component(final Component c, final IVisit visit
> > > /*[2]*/) {
> > > if (!visited.contains(c)) {
> > > visited.add(c);
> > > c.add(new RequiredBorder());
> > > c.add(new ValidationMsgBehavior());
> > > c.add(new ErrorHighlightBehavior());
> > > }
> > > }
> > >
> > > ...
> > >
> > > private class ValidationMsgBehavior extends Behavior {
> > >
> > > public void onRendered(Component c) {
> > > FormComponent fc = (FormComponent) c;
> > > if (!fc.isValid()) {
> > > String error;
> > > if (fc.hasFeedbackMessage()) {
> > >   * //Had error, now working with this.. thats right?
> > > error =
> > > fc.getFeedbackMessages().first().getLevelAsString();*
> >
> > fc.getFeedbackMessages().first(FeedbackMessage.LEVEL_ERROR).toString();
> >
> > Or you may use the default registered converter to transform it to
> > String. But this is more advanced and most probably you don't need it.
> >
> > >
> > > } else {
> > > error = "Your input is invalid.";
> > > }
> > > fc.getResponse().write(
> > > "" + error +
> > "");
> > > }
> > > }
> > > }
> > > }
> > >
> > >
> > > 2) Do you know any good wicket tutorials/example where I can learn how
> to
> > > work with customized FeedbackMessages?
> >
> > The source code is the best. It is really simple.
> > Check
> >
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
> >
> > >
> > > thanks..
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4653024.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
> >
> >
>
>
> --
> Thanks & regards
> James Selvakumar
>



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


new hierarchical feedback panel added

2012-11-25 Thread Igor Vaynberg
a common question on this list is how to build "hierarchical" feedback
panels. i just checked in my attempt to help solve this problem into
master. here is the javadoc that explains what it does. feedback
welcome.

-igor

/**
 * A specialized feedback panel that only displays messages from
inside a fence defined by a
 * container component. Instances will not show messages coming from
inside a nested fence, allowing
 * the nesting of these panels to work correctly without displaying
the same feedback message twice.
 * A constructor that does not takes a fencing component creates a
catch-all panel that shows
 * messages that do not come from inside any fence or from the {@link Session}.
 *
 * IN DEPTH EXPLANATION
 * 
 * It is often very useful to have feedback panels that show feedback
that comes from inside a
 * certain container only. For example given a page with the following
structure:
 * 
 *
 * 
 * Page
 *   Form1
 * Feedback1
 * Input1
 * Form2
 *   Feedback2
 *   Input2
 * 
 * 
 * we want Feedback2 to show messages originating only from inside
Form2 and Feedback1 to show
 * messages only originating from Form1 but not Form2 (because
messages originating from Form2 are
 * already shown by Feedback2).
 * 
 * 
 * It is fairly simple to configure Feedback2 - a {@link
ContainerFeedbackMessageFilter} added to
 * the regular {@link FeedbackPanel} will do the trick. The hard part
is configuring Feedback1. We
 * can add a {@link ContainerFeedbackMessageFilter} to it, but since
Form2 is inside Form1 the
 * container filter will allow messages from both Form1 and Form2 to
be added to FeedbackPanel1.
 * 
 * 
 * This is where the {@link FencedFeedbackPanel} comes in. All we have
to do is to make
 * FeedbackPanel2 a {@link FencedFeedbackPanel} with the fencing
component defined as Form2 and
 * Feedback1 a {@link FencedFeedbackPanel} with the fencing component
defiend as Form1.
 * {@link FencedFeedbackPanel} will only show messages that original
from inside its fencing
 * component and not from inside any descendant component that acts as
a fence for another
 * {@link FencedFeedbackPanel}.
 * 
 * 
 * When created with a {@code null} fencing component or using a
constructor that does not take one
 * the panel will only display messages that do not come from inside a
fence. It will also display
 * messages that come from {@link Session}. This acts as a catch-all
panels showing messages that
 * would not be shown using any other instance of the {@link
FencedFeedbackPanel} created witha
 * fencing component. There is usually one instance of such a panel at
the top of the page to
 * display notifications of success.
 * 

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



Re: initial bean validation integration checked into experimental module

2012-11-25 Thread Igor Vaynberg
On Sun, Nov 25, 2012 at 4:12 PM, Paul Bors  wrote:
> Looks awesome!
>
> One suggestion/question about it (might sound silly at first but keep an
> open mind).
>
> I understand you're implementing the JSR-303, but I was wondering if it
> would be possible to allow some of the settings be borrowed from other
> annotation framework like Hibernate or some other 3rd party not necessary
> out of the box but perhaps via a user defined mapping?
>
> Given your example POJO:
> public class Person implements Serializable
> {
>@NotNull
>@Size(min = 2, max = 30)
>private String name;
> ...
>
> If one were to use the same POJO to map it via Hibernate the code would look
> like:
> @Entity
> public class Person implements Serializable
> {
>@NotNull
>@Size(min = 2, max = 30)
>@Column(name = "full_name", nullable = false, length=30)
>private String name;
> ...
>
> That seems like duplicated meta data to me since you're defining the same
> info twice such as the null state and length in two or more different
> annotations.

i believe you are coming into this from the wrong angle. the
integration should not be between Wicket validation and hibernate
annotations, the integration should instead be between bean validation
(303) and hibernate annotations.

303 provides the validator and the metadata constraint discovery which
i use. if you choose to integrate between wicket and hibernate
annotations you have to basically build a parallel 303 implementation.

instead, figure out how to integrate hibernate annotations with 303
and you get to piggy back on everything thats already there.

-igor


>
> ~ Thank you,
>   Paul Bors
>
> -Original Message-
> From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
> Sent: Sunday, November 25, 2012 1:41 AM
> To: users@wicket.apache.org
> Subject: initial bean validation integration checked into experimental
> module
>
> just checked in a first pass on bean validation (jsr 303) integration.
> see this commit for details:
>
> https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=580a8dd9
> ;hp=2d47bf340875f6053aa2a3b69c4f442f2fbb03e1
>
> feedback is welome.
>
> -igor
>
> -
> 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: highlight invalid fields with custom Validation Framework?

2012-11-25 Thread James Selvakumar
Martin,

Thank you so much. I was exactly in the position where delta458 was and
almost got through with it.
After following your suggestions, the ValidationMsgBehavior looks like this:


public class ValidationMsgBehavior extends Behavior
{
@Override
public void onRendered(Component c)
{
FormComponent fc = (FormComponent) c;
if (!fc.isValid()) {
String error;
if (fc.hasFeedbackMessage()) {
error =
fc.getFeedbackMessages().first(FeedbackMessage.ERROR).toString();
} else {
error = "Your input is invalid.";
}
fc.getResponse().write(
"" + error +
"");
}
}
}


I'm using Wicket 6.3.0 and there is no "onRendered" method in Behavior.
I should be using "afterRender(Component component)" now, right?
That will make this code compatible with the latest wicket version.


On Wed, Oct 17, 2012 at 3:07 PM, Martin Grigorov wrote:

> On Wed, Oct 17, 2012 at 8:22 AM, delta458  wrote:
> > Hi Martin,
> > thanks so much for the replies... almost done, some little questions
> still
> > there.. I got it working, could you verify that its right what I made? :)
> >
> > 1)
> > *//Had Error: Wrong number of type arguments, required 2 - It works when
> I
> > do  IVisitor ;-)
>
> Trust the compiler and follow his recommendations ;-)
>
> > public class ShinyFormVisitor implements
> IVisitor,Serializable {*
> >
> > Set visited = new HashSet();
> >
> > public void component(final Component c, final IVisit visit
> > /*[2]*/) {
> > if (!visited.contains(c)) {
> > visited.add(c);
> > c.add(new RequiredBorder());
> > c.add(new ValidationMsgBehavior());
> > c.add(new ErrorHighlightBehavior());
> > }
> > }
> >
> > ...
> >
> > private class ValidationMsgBehavior extends Behavior {
> >
> > public void onRendered(Component c) {
> > FormComponent fc = (FormComponent) c;
> > if (!fc.isValid()) {
> > String error;
> > if (fc.hasFeedbackMessage()) {
> >   * //Had error, now working with this.. thats right?
> > error =
> > fc.getFeedbackMessages().first().getLevelAsString();*
>
> fc.getFeedbackMessages().first(FeedbackMessage.LEVEL_ERROR).toString();
>
> Or you may use the default registered converter to transform it to
> String. But this is more advanced and most probably you don't need it.
>
> >
> > } else {
> > error = "Your input is invalid.";
> > }
> > fc.getResponse().write(
> > "" + error +
> "");
> > }
> > }
> > }
> > }
> >
> >
> > 2) Do you know any good wicket tutorials/example where I can learn how to
> > work with customized FeedbackMessages?
>
> The source code is the best. It is really simple.
> Check
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
>
> >
> > thanks..
> >
> >
> >
> >
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4653024.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
>
>


-- 
Thanks & regards
James Selvakumar


Re: wicket-6 User friendly form validation with Wicket (stuq)

2012-11-25 Thread James Selvakumar
Sorry,

Got most of the answers from the mailing list discussion here:
http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4652978.html


On Mon, Nov 26, 2012 at 11:31 AM, James Selvakumar wrote:

> Hi all,
>
> We have been using the examples given in the "FormsWithFlair" for a while
> and it has been working very well.
> However, we recently migrated from wicket 1.5.x to 6.3.0 and the code
> didn't compile because of some api changes.
>
> Here's the code that worked in 1.5.x
> 
> public class ValidationMsgBehavior extends AbstractBehavior
> {
> @Override
> public void onRendered(Component c)
> {
> FormComponent fc = (FormComponent) c;
> if (!fc.isValid()) {
> String error;
> if (fc.hasFeedbackMessage()) {
> error = fc.getFeedbackMessage().getMessage().toString();
> } else {
> error = "Your input is invalid.";
> }
> fc.getResponse().write(
> "" + error +
> "");
> }
> }
> }
> 
>
> Am I right to say that I can replace AbstractBehavior with Behavior?
> But I'm not sure what will be the best way to handle the feedback messages
> related code.
> Is a call to "hasFeedbackMessage()" correct now or should we use a
> feedback collector here?
> "getFeedbackMessage()" has been removed so I have no choice but to use
> feedback collector to get it.
>
>
> On Tue, Nov 6, 2012 at 3:09 AM, Rafał Krupiński wrote:
>
>> On 05.11.2012 17:01, Martin Grigorov wrote:
>>
>>> See FormsWithFlair application and PDF at
>>> http://code.google.com/p/**londonwicket/downloads/list
>>> It also shows how a behavior can be used for this.
>>>
>>
>> Thanks for the link, looks very promising.
>>
>>
>> Best Regards
>> Rafał Krupiński
>>
>>
>> --**--**-
>> To unsubscribe, e-mail: 
>> users-unsubscribe@wicket.**apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> --
> Thanks & regards
> James Selvakumar
>
>


-- 
Thanks & regards
James Selvakumar


Re: wicket-6 User friendly form validation with Wicket (stuq)

2012-11-25 Thread James Selvakumar
Hi all,

We have been using the examples given in the "FormsWithFlair" for a while
and it has been working very well.
However, we recently migrated from wicket 1.5.x to 6.3.0 and the code
didn't compile because of some api changes.

Here's the code that worked in 1.5.x

public class ValidationMsgBehavior extends AbstractBehavior
{
@Override
public void onRendered(Component c)
{
FormComponent fc = (FormComponent) c;
if (!fc.isValid()) {
String error;
if (fc.hasFeedbackMessage()) {
error = fc.getFeedbackMessage().getMessage().toString();
} else {
error = "Your input is invalid.";
}
fc.getResponse().write(
"" + error +
"");
}
}
}


Am I right to say that I can replace AbstractBehavior with Behavior?
But I'm not sure what will be the best way to handle the feedback messages
related code.
Is a call to "hasFeedbackMessage()" correct now or should we use a feedback
collector here?
"getFeedbackMessage()" has been removed so I have no choice but to use
feedback collector to get it.


On Tue, Nov 6, 2012 at 3:09 AM, Rafał Krupiński wrote:

> On 05.11.2012 17:01, Martin Grigorov wrote:
>
>> See FormsWithFlair application and PDF at
>> http://code.google.com/p/**londonwicket/downloads/list
>> It also shows how a behavior can be used for this.
>>
>
> Thanks for the link, looks very promising.
>
>
> Best Regards
> Rafał Krupiński
>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Thanks & regards
James Selvakumar


RE: initial bean validation integration checked into experimental module

2012-11-25 Thread Paul Bors
Looks awesome!

One suggestion/question about it (might sound silly at first but keep an
open mind).

I understand you're implementing the JSR-303, but I was wondering if it
would be possible to allow some of the settings be borrowed from other
annotation framework like Hibernate or some other 3rd party not necessary
out of the box but perhaps via a user defined mapping?

Given your example POJO:
public class Person implements Serializable 
{
   @NotNull
   @Size(min = 2, max = 30)
   private String name;
...

If one were to use the same POJO to map it via Hibernate the code would look
like:
@Entity
public class Person implements Serializable 
{
   @NotNull
   @Size(min = 2, max = 30)
   @Column(name = "full_name", nullable = false, length=30)
   private String name;
...

That seems like duplicated meta data to me since you're defining the same
info twice such as the null state and length in two or more different
annotations.

~ Thank you,
  Paul Bors

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Sunday, November 25, 2012 1:41 AM
To: users@wicket.apache.org
Subject: initial bean validation integration checked into experimental
module

just checked in a first pass on bean validation (jsr 303) integration.
see this commit for details:

https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=580a8dd9
;hp=2d47bf340875f6053aa2a3b69c4f442f2fbb03e1

feedback is welome.

-igor

-
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: Cloneing Wicket Objects

2012-11-25 Thread Paul Bors
Can't you crate the "navigation panel" once and call add() on it twice by
passing the same reference to it from within your page hierarchy?

On the client side I don't see why you would push this cloning to the
client. Just let the page contain the same panel (html/js) via a single
reference.
You should be fine as long as you handle the db trip in the constructor or
your own "init()" method.

~ Thank you,
  Paul Bors

-Original Message-
From: Colin Rogers [mailto:colin.rog...@objectconsulting.com.au] 
Sent: Sunday, November 25, 2012 6:28 PM
To: users@wicket.apache.org
Subject: Cloneing Wicket Objects

Wicketeers,

I was wondering what the best was to duplicate or clone wicket components. I
need guidance as to the best way to do this.

I have, on my screen two 'navigation panels' that are identical - one at the
top of the page, another at the bottom. They contain dropdown choice fields
that, when 'onchange' event occurs, it triggers an ajax request that
redirects the user to another page.

As, in order to create the navigation panels - I have to visit the DB, and
create them dynamically, so it doesn't make sense to perform this operation
twice. Also they generate a large amount of HTML, in order render them, so
it seems sensible to do as much as I can on the client side.

The idea was - I generate the components once, and then clone them on the
client side. This saves going to the DB twice and rendering them twice. I've
attempted to use jquery's clone function as; clone(), clone(true) and
clone(true, true) - but none work. The elements are copied, but the ajax
actions never execute onchange.

Is there another way to do this that works? A more wicket-centric way?

Cheers,
Col.


EMAIL DISCLAIMER This email message and its attachments are confidential and
may also contain copyright or privileged material. If you are not the
intended recipient, you may not forward the email or disclose or use the
information contained in it. If you have received this email message in
error, please advise the sender immediately by replying to this email and
delete the message and any associated attachments. Any views, opinions,
conclusions, advice or statements expressed in this email message are those
of the individual sender and should not be relied upon as the considered
view, opinion, conclusions, advice or statement of this company except where
the sender expressly, and with authority, states them to be the considered
view, opinion, conclusions, advice or statement of this company. Every care
is taken but we recommend that you scan any attachments for viruses.


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



Cloneing Wicket Objects

2012-11-25 Thread Colin Rogers
Wicketeers,

I was wondering what the best was to duplicate or clone wicket components. I 
need guidance as to the best way to do this.

I have, on my screen two 'navigation panels' that are identical - one at the 
top of the page, another at the bottom. They contain dropdown choice fields 
that, when 'onchange' event occurs, it triggers an ajax request that redirects 
the user to another page.

As, in order to create the navigation panels - I have to visit the DB, and 
create them dynamically, so it doesn't make sense to perform this operation 
twice. Also they generate a large amount of HTML, in order render them, so it 
seems sensible to do as much as I can on the client side.

The idea was - I generate the components once, and then clone them on the 
client side. This saves going to the DB twice and rendering them twice. I've 
attempted to use jquery's clone function as; clone(), clone(true) and 
clone(true, true) - but none work. The elements are copied, but the ajax 
actions never execute onchange.

Is there another way to do this that works? A more wicket-centric way?

Cheers,
Col.


EMAIL DISCLAIMER This email message and its attachments are confidential and 
may also contain copyright or privileged material. If you are not the intended 
recipient, you may not forward the email or disclose or use the information 
contained in it. If you have received this email message in error, please 
advise the sender immediately by replying to this email and delete the message 
and any associated attachments. Any views, opinions, conclusions, advice or 
statements expressed in this email message are those of the individual sender 
and should not be relied upon as the considered view, opinion, conclusions, 
advice or statement of this company except where the sender expressly, and with 
authority, states them to be the considered view, opinion, conclusions, advice 
or statement of this company. Every care is taken but we recommend that you 
scan any attachments for viruses.


Re: Is wicket-cdi native to Wicket 6.1 and upwards?

2012-11-25 Thread Martin Grigorov
Hi,

Take a look at the sources of
http://www.wicket-library.com/wicket-examples-6.0.x/cdi/ application.
Especially in its WebApplication class.


On Sun, Nov 25, 2012 at 11:09 PM, Yuci Gou  wrote:

> Just read the article - Status of wicket-cdi Module at
> https://www.42lines.net/2012/09/11/status-of-wicket-cdi-module/.
>
> Wonder if wicket-cdi is part of Wicket 6.1 release and upwards. I tried a
> simple Wicket 6.3 application running in TomEE, but could not get the CDI
> injection to work. These are the steps I used:
>
> 1. Create a Wicket project with Maven (according to
> http://wicket.apache.org/start/quickstart.html)
>
> mvn archetype:generate -DarchetypeGroupId=org.apache.wicket
> -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=6.3.0
> -DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository=
> https://repository.apache.org/ -DinteractiveMode=false
>
> 2. Generate the eclipse configuration files
> mvn eclipse:eclipse -Dwtpversion=2.0
>
> (Note: Following steps are based on the tutorial on Youtube:
> http://www.youtube.com/watch?v=Lr8pxEACVRI)
> 3. In folder src/main/webapp/WEB-INF, create file beans.xml
> (Also in folder src/main/webapp/META-INF, create file beans.xml, according
> to the explanation for this example:
> http://tomee.apache.org/examples-trunk/cdi-basic/README.html, and also
> src/main/resources/META-INF/beans.xml just in case)
>
> 4. Create a POJO
> public class Faculty {
> private List facultyMembers;
> private String facultyName;
>
> @PostConstruct
> public void initialize() {
> this.facultyMembers = new ArrayList();
> facultyMembers.add("Ian Schultz");
> facultyMembers.add("Diane Reyes");
> facultyName = "Computer Science";
> }
>
> public List getFacultyMembers() {
> return facultyMembers;
> }
>
> public String getFacultyName() {
> return facultyName;
> }
> }
>
> 5. Inject the POJO in HomePage.java and display it.
> public class HomePage extends WebPage {
> private static final long serialVersionUID = 1L;
>
> @Inject
> private Faculty faculty;
>
> public HomePage(final PageParameters parameters) {
> super(parameters);
>
> if (faculty != null) {
> add(new Label("cdi", faculty.getFacultyName()));
> } else {
> add(new Label("cdi", "Not working!"));
> }
> }
> }
>
> Note, class HomePage is the class for the Wicket homepage, as specified
> below:
> public class WicketApplication extends WebApplication
> {
> /**
>  * @see org.apache.wicket.Application#getHomePage()
>  */
> @Override
> public Class getHomePage()
> {
> return HomePage.class;
> }
> }
>
> These are the steps I tried, but when running, "Not working!" is displayed
> on the home page. I debugged it and confirmed that faculty is null, which
> means not injected.
>
> Many thanks for your kind help!
>
> Yuci
>



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


Re: After/before creation or serialization

2012-11-25 Thread Martin Grigorov
The proxy does effectively the same as your code - it uses a transient bean
and if it is not available then it looks it up in the bean repository.

I'm not sure what performance loss you experience.


On Sun, Nov 25, 2012 at 11:15 PM, Oscar Besga Arcauz wrote:

> Hi Martin
>
>
> Yes, I've tried @SpringBean but I don't like it because I noticed a (not
> very big) performace loss when using it; because the dynamicly-created
> serializable proxy.
> Or at least that seems to me.
>
> IMHO, the proxy is an overwhelming solution, I prefer a combination of
> transients and 'if (dao==null) dao = (
> ((MyApplicattion)getApplication()).getDao());'
>
> Simply if this can be done in another way.
>
> Thanks
>
>
>
>
> > > > Oscar Besga Arcauz  < < <
>
> -Martin Grigorov  escribió: -
> Para: users@wicket.apache.org
> De: Martin Grigorov 
> Fecha: 25/11/2012  15:57
> Asunto: Re: After/before creation or serialization
>
> Hi,
>
> onInitialize is called just once for any Component. As its javadoc says it
> is called some time before the first call of #onConfigure.
> #onDetach() is called before passing the Page to serialization but it can
> be called at any time and several times per request cycle, so it is not
> good idea to do your task there too.
>
> The solution you are looking for is wicket-ioc module. It is the base for
> @SpringBean and @Inject support in Wicket. It injects serializable proxy
> instead of your real DAO/Service/... So it is very cheap for serialization
> and doesn't require your real dao/service to be Serializable itself.
>
>
> On Sun, Nov 25, 2012 at 2:22 PM, Oscar Besga Arcauz  >wrote:
>
> >  Thanks
> >
> > Yes, I can use both methos onInitialize + onRead and onDetach + onSave
> >
> > Perhaps I should ask if onInitialize and onDetach are used when component
> > is serialized /deserialized on wicket 6
> >
> > My plan is to do avoid this
> >
> > MyPanel(String id){
> > super(id)
> > ((MyApplicattion)getApplication()).getDao().getData();
> >}
> >
> > and turn into this
> >
> >
> > MyPanel(String id){
> > super(id)
> > }
> >
> > private transient Dao dao;
> >
> > void onCreateOrRead(){
> > dao = ((MyApplicattion)getApplication()).getDao();
> > }
> >
> >
> >void onCreateOrRead(){
> > dao = null; // Not necessary
> >}
> >
> >
> > > > > Oscar Besga Arcauz  < < <
> >
> > -Cedric Gatay  escribió: -
> > Para: users@wicket.apache.org
> > De: Cedric Gatay 
> > Fecha: 25/11/2012  13:36
> > Asunto: Re: After/before creation or serialization
> >
> > Hi,
> > I don't know if there is a special Wicket thing, but you can use the
> > standard Java way like this :
> > private void writeObject(ObjectOutputStream out) throws IOException {
> > //provide your own logic
> > }
> >
> > private void readObject(ObjectInputStream in) throws IOException,
> > ClassNotFoundException {
> > //provide your own logic
> > }
> >
> > Regards,
> >
> > __
> > Cedric Gatay
> > http://www.bloggure.info | http://cedric.gatay.fr |
> > @Cedric_Gatay
> >
> >
> >
> > On Sun, Nov 25, 2012 at 1:28 PM, Oscar Besga Arcauz  > >wrote:
> >
> > >
> > >
> > > Hi wickers !
> > >
> > > Is there a method on Wicket components that is called before
> > > creation/load(f.e. from disk, deserialization) and another method
> called
> > > before destroy/save(to disk, serialization)
> > >
> > > Would it be methods onInitialize()   and onDetach()  of
> > > org.apache.wicket.Component ?
> > >
> > > Thanks !
> > >
> > >
> > > > > > Oscar Besga Arcauz  < < <
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com 
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


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


Re: After/before creation or serialization

2012-11-25 Thread Oscar Besga Arcauz
Hi Martin 

 
Yes, I've tried @SpringBean but I don't like it because I noticed a (not very 
big) performace loss when using it; because the dynamicly-created serializable 
proxy. 
Or at least that seems to me.

IMHO, the proxy is an overwhelming solution, I prefer a combination of 
transients and 'if (dao==null) dao = (
((MyApplicattion)getApplication()).getDao());'

Simply if this can be done in another way.

Thanks 




> > > Oscar Besga Arcauz  < < < 

-Martin Grigorov  escribió: -
Para: users@wicket.apache.org
De: Martin Grigorov 
Fecha: 25/11/2012  15:57
Asunto: Re: After/before creation or serialization

Hi,

onInitialize is called just once for any Component. As its javadoc says it
is called some time before the first call of #onConfigure.
#onDetach() is called before passing the Page to serialization but it can
be called at any time and several times per request cycle, so it is not
good idea to do your task there too.

The solution you are looking for is wicket-ioc module. It is the base for
@SpringBean and @Inject support in Wicket. It injects serializable proxy
instead of your real DAO/Service/... So it is very cheap for serialization
and doesn't require your real dao/service to be Serializable itself.


On Sun, Nov 25, 2012 at 2:22 PM, Oscar Besga Arcauz wrote:

>  Thanks
>
> Yes, I can use both methos onInitialize + onRead and onDetach + onSave
>
> Perhaps I should ask if onInitialize and onDetach are used when component
> is serialized /deserialized on wicket 6
>
> My plan is to do avoid this
>
>     MyPanel(String id){
>         super(id)
>         ((MyApplicattion)getApplication()).getDao().getData();
>    }
>
> and turn into this
>
>
>     MyPanel(String id){
>         super(id)
>     }
>
>     private transient Dao dao;
>
>     void onCreateOrRead(){
>         dao = ((MyApplicattion)getApplication()).getDao();
>     }
>
>
>    void onCreateOrRead(){
>         dao = null; // Not necessary
>    }
>
>
>     > > > Oscar Besga Arcauz  < < <
>
> -Cedric Gatay  escribió: -
> Para: users@wicket.apache.org
> De: Cedric Gatay 
> Fecha: 25/11/2012  13:36
> Asunto: Re: After/before creation or serialization
>
> Hi,
> I don't know if there is a special Wicket thing, but you can use the
> standard Java way like this :
>     private void writeObject(ObjectOutputStream out) throws IOException {
>         //provide your own logic
>     }
>
>     private void readObject(ObjectInputStream in) throws IOException,
> ClassNotFoundException {
>         //provide your own logic
>     }
>
> Regards,
>
> __
> Cedric Gatay
> http://www.bloggure.info | http://cedric.gatay.fr |
> @Cedric_Gatay
>
>
>
> On Sun, Nov 25, 2012 at 1:28 PM, Oscar Besga Arcauz  >wrote:
>
> >
> >
> > Hi wickers !
> >
> > Is there a method on Wicket components that is called before
> > creation/load(f.e. from disk, deserialization) and another method called
> > before destroy/save(to disk, serialization)
> >
> > Would it be methods onInitialize()   and onDetach()  of
> > org.apache.wicket.Component ?
> >
> > Thanks !
> >
> >
> >     > > > Oscar Besga Arcauz  < < <
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


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

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



Is wicket-cdi native to Wicket 6.1 and upwards?

2012-11-25 Thread Yuci Gou
Just read the article - Status of wicket-cdi Module at
https://www.42lines.net/2012/09/11/status-of-wicket-cdi-module/.

Wonder if wicket-cdi is part of Wicket 6.1 release and upwards. I tried a
simple Wicket 6.3 application running in TomEE, but could not get the CDI
injection to work. These are the steps I used:

1. Create a Wicket project with Maven (according to
http://wicket.apache.org/start/quickstart.html)

mvn archetype:generate -DarchetypeGroupId=org.apache.wicket
-DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=6.3.0
-DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository=
https://repository.apache.org/ -DinteractiveMode=false

2. Generate the eclipse configuration files
mvn eclipse:eclipse -Dwtpversion=2.0

(Note: Following steps are based on the tutorial on Youtube:
http://www.youtube.com/watch?v=Lr8pxEACVRI)
3. In folder src/main/webapp/WEB-INF, create file beans.xml
(Also in folder src/main/webapp/META-INF, create file beans.xml, according
to the explanation for this example:
http://tomee.apache.org/examples-trunk/cdi-basic/README.html, and also
src/main/resources/META-INF/beans.xml just in case)

4. Create a POJO
public class Faculty {
private List facultyMembers;
private String facultyName;

@PostConstruct
public void initialize() {
this.facultyMembers = new ArrayList();
facultyMembers.add("Ian Schultz");
facultyMembers.add("Diane Reyes");
facultyName = "Computer Science";
}

public List getFacultyMembers() {
return facultyMembers;
}

public String getFacultyName() {
return facultyName;
}
}

5. Inject the POJO in HomePage.java and display it.
public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;

@Inject
private Faculty faculty;

public HomePage(final PageParameters parameters) {
super(parameters);

if (faculty != null) {
add(new Label("cdi", faculty.getFacultyName()));
} else {
add(new Label("cdi", "Not working!"));
}
}
}

Note, class HomePage is the class for the Wicket homepage, as specified
below:
public class WicketApplication extends WebApplication
{
/**
 * @see org.apache.wicket.Application#getHomePage()
 */
@Override
public Class getHomePage()
{
return HomePage.class;
}
}

These are the steps I tried, but when running, "Not working!" is displayed
on the home page. I debugged it and confirmed that faculty is null, which
means not injected.

Many thanks for your kind help!

Yuci


Re: Behavior.renderHeader being invoked twice

2012-11-25 Thread Sven Meier

In development config the headers are validated after rendering:

org.apache.wicket.markup.html.WebPage.validateHeaders(WebPage.java:274)

Sven


On 11/25/2012 09:17 PM, Nick Pratt wrote:

Any thoughts on why Im seeing two invocations of the renderHead method?


On Wed, Nov 21, 2012 at 12:14 PM, Nick Pratt  wrote:


I've created a custom Behavior, and attached it to a DataTable.

I'm seeing two invocations per Page load of myBehavior.renderHeader
method, stacks below.
I've confirmed the following:
1. The containing Panel, and the DataTable are only added and constructed
once.
2. The hashcode of the Behavior is the same on both invocations
3. Ive only added the Behavior once, to the DataTable.

Are the following stacks expected correct processing for Wicket 6.3.0 ?



at com.DataTableBehavior.renderHead(DataTableBehavior.java:39)
  at org.apache.wicket.Component.renderHead(Component.java:2700)
at
org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy$1.component(ChildFirstHeaderRenderStrategy.java:85)
  at
org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:96)
at
org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87)
  at
org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87)
at
org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:51)
  at
org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderChildHeaders(ChildFirstHeaderRenderStrategy.java:78)
  at
org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderHeader(ChildFirstHeaderRenderStrategy.java:57)
  at
org.apache.wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:170)
at
org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
  at
org.apache.wicket.Component.internalRenderComponent(Component.java:2535)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1491)
  at org.apache.wicket.Component.internalRender(Component.java:2365)
at org.apache.wicket.Component.render(Component.java:2293)
  at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1388)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1553)
  at org.apache.wicket.Page.onRender(Page.java:884)
at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:142)
  at org.apache.wicket.Component.internalRender(Component.java:2365)
@@ at org.apache.wicket.Component.render(Component.java:2293)
  at org.apache.wicket.Page.renderPage(Page.java:1021)
at
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:116)
  at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:244)
at
org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
  at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:830)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
  at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:253)
at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
  at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:281)
at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
  at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:245)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
  at
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147)
  at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
  at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
  at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
  at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
  at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
  at
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at
org.mortbay.thread

Re: Behavior.renderHeader being invoked twice

2012-11-25 Thread Nick Pratt
Any thoughts on why Im seeing two invocations of the renderHead method?


On Wed, Nov 21, 2012 at 12:14 PM, Nick Pratt  wrote:

> I've created a custom Behavior, and attached it to a DataTable.
>
> I'm seeing two invocations per Page load of myBehavior.renderHeader
> method, stacks below.
> I've confirmed the following:
> 1. The containing Panel, and the DataTable are only added and constructed
> once.
> 2. The hashcode of the Behavior is the same on both invocations
> 3. Ive only added the Behavior once, to the DataTable.
>
> Are the following stacks expected correct processing for Wicket 6.3.0 ?
>
>
>
> at com.DataTableBehavior.renderHead(DataTableBehavior.java:39)
>  at org.apache.wicket.Component.renderHead(Component.java:2700)
> at
> org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy$1.component(ChildFirstHeaderRenderStrategy.java:85)
>  at
> org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:96)
> at
> org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87)
>  at
> org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87)
> at
> org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:51)
>  at
> org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderChildHeaders(ChildFirstHeaderRenderStrategy.java:78)
>  at
> org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderHeader(ChildFirstHeaderRenderStrategy.java:57)
>  at
> org.apache.wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:170)
> at
> org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
>  at
> org.apache.wicket.Component.internalRenderComponent(Component.java:2535)
> at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1491)
>  at org.apache.wicket.Component.internalRender(Component.java:2365)
> at org.apache.wicket.Component.render(Component.java:2293)
>  at
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1388)
> at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1553)
>  at org.apache.wicket.Page.onRender(Page.java:884)
> at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:142)
>  at org.apache.wicket.Component.internalRender(Component.java:2365)
> @@ at org.apache.wicket.Component.render(Component.java:2293)
>  at org.apache.wicket.Page.renderPage(Page.java:1021)
> at
> org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:116)
>  at
> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:244)
> at
> org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
>  at
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:830)
> at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>  at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:253)
> at
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
>  at
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:281)
> at
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
>  at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:245)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>  at
> org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147)
>  at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>  at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>  at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
>  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>  at org.mortbay.jetty.Server.handle(Server.java:326)
> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>  at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
>  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>  at
> org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
> at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run

Re: Ajax based panel replacement

2012-11-25 Thread Oliver Zemann
Are the changes pushed to the git repo? Or is this only a solution which 
will work in my case but will not be pushed because of side effects, no 
necessity etc.?


Thanks in advance.

Oli

Am 25.11.2012 20:25, schrieb Sven Meier:

Without the 'true ||'.


Great :)

Sven

On 11/25/2012 07:15 PM, Martin Grigorov wrote:
On Sun, Nov 25, 2012 at 7:14 PM, Martin Grigorov 
wrote:



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

b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java 


index 3071875..0651c33 100644
---
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java 


+++
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java 


@@ -21,6 +21,7 @@ import
org.apache.wicket.core.util.string.JavaScriptUtils;
  import org.apache.wicket.markup.head.IHeaderResponse;
  import org.apache.wicket.markup.head.JavaScriptHeaderItem;
  import org.apache.wicket.markup.head.OnLoadHeaderItem;
+import org.apache.wicket.markup.html.WebPage;
  import org.apache.wicket.request.http.WebRequest;
  import org.apache.wicket.util.time.Duration;

@@ -127,15 +128,25 @@ public abstract class AbstractAjaxTimerBehavior
extends AbstractDefaultAjaxBehav
 @Override
 protected final void respond(final AjaxRequestTarget target)
 {
-   if (!isStopped() && isEnabled(getComponent()))
+   if (shouldTrigger())
  {
 onTimer(target);

-   target.getHeaderResponse().render(
-
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   if (true || shouldTrigger())


Without the 'true ||'.



+   {
+ target.getHeaderResponse().render(
+
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   }
 }
 }

+   private boolean shouldTrigger()
+   {
+   return isStopped() == false &&
+   isEnabled(getComponent()) &&
+ getComponent().findParent(WebPage.class)
!= null;
+   }
+
 /**



On Sun, Nov 25, 2012 at 7:07 PM, Sven Meier  wrote:


Of course the component should be added to the ART.
But the example already fails when the behavior tries to write out the
next timeout after #onTimer().

This is why I think it should re-check #isStopped(), since the user 
might

stop the timer in #onTimer().

I'll take a look at WICKET-4886.

Sven


On 11/25/2012 06:58 PM, Martin Grigorov wrote:


I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
  @Override
  protected void onTimer(AjaxRequestTarget target) {
  PanelTwo two = new PanelTwo("panel");
  wmc.addOrReplace(two);
  }
  });

But it doesn't use 'target' to repaint any component, so the 
registered

JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call 
triggered by
the obsolete timer fails with "The behavior's component (a Form 
which is

no
more connected to the Page) cannot find its page.
This is a plain error in the application.



On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann 


**wrote:

  As suggested i created the JIRA issue https://issues.apache.org/**

jira/browse/WICKET-4886browse/WICKET-4886 
>


I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:

  Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  
wrote:


   Make a copy of AbstractAjaxTimerBehavior and let it be 
stoppable from



onTimer():

diff --git a/wicket-core/src/main/java/
**org/apache/wicket/ajax/
AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**


AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
{
onTimer(target);

- target.getHeaderResponse().**render(
- OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
updateInterval)));

+if (!isStopped())

   But this code is already in : if (!isStopped() &&


isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


   +{


+ target.getHeaderResponse().**render(
+ OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
updateInterval)));


+}
}
}

You could create a jira issue too.

  Additionally there are two global Ajax listeners at the 
bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete 
timers.
I haven't debugged the 

Re: Ajax based panel replacement

2012-11-25 Thread Sven Meier

Without the 'true ||'.


Great :)

Sven

On 11/25/2012 07:15 PM, Martin Grigorov wrote:

On Sun, Nov 25, 2012 at 7:14 PM, Martin Grigorov wrote:


diff --git
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
index 3071875..0651c33 100644
---
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
+++
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
@@ -21,6 +21,7 @@ import
org.apache.wicket.core.util.string.JavaScriptUtils;
  import org.apache.wicket.markup.head.IHeaderResponse;
  import org.apache.wicket.markup.head.JavaScriptHeaderItem;
  import org.apache.wicket.markup.head.OnLoadHeaderItem;
+import org.apache.wicket.markup.html.WebPage;
  import org.apache.wicket.request.http.WebRequest;
  import org.apache.wicket.util.time.Duration;

@@ -127,15 +128,25 @@ public abstract class AbstractAjaxTimerBehavior
extends AbstractDefaultAjaxBehav
 @Override
 protected final void respond(final AjaxRequestTarget target)
 {
-   if (!isStopped() && isEnabled(getComponent()))
+   if (shouldTrigger())
  {
 onTimer(target);

-   target.getHeaderResponse().render(
-
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   if (true || shouldTrigger())


Without the 'true ||'.



+   {
+   target.getHeaderResponse().render(
+
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   }
 }
 }

+   private boolean shouldTrigger()
+   {
+   return isStopped() == false &&
+   isEnabled(getComponent()) &&
+   getComponent().findParent(WebPage.class)
!= null;
+   }
+
 /**



On Sun, Nov 25, 2012 at 7:07 PM, Sven Meier  wrote:


Of course the component should be added to the ART.
But the example already fails when the behavior tries to write out the
next timeout after #onTimer().

This is why I think it should re-check #isStopped(), since the user might
stop the timer in #onTimer().

I'll take a look at WICKET-4886.

Sven


On 11/25/2012 06:58 PM, Martin Grigorov wrote:


I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
  @Override
  protected void onTimer(AjaxRequestTarget target) {
  PanelTwo two = new PanelTwo("panel");
  wmc.addOrReplace(two);
  }
  });

But it doesn't use 'target' to repaint any component, so the registered
JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call triggered by
the obsolete timer fails with "The behavior's component (a Form which is
no
more connected to the Page) cannot find its page.
This is a plain error in the application.



On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann 
**wrote:

  As suggested i created the JIRA issue https://issues.apache.org/**

jira/browse/WICKET-4886https://issues.apache.org/jira/browse/WICKET-4886>>

I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:

  Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

   Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from


onTimer():

diff --git a/wicket-core/src/main/java/
**org/apache/wicket/ajax/
AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**


AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
{
onTimer(target);

-target.getHeaderResponse().**render(
- OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
updateInterval)));

+if (!isStopped())

   But this code is already in : if (!isStopped() &&


isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


   +{


+target.getHeaderResponse().**render(
+ OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
updateInterval)));


+}
}
}

You could create a jira issue too.

  Additionally there are two global Ajax listeners at the bottom of

wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.



  Sven



On 11/25/2012 01:13 AM, Oliver Zemann wrote:

   Unfortunately this is not a solution as i have about 30 different


panel

Re: Ajax based panel replacement

2012-11-25 Thread Oliver Zemann


Am 25.11.2012 18:58, schrieb Martin Grigorov:

I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
 @Override
 protected void onTimer(AjaxRequestTarget target) {
 PanelTwo two = new PanelTwo("panel");
 wmc.addOrReplace(two);
 }
 });

But it doesn't use 'target' to repaint any component, so the registered JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call triggered by
the obsolete timer fails with "The behavior's component (a Form which is no
more connected to the Page) cannot find its page.
This is a plain error in the application.
I am pretty new to wicket. If there is a better way to do that, please 
feel free to give me hints :)
I see no other way of doing what i want without using ajax that way 
(directly in the panel instead of the base page).




On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann wrote:


As suggested i created the JIRA issue https://issues.apache.org/**
jira/browse/WICKET-4886
I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:


Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

  Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from

onTimer():

diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/
AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/**

AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
   {
   onTimer(target);

-target.getHeaderResponse().render(
- OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+if (!isStopped())

  But this code is already in : if (!isStopped() &&

isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


  +{

+target.getHeaderResponse().render(
+ OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));

+}
   }
   }

You could create a jira issue too.


Additionally there are two global Ajax listeners at the bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.




Sven



On 11/25/2012 01:13 AM, Oliver Zemann wrote:

  Unfortunately this is not a solution as i have about 30 different

panels.
And i guess at least 10 of them should later use JS. With the approach
you
suggested i would have to check which panel should be displayed and load
that (switch/case with 10 different panels). I guess that would also
lead
in heavy mixing the panels with the HomePage (BasePage) (destroying
reusability).

There is also no way for me to create a "flow based" dialogue as this is
done in the backend controller which only tells me which panel to load.

So there is no other way to go?

Am 24.11.2012 22:57, schrieb Sven Meier:

  After the timer has fired, AbstractAjaxTimerBehavior automatically

registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's
replaced by PanelTwo already.

I'd recommend adding the behavor to the container instead:

  final WebMarkupContainer wmc = new
WebMarkupContainer("container"
**);
  wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5))
{

  @Override
  protected void onTimer(AjaxRequestTarget target) {
  PanelTwo two = new PanelTwo("panel");
  wmc.addOrReplace(two);
  target.add(wmc);

  stop(target);
  }
  });
  add(wmc);

  wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:

  The problem is that this leads to a Page not found error. The problem

is that the Panel which should be replaced is still looked up in the
findPage() method. But findPage() returns null on that component, so
this
error is thrown.

Am 24.11.2012 21:48, schrieb Sven Meier:

  What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

  Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace


The first panel gets displayed, after a few seconds it should be
replaced by the second panel. Is there any way to achieve this
be

Re: Wicket (6) JARs...

2012-11-25 Thread Martin Grigorov
On Sun, Nov 25, 2012 at 7:30 PM, Russell Bateman wrote:

> Martin,
>
> I don't know why it is I didn't see or stumble upon this when I was
> looking at wicket.apache.org to get started.
>

There is a link "Download" which lists the last versions with links like
http://www.apache.org/dyn/closer.cgi/wicket/6.3.0


>
> Thank you profusely!
>
> Best,
>
> Russ
>
>
> On 11/25/2012 11:24 AM, Martin Grigorov wrote:
>
>> There is 'binaries' folder in the dist :
>> http://ftp-stud.hs-esslingen.**de/pub/Mirrors/ftp.apache.org/**
>> dist/wicket/6.3.0/
>>
>>
>> On Sun, Nov 25, 2012 at 7:22 PM, Russell Bateman > >wrote:
>>
>>  I downloaded Wicket 6 and found no JAR files within. I googled around
>>> without satisfaction. Is there just one JAR? I'm starting to look
>>> through a
>>> lot of places. It seems easier just to ask.
>>>
>>> I do not wish to use Maven. (I know this is probably shocking.)
>>>
>>> Could someone confirm there is only one JAR for Wicket?
>>>
>>>
>>> Russ
>>>
>>> --**
>>> --**-
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apa**che.org
>>> 
>>> >
>>>
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


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


Re: set favicon.ico dynamically in wicket 6

2012-11-25 Thread Martin Grigorov
You can add components which are in the .

MyPage.html:

  
 
  ...

.

MyPage.java:

add(new Favicon("favicon"));



Favicon.java:

public class Favicon extends WebComponent {

   public Favicon(String id){
 super(id);
   }

   public void onInitialize()
  {
 super.onInitialize();

 add(AttributeModifier.replace("href", generateHref(getPage(
  }
.
}


On Sun, Nov 25, 2012 at 7:08 PM, Tim Van Meerbeeck  wrote:

> Rob,
>
> This is a solution if you want to achieve this! I was just looking into the
> possibility because this is a pretty rare scenario. The favico was designed
> to have a bookmark to a site and have an icon in your favorites so you can
> quickly find the right bookmark. So the scenario to load this dynamically
> (for example for every different bookmarkable page in a wicket application,
> a different favico) is not so common.
>
> Though I had expected to find something in the standard wicket but yeah the
> scenario is quite uncommon. And with overriding this was implemented by
> you.
>
>
> Kind regards,
>
> Tim Van Meerbeeck
>
>
> 2012/11/25 Rob Schroeder 
>
> > Hi Tim,
> >
> > I ran into the same question a couple of days ago, and in what maybe
> > constitutes overkill for a simpler solution I didn't see, I looked at
> > CssResourceReference and reused as much of the code as seemed to be
> > necessary to make a FaviconResourceReference:
> >
> >
> https://docs.google.com/uc?export=download&id=0B3dKFXxMXAj1dWpCVUJqYzNJYUk
> >
> > With it, you can put your favicon.ico where you said you would, create a
> >
> >   FaviconResourceReference feedReaderFavicon = new
> FaviconResourceReference
> >   (FeedReader.class, "resources/favicon.ico");
> >
> > and add
> >
> >
> >
> response.render(FaviconReferenceHeaderItem.forReference(feedReaderFavicon));
> >
> > to your page's (overridden) renderHead method, just as you would with a
> > page-specific CSS resource.
> >
> > Cheers,
> > Robert
> >
> >
> > On Sat, 24 Nov 2012 21:36:14 +0100, Tim Van Meerbeeck wrote:
> >
> > > Hi
> > >
> > > I got a question about wicket 6 and adding a favicon.ico:
> > >
> > > I am trying to use a StringHeaderItem but I want the favicon.ico to be
> in
> > > the resources folder (normal page:
> > > http://localhost/whatever/page?0standard wicket resource directory:
> > > http://localhost/whatever/resources/*). I think I should use a
> > > ContextRelativeResource to point to the favico but you can'( point that
> > in
> > > stringheaderitem.
> > >
> > > I am looking at the best way to do this in Wicket 6 and above. for
> > earlier
> > > versions of wicket I found some things on the net but version 6 changed
> > > things around and I suppose this will be easy but I can't find it.
> > >
> > > Any help is appreciated
> > >
> > > Tim Van Meerbeeck
> > >
> >
> >
> >
> >
> > -
> > 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 


Re: Wicket (6) JARs...

2012-11-25 Thread Russell Bateman

Martin,

I don't know why it is I didn't see or stumble upon this when I was 
looking at wicket.apache.org to get started.


Thank you profusely!

Best,

Russ

On 11/25/2012 11:24 AM, Martin Grigorov wrote:

There is 'binaries' folder in the dist :
http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist/wicket/6.3.0/


On Sun, Nov 25, 2012 at 7:22 PM, Russell Bateman wrote:


I downloaded Wicket 6 and found no JAR files within. I googled around
without satisfaction. Is there just one JAR? I'm starting to look through a
lot of places. It seems easier just to ask.

I do not wish to use Maven. (I know this is probably shocking.)

Could someone confirm there is only one JAR for Wicket?


Russ

--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@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: Wicket (6) JARs...

2012-11-25 Thread Martin Grigorov
There is 'binaries' folder in the dist :
http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist/wicket/6.3.0/


On Sun, Nov 25, 2012 at 7:22 PM, Russell Bateman wrote:

> I downloaded Wicket 6 and found no JAR files within. I googled around
> without satisfaction. Is there just one JAR? I'm starting to look through a
> lot of places. It seems easier just to ask.
>
> I do not wish to use Maven. (I know this is probably shocking.)
>
> Could someone confirm there is only one JAR for Wicket?
>
>
> Russ
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


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


Wicket (6) JARs...

2012-11-25 Thread Russell Bateman
I downloaded Wicket 6 and found no JAR files within. I googled around 
without satisfaction. Is there just one JAR? I'm starting to look 
through a lot of places. It seems easier just to ask.


I do not wish to use Maven. (I know this is probably shocking.)

Could someone confirm there is only one JAR for Wicket?


Russ

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



Re: Ajax based panel replacement

2012-11-25 Thread Martin Grigorov
On Sun, Nov 25, 2012 at 7:14 PM, Martin Grigorov wrote:

> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
> b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
> index 3071875..0651c33 100644
> ---
> a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
> +++
> b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
> @@ -21,6 +21,7 @@ import
> org.apache.wicket.core.util.string.JavaScriptUtils;
>  import org.apache.wicket.markup.head.IHeaderResponse;
>  import org.apache.wicket.markup.head.JavaScriptHeaderItem;
>  import org.apache.wicket.markup.head.OnLoadHeaderItem;
> +import org.apache.wicket.markup.html.WebPage;
>  import org.apache.wicket.request.http.WebRequest;
>  import org.apache.wicket.util.time.Duration;
>
> @@ -127,15 +128,25 @@ public abstract class AbstractAjaxTimerBehavior
> extends AbstractDefaultAjaxBehav
> @Override
> protected final void respond(final AjaxRequestTarget target)
> {
> -   if (!isStopped() && isEnabled(getComponent()))
> +   if (shouldTrigger())
>  {
> onTimer(target);
>
> -   target.getHeaderResponse().render(
> -
> OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
> +   if (true || shouldTrigger())
>

Without the 'true ||'.


> +   {
> +   target.getHeaderResponse().render(
> +
> OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
> +   }
> }
> }
>
> +   private boolean shouldTrigger()
> +   {
> +   return isStopped() == false &&
> +   isEnabled(getComponent()) &&
> +   getComponent().findParent(WebPage.class)
> != null;
> +   }
> +
> /**
>
>
>
> On Sun, Nov 25, 2012 at 7:07 PM, Sven Meier  wrote:
>
>> Of course the component should be added to the ART.
>> But the example already fails when the behavior tries to write out the
>> next timeout after #onTimer().
>>
>> This is why I think it should re-check #isStopped(), since the user might
>> stop the timer in #onTimer().
>>
>> I'll take a look at WICKET-4886.
>>
>> Sven
>>
>>
>> On 11/25/2012 06:58 PM, Martin Grigorov wrote:
>>
>>> I see now what Sven meant with the second check for isStopped().
>>>
>>> But additionally I see that the quickstart is very broken.
>>>
>>> PanelOne does:
>>> form.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
>>>  @Override
>>>  protected void onTimer(AjaxRequestTarget target) {
>>>  PanelTwo two = new PanelTwo("panel");
>>>  wmc.addOrReplace(two);
>>>  }
>>>  });
>>>
>>> But it doesn't use 'target' to repaint any component, so the registered
>>> JS
>>> timer continues with its original Url which uses the old pageId and
>>> component path to PanelOne. And as expected the second call triggered by
>>> the obsolete timer fails with "The behavior's component (a Form which is
>>> no
>>> more connected to the Page) cannot find its page.
>>> This is a plain error in the application.
>>>
>>>
>>>
>>> On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann 
>>> **wrote:
>>>
>>>  As suggested i created the JIRA issue https://issues.apache.org/**
 jira/browse/WICKET-4886>>> browse/WICKET-4886 >

 I will test the diff tomorrow.

 Am 25.11.2012 15:41, schrieb Martin Grigorov:

  Hi,
>
>
> On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:
>
>   Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from
>
>> onTimer():
>>
>> diff --git a/wicket-core/src/main/java/
>> **org/apache/wicket/ajax/
>> AbstractAjaxTimerBehavior.java
>> b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
>> AbstractAjaxTimerBehavior.java
>> index 3071875..b982a39 100644
>> --- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
>> AbstractAjaxTimerBehavior.java
>> +++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
>>
>>
>> AbstractAjaxTimerBehavior.java
>> @@ -131,8 +131,11 @@
>>{
>>onTimer(target);
>>
>> -target.getHeaderResponse().**render(
>> - OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
>> updateInterval)));
>>
>> +if (!isStopped())
>>
>>   But this code is already in : if (!isStopped() &&
>>
> isEnabled(getComponent()))
> How the second "if (!isStopped())" fixes the issue ?
>
>
>   +{
>
>> +target.getHeaderResponse().**render(
>> + OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
>> updateInterval)));

Re: Ajax based panel replacement

2012-11-25 Thread Martin Grigorov
diff --git
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
index 3071875..0651c33 100644
---
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
+++
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
@@ -21,6 +21,7 @@ import org.apache.wicket.core.util.string.JavaScriptUtils;
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.head.JavaScriptHeaderItem;
 import org.apache.wicket.markup.head.OnLoadHeaderItem;
+import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.request.http.WebRequest;
 import org.apache.wicket.util.time.Duration;

@@ -127,15 +128,25 @@ public abstract class AbstractAjaxTimerBehavior
extends AbstractDefaultAjaxBehav
@Override
protected final void respond(final AjaxRequestTarget target)
{
-   if (!isStopped() && isEnabled(getComponent()))
+   if (shouldTrigger())
{
onTimer(target);

-   target.getHeaderResponse().render(
-
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   if (true || shouldTrigger())
+   {
+   target.getHeaderResponse().render(
+
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   }
}
}

+   private boolean shouldTrigger()
+   {
+   return isStopped() == false &&
+   isEnabled(getComponent()) &&
+   getComponent().findParent(WebPage.class) !=
null;
+   }
+
/**



On Sun, Nov 25, 2012 at 7:07 PM, Sven Meier  wrote:

> Of course the component should be added to the ART.
> But the example already fails when the behavior tries to write out the
> next timeout after #onTimer().
>
> This is why I think it should re-check #isStopped(), since the user might
> stop the timer in #onTimer().
>
> I'll take a look at WICKET-4886.
>
> Sven
>
>
> On 11/25/2012 06:58 PM, Martin Grigorov wrote:
>
>> I see now what Sven meant with the second check for isStopped().
>>
>> But additionally I see that the quickstart is very broken.
>>
>> PanelOne does:
>> form.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
>>  @Override
>>  protected void onTimer(AjaxRequestTarget target) {
>>  PanelTwo two = new PanelTwo("panel");
>>  wmc.addOrReplace(two);
>>  }
>>  });
>>
>> But it doesn't use 'target' to repaint any component, so the registered JS
>> timer continues with its original Url which uses the old pageId and
>> component path to PanelOne. And as expected the second call triggered by
>> the obsolete timer fails with "The behavior's component (a Form which is
>> no
>> more connected to the Page) cannot find its page.
>> This is a plain error in the application.
>>
>>
>>
>> On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann *
>> *wrote:
>>
>>  As suggested i created the JIRA issue https://issues.apache.org/**
>>> jira/browse/WICKET-4886>> browse/WICKET-4886 >
>>>
>>> I will test the diff tomorrow.
>>>
>>> Am 25.11.2012 15:41, schrieb Martin Grigorov:
>>>
>>>  Hi,


 On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

   Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from

> onTimer():
>
> diff --git a/wicket-core/src/main/java/
> **org/apache/wicket/ajax/
> AbstractAjaxTimerBehavior.java
> b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> index 3071875..b982a39 100644
> --- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> +++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
>
>
> AbstractAjaxTimerBehavior.java
> @@ -131,8 +131,11 @@
>{
>onTimer(target);
>
> -target.getHeaderResponse().**render(
> - OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
> updateInterval)));
>
> +if (!isStopped())
>
>   But this code is already in : if (!isStopped() &&
>
 isEnabled(getComponent()))
 How the second "if (!isStopped())" fixes the issue ?


   +{

> +target.getHeaderResponse().**render(
> + OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
> updateInterval)));
>
>
> +}
>}
>}
>
> You could create a jira issue too.
>
>  Additionally there are two global Ajax listeners at the bottom of
 wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
 I hav

Re: set favicon.ico dynamically in wicket 6

2012-11-25 Thread Tim Van Meerbeeck
Rob,

This is a solution if you want to achieve this! I was just looking into the
possibility because this is a pretty rare scenario. The favico was designed
to have a bookmark to a site and have an icon in your favorites so you can
quickly find the right bookmark. So the scenario to load this dynamically
(for example for every different bookmarkable page in a wicket application,
a different favico) is not so common.

Though I had expected to find something in the standard wicket but yeah the
scenario is quite uncommon. And with overriding this was implemented by you.


Kind regards,

Tim Van Meerbeeck


2012/11/25 Rob Schroeder 

> Hi Tim,
>
> I ran into the same question a couple of days ago, and in what maybe
> constitutes overkill for a simpler solution I didn't see, I looked at
> CssResourceReference and reused as much of the code as seemed to be
> necessary to make a FaviconResourceReference:
>
> https://docs.google.com/uc?export=download&id=0B3dKFXxMXAj1dWpCVUJqYzNJYUk
>
> With it, you can put your favicon.ico where you said you would, create a
>
>   FaviconResourceReference feedReaderFavicon = new FaviconResourceReference
>   (FeedReader.class, "resources/favicon.ico");
>
> and add
>
>
> response.render(FaviconReferenceHeaderItem.forReference(feedReaderFavicon));
>
> to your page's (overridden) renderHead method, just as you would with a
> page-specific CSS resource.
>
> Cheers,
> Robert
>
>
> On Sat, 24 Nov 2012 21:36:14 +0100, Tim Van Meerbeeck wrote:
>
> > Hi
> >
> > I got a question about wicket 6 and adding a favicon.ico:
> >
> > I am trying to use a StringHeaderItem but I want the favicon.ico to be in
> > the resources folder (normal page:
> > http://localhost/whatever/page?0standard wicket resource directory:
> > http://localhost/whatever/resources/*). I think I should use a
> > ContextRelativeResource to point to the favico but you can'( point that
> in
> > stringheaderitem.
> >
> > I am looking at the best way to do this in Wicket 6 and above. for
> earlier
> > versions of wicket I found some things on the net but version 6 changed
> > things around and I suppose this will be easy but I can't find it.
> >
> > Any help is appreciated
> >
> > Tim Van Meerbeeck
> >
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Ajax based panel replacement

2012-11-25 Thread Sven Meier

Of course the component should be added to the ART.
But the example already fails when the behavior tries to write out the 
next timeout after #onTimer().


This is why I think it should re-check #isStopped(), since the user 
might stop the timer in #onTimer().


I'll take a look at WICKET-4886.

Sven

On 11/25/2012 06:58 PM, Martin Grigorov wrote:

I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
 @Override
 protected void onTimer(AjaxRequestTarget target) {
 PanelTwo two = new PanelTwo("panel");
 wmc.addOrReplace(two);
 }
 });

But it doesn't use 'target' to repaint any component, so the registered JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call triggered by
the obsolete timer fails with "The behavior's component (a Form which is no
more connected to the Page) cannot find its page.
This is a plain error in the application.



On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann wrote:


As suggested i created the JIRA issue https://issues.apache.org/**
jira/browse/WICKET-4886
I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:


Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

  Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from

onTimer():

diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/
AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/**

AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
   {
   onTimer(target);

-target.getHeaderResponse().render(
- OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+if (!isStopped())

  But this code is already in : if (!isStopped() &&

isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


  +{

+target.getHeaderResponse().render(
+ OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));

+}
   }
   }

You could create a jira issue too.


Additionally there are two global Ajax listeners at the bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.




Sven



On 11/25/2012 01:13 AM, Oliver Zemann wrote:

  Unfortunately this is not a solution as i have about 30 different

panels.
And i guess at least 10 of them should later use JS. With the approach
you
suggested i would have to check which panel should be displayed and load
that (switch/case with 10 different panels). I guess that would also
lead
in heavy mixing the panels with the HomePage (BasePage) (destroying
reusability).

There is also no way for me to create a "flow based" dialogue as this is
done in the backend controller which only tells me which panel to load.

So there is no other way to go?

Am 24.11.2012 22:57, schrieb Sven Meier:

  After the timer has fired, AbstractAjaxTimerBehavior automatically

registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's
replaced by PanelTwo already.

I'd recommend adding the behavor to the container instead:

  final WebMarkupContainer wmc = new
WebMarkupContainer("container"
**);
  wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5))
{

  @Override
  protected void onTimer(AjaxRequestTarget target) {
  PanelTwo two = new PanelTwo("panel");
  wmc.addOrReplace(two);
  target.add(wmc);

  stop(target);
  }
  });
  add(wmc);

  wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:

  The problem is that this leads to a Page not found error. The problem

is that the Panel which should be replaced is still looked up in the
findPage() method. But findPage() returns null on that component, so
this
error is thrown.

Am 24.11.2012 21:48, schrieb Sven Meier:

  What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

  Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace


The first panel gets displayed, after a few seco

Re: Ajax based panel replacement

2012-11-25 Thread Martin Grigorov
I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
@Override
protected void onTimer(AjaxRequestTarget target) {
PanelTwo two = new PanelTwo("panel");
wmc.addOrReplace(two);
}
});

But it doesn't use 'target' to repaint any component, so the registered JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call triggered by
the obsolete timer fails with "The behavior's component (a Form which is no
more connected to the Page) cannot find its page.
This is a plain error in the application.



On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann wrote:

> As suggested i created the JIRA issue https://issues.apache.org/**
> jira/browse/WICKET-4886
> I will test the diff tomorrow.
>
> Am 25.11.2012 15:41, schrieb Martin Grigorov:
>
>> Hi,
>>
>>
>> On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:
>>
>>  Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from
>>> onTimer():
>>>
>>> diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/
>>> AbstractAjaxTimerBehavior.java
>>> b/wicket-core/src/main/java/org/apache/wicket/ajax/**
>>> AbstractAjaxTimerBehavior.java
>>> index 3071875..b982a39 100644
>>> --- a/wicket-core/src/main/java/org/apache/wicket/ajax/**
>>> AbstractAjaxTimerBehavior.java
>>> +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/**
>>>
>>> AbstractAjaxTimerBehavior.java
>>> @@ -131,8 +131,11 @@
>>>   {
>>>   onTimer(target);
>>>
>>> -target.getHeaderResponse().render(
>>> - OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
>>> +if (!isStopped())
>>>
>>>  But this code is already in : if (!isStopped() &&
>> isEnabled(getComponent()))
>> How the second "if (!isStopped())" fixes the issue ?
>>
>>
>>  +{
>>> +target.getHeaderResponse().render(
>>> + OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
>>>
>>> +}
>>>   }
>>>   }
>>>
>>> You could create a jira issue too.
>>>
>>
>> Additionally there are two global Ajax listeners at the bottom of
>> wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
>> I haven't debugged the application so I'm not sure where exactly is the
>> problem.
>>
>>
>>
>>> Sven
>>>
>>>
>>>
>>> On 11/25/2012 01:13 AM, Oliver Zemann wrote:
>>>
>>>  Unfortunately this is not a solution as i have about 30 different
 panels.
 And i guess at least 10 of them should later use JS. With the approach
 you
 suggested i would have to check which panel should be displayed and load
 that (switch/case with 10 different panels). I guess that would also
 lead
 in heavy mixing the panels with the HomePage (BasePage) (destroying
 reusability).

 There is also no way for me to create a "flow based" dialogue as this is
 done in the backend controller which only tells me which panel to load.

 So there is no other way to go?

 Am 24.11.2012 22:57, schrieb Sven Meier:

  After the timer has fired, AbstractAjaxTimerBehavior automatically
> registers another timeout for the form inside PanelOne.
> But at that point PanelOne is no longer in the component tree, it's
> replaced by PanelTwo already.
>
> I'd recommend adding the behavor to the container instead:
>
>  final WebMarkupContainer wmc = new
> WebMarkupContainer("container"
> **);
>  wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5))
> {
>
>  @Override
>  protected void onTimer(AjaxRequestTarget target) {
>  PanelTwo two = new PanelTwo("panel");
>  wmc.addOrReplace(two);
>  target.add(wmc);
>
>  stop(target);
>  }
>  });
>  add(wmc);
>
>  wmc.add(new PanelOne("panel"));
>
> This way you won't have to pass 'wmc' to PanelOne any longer.
>
> Sven
>
> On 11/24/2012 10:04 PM, Oliver Zemann wrote:
>
>  The problem is that this leads to a Page not found error. The problem
>> is that the Panel which should be replaced is still looked up in the
>> findPage() method. But findPage() returns null on that component, so
>> this
>> error is thrown.
>>
>> Am 24.11.2012 21:48, schrieb Sven Meier:
>>
>>  What is the problem?
>>>
>>> Sven
>>>
>>> On 11/24/2012 08:22 PM, Oliver Zemann wrote:
>>>
>>>  Hi,

 i created a small wicket application to show my problem:
 https://github.com/olze/WicketPanelRep

Re: Ajax based panel replacement

2012-11-25 Thread Oliver Zemann
As suggested i created the JIRA issue 
https://issues.apache.org/jira/browse/WICKET-4886

I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:

Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:


Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from
onTimer():

diff --git 
a/wicket-core/src/main/java/**org/apache/wicket/ajax/**AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
  {
  onTimer(target);

-target.getHeaderResponse().**render(
- OnLoadHeaderItem.forScript(**getJsTimeoutCall(**updateInterval)));
+if (!isStopped())


But this code is already in : if (!isStopped() && isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?



+{
+target.getHeaderResponse().**render(
+ OnLoadHeaderItem.forScript(**getJsTimeoutCall(**updateInterval)));
+}
  }
  }

You could create a jira issue too.


Additionally there are two global Ajax listeners at the bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.




Sven



On 11/25/2012 01:13 AM, Oliver Zemann wrote:


Unfortunately this is not a solution as i have about 30 different panels.
And i guess at least 10 of them should later use JS. With the approach you
suggested i would have to check which panel should be displayed and load
that (switch/case with 10 different panels). I guess that would also lead
in heavy mixing the panels with the HomePage (BasePage) (destroying
reusability).

There is also no way for me to create a "flow based" dialogue as this is
done in the backend controller which only tells me which panel to load.

So there is no other way to go?

Am 24.11.2012 22:57, schrieb Sven Meier:


After the timer has fired, AbstractAjaxTimerBehavior automatically
registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's
replaced by PanelTwo already.

I'd recommend adding the behavor to the container instead:

 final WebMarkupContainer wmc = new WebMarkupContainer("container"
**);
 wmc.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
 @Override
 protected void onTimer(AjaxRequestTarget target) {
 PanelTwo two = new PanelTwo("panel");
 wmc.addOrReplace(two);
 target.add(wmc);

 stop(target);
 }
 });
 add(wmc);

 wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:


The problem is that this leads to a Page not found error. The problem
is that the Panel which should be replaced is still looked up in the
findPage() method. But findPage() returns null on that component, so this
error is thrown.

Am 24.11.2012 21:48, schrieb Sven Meier:


What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:


Hi,

i created a small wicket application to show my problem:
https://github.com/olze/**WicketPanelReplace

The first panel gets displayed, after a few seconds it should be
replaced by the second panel. Is there any way to achieve this behavior
with that kind of architecture?

If not, how should a ajax based panel wizard work? Any
recommendations?

Thanks in advance.

Oli

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



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



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



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



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



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

Re: Injector.get() in websession returns null [SOLVED]

2012-11-25 Thread Kurt Sys
That looks nicer than what I had :). Great, thanks a lot!
Kurt

2012/11/25 Martin Grigorov :
> I don't use Wicket-CDI in my applications so I don't have much experience
> with it but I just took a look at the APIs and here is how I would do it:
>
> CdiContainer.get().getNonContextualManager().inject(this);
>
>
> On Sun, Nov 25, 2012 at 4:59 PM, Kurt Sys  wrote:
>
>> Hey Martin,
>>
>> Thanks. The init-method of MySession looks now like this:
>> --
>> private void init() {
>> BeanManager manager = null;
>> try {
>> manager = (BeanManager)
>> InitialContext.doLookup("java:comp/BeanManager");
>> } catch (NamingException e) {
>> e.printStackTrace();
>> }
>>
>> NonContextual.of(MySession.class, manager).inject(this);
>>}
>> --
>>
>> I don't now if this is the proper way of injecting into the session. I
>> don't really get how NonContextual works, but so far, this is how I
>> understand it: the class-parameter in the 'of'-method defines which
>> non-contextual classes can be injected in (managed by) the manager,
>> and inject actually makes the instance managed by the container.
>>
>> And well... there might be an easier way to get the BeanManager, but
>> at least, it works now. Should I make BeanManager from MainApp
>> accessible so MySession can get it from there, or should I leave it
>> like it?
>>
>> Thanks again, that was pretty easy,
>> Kurt
>>
>>
>> 2012/11/25 Martin Grigorov :
>> > Hi,
>> >
>> > Wicket is a bit inconsistent with its CDI integration.
>> > It doesn't use wicket-ioc Injector at all.
>> > You have to use NonContextual.of(...).inject(this) instead.
>> >
>> >
>> > On Sun, Nov 25, 2012 at 4:27 PM, Kurt Sys  wrote:
>> >
>> >> Hey all,
>> >> I'm trying to get cdi/injection to work with wicket. So far,
>> >> everything seems to be allright except for one thing: injecting into a
>> >> wicket-websession. Seems logical in some way, since a session is not a
>> >> component, so I tried using 'Injector.get().inject(this)', but
>> >> apparently, Injector.get() returns null. Injection into components
>> >> does work flawlessly (DaoService as well as other components are
>> >> injected into HomePage.java).
>> >> What am I missing?
>> >>
>> >> Thanks,
>> >> Kurt
>> >>
>> >>
>> >> Mainapp.java
>> >> --
>> >> package mypackage;
>> >>
>> >> import javax.enterprise.inject.spi.BeanManager;
>> >> import javax.naming.InitialContext;
>> >> import javax.naming.NamingException;
>> >> import org.apache.wicket.Application;
>> >> import org.apache.wicket.Session;
>> >> import org.apache.wicket.cdi.CdiConfiguration;
>> >> import org.apache.wicket.protocol.http.WebApplication;
>> >> import org.apache.wicket.request.Request;
>> >> import org.apache.wicket.request.Response;
>> >>
>> >> public class MainApp
>> >> extends WebApplication {
>> >>
>> >> public MainApp() {
>> >> }
>> >>
>> >> @Override
>> >> public void init() {
>> >> super.init();
>> >>
>> >> BeanManager manager = null;
>> >> try {
>> >> manager = (BeanManager)
>> >> InitialContext.doLookup("java:comp/BeanManager");
>> >> } catch (NamingException e) {
>> >> e.printStackTrace();
>> >> }
>> >> new CdiConfiguration(manager).configure(this);
>> >> }
>> >>
>> >> @Override
>> >> public void onDestroy() {
>> >> }
>> >>
>> >> public Class getHomePage() {
>> >> return HomePage.class;
>> >> }
>> >>
>> >> @Override
>> >> public final Session newSession(Request req, Response res) {
>> >> return new MySession(req);
>> >> }
>> >> }
>> >> --
>> >>
>> >> MySession.java
>> >> --
>> >> package mypackage;
>> >>
>> >> import javax.inject.Inject;
>> >> import org.apache.wicket.Session;
>> >> import org.apache.wicket.injection.Injector;
>> >> import org.apache.wicket.protocol.http.WebSession;
>> >> import org.apache.wicket.request.Request;
>> >>
>> >> public class MySession
>> >> extends WebSession {
>> >>
>> >> @Inject
>> >> DaoService daoService;
>> >>
>> >> public static MySession get() {
>> >> return (MySession) Session.get();
>> >> }
>> >>
>> >> MySession(Request req) {
>> >> super(req);
>> >> init();
>> >> }
>> >>
>> >> private void init() {
>> >> Injector.get().inject(this);
>> >> }
>> >>
>> >> private void test() {
>> >> daoService.someMethod();
>> >> }
>> >> }
>> >> --
>> >> I added the private void test-method to test if daoService is null.
>> >> However, there is a nullpointerexception earlier, at line
>> >> 'Injector.get().inject(this)'. I avoid 'this' in the constructor, so I
>> >> put i

Re: Injector.get() in websession returns null

2012-11-25 Thread Martin Grigorov
I don't use Wicket-CDI in my applications so I don't have much experience
with it but I just took a look at the APIs and here is how I would do it:

CdiContainer.get().getNonContextualManager().inject(this);


On Sun, Nov 25, 2012 at 4:59 PM, Kurt Sys  wrote:

> Hey Martin,
>
> Thanks. The init-method of MySession looks now like this:
> --
> private void init() {
> BeanManager manager = null;
> try {
> manager = (BeanManager)
> InitialContext.doLookup("java:comp/BeanManager");
> } catch (NamingException e) {
> e.printStackTrace();
> }
>
> NonContextual.of(MySession.class, manager).inject(this);
>}
> --
>
> I don't now if this is the proper way of injecting into the session. I
> don't really get how NonContextual works, but so far, this is how I
> understand it: the class-parameter in the 'of'-method defines which
> non-contextual classes can be injected in (managed by) the manager,
> and inject actually makes the instance managed by the container.
>
> And well... there might be an easier way to get the BeanManager, but
> at least, it works now. Should I make BeanManager from MainApp
> accessible so MySession can get it from there, or should I leave it
> like it?
>
> Thanks again, that was pretty easy,
> Kurt
>
>
> 2012/11/25 Martin Grigorov :
> > Hi,
> >
> > Wicket is a bit inconsistent with its CDI integration.
> > It doesn't use wicket-ioc Injector at all.
> > You have to use NonContextual.of(...).inject(this) instead.
> >
> >
> > On Sun, Nov 25, 2012 at 4:27 PM, Kurt Sys  wrote:
> >
> >> Hey all,
> >> I'm trying to get cdi/injection to work with wicket. So far,
> >> everything seems to be allright except for one thing: injecting into a
> >> wicket-websession. Seems logical in some way, since a session is not a
> >> component, so I tried using 'Injector.get().inject(this)', but
> >> apparently, Injector.get() returns null. Injection into components
> >> does work flawlessly (DaoService as well as other components are
> >> injected into HomePage.java).
> >> What am I missing?
> >>
> >> Thanks,
> >> Kurt
> >>
> >>
> >> Mainapp.java
> >> --
> >> package mypackage;
> >>
> >> import javax.enterprise.inject.spi.BeanManager;
> >> import javax.naming.InitialContext;
> >> import javax.naming.NamingException;
> >> import org.apache.wicket.Application;
> >> import org.apache.wicket.Session;
> >> import org.apache.wicket.cdi.CdiConfiguration;
> >> import org.apache.wicket.protocol.http.WebApplication;
> >> import org.apache.wicket.request.Request;
> >> import org.apache.wicket.request.Response;
> >>
> >> public class MainApp
> >> extends WebApplication {
> >>
> >> public MainApp() {
> >> }
> >>
> >> @Override
> >> public void init() {
> >> super.init();
> >>
> >> BeanManager manager = null;
> >> try {
> >> manager = (BeanManager)
> >> InitialContext.doLookup("java:comp/BeanManager");
> >> } catch (NamingException e) {
> >> e.printStackTrace();
> >> }
> >> new CdiConfiguration(manager).configure(this);
> >> }
> >>
> >> @Override
> >> public void onDestroy() {
> >> }
> >>
> >> public Class getHomePage() {
> >> return HomePage.class;
> >> }
> >>
> >> @Override
> >> public final Session newSession(Request req, Response res) {
> >> return new MySession(req);
> >> }
> >> }
> >> --
> >>
> >> MySession.java
> >> --
> >> package mypackage;
> >>
> >> import javax.inject.Inject;
> >> import org.apache.wicket.Session;
> >> import org.apache.wicket.injection.Injector;
> >> import org.apache.wicket.protocol.http.WebSession;
> >> import org.apache.wicket.request.Request;
> >>
> >> public class MySession
> >> extends WebSession {
> >>
> >> @Inject
> >> DaoService daoService;
> >>
> >> public static MySession get() {
> >> return (MySession) Session.get();
> >> }
> >>
> >> MySession(Request req) {
> >> super(req);
> >> init();
> >> }
> >>
> >> private void init() {
> >> Injector.get().inject(this);
> >> }
> >>
> >> private void test() {
> >> daoService.someMethod();
> >> }
> >> }
> >> --
> >> I added the private void test-method to test if daoService is null.
> >> However, there is a nullpointerexception earlier, at line
> >> 'Injector.get().inject(this)'. I avoid 'this' in the constructor, so I
> >> put it in a init-method. That keeps the code a little cleaner, I
> >> think.
> >>
> >> DaoService.java:
> >> --
> >> package mypackage;
> >>
> >> import java.util.List;
> >> import javax.ejb.Stateless;
> >> import javax.persistence.EntityManager;
> >> i

Re: Injector.get() in websession returns null

2012-11-25 Thread Kurt Sys
Hey Martin,

Thanks. The init-method of MySession looks now like this:
--
private void init() {
BeanManager manager = null;
try {
manager = (BeanManager) 
InitialContext.doLookup("java:comp/BeanManager");
} catch (NamingException e) {
e.printStackTrace();
}

NonContextual.of(MySession.class, manager).inject(this);
   }
--

I don't now if this is the proper way of injecting into the session. I
don't really get how NonContextual works, but so far, this is how I
understand it: the class-parameter in the 'of'-method defines which
non-contextual classes can be injected in (managed by) the manager,
and inject actually makes the instance managed by the container.

And well... there might be an easier way to get the BeanManager, but
at least, it works now. Should I make BeanManager from MainApp
accessible so MySession can get it from there, or should I leave it
like it?

Thanks again, that was pretty easy,
Kurt


2012/11/25 Martin Grigorov :
> Hi,
>
> Wicket is a bit inconsistent with its CDI integration.
> It doesn't use wicket-ioc Injector at all.
> You have to use NonContextual.of(...).inject(this) instead.
>
>
> On Sun, Nov 25, 2012 at 4:27 PM, Kurt Sys  wrote:
>
>> Hey all,
>> I'm trying to get cdi/injection to work with wicket. So far,
>> everything seems to be allright except for one thing: injecting into a
>> wicket-websession. Seems logical in some way, since a session is not a
>> component, so I tried using 'Injector.get().inject(this)', but
>> apparently, Injector.get() returns null. Injection into components
>> does work flawlessly (DaoService as well as other components are
>> injected into HomePage.java).
>> What am I missing?
>>
>> Thanks,
>> Kurt
>>
>>
>> Mainapp.java
>> --
>> package mypackage;
>>
>> import javax.enterprise.inject.spi.BeanManager;
>> import javax.naming.InitialContext;
>> import javax.naming.NamingException;
>> import org.apache.wicket.Application;
>> import org.apache.wicket.Session;
>> import org.apache.wicket.cdi.CdiConfiguration;
>> import org.apache.wicket.protocol.http.WebApplication;
>> import org.apache.wicket.request.Request;
>> import org.apache.wicket.request.Response;
>>
>> public class MainApp
>> extends WebApplication {
>>
>> public MainApp() {
>> }
>>
>> @Override
>> public void init() {
>> super.init();
>>
>> BeanManager manager = null;
>> try {
>> manager = (BeanManager)
>> InitialContext.doLookup("java:comp/BeanManager");
>> } catch (NamingException e) {
>> e.printStackTrace();
>> }
>> new CdiConfiguration(manager).configure(this);
>> }
>>
>> @Override
>> public void onDestroy() {
>> }
>>
>> public Class getHomePage() {
>> return HomePage.class;
>> }
>>
>> @Override
>> public final Session newSession(Request req, Response res) {
>> return new MySession(req);
>> }
>> }
>> --
>>
>> MySession.java
>> --
>> package mypackage;
>>
>> import javax.inject.Inject;
>> import org.apache.wicket.Session;
>> import org.apache.wicket.injection.Injector;
>> import org.apache.wicket.protocol.http.WebSession;
>> import org.apache.wicket.request.Request;
>>
>> public class MySession
>> extends WebSession {
>>
>> @Inject
>> DaoService daoService;
>>
>> public static MySession get() {
>> return (MySession) Session.get();
>> }
>>
>> MySession(Request req) {
>> super(req);
>> init();
>> }
>>
>> private void init() {
>> Injector.get().inject(this);
>> }
>>
>> private void test() {
>> daoService.someMethod();
>> }
>> }
>> --
>> I added the private void test-method to test if daoService is null.
>> However, there is a nullpointerexception earlier, at line
>> 'Injector.get().inject(this)'. I avoid 'this' in the constructor, so I
>> put it in a init-method. That keeps the code a little cleaner, I
>> think.
>>
>> DaoService.java:
>> --
>> package mypackage;
>>
>> import java.util.List;
>> import javax.ejb.Stateless;
>> import javax.persistence.EntityManager;
>> import javax.persistence.PersistenceContext;
>>
>> @Stateless
>> public class DaoService {
>>
>> @PersistenceContext(unitName="testPU")
>> private EntityManager entityManager;
>>
>> public void someMethod() {
>> }
>>
>> [...]
>> }
>> --
>> Injecting persistencecontext into daoservice does work fine.
>>
>> HomePage.java
>> --
>> package mypackage;
>>
>> import javax.inject.Inject;
>> import org.apache.wicket.markup.html.basic.Label
>> import org.apache.wicket.model.PropertyModel;
>>
>> public class HomePage
>>  

Re: Injector.get() in websession returns null

2012-11-25 Thread Martin Grigorov
Hi,

Wicket is a bit inconsistent with its CDI integration.
It doesn't use wicket-ioc Injector at all.
You have to use NonContextual.of(...).inject(this) instead.


On Sun, Nov 25, 2012 at 4:27 PM, Kurt Sys  wrote:

> Hey all,
> I'm trying to get cdi/injection to work with wicket. So far,
> everything seems to be allright except for one thing: injecting into a
> wicket-websession. Seems logical in some way, since a session is not a
> component, so I tried using 'Injector.get().inject(this)', but
> apparently, Injector.get() returns null. Injection into components
> does work flawlessly (DaoService as well as other components are
> injected into HomePage.java).
> What am I missing?
>
> Thanks,
> Kurt
>
>
> Mainapp.java
> --
> package mypackage;
>
> import javax.enterprise.inject.spi.BeanManager;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import org.apache.wicket.Application;
> import org.apache.wicket.Session;
> import org.apache.wicket.cdi.CdiConfiguration;
> import org.apache.wicket.protocol.http.WebApplication;
> import org.apache.wicket.request.Request;
> import org.apache.wicket.request.Response;
>
> public class MainApp
> extends WebApplication {
>
> public MainApp() {
> }
>
> @Override
> public void init() {
> super.init();
>
> BeanManager manager = null;
> try {
> manager = (BeanManager)
> InitialContext.doLookup("java:comp/BeanManager");
> } catch (NamingException e) {
> e.printStackTrace();
> }
> new CdiConfiguration(manager).configure(this);
> }
>
> @Override
> public void onDestroy() {
> }
>
> public Class getHomePage() {
> return HomePage.class;
> }
>
> @Override
> public final Session newSession(Request req, Response res) {
> return new MySession(req);
> }
> }
> --
>
> MySession.java
> --
> package mypackage;
>
> import javax.inject.Inject;
> import org.apache.wicket.Session;
> import org.apache.wicket.injection.Injector;
> import org.apache.wicket.protocol.http.WebSession;
> import org.apache.wicket.request.Request;
>
> public class MySession
> extends WebSession {
>
> @Inject
> DaoService daoService;
>
> public static MySession get() {
> return (MySession) Session.get();
> }
>
> MySession(Request req) {
> super(req);
> init();
> }
>
> private void init() {
> Injector.get().inject(this);
> }
>
> private void test() {
> daoService.someMethod();
> }
> }
> --
> I added the private void test-method to test if daoService is null.
> However, there is a nullpointerexception earlier, at line
> 'Injector.get().inject(this)'. I avoid 'this' in the constructor, so I
> put it in a init-method. That keeps the code a little cleaner, I
> think.
>
> DaoService.java:
> --
> package mypackage;
>
> import java.util.List;
> import javax.ejb.Stateless;
> import javax.persistence.EntityManager;
> import javax.persistence.PersistenceContext;
>
> @Stateless
> public class DaoService {
>
> @PersistenceContext(unitName="testPU")
> private EntityManager entityManager;
>
> public void someMethod() {
> }
>
> [...]
> }
> --
> Injecting persistencecontext into daoservice does work fine.
>
> HomePage.java
> --
> package mypackage;
>
> import javax.inject.Inject;
> import org.apache.wicket.markup.html.basic.Label
> import org.apache.wicket.model.PropertyModel;
>
> public class HomePage
> extends BasePage {
>
> @Inject
> DaoService daoService;
> @Inject
> Clock clock;
>
> public HomePage() {
> add(new Label("time", new PropertyModel(this,
> "clock.time")));
> daoService.someMethod();
> }
> }
> --
> No nullpointerexception or any other problem here.
>
> I don't get any issues as long as I don't open the webapp (the
> application starts fine). Some logs (line numbers are incorrect: line
> number 28 is the one with 'Injector.get()'; I deleted some comments to
> keep it a little more readable):
> --
> INFO: Server startup in 6005 ms
> 25-nov-2012 16:00:59 org.apache.wicket.DefaultExceptionMapper internalMap
> SEVERE: Unexpected error occurred
> java.lang.NullPointerException
> at mypackage.MySession.init(MySession.java:28)
> at mypackage.MySession.(MySession.java:24)
> at mypackage.MainApp.newSession(MainApp.java:45)
> at
> org.apache.wicket.Application.fetchCreateAndSetSession(Application.java:1557)
> at org.apache.wicket.Session.get(Session.java:152)
> at org.apache.wicket.Restart
> [...]
> 25-nov-2012 16:00:59 org.apache.wicket.DefaultExceptionMapper map
> SEVERE: unexpected 

Injector.get() in websession returns null

2012-11-25 Thread Kurt Sys
Hey all,
I'm trying to get cdi/injection to work with wicket. So far,
everything seems to be allright except for one thing: injecting into a
wicket-websession. Seems logical in some way, since a session is not a
component, so I tried using 'Injector.get().inject(this)', but
apparently, Injector.get() returns null. Injection into components
does work flawlessly (DaoService as well as other components are
injected into HomePage.java).
What am I missing?

Thanks,
Kurt


Mainapp.java
--
package mypackage;

import javax.enterprise.inject.spi.BeanManager;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.apache.wicket.Application;
import org.apache.wicket.Session;
import org.apache.wicket.cdi.CdiConfiguration;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response;

public class MainApp
extends WebApplication {

public MainApp() {
}

@Override
public void init() {
super.init();

BeanManager manager = null;
try {
manager = (BeanManager) 
InitialContext.doLookup("java:comp/BeanManager");
} catch (NamingException e) {
e.printStackTrace();
}
new CdiConfiguration(manager).configure(this);
}

@Override
public void onDestroy() {
}

public Class getHomePage() {
return HomePage.class;
}

@Override
public final Session newSession(Request req, Response res) {
return new MySession(req);
}
}
--

MySession.java
--
package mypackage;

import javax.inject.Inject;
import org.apache.wicket.Session;
import org.apache.wicket.injection.Injector;
import org.apache.wicket.protocol.http.WebSession;
import org.apache.wicket.request.Request;

public class MySession
extends WebSession {

@Inject
DaoService daoService;

public static MySession get() {
return (MySession) Session.get();
}

MySession(Request req) {
super(req);
init();
}

private void init() {
Injector.get().inject(this);
}

private void test() {
daoService.someMethod();
}
}
--
I added the private void test-method to test if daoService is null.
However, there is a nullpointerexception earlier, at line
'Injector.get().inject(this)'. I avoid 'this' in the constructor, so I
put it in a init-method. That keeps the code a little cleaner, I
think.

DaoService.java:
--
package mypackage;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class DaoService {

@PersistenceContext(unitName="testPU")
private EntityManager entityManager;

public void someMethod() {
}

[...]
}
--
Injecting persistencecontext into daoservice does work fine.

HomePage.java
--
package mypackage;

import javax.inject.Inject;
import org.apache.wicket.markup.html.basic.Label
import org.apache.wicket.model.PropertyModel;

public class HomePage
extends BasePage {

@Inject
DaoService daoService;
@Inject
Clock clock;

public HomePage() {
add(new Label("time", new PropertyModel(this, "clock.time")));
daoService.someMethod();
}
}
--
No nullpointerexception or any other problem here.

I don't get any issues as long as I don't open the webapp (the
application starts fine). Some logs (line numbers are incorrect: line
number 28 is the one with 'Injector.get()'; I deleted some comments to
keep it a little more readable):
--
INFO: Server startup in 6005 ms
25-nov-2012 16:00:59 org.apache.wicket.DefaultExceptionMapper internalMap
SEVERE: Unexpected error occurred
java.lang.NullPointerException
at mypackage.MySession.init(MySession.java:28)
at mypackage.MySession.(MySession.java:24)
at mypackage.MainApp.newSession(MainApp.java:45)
at 
org.apache.wicket.Application.fetchCreateAndSetSession(Application.java:1557)
at org.apache.wicket.Session.get(Session.java:152)
at org.apache.wicket.Restart
[...]
25-nov-2012 16:00:59 org.apache.wicket.DefaultExceptionMapper map
SEVERE: unexpected exception when handling another exception: null
java.lang.NullPointerException
at mypackage.MySession.init(MySession.java:28)
at mypackage.MySession.(MySession.java:24)
at mypackage.MainApp.newSession(MainApp.java:45)
at 
org.apache.wicket.Application.fetchCreateAndSetSession(Application.java:1557)
at org.apache.wicket.Session.get(Session.java:152)
at 
org.apache.wicket.RestartResponseAtInterceptPageException$InterceptData.get(RestartResponseAtInterceptPageException.java

Re: Lifecycle debugging setting

2012-11-25 Thread Martin Grigorov
Hi,

What are the possible states you mean ?


On Fri, Nov 23, 2012 at 11:05 PM, Chris Colman  wrote:

> Is there a debug setting that can turn on debugging of lifecycle states?
>
>
> i.e. when turned on it will dump the component Id and the state it just
> entered as it enters each state
>
> Yours sincerely,
>
> Chris Colman
>



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


Re: WicketTagIdentifier: possible optimization

2012-11-25 Thread Martin Grigorov
Hi,

Please file a ticket for this improvement.


On Sat, Nov 24, 2012 at 5:25 AM, Chris Colman
wrote:

> Just looking at the Wicket source for an unrelated issue I noticed that
>
> WicketTagIdentifier stores a private static collection of
> wellKnownTagNames as an ArrayList.
>
> and a method called isWellKnown is called from within
> WicketTagIdentifier.onComponentTag and presumably it's called on every
> Wicket tag parsed.
>
> private boolean isWellKnown(final ComponentTag tag)
> {
> for (String name : wellKnownTagNames)
> {
> if
> (tag.getName().equalsIgnoreCase(name))
> {
> return true;
> }
> }
> return false;
> }
>
> This method iterates over the list elements until an item is found so
> has O(n) performance. If this array list was to be changed to a Set
> instead it would have O(1) performance.
>
> I haven't got any metrics on the usage and I don't think the improvement
> would be sensational but for web apps with large quantities of markup it
> could make some difference. For such a simple change it's probably worth
> it.
>



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


Re: After/before creation or serialization

2012-11-25 Thread Martin Grigorov
Hi,

onInitialize is called just once for any Component. As its javadoc says it
is called some time before the first call of #onConfigure.
#onDetach() is called before passing the Page to serialization but it can
be called at any time and several times per request cycle, so it is not
good idea to do your task there too.

The solution you are looking for is wicket-ioc module. It is the base for
@SpringBean and @Inject support in Wicket. It injects serializable proxy
instead of your real DAO/Service/... So it is very cheap for serialization
and doesn't require your real dao/service to be Serializable itself.


On Sun, Nov 25, 2012 at 2:22 PM, Oscar Besga Arcauz wrote:

>  Thanks
>
> Yes, I can use both methos onInitialize + onRead and onDetach + onSave
>
> Perhaps I should ask if onInitialize and onDetach are used when component
> is serialized /deserialized on wicket 6
>
> My plan is to do avoid this
>
> MyPanel(String id){
> super(id)
> ((MyApplicattion)getApplication()).getDao().getData();
>}
>
> and turn into this
>
>
> MyPanel(String id){
> super(id)
> }
>
> private transient Dao dao;
>
> void onCreateOrRead(){
> dao = ((MyApplicattion)getApplication()).getDao();
> }
>
>
>void onCreateOrRead(){
> dao = null; // Not necessary
>}
>
>
> > > > Oscar Besga Arcauz  < < <
>
> -Cedric Gatay  escribió: -
> Para: users@wicket.apache.org
> De: Cedric Gatay 
> Fecha: 25/11/2012  13:36
> Asunto: Re: After/before creation or serialization
>
> Hi,
> I don't know if there is a special Wicket thing, but you can use the
> standard Java way like this :
> private void writeObject(ObjectOutputStream out) throws IOException {
> //provide your own logic
> }
>
> private void readObject(ObjectInputStream in) throws IOException,
> ClassNotFoundException {
> //provide your own logic
> }
>
> Regards,
>
> __
> Cedric Gatay
> http://www.bloggure.info | http://cedric.gatay.fr |
> @Cedric_Gatay
>
>
>
> On Sun, Nov 25, 2012 at 1:28 PM, Oscar Besga Arcauz  >wrote:
>
> >
> >
> > Hi wickers !
> >
> > Is there a method on Wicket components that is called before
> > creation/load(f.e. from disk, deserialization) and another method called
> > before destroy/save(to disk, serialization)
> >
> > Would it be methods onInitialize()   and onDetach()  of
> > org.apache.wicket.Component ?
> >
> > Thanks !
> >
> >
> > > > > Oscar Besga Arcauz  < < <
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


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


Re: set favicon.ico dynamically in wicket 6

2012-11-25 Thread Martin Grigorov
Hi,

Is 'resources' folder next to WEB-INF folder in the file system ?
If YES then all you need to do is:

MyPage.html

  
 


Wicket automatically resolves such relative urls to context relative ones
no matter what is the mount point of your page



On Sat, Nov 24, 2012 at 9:36 PM, Tim Van Meerbeeck  wrote:

> Hi
>
> I got a question about wicket 6 and adding a favicon.ico:
>
> I am trying to use a StringHeaderItem but I want the favicon.ico to be in
> the resources folder (normal page:
> http://localhost/whatever/page?0standard wicket resource directory:
> http://localhost/whatever/resources/*). I think I should use a
> ContextRelativeResource to point to the favico but you can'( point that in
> stringheaderitem.
>
> I am looking at the best way to do this in Wicket 6 and above. for earlier
> versions of wicket I found some things on the net but version 6 changed
> things around and I suppose this will be easy but I can't find it.
>
> Any help is appreciated
>
> Tim Van Meerbeeck
>



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


Re: Ajax based panel replacement

2012-11-25 Thread Martin Grigorov
Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

> Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from
> onTimer():
>
> diff --git 
> a/wicket-core/src/main/java/**org/apache/wicket/ajax/**AbstractAjaxTimerBehavior.java
> b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> index 3071875..b982a39 100644
> --- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> +++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> @@ -131,8 +131,11 @@
>  {
>  onTimer(target);
>
> -target.getHeaderResponse().**render(
> - OnLoadHeaderItem.forScript(**getJsTimeoutCall(**updateInterval)));
> +if (!isStopped())
>

But this code is already in : if (!isStopped() && isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


> +{
> +target.getHeaderResponse().**render(
> + OnLoadHeaderItem.forScript(**getJsTimeoutCall(**updateInterval)));
> +}
>  }
>  }
>
> You could create a jira issue too.


Additionally there are two global Ajax listeners at the bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.


>
>
> Sven
>
>
>
> On 11/25/2012 01:13 AM, Oliver Zemann wrote:
>
>> Unfortunately this is not a solution as i have about 30 different panels.
>> And i guess at least 10 of them should later use JS. With the approach you
>> suggested i would have to check which panel should be displayed and load
>> that (switch/case with 10 different panels). I guess that would also lead
>> in heavy mixing the panels with the HomePage (BasePage) (destroying
>> reusability).
>>
>> There is also no way for me to create a "flow based" dialogue as this is
>> done in the backend controller which only tells me which panel to load.
>>
>> So there is no other way to go?
>>
>> Am 24.11.2012 22:57, schrieb Sven Meier:
>>
>>> After the timer has fired, AbstractAjaxTimerBehavior automatically
>>> registers another timeout for the form inside PanelOne.
>>> But at that point PanelOne is no longer in the component tree, it's
>>> replaced by PanelTwo already.
>>>
>>> I'd recommend adding the behavor to the container instead:
>>>
>>> final WebMarkupContainer wmc = new WebMarkupContainer("container"
>>> **);
>>> wmc.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
>>> @Override
>>> protected void onTimer(AjaxRequestTarget target) {
>>> PanelTwo two = new PanelTwo("panel");
>>> wmc.addOrReplace(two);
>>> target.add(wmc);
>>>
>>> stop(target);
>>> }
>>> });
>>> add(wmc);
>>>
>>> wmc.add(new PanelOne("panel"));
>>>
>>> This way you won't have to pass 'wmc' to PanelOne any longer.
>>>
>>> Sven
>>>
>>> On 11/24/2012 10:04 PM, Oliver Zemann wrote:
>>>
 The problem is that this leads to a Page not found error. The problem
 is that the Panel which should be replaced is still looked up in the
 findPage() method. But findPage() returns null on that component, so this
 error is thrown.

 Am 24.11.2012 21:48, schrieb Sven Meier:

> What is the problem?
>
> Sven
>
> On 11/24/2012 08:22 PM, Oliver Zemann wrote:
>
>> Hi,
>>
>> i created a small wicket application to show my problem:
>> https://github.com/olze/**WicketPanelReplace
>>
>> The first panel gets displayed, after a few seconds it should be
>> replaced by the second panel. Is there any way to achieve this behavior
>> with that kind of architecture?
>>
>> If not, how should a ajax based panel wizard work? Any
>> recommendations?
>>
>> Thanks in advance.
>>
>> Oli
>>
>> --**--**
>> -
>> To unsubscribe, e-mail: 
>> users-unsubscribe@wicket.**apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> --**--**
> -
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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


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

Re: Deploy on production: optimization tip & tricks

2012-11-25 Thread Martin Grigorov
Hi,


On Sun, Nov 25, 2012 at 11:54 AM, Oscar Besga Arcauz wrote:

> Thank you !
>
> Some of these improvements are already implemented on my site.
>
> I've been looking forward to implement wicket-specific optimizations
> (althought I'm discovering that wicket alone it's default optimized on
> deployment mode )
>
> And as you already said, perfomance is an art where no silver bullets are
> common; but a search for balance and tradeoffs.
>
> For example, I've said that using (1) code will . Well, for one side it
> will dinamically minify the resulting html code downloaded by browser. But
> these settings will make page processing slower.
>

These particular settings are actually not a problem.
They are used during the reading of the markup templates. Once read the
templates are cached and used for the lifetime of the application.


>
> So it's up to you to choose the rigth approach.
>
> (1)
> getMarkupSettings().setStripComments(true);
> getMarkupSettings().setCompressWhitespace(true);
> getMarkupSettings().setStripWicketTags(true);
>
>
> > > > Oscar Besga Arcauz  < < <
>
> -"Serban.Balamaci"  escribió: -
> Para: users@wicket.apache.org
> De: "Serban.Balamaci" 
> Fecha: 15/11/2012  22:45
> Asunto: Re: Deploy on production: optimization tip & tricks
>
> Hi Oscar,
> Probably nobody responded because this is not a simple topic but with many
> implications and turns. There are many optimizations that can be done not
> necessarily related to wicket.
> I'd recomend http://stevesouders.com/ blog, http://www.bookofspeed.com/ ,
> http://www.guypo.com/
>
> But ok I'll play along and add my 2 cents:
> 1. Setting Caching  headers on the web response is for certain something
> that you'd want to do. Set a long expire date for JS and CSS file like
> months even 1year. But you'd also want the users to receive the latest css
> and JS files you make with a new release. So it's good to mix up the
> resource name with some kind of version token(I use the app version nr in
> the css/js files name something like  href="https://portal.isdefe.es/2.14/css/site.css"; />).
>
> Also most important optimizations that give the user the impression of
> speed
> are related to loading the JS files. While JS files are being downloaded
> the
> PAGE RENDERING is STOPPED. So it's a good idea to put them at the page's
> bottom and using the css and html to render the page in an usable(nice
> looking) state and then, while the user is reading and figuring out the
> content, the JS "enhancements" like sliding menus etc are loading in the
> "background". Otherwise keeping the JS at the top results in the so called
> "WhitePageOfDeath" in which the user sees a blank page while the header JS
> files are being downloaded.
> You can achieve the same thing as putting the JS at the page bottom but
> while keeping the JS files at the head with the "defer" attribute easily
> like . That means the rendering will not be blocked but the JS will execute
> on DomReady event.
>
> 2. Minification and merging JS files into one:
> A. Most today's browsers are limited to making at most 6 parallel requests
> to a certain domain. So you don't want to have more js files merged into a
> single one so you don't wait for another wave of free connections. There is
> also the RoundTripTime overhead associated with making a new call to the
> server.
> B. The the bigger a text file is, the better it's compression ratio will
> be.
> So you'd get some benefit from merging all the js files into one and the
> gzip compression will be greater and also the minification gain. I
> recommend
> the *wro4j* project as it has lots of minification plugins.
> Unfortunately Wicket's component nature where every component can
> contribute
> it's own separate JS file makes it harder to have a single big minified JS
> file for all the page.
>
>
> 3. Using CDNs have the benefit of lower latency and also introducing
> another
> domain and thus increasing those 6 max nr of connections. Using some famous
> CDN like you did for JQuery also increases the probability of user already
> having Jquery in the cache from another site that he visited before(that's
> why I'm a fan of not also including the JQuery library in a minified
> package
> of all your site's JS files).
>
> Using asynchronous loading for 3rd party scripts like g+, facebook, ga are
> mandatory also these days.
>
> 4. Caching before the web server layer - using a caching proxy like Varnish
> or Apache/Nginx with a caching module to save maybe DB generated image
> resources maybe can be a good idea also.
> The topic is far far from being exhausted so I think that's the reason why
> nobody is playing along with responding.
>
> Personally I'm curios if an enhancement of providing "Transfer-Encoding:
> chunked" and keeping the JS resources in the head with the "defer"
> attribute(so the browser quickly receives the header and can begin the
> download of JS files) while a slow DB prevents us

Re: After/before creation or serialization

2012-11-25 Thread Oscar Besga Arcauz
 Thanks

Yes, I can use both methos onInitialize + onRead and onDetach + onSave

Perhaps I should ask if onInitialize and onDetach are used when component is 
serialized /deserialized on wicket 6

My plan is to do avoid this

    MyPanel(String id){
    super(id)
        ((MyApplicattion)getApplication()).getDao().getData();
   }

and turn into this


    MyPanel(String id){
    super(id)
    }

    private transient Dao dao;

    void onCreateOrRead(){
    dao = ((MyApplicattion)getApplication()).getDao();
    }


   void onCreateOrRead(){
    dao = null; // Not necessary
   }


> > > Oscar Besga Arcauz  < < < 

-Cedric Gatay  escribió: -
Para: users@wicket.apache.org
De: Cedric Gatay 
Fecha: 25/11/2012  13:36
Asunto: Re: After/before creation or serialization

Hi,
I don't know if there is a special Wicket thing, but you can use the
standard Java way like this :
    private void writeObject(ObjectOutputStream out) throws IOException {
        //provide your own logic
    }

    private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
        //provide your own logic
    }

Regards,

__
Cedric Gatay
http://www.bloggure.info | http://cedric.gatay.fr |
@Cedric_Gatay



On Sun, Nov 25, 2012 at 1:28 PM, Oscar Besga Arcauz wrote:

>
>
> Hi wickers !
>
> Is there a method on Wicket components that is called before
> creation/load(f.e. from disk, deserialization) and another method called
> before destroy/save(to disk, serialization)
>
> Would it be methods onInitialize()   and onDetach()  of
> org.apache.wicket.Component ?
>
> Thanks !
>
>
>     > > > Oscar Besga Arcauz  < < <
> -
> 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: After/before creation or serialization

2012-11-25 Thread Cedric Gatay
Hi,
I don't know if there is a special Wicket thing, but you can use the
standard Java way like this :
private void writeObject(ObjectOutputStream out) throws IOException {
//provide your own logic
}

private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
//provide your own logic
}

Regards,

__
Cedric Gatay
http://www.bloggure.info | http://cedric.gatay.fr |
@Cedric_Gatay



On Sun, Nov 25, 2012 at 1:28 PM, Oscar Besga Arcauz wrote:

>
>
> Hi wickers !
>
> Is there a method on Wicket components that is called before
> creation/load(f.e. from disk, deserialization) and another method called
> before destroy/save(to disk, serialization)
>
> Would it be methods onInitialize()   and onDetach()  of
> org.apache.wicket.Component ?
>
> Thanks !
>
>
> > > > Oscar Besga Arcauz  < < <
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


After/before creation or serialization

2012-11-25 Thread Oscar Besga Arcauz
 

Hi wickers !

Is there a method on Wicket components that is called before creation/load(f.e. 
from disk, deserialization) and another method called before destroy/save(to 
disk, serialization)

Would it be methods onInitialize()   and onDetach()  of 
org.apache.wicket.Component ?

Thanks !


> > > Oscar Besga Arcauz  < < < 
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Deploy on production: optimization tip & tricks

2012-11-25 Thread Oscar Besga Arcauz
Thank you !

Some of these improvements are already implemented on my site.

I've been looking forward to implement wicket-specific optimizations (althought 
I'm discovering that wicket alone it's default optimized on deployment mode ) 

And as you already said, perfomance is an art where no silver bullets are 
common; but a search for balance and tradeoffs.

For example, I've said that using (1) code will . Well, for one side it will 
dinamically minify the resulting html code downloaded by browser. But these 
settings will make page processing slower.

So it's up to you to choose the rigth approach.

(1)
        getMarkupSettings().setStripComments(true);
    getMarkupSettings().setCompressWhitespace(true);
    getMarkupSettings().setStripWicketTags(true);


> > > Oscar Besga Arcauz  < < < 

-"Serban.Balamaci"  escribió: -
Para: users@wicket.apache.org
De: "Serban.Balamaci" 
Fecha: 15/11/2012  22:45
Asunto: Re: Deploy on production: optimization tip & tricks

Hi Oscar,
Probably nobody responded because this is not a simple topic but with many
implications and turns. There are many optimizations that can be done not
necessarily related to wicket. 
I'd recomend http://stevesouders.com/ blog, http://www.bookofspeed.com/ ,
http://www.guypo.com/

But ok I'll play along and add my 2 cents: 
1. Setting Caching  headers on the web response is for certain something
that you'd want to do. Set a long expire date for JS and CSS file like
months even 1year. But you'd also want the users to receive the latest css
and JS files you make with a new release. So it's good to mix up the
resource name with some kind of version token(I use the app version nr in
the css/js files name something like https://portal.isdefe.es/2.14/css/site.css"; />).

Also most important optimizations that give the user the impression of speed
are related to loading the JS files. While JS files are being downloaded the
PAGE RENDERING is STOPPED. So it's a good idea to put them at the page's
bottom and using the css and html to render the page in an usable(nice
looking) state and then, while the user is reading and figuring out the
content, the JS "enhancements" like sliding menus etc are loading in the
"background". Otherwise keeping the JS at the top results in the so called
"WhitePageOfDeath" in which the user sees a blank page while the header JS
files are being downloaded.
You can achieve the same thing as putting the JS at the page bottom but
while keeping the JS files at the head with the "defer" attribute easily
like . That means the rendering will not be blocked but the JS will execute
on DomReady event.

2. Minification and merging JS files into one:
A. Most today's browsers are limited to making at most 6 parallel requests
to a certain domain. So you don't want to have more js files merged into a
single one so you don't wait for another wave of free connections. There is
also the RoundTripTime overhead associated with making a new call to the
server.
B. The the bigger a text file is, the better it's compression ratio will be.
So you'd get some benefit from merging all the js files into one and the
gzip compression will be greater and also the minification gain. I recommend
the *wro4j* project as it has lots of minification plugins. 
Unfortunately Wicket's component nature where every component can contribute
it's own separate JS file makes it harder to have a single big minified JS
file for all the page.


3. Using CDNs have the benefit of lower latency and also introducing another
domain and thus increasing those 6 max nr of connections. Using some famous
CDN like you did for JQuery also increases the probability of user already
having Jquery in the cache from another site that he visited before(that's
why I'm a fan of not also including the JQuery library in a minified package
of all your site's JS files). 

Using asynchronous loading for 3rd party scripts like g+, facebook, ga are
mandatory also these days.

4. Caching before the web server layer - using a caching proxy like Varnish
or Apache/Nginx with a caching module to save maybe DB generated image
resources maybe can be a good idea also.
The topic is far far from being exhausted so I think that's the reason why
nobody is playing along with responding. 

Personally I'm curios if an enhancement of providing "Transfer-Encoding:
chunked" and keeping the JS resources in the head with the "defer"
attribute(so the browser quickly receives the header and can begin the
download of JS files) while a slow DB prevents us from returning the full
html. But I'm afraid it might be a mess with not really huge gains in
performance and wicket by it's component nature means we don't know the
required js resources in the page's head until all the components have been
added to the page and got a chance to contribute there needed resources. 

I'm also curious what the future holds in terms of the SPDY protocol since
optimizing for it and might go against today's best pr

Re: set favicon.ico dynamically in wicket 6

2012-11-25 Thread Rob Schroeder
Hi Tim,

I ran into the same question a couple of days ago, and in what maybe 
constitutes overkill for a simpler solution I didn't see, I looked at 
CssResourceReference and reused as much of the code as seemed to be 
necessary to make a FaviconResourceReference: 

https://docs.google.com/uc?export=download&id=0B3dKFXxMXAj1dWpCVUJqYzNJYUk

With it, you can put your favicon.ico where you said you would, create a

  FaviconResourceReference feedReaderFavicon = new FaviconResourceReference
  (FeedReader.class, "resources/favicon.ico");

and add

  response.render(FaviconReferenceHeaderItem.forReference(feedReaderFavicon));

to your page's (overridden) renderHead method, just as you would with a 
page-specific CSS resource.

Cheers,
Robert


On Sat, 24 Nov 2012 21:36:14 +0100, Tim Van Meerbeeck wrote:

> Hi
> 
> I got a question about wicket 6 and adding a favicon.ico:
> 
> I am trying to use a StringHeaderItem but I want the favicon.ico to be in
> the resources folder (normal page:
> http://localhost/whatever/page?0standard wicket resource directory:
> http://localhost/whatever/resources/*). I think I should use a
> ContextRelativeResource to point to the favico but you can'( point that in
> stringheaderitem.
> 
> I am looking at the best way to do this in Wicket 6 and above. for earlier
> versions of wicket I found some things on the net but version 6 changed
> things around and I suppose this will be easy but I can't find it.
> 
> Any help is appreciated
> 
> Tim Van Meerbeeck
> 




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



Re: Ajax based panel replacement

2012-11-25 Thread Sven Meier
Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from 
onTimer():


diff --git 
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java 
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java

index 3071875..b982a39 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java

@@ -131,8 +131,11 @@
 {
 onTimer(target);

-target.getHeaderResponse().render(
- OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+if (!isStopped())
+{
+target.getHeaderResponse().render(
+ OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+}
 }
 }

You could create a jira issue too.

Sven


On 11/25/2012 01:13 AM, Oliver Zemann wrote:
Unfortunately this is not a solution as i have about 30 different 
panels. And i guess at least 10 of them should later use JS. With the 
approach you suggested i would have to check which panel should be 
displayed and load that (switch/case with 10 different panels). I 
guess that would also lead in heavy mixing the panels with the 
HomePage (BasePage) (destroying reusability).


There is also no way for me to create a "flow based" dialogue as this 
is done in the backend controller which only tells me which panel to 
load.


So there is no other way to go?

Am 24.11.2012 22:57, schrieb Sven Meier:
After the timer has fired, AbstractAjaxTimerBehavior automatically 
registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's 
replaced by PanelTwo already.


I'd recommend adding the behavor to the container instead:

final WebMarkupContainer wmc = new 
WebMarkupContainer("container");

wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
@Override
protected void onTimer(AjaxRequestTarget target) {
PanelTwo two = new PanelTwo("panel");
wmc.addOrReplace(two);
target.add(wmc);

stop(target);
}
});
add(wmc);

wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:
The problem is that this leads to a Page not found error. The 
problem is that the Panel which should be replaced is still looked 
up in the findPage() method. But findPage() returns null on that 
component, so this error is thrown.


Am 24.11.2012 21:48, schrieb Sven Meier:

What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace

The first panel gets displayed, after a few seconds it should be 
replaced by the second panel. Is there any way to achieve this 
behavior with that kind of architecture?


If not, how should a ajax based panel wizard work? Any 
recommendations?


Thanks in advance.

Oli

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




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




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




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




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




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