Re: Redirecting to another page in a WebPage constructor

2011-03-10 Thread Maarten Billemont
On 10 Mar 2011, at 13:25, vineetsemwal wrote:
> 
> use restartresponseexception

While drf may not have meant what he said, RestartResponseException will not 
actually redirect to another page, it will just load the other page as a 
response to the current page's URL.  That is often very confusing for users, 
especially when the current page is mounted.
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Wicket thinks setOutputMarkupId property is not set to true

2011-03-10 Thread Coleman, Chris
Hmmm, it is in a tab panel so it could be the scenario you mention. I'll check 
out that theory.

Chris

-Original Message-
From: Bertrand Guay-Paquet [mailto:ber...@step.polymtl.ca] 
Sent: Friday, 11 March 2011 4:56 PM
To: users@wicket.apache.org
Subject: Re: Wicket thinks setOutputMarkupId property is not set to true

You did say that you set output markup ID to true on both components, 
but maybe you should double check that. I had a very similar problem 
once with an AjaxTabbedPanel that went like this:

1-The first displayed panel (tab) did not have setOutputMarkupId(true);
2-When the second tab is selected Wicket does a replace() to replace the 
first tab panel and overwrites the OutputMarkupId flag of the second 
panel which does setOutputMarkupId(true) in its constructor.

Maybe you have a chain of replaces where the first panel doesn't have 
setOutputMarkupId(true)?

Regards,
Bertrand

On 11/03/2011 12:04 AM, Coleman, Chris wrote:
> I should add that this is on 1.5-rc2. Previously on 1.4.16 the exact same 
> code (except for package renames) worked fine.
>
> Chris
>
> -Original Message-
> From: Coleman, Chris [mailto:chris.cole...@thalesgroup.com.au]
> Sent: Friday, 11 March 2011 4:02 PM
> To: users@wicket.apache.org
> Subject: Wicket thinks setOutputMarkupId property is not set to true
>
> I get this error even though I set output markup ID to true on the component 
> that is being replaced (and the one that is replacing it):
>
>
> Root cause:
>
> java.lang.IllegalArgumentException: cannot update component that does not 
> have setOutputMarkupId property set to true. Component: [PackageDetailsPanel 
> [Component id = panel]]
>   at 
> org.apache.wicket.ajax.AjaxRequestTarget.add(AjaxRequestTarget.java:375)
>   at 
> org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:356)
> Any idea how this can happen?
>
>
>
> DISCLAIMER:---
> This e-mail transmission and any documents, files and previous e-mail messages
> attached to it are private and confidential. They may contain proprietary or 
> copyright
> material or information that is subject to legal professional privilege. They 
> are for
> the use of the intended recipient only.  Any unauthorised viewing, use, 
> disclosure,
> copying, alteration, storage or distribution of, or reliance on, this message 
> is
> strictly prohibited. No part may be reproduced, adapted or transmitted 
> without the
> written permission of the owner. If you have received this transmission in 
> error, or
> are not an authorised recipient, please immediately notify the sender by 
> return email,
> delete this message and all copies from your e-mail system, and destroy any 
> printed
> copies. Receipt by anyone other than the intended recipient should not be 
> deemed a
> waiver of any privilege or protection. Thales Australia does not warrant or 
> represent
> that this e-mail or any documents, files and previous e-mail messages 
> attached are
> error or virus free.
> --
>
>
>
>
> DISCLAIMER:---
> This e-mail transmission and any documents, files and previous e-mail messages
> attached to it are private and confidential. They may contain proprietary or 
> copyright
> material or information that is subject to legal professional privilege. They 
> are for
> the use of the intended recipient only.  Any unauthorised viewing, use, 
> disclosure,
> copying, alteration, storage or distribution of, or reliance on, this message 
> is
> strictly prohibited. No part may be reproduced, adapted or transmitted 
> without the
> written permission of the owner. If you have received this transmission in 
> error, or
> are not an authorised recipient, please immediately notify the sender by 
> return email,
> delete this message and all copies from your e-mail system, and destroy any 
> printed
> copies. Receipt by anyone other than the intended recipient should not be 
> deemed a
> waiver of any privilege or protection. Thales Australia does not warrant or 
> represent
> that this e-mail or any documents, files and previous e-mail messages 
> attached are
> error or virus free.
> --
>
>
> -
> 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




DISCLAIMER:---
This e-mail transmission and any documents, files and previous e-mail

Re: Wicket thinks setOutputMarkupId property is not set to true

2011-03-10 Thread Bertrand Guay-Paquet
You did say that you set output markup ID to true on both components, 
but maybe you should double check that. I had a very similar problem 
once with an AjaxTabbedPanel that went like this:


1-The first displayed panel (tab) did not have setOutputMarkupId(true);
2-When the second tab is selected Wicket does a replace() to replace the 
first tab panel and overwrites the OutputMarkupId flag of the second 
panel which does setOutputMarkupId(true) in its constructor.


Maybe you have a chain of replaces where the first panel doesn't have 
setOutputMarkupId(true)?


Regards,
Bertrand

On 11/03/2011 12:04 AM, Coleman, Chris wrote:

I should add that this is on 1.5-rc2. Previously on 1.4.16 the exact same code 
(except for package renames) worked fine.

Chris

-Original Message-
From: Coleman, Chris [mailto:chris.cole...@thalesgroup.com.au]
Sent: Friday, 11 March 2011 4:02 PM
To: users@wicket.apache.org
Subject: Wicket thinks setOutputMarkupId property is not set to true

I get this error even though I set output markup ID to true on the component 
that is being replaced (and the one that is replacing it):


Root cause:

java.lang.IllegalArgumentException: cannot update component that does not have 
setOutputMarkupId property set to true. Component: [PackageDetailsPanel 
[Component id = panel]]
  at 
org.apache.wicket.ajax.AjaxRequestTarget.add(AjaxRequestTarget.java:375)
  at 
org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:356)
Any idea how this can happen?



DISCLAIMER:---
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--




DISCLAIMER:---
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--


-
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: Wicket thinks setOutputMarkupId property is not set to true

2011-03-10 Thread Coleman, Chris
I should add that this is on 1.5-rc2. Previously on 1.4.16 the exact same code 
(except for package renames) worked fine.

Chris

-Original Message-
From: Coleman, Chris [mailto:chris.cole...@thalesgroup.com.au] 
Sent: Friday, 11 March 2011 4:02 PM
To: users@wicket.apache.org
Subject: Wicket thinks setOutputMarkupId property is not set to true

I get this error even though I set output markup ID to true on the component 
that is being replaced (and the one that is replacing it):


Root cause:

java.lang.IllegalArgumentException: cannot update component that does not have 
setOutputMarkupId property set to true. Component: [PackageDetailsPanel 
[Component id = panel]]
 at org.apache.wicket.ajax.AjaxRequestTarget.add(AjaxRequestTarget.java:375)
 at 
org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:356)
Any idea how this can happen?



DISCLAIMER:---
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--




DISCLAIMER:---
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--


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



Wicket thinks setOutputMarkupId property is not set to true

2011-03-10 Thread Coleman, Chris
I get this error even though I set output markup ID to true on the component 
that is being replaced (and the one that is replacing it):


Root cause:

java.lang.IllegalArgumentException: cannot update component that does not have 
setOutputMarkupId property set to true. Component: [PackageDetailsPanel 
[Component id = panel]]
 at org.apache.wicket.ajax.AjaxRequestTarget.add(AjaxRequestTarget.java:375)
 at 
org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:356)
Any idea how this can happen?



DISCLAIMER:---
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--



Re: Using jQuery with Wicket

2011-03-10 Thread Josh Kamau
Create a smaller version of it (a quickstart application) demonstrating what
you want to achieve.

Josh.


BodyTagAttributeModifier doesn't seem to do anything

2011-03-10 Thread Dan Washusen
Hey All,
I'm attempting to add a css class to the body element of extensions of our base 
page. I've been trying to get BodyTagAttributeModifier working but it doesn't 
seem to do anything.

In the onInitialize method I'm using the following:
add(new BodyTagAttributeModifier("class", true, Model.of("authenticated"), this 
/* the page */));

Anyone have any hints on how to achieve this?

Cheers,
-- 
Dan Washusen


Re: [VOTE] WICKET-3218 - Component#onInitialize is broken for Pages

2011-03-10 Thread Scott Swank
+1 for keeping calls to add() in the Component constructor.  This
makes upgrading as painless as possible.

+1 also for having onInitialize() mimic:

private boolean initialized = false;
/// etc
protected void onBeforeRender() {
  if (!initialized) {
onInitialize();
initialized = true;
  }
  // other onBeforeRender stuff
}

Thank you all,
Scott

On Thu, Mar 10, 2011 at 2:54 PM, Coleman, Chris
 wrote:
> +1 for the approach you mention where onInitialize is called from the 
> framework and not as a surprise side effect of calling page#add().
>
> From: Maarten Billemont [mailto:lhun...@gmail.com]
>
> On 10 Mar 2011, at 00:42, Igor Vaynberg wrote:
>>> i am +0 for refactoring the code so that oninitialize() cascade is not
>>> started from page#add() but from somewhere before page#onconfigure().
>>> this way oninitialize() is safe to override in pages because it will
>>> not be invoked from page's constructor but from some framework code at
>>> a later time.
>
>>Then I think that's the only actual solution that has positive votes.  
>>Without any further feedback, can we agree to leave constructors as they are, 
>>make onInitialize >overridable and do it this way?
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
>
>
> DISCLAIMER:---
> This e-mail transmission and any documents, files and previous e-mail messages
> attached to it are private and confidential. They may contain proprietary or 
> copyright
> material or information that is subject to legal professional privilege. They 
> are for
> the use of the intended recipient only.  Any unauthorised viewing, use, 
> disclosure,
> copying, alteration, storage or distribution of, or reliance on, this message 
> is
> strictly prohibited. No part may be reproduced, adapted or transmitted 
> without the
> written permission of the owner. If you have received this transmission in 
> error, or
> are not an authorised recipient, please immediately notify the sender by 
> return email,
> delete this message and all copies from your e-mail system, and destroy any 
> printed
> copies. Receipt by anyone other than the intended recipient should not be 
> deemed a
> waiver of any privilege or protection. Thales Australia does not warrant or 
> represent
> that this e-mail or any documents, files and previous e-mail messages 
> attached are
> error or virus free.
> --
>
>
> -
> 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: [VOTE] WICKET-3218 - Component#onInitialize is broken for Pages

2011-03-10 Thread Coleman, Chris
+1 for the approach you mention where onInitialize is called from the framework 
and not as a surprise side effect of calling page#add().

From: Maarten Billemont [mailto:lhun...@gmail.com] 

On 10 Mar 2011, at 00:42, Igor Vaynberg wrote:
>> i am +0 for refactoring the code so that oninitialize() cascade is not
>> started from page#add() but from somewhere before page#onconfigure().
>> this way oninitialize() is safe to override in pages because it will
>> not be invoked from page's constructor but from some framework code at
>> a later time.

>Then I think that's the only actual solution that has positive votes.  Without 
>any further feedback, can we agree to leave constructors as they are, make 
>onInitialize >overridable and do it this way?
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




DISCLAIMER:---
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--


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



Re: mountSharedResource() on huge amount of images

2011-03-10 Thread Bas Gooren
The general idea is to mount a single handler, which takes the filename 
from the url.

There is no reason to mount all images by such a handler one-by-one.

Bas

Op 10-3-2011 23:01, Ladislav DANKO schreef:

Hi all,

what is the recommended way to mount huge amount of an images (thousands)
in app? Does mountSharedResource() has any bottleneck? Simplified code look
like:

Folder folder = ((Start) Application.get()).getUploadFolder();
File[] files = folder.getFiles();
List  lList = Arrays.asList(files);
Collections.sort(lList);
int i = 0;
Iterator  iterator = lList.iterator();
while(iterator.hasNext())
{
iterator.next();
String fileName = lList.get(i).getName();
mountSharedResource("/images/" + fileName, new
ResourceReference(Images.class, fileName).getSharedResourceKey());
i++;
}

But what if in folder is for example 100.000 photos?

Thanks for pointing,

--
Ladislav DANKO


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



mountSharedResource() on huge amount of images

2011-03-10 Thread Ladislav DANKO
Hi all,

what is the recommended way to mount huge amount of an images (thousands)
in app? Does mountSharedResource() has any bottleneck? Simplified code look
like:

Folder folder = ((Start) Application.get()).getUploadFolder();
File[] files = folder.getFiles();
List lList = Arrays.asList(files);
Collections.sort(lList);
int i = 0;
Iterator iterator = lList.iterator();
while(iterator.hasNext())
{
iterator.next();
String fileName = lList.get(i).getName();
mountSharedResource("/images/" + fileName, new
ResourceReference(Images.class, fileName).getSharedResourceKey());
i++;
}

But what if in folder is for example 100.000 photos?

Thanks for pointing,

--
Ladislav DANKO


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



Re: Resource loading

2011-03-10 Thread Marek Šabo

Hi,

thanks for suggestions. I know these variants but I've never had a file 
in src/main/java, there's always something like org.company package before.


Regards,

Marek
On 03/10/2011 10:00 PM, Martin Grigorov wrote:

On Thu, Mar 10, 2011 at 10:37 PM, Peter Ertl  wrote:


alternatively use:

   AnyClass.class.getResourceAsStream(...)


this will look next to AnyClass.class, not in the root of the classpath



Am 10.03.2011 um 19:20 schrieb Martin Grigorov:


You can also use:


AnyClassInSrcMainJava.class.getClassLoader().getResource("modules.properties")

On Thu, Mar 10, 2011 at 4:29 PM, Marek Šabo  wrote:


Hi all,

I have a question regarding resource loading in general (sorry for

little

OT). What code should I use to load a property file which is located in
src/main/resources folder (maven directory structure)? I tried various
snippets and the only one working for me under both tomcat (standalone)

and

jetty (mvn jetty:run) is to load it like this (e.g. from Application

class):

URL url =


Thread.currentThread().getContextClassLoader().getResource("modules.properties");

I extracted this from log4j loading code - is this the only way or are
there other ways of doing this? The point being that files from

resources

folder vary in different places when running mvn jetty:run, deploying

war or

just running jar archive.

Regards,

Marek

-
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






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



Re: Using jQuery with Wicket

2011-03-10 Thread tech7
Thaks to all forum users for their responses.
I have solved the problem.
The problem was related with authentication methodology.

Happy Wicketlying to all 

-
Developer
Wicket
Java
JSP
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-jQuery-with-Wicket-tp3343275p3346836.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: Resource loading

2011-03-10 Thread Martin Grigorov
On Thu, Mar 10, 2011 at 10:37 PM, Peter Ertl  wrote:

> alternatively use:
>
>   AnyClass.class.getResourceAsStream(...)
>

this will look next to AnyClass.class, not in the root of the classpath

>
>
> Am 10.03.2011 um 19:20 schrieb Martin Grigorov:
>
> > You can also use:
> >
> AnyClassInSrcMainJava.class.getClassLoader().getResource("modules.properties")
> >
> > On Thu, Mar 10, 2011 at 4:29 PM, Marek Šabo  wrote:
> >
> >> Hi all,
> >>
> >> I have a question regarding resource loading in general (sorry for
> little
> >> OT). What code should I use to load a property file which is located in
> >> src/main/resources folder (maven directory structure)? I tried various
> >> snippets and the only one working for me under both tomcat (standalone)
> and
> >> jetty (mvn jetty:run) is to load it like this (e.g. from Application
> class):
> >>
> >> URL url =
> >>
> Thread.currentThread().getContextClassLoader().getResource("modules.properties");
> >>
> >> I extracted this from log4j loading code - is this the only way or are
> >> there other ways of doing this? The point being that files from
> resources
> >> folder vary in different places when running mvn jetty:run, deploying
> war or
> >> just running jar archive.
> >>
> >> Regards,
> >>
> >> Marek
> >>
> >> -
> >> 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: Resource loading

2011-03-10 Thread Peter Ertl
alternatively use:

   AnyClass.class.getResourceAsStream(...)


Am 10.03.2011 um 19:20 schrieb Martin Grigorov:

> You can also use:
> AnyClassInSrcMainJava.class.getClassLoader().getResource("modules.properties")
> 
> On Thu, Mar 10, 2011 at 4:29 PM, Marek Šabo  wrote:
> 
>> Hi all,
>> 
>> I have a question regarding resource loading in general (sorry for little
>> OT). What code should I use to load a property file which is located in
>> src/main/resources folder (maven directory structure)? I tried various
>> snippets and the only one working for me under both tomcat (standalone) and
>> jetty (mvn jetty:run) is to load it like this (e.g. from Application class):
>> 
>> URL url =
>> Thread.currentThread().getContextClassLoader().getResource("modules.properties");
>> 
>> I extracted this from log4j loading code - is this the only way or are
>> there other ways of doing this? The point being that files from resources
>> folder vary in different places when running mvn jetty:run, deploying war or
>> just running jar archive.
>> 
>> Regards,
>> 
>> Marek
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com 


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



Re: Using jQuery with Wicket

2011-03-10 Thread tech7
Hi Andrea, code is too long to attach here.
What can I do?

-
Developer
Wicket
Java
JSP
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-jQuery-with-Wicket-tp3343275p3346586.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket in Action: problem with redirection

2011-03-10 Thread Jeremy Thomerson
On Thu, Mar 10, 2011 at 12:36 PM, Jim Goodwin  wrote:

> I'm a Wicket newbie, working my way through /Wicket in Action.
>
> /I don't understand redirection too clearly yet, but there is
> an example in the book which doesn't work right when I
> try it and I'd like to ask if the book example code makes
> sense to more experienced folks.
>
> Page 271 Listing 11.3 line 4: The onSubmit() method calls
> !continueToOriginalDestination().
>

continueToOriginalDestination() lets the user continue on to the place they
were going before being interrupted by the security mechanism if they aren't
logged in.  i.e:

user on home page
user clicks "restricted page" link
security strategy says "can't go there without being logged in as X",
redirects user to login page
user logs in, and continueToOriginalDestination() redirects to "restricted
page" (original dest) and returns true.

another example:
user clicks bookmarked link in a new tab in their browser to login page (or
goes to unrestricted home page and clicks link for login page)
user logs in, and continueToOriginalDestination() can't redirect them
anywhere, because there is no "original destination" that was interrupted

Page 272 Listing 11.4 , new Link(...){ ... method onClick():
> throws new RestartResponseAtInterceptPageException(signInPage)
>

This is a way to stop processing at ANY point in your application and
redirect the user to a certain page.


> How is this supposed to work?
>
> Suppose the user is on the Home page, and the Home Page
> has a UserPanel, and the user clicks on the "Sign In" link.
> Then  the link itself sets an intercept to the sign-in page
> (that is how the link arranges to take you there, as far as I can
> understand).
>
> But then, when the user enters name/password and submits, and
> the submit method  calls continueToOriginalDestination(), it will
> always succceed, and find the "original destination" to be the signIn
> page, regardless of where it really originated (the Home Page, in
> this case).
>

You're a bit confused by "original" and "destination".  Since the user
clicked the "signin page" link, the *destination* was the signin page -
which is unrestricted, so the continueToOriginalDestination() method can not
redirect them anywhere, and thus returns false.  You now need to redirect
them somewhere manually or the signin page will re-render.

The *origin* was the home page - but that doesn't matter.  Don't be thrown
off by "original" (destination) and "origin" - which are two different
things.  :)

For a while my code was working like that: Signing in worked,
> i.e. it did sign you in, but you were returned to a blank sign-in page.
> (My code doesn't work like that just this minute, but that is only
> because I've been enhancing it with other bugs.)
>
> Can anyone explain how the book-example is supposed to work?
>
> Thanks
> Jim
>


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


Re: Resource loading

2011-03-10 Thread Martin Grigorov
You can also use:
AnyClassInSrcMainJava.class.getClassLoader().getResource("modules.properties")

On Thu, Mar 10, 2011 at 4:29 PM, Marek Šabo  wrote:

> Hi all,
>
> I have a question regarding resource loading in general (sorry for little
> OT). What code should I use to load a property file which is located in
> src/main/resources folder (maven directory structure)? I tried various
> snippets and the only one working for me under both tomcat (standalone) and
> jetty (mvn jetty:run) is to load it like this (e.g. from Application class):
>
> URL url =
> Thread.currentThread().getContextClassLoader().getResource("modules.properties");
>
> I extracted this from log4j loading code - is this the only way or are
> there other ways of doing this? The point being that files from resources
> folder vary in different places when running mvn jetty:run, deploying war or
> just running jar archive.
>
> Regards,
>
> Marek
>
> -
> 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 


Wicket in Action: problem with redirection

2011-03-10 Thread Jim Goodwin

I'm a Wicket newbie, working my way through /Wicket in Action.

/I don't understand redirection too clearly yet, but there is
an example in the book which doesn't work right when I
try it and I'd like to ask if the book example code makes
sense to more experienced folks.

Page 271 Listing 11.3 line 4: The onSubmit() method calls
!continueToOriginalDestination().

Page 272 Listing 11.4 , new Link(...){ ... method onClick():
throws new RestartResponseAtInterceptPageException(signInPage)

How is this supposed to work?

Suppose the user is on the Home page, and the Home Page
has a UserPanel, and the user clicks on the "Sign In" link.
Then  the link itself sets an intercept to the sign-in page
(that is how the link arranges to take you there, as far as I can
understand).

But then, when the user enters name/password and submits, and
the submit method  calls continueToOriginalDestination(), it will
always succceed, and find the "original destination" to be the signIn
page, regardless of where it really originated (the Home Page, in
this case).

For a while my code was working like that: Signing in worked,
i.e. it did sign you in, but you were returned to a blank sign-in page.
(My code doesn't work like that just this minute, but that is only
because I've been enhancing it with other bugs.)

Can anyone explain how the book-example is supposed to work?

Thanks
Jim

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



Re: [VOTE] WICKET-3218 - Component#onInitialize is broken for Pages

2011-03-10 Thread Peter Ertl
-1 on removing add() from ctor, too

it will piss of a huge load of wicket developers for a tiny and questionable 
benefit.

things like this made me drop tapestry btw (thanks for the really big laugh, 
martijn :-)

we don't want users to leave because we make decisions from within the ivory 
tower.


Am 10.03.2011 um 14:07 schrieb Maarten Billemont:

>> [drama]
>> 
>> So to summarize my rant:
>> 
>> -1 for removing the ability to use add inside a constructor.
>> +0 for improving the handling of oninitialize
>> +1 for improving the documentation on the lifecycle of components and
>> the event chain called during processing [2]
> 
> I assume that means you don't care if 3218 is marked as won't fix and 
> onInitialize remains overridable by those that choose to use it.
> 
> Documentation is a good enough alternative when there is an unresolved issue 
> that only occurs in rare cases.  So yes, document it, and let those that want 
> to use onInitialize do so.
> 
> I never claimed using constructors will make your webapps eat your young.  I 
> simply outlined the pros and cons of each approach and argued the design 
> advantages of not touching your components from outside wicket lifecycle 
> methods.
> -
> 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: entity manager in webapp

2011-03-10 Thread Witold Czaplewski
IMO warp-persist is dead and Guice 3.0 should be final soon (rc3 is out now):
http://code.google.com/p/google-guice/downloads/list


Witold

Am Thu, 10 Mar 2011 15:31:19 +0100
schrieb Bas Gooren :

> Which is basically warp-persist, but integrated into guice. But as far 
> as I know, it will be only be integrated as of guice 3.0;
> 
> Bas
> 
> Op 10-3-2011 15:29, nino martinez wael schreef:
> > I'd go for guice persist if thats an option..
> >
> > 2011/3/10 Bas Gooren
> >
> >> Have a look at databinder or warp-persist for a better implementation.
> >>
> >> Should you go with your own implementation, do not forget to clear the
> >> ThreadLocal at the end of the request to prevent:
> >> a) leaking
> >> b) re-using an EntityManager from a previous request (most if not all
> >> application servers use a thread pool)
> >>
> >> Bas
> >>
> >> Op 10-3-2011 13:12, Duro schreef:
> >>
> >>   Hi guys, is this an option to store the JPA entity manager for a wicket
> >>> webapp:
> >>> public class DBUtil {
> >>> private static EntityManagerFactory entityManagerFactory = Persistence
> >>> .createEntityManagerFactory("db");
> >>> private static ThreadLocal  emHolder = new
> >>> ThreadLocal() {
> >>> protected EntityManager initialValue() {
> >>> return entityManagerFactory.createEntityManager();
> >>> };
> >>> };
> >>>
> >>> public static User getUser(String userName) {
> >>> return emHolder.get().find(User.class, userName);
> >>> }
> >>>
> >>> ..
> >>>
> >>> If not, thanks for possible better solutions, Juraj
> >>>
> >>> -
> >>> 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



Resource loading

2011-03-10 Thread Marek Šabo

Hi all,

I have a question regarding resource loading in general (sorry for 
little OT). What code should I use to load a property file which is 
located in src/main/resources folder (maven directory structure)? I 
tried various snippets and the only one working for me under both tomcat 
(standalone) and jetty (mvn jetty:run) is to load it like this (e.g. 
from Application class):


URL url = 
Thread.currentThread().getContextClassLoader().getResource("modules.properties");


I extracted this from log4j loading code - is this the only way or are 
there other ways of doing this? The point being that files from 
resources folder vary in different places when running mvn jetty:run, 
deploying war or just running jar archive.


Regards,

Marek

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



Re: entity manager in webapp

2011-03-10 Thread Bas Gooren
Which is basically warp-persist, but integrated into guice. But as far 
as I know, it will be only be integrated as of guice 3.0;


Bas

Op 10-3-2011 15:29, nino martinez wael schreef:

I'd go for guice persist if thats an option..

2011/3/10 Bas Gooren


Have a look at databinder or warp-persist for a better implementation.

Should you go with your own implementation, do not forget to clear the
ThreadLocal at the end of the request to prevent:
a) leaking
b) re-using an EntityManager from a previous request (most if not all
application servers use a thread pool)

Bas

Op 10-3-2011 13:12, Duro schreef:

  Hi guys, is this an option to store the JPA entity manager for a wicket

webapp:
public class DBUtil {
private static EntityManagerFactory entityManagerFactory = Persistence
.createEntityManagerFactory("db");
private static ThreadLocal  emHolder = new
ThreadLocal() {
protected EntityManager initialValue() {
return entityManagerFactory.createEntityManager();
};
};

public static User getUser(String userName) {
return emHolder.get().find(User.class, userName);
}

..

If not, thanks for possible better solutions, Juraj

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




Re: entity manager in webapp

2011-03-10 Thread nino martinez wael
I'd go for guice persist if thats an option..

2011/3/10 Bas Gooren 

> Have a look at databinder or warp-persist for a better implementation.
>
> Should you go with your own implementation, do not forget to clear the
> ThreadLocal at the end of the request to prevent:
> a) leaking
> b) re-using an EntityManager from a previous request (most if not all
> application servers use a thread pool)
>
> Bas
>
> Op 10-3-2011 13:12, Duro schreef:
>
>  Hi guys, is this an option to store the JPA entity manager for a wicket
>> webapp:
>> public class DBUtil {
>>private static EntityManagerFactory entityManagerFactory = Persistence
>>.createEntityManagerFactory("db");
>>private static ThreadLocal emHolder = new
>> ThreadLocal() {
>>protected EntityManager initialValue() {
>>return entityManagerFactory.createEntityManager();
>>};
>>};
>>
>>public static User getUser(String userName) {
>>return emHolder.get().find(User.class, userName);
>>}
>>
>> ..
>>
>> If not, thanks for possible better solutions, Juraj
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>


Re: [VOTE] WICKET-3218 - Component#onInitialize is broken for Pages

2011-03-10 Thread Maarten Billemont
> [drama]
> 
> So to summarize my rant:
> 
> -1 for removing the ability to use add inside a constructor.
> +0 for improving the handling of oninitialize
> +1 for improving the documentation on the lifecycle of components and
> the event chain called during processing [2]

I assume that means you don't care if 3218 is marked as won't fix and 
onInitialize remains overridable by those that choose to use it.

Documentation is a good enough alternative when there is an unresolved issue 
that only occurs in rare cases.  So yes, document it, and let those that want 
to use onInitialize do so.

I never claimed using constructors will make your webapps eat your young.  I 
simply outlined the pros and cons of each approach and argued the design 
advantages of not touching your components from outside wicket lifecycle 
methods.
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Before deployment checklist

2011-03-10 Thread Mauro Ciancio
I usually use two set of configuration for Sprint (in case that you're
using it) and also maven profiles allows you to forget setting the
proper one. Also I have two set of logger configs and maven chooses
the correct one.

If you need more details just reply me.

Regards.

On Wed, Mar 9, 2011 at 10:11 AM, Henrique Boregio  wrote:
> Hello. I am getting close to deploying my first wicket web
> application. It's not huge but it does have lots of classes,
> components, database stuff, search features, etc.
>
> I was wondering if anyone had some kind of checklist on what things to
> definitely check before deploying a wicket application into
> production.
>
> Thanks.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Mauro Ciancio
http://about.me/maurociancio

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



Re: entity manager in webapp

2011-03-10 Thread Bas Gooren

Have a look at databinder or warp-persist for a better implementation.

Should you go with your own implementation, do not forget to clear the 
ThreadLocal at the end of the request to prevent:

a) leaking
b) re-using an EntityManager from a previous request (most if not all 
application servers use a thread pool)


Bas

Op 10-3-2011 13:12, Duro schreef:
Hi guys, is this an option to store the JPA entity manager for a 
wicket webapp:

public class DBUtil {
private static EntityManagerFactory entityManagerFactory = 
Persistence

.createEntityManagerFactory("db");
private static ThreadLocal emHolder = new 
ThreadLocal() {

protected EntityManager initialValue() {
return entityManagerFactory.createEntityManager();
};
};

public static User getUser(String userName) {
return emHolder.get().find(User.class, userName);
}

..

If not, thanks for possible better solutions, Juraj

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



Re: Redirecting to another page in a WebPage constructor

2011-03-10 Thread vineetsemwal
use restartresponseexception

-
vineet semwal
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Redirecting-to-another-page-in-a-WebPage-constructor-tp3345688p3345714.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



entity manager in webapp

2011-03-10 Thread Duro
Hi guys, is this an option to store the JPA entity manager for a wicket 
webapp:

public class DBUtil {
private static EntityManagerFactory entityManagerFactory = Persistence
.createEntityManagerFactory("db");
private static ThreadLocal emHolder = new 
ThreadLocal() {

protected EntityManager initialValue() {
return entityManagerFactory.createEntityManager();
};
};

public static User getUser(String userName) {
return emHolder.get().find(User.class, userName);
}

..

If not, thanks for possible better solutions, Juraj

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



Redirecting to another page in a WebPage constructor

2011-03-10 Thread drf
In the constructor of a class which extends WebPage, is there a way to
redirect to another page?
setResponsePage() apparently will not work in a constructor.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Redirecting-to-another-page-in-a-WebPage-constructor-tp3345688p3345688.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: visural-wicket running on wicket 1.5?

2011-03-10 Thread nino martinez wael
Doh my bad, I had the components markup in my html as well as in the
fragment, so when I removed them from the html everything works as wanted:)

2011/3/10 nino martinez wael 

> I've added generics.. Still not working though, it's as if the components
> get added twice (and the fragment never gets added or something like that)
>
>
>
>
> Index:
> branches/1.5/visural-wicket/src/com/visural/wicket/component/viewmode/ViewOrEdit.java
> ===
> ---
> branches/1.5/visural-wicket/src/com/visural/wicket/component/viewmode/ViewOrEdit.java
>  (revision
> 266)
> +++
> branches/1.5/visural-wicket/src/com/visural/wicket/component/viewmode/ViewOrEdit.java
>  (working
> copy)
> @@ -14,11 +14,8 @@
>   *  limitations under the License.
>   *  under the License.
>   */
> -package com.visural.wicket.component.viewmode;
> +package com.netdesign.ccadmin.components.vieworedit;
>
> -import com.visural.wicket.security.IPrivilege;
> -import com.visural.wicket.security.ISecureEnableInstance;
> -import com.visural.wicket.security.ISecureRenderInstance;
>  import org.apache.wicket.Component;
>  import org.apache.wicket.markup.html.basic.Label;
>  import org.apache.wicket.markup.html.form.AbstractChoice;
> @@ -35,19 +32,19 @@
>  import org.apache.wicket.model.Model;
>
>  /**
> - * A wrapper for a FormComponent which replaces the component with a Label
> - * when the wrapped control is in "view mode".
> - *
> + * A wrapper for a FormComponent which replaces the component with a Label
> when
> + * the wrapped control is in "view mode".
> + *
>   * Apply to a containing DOM element, e.g. `` or
> ``
>   *
>   * The component you provide to the constructor must be given as ID
> matching
>   * `ViewOrEdit.COMP_ID`.
> - *
> + *
>   * The idea is to allow the rendering of web-like modern applications
> where
>   * non-editable elements are represented in text form, using the same
> wicket
>   * page / form implementation.
> - *
> - * What is "view mode" for a given component is determined by the method
> + *
> + * What is "view mode" for a given component is determined by the method
>   * `isViewMode()`. The default implementation of this method uses the
> component
>   * and its form's `isEnabled()` state to determine view or edit.
>   *
> @@ -59,194 +56,194 @@
>   * apply to form elements wrapped in a `ViewOrEdit` container. Just name
> your
>   * `ViewOrEdit` element as per the property you wish to apply to the child
>   * control.
> - *
> + *
>   * @version $Id$
>   * @author Richard Nichols
>   */
> -public class ViewOrEdit extends FormComponentPanel implements
> ISecureRenderInstance, ISecureEnableInstance {
> -private static final long serialVersionUID = 1L;
> -/**
> - * This is the id of the component to be contained within the
> ViewOrEdit container.
> - * Any component provided to the ViewOrEdit component should be
> identified as ViewOrEdit.COMP_ID
> - */
> -public final static String COMP_ID = "component";
> +public class ViewOrEdit extends FormComponentPanel {
> + private static final long serialVersionUID = 1L;
> + /**
> + * This is the id of the component to be contained within the ViewOrEdit
> + * container. Any component provided to the ViewOrEdit component should
> be
> + * identified as ViewOrEdit.COMP_ID
> + */
> + public final static String COMP_ID = "component";
>
> -private final FormComponent component;
> -private Label label;
> + private final FormComponent component;
> + private Label label;
>
> -public ViewOrEdit(String id, FormComponent component) {
> -this(id, component, null, null);
> -}
> + public ViewOrEdit(String id, FormComponent component) {
> + this(id, component, null, null);
> + }
>
> -public ViewOrEdit(String id, FormComponent component, IModel
> labelModel) {
> -this(id, component, labelModel, null);
> -}
> + public ViewOrEdit(String id, FormComponent component,
> + IModel labelModel) {
> + this(id, component, labelModel, null);
> + }
>
> -public ViewOrEdit(String id, FormComponent component,
> ComponentModelToLabel componentModelToLabel) {
> -this(id, component, null, componentModelToLabel);
> -}
> + public ViewOrEdit(String id, FormComponent component,
> + ComponentModelToLabel componentModelToLabel) {
> + this(id, component, null, componentModelToLabel);
> + }
>
> -protected ViewOrEdit(final String id, final FormComponent component,
> IModel labelModel, final ComponentModelToLabel componentModelToLabel) {
> -super(id);
> -this.component = component;
> -
> -if (labelModel == null && componentModelToLabel != null) {
> -labelModel = new AbstractReadOnlyModel() {
> + protected ViewOrEdit(final String id, final FormComponent component,
> + IModel labelModel,
> + final ComponentModelToLabel componentModelToLabel) {
> + super(id);
> + this.component = component;
>
> -private final ComponentModelToLabel converter

Re: visural-wicket running on wicket 1.5?

2011-03-10 Thread nino martinez wael
I've added generics.. Still not working though, it's as if the components
get added twice (and the fragment never gets added or something like that)




Index:
branches/1.5/visural-wicket/src/com/visural/wicket/component/viewmode/ViewOrEdit.java
===
---
branches/1.5/visural-wicket/src/com/visural/wicket/component/viewmode/ViewOrEdit.java
(revision
266)
+++
branches/1.5/visural-wicket/src/com/visural/wicket/component/viewmode/ViewOrEdit.java
(working
copy)
@@ -14,11 +14,8 @@
  *  limitations under the License.
  *  under the License.
  */
-package com.visural.wicket.component.viewmode;
+package com.netdesign.ccadmin.components.vieworedit;

-import com.visural.wicket.security.IPrivilege;
-import com.visural.wicket.security.ISecureEnableInstance;
-import com.visural.wicket.security.ISecureRenderInstance;
 import org.apache.wicket.Component;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.AbstractChoice;
@@ -35,19 +32,19 @@
 import org.apache.wicket.model.Model;

 /**
- * A wrapper for a FormComponent which replaces the component with a Label
- * when the wrapped control is in "view mode".
- *
+ * A wrapper for a FormComponent which replaces the component with a Label
when
+ * the wrapped control is in "view mode".
+ *
  * Apply to a containing DOM element, e.g. `` or ``
  *
  * The component you provide to the constructor must be given as ID
matching
  * `ViewOrEdit.COMP_ID`.
- *
+ *
  * The idea is to allow the rendering of web-like modern applications where
  * non-editable elements are represented in text form, using the same
wicket
  * page / form implementation.
- *
- * What is "view mode" for a given component is determined by the method
+ *
+ * What is "view mode" for a given component is determined by the method
  * `isViewMode()`. The default implementation of this method uses the
component
  * and its form's `isEnabled()` state to determine view or edit.
  *
@@ -59,194 +56,194 @@
  * apply to form elements wrapped in a `ViewOrEdit` container. Just name
your
  * `ViewOrEdit` element as per the property you wish to apply to the child
  * control.
- *
+ *
  * @version $Id$
  * @author Richard Nichols
  */
-public class ViewOrEdit extends FormComponentPanel implements
ISecureRenderInstance, ISecureEnableInstance {
-private static final long serialVersionUID = 1L;
-/**
- * This is the id of the component to be contained within the
ViewOrEdit container.
- * Any component provided to the ViewOrEdit component should be
identified as ViewOrEdit.COMP_ID
- */
-public final static String COMP_ID = "component";
+public class ViewOrEdit extends FormComponentPanel {
+ private static final long serialVersionUID = 1L;
+ /**
+ * This is the id of the component to be contained within the ViewOrEdit
+ * container. Any component provided to the ViewOrEdit component should be
+ * identified as ViewOrEdit.COMP_ID
+ */
+ public final static String COMP_ID = "component";

-private final FormComponent component;
-private Label label;
+ private final FormComponent component;
+ private Label label;

-public ViewOrEdit(String id, FormComponent component) {
-this(id, component, null, null);
-}
+ public ViewOrEdit(String id, FormComponent component) {
+ this(id, component, null, null);
+ }

-public ViewOrEdit(String id, FormComponent component, IModel
labelModel) {
-this(id, component, labelModel, null);
-}
+ public ViewOrEdit(String id, FormComponent component,
+ IModel labelModel) {
+ this(id, component, labelModel, null);
+ }

-public ViewOrEdit(String id, FormComponent component,
ComponentModelToLabel componentModelToLabel) {
-this(id, component, null, componentModelToLabel);
-}
+ public ViewOrEdit(String id, FormComponent component,
+ ComponentModelToLabel componentModelToLabel) {
+ this(id, component, null, componentModelToLabel);
+ }

-protected ViewOrEdit(final String id, final FormComponent component,
IModel labelModel, final ComponentModelToLabel componentModelToLabel) {
-super(id);
-this.component = component;
-
-if (labelModel == null && componentModelToLabel != null) {
-labelModel = new AbstractReadOnlyModel() {
+ protected ViewOrEdit(final String id, final FormComponent component,
+ IModel labelModel,
+ final ComponentModelToLabel componentModelToLabel) {
+ super(id);
+ this.component = component;

-private final ComponentModelToLabel converter =
componentModelToLabel;
+ if (labelModel == null && componentModelToLabel != null) {
+ labelModel = new AbstractReadOnlyModel() {

-@Override
-public Object getObject() {
-return
converter.convertToLabel(component.getModelObject());
-}
-};
-}
+ private final ComponentModelToLabel converter = componentModelToLabel;

-if (component == null |

Re: visural-wicket running on wicket 1.5?

2011-03-10 Thread nino martinez wael
Ok I've given it a run.. And are having problems :(

It still does'nt seem like ViewOrEdit honors the fact that it is either
ViewOrEdit.
So it either looks like:
http://img826.imageshack.us/i/greenshot20110310111030.png/
Or
http://img689.imageshack.us/i/greenshot20110310111207.png/

If I try to run the examples I get and error:
http://img833.imageshack.us/i/greenshot2011031026.png/


Also I had to add the servlet api inorder to run the ant build, as well as
putting the jar files besides the other wicket dependencies.

Index: branches/1.5/visural-wicket-examples/lib/nblibraries.properties
===
--- branches/1.5/visural-wicket-examples/lib/nblibraries.properties (revision
266)
+++ branches/1.5/visural-wicket-examples/lib/nblibraries.properties (working
copy)
@@ -20,6 +20,7 @@
 libs.visural-wicket.src=\
 ${base}/visural-wicket/visural-wicket-0.5-sources.jar
 libs.Wicket.classpath=\
+ ${base}/Wicket/servlet-api-2.5-20081211.jar;\
 ${base}/Wicket/slf4j-api-1.4.2.jar;\
 ${base}/Wicket/slf4j-jdk14-1.4.2.jar;\
 ${base}/Wicket/wicket-core-1.5-rc2.jar;\





2011/3/9 nino martinez wael 

> Thanks. I'll give feedback if needed
> On Mar 9, 2011 4:22 AM, "Richard Nichols"  wrote:
> > I've committed what appears to be a mostly working visural-wicket with
> 1.5
> > (rc2) compatibility.
> >
> >
> http://code.google.com/p/visural-wicket/source/browse/#svn%2Fbranches%2F1.5
> >
> > If there are any issues found, please report them at
> > http://code.google.com/p/visural-wicket/
> >
> > cheers,
> > Richard.
> >
> > On Wed, Mar 9, 2011 at 4:30 AM, nino martinez wael <
> > nino.martinez.w...@gmail.com> wrote:
> >
> >> ok great.. I'll probably take at look at it monday then..
> >>
> >> 2011/3/8 Richard Nichols 
> >>
> >> > Hi Nino,
> >> >
> >> > The version in the public respository 1.5 branch is still a direct
> copy
> >> of
> >> > 1.4 - sorry I haven't commited the WIP 1.5 changes yet.
> >> >
> >> > I'll aim to get the WIP committed in this week.
> >> >
> >> > cheers,
> >> > Richard.
> >> >
> >> > On Mon, Mar 7, 2011 at 6:47 PM, nino martinez wael <
> >> > nino.martinez.w...@gmail.com> wrote:
> >> >
> >> > > Strange it compiles well, but does not work as wanted.. Any idea on
> >> which
> >> > > parts are causing the problems? On my dropdowns the dropdowns are
> >> empty,
> >> > > and in my textfields both the text and the span are added if in view
> >> > mode,
> >> > > and if not 2 textfields are added.
> >> > >
> >> > > 2011/3/5 Richard Nichols 
> >> > >
> >> > > > I've created a 1.5 branch and it's in the works. 1.5 broke more
> stuff
> >> > > > than expected :)
> >> > > >
> >> > > > Hopefully I can have a beta 1.5 branch functional within a few
> weeks
> >> > > >
> >> > > > Sent from my iPhone
> >> > > >
> >> > > > On 05/03/2011, at 6:15 AM, nino martinez wael
> >> > > >  wrote:
> >> > > >
> >> > > > > So does has anybody run it on wicket 1.5, or is there something
> in
> >> > the
> >> > > > works
> >> > > > > for it?
> >> > > > >
> >> > > > > regards Nino
> >> > > >
> >> > > >
> -
> >> > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> > > > For additional commands, e-mail: users-h...@wicket.apache.org
> >> > > >
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > Richard Nichols
> >> > http://www.richardnichols.net/ :: http://onmydoorstep.com.au/
> >> >
> >>
> >
> >
> >
> > --
> > Richard Nichols
> > http://www.richardnichols.net/ :: http://onmydoorstep.com.au/
>


Re: shift / ctrl / alt keys + ajax

2011-03-10 Thread Antoine van Wel
Thanks! I'll look into it this weekend and get back here. Preferably
I'd like a solution without forms, but this approach is certainly
better than hacking into the wicket-ajax call.


Antoine


On Wed, Mar 9, 2011 at 6:07 AM, Richard Nichols  wrote:
> You can do this on the client side relatively easily.
>
> Just bind a javascript event handler to the onkeydown event in the browser.
>
> When these key(s) are depressed change a form input to indicate which keys
> are pressed.
>
> When your Ajax event submits, you can check the model of the component the
> input is bound to to determine if the key(s) were pressed.
>
> cheers,
> Richard.
>
> On Tue, Mar 8, 2011 at 9:59 PM, Antoine van Wel
> wrote:
>
>> Hi,
>>
>> when clicking an (ajax)link, or a checkbox, etc, on the server side
>> I'd like to know whether the shift, ctrl or alt keys are pressed at
>> the same time.
>>
>> So I figure I need to fetch via JavaScript and adapt the ajax call
>> with some extra parameters.
>> Any thoughts how to do that in a nice & clean way in 1.5 without too
>> much hacking involved?
>>
>>
>> regards,
>> Antoine
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> --
> Richard Nichols
> http://www.richardnichols.net/ :: http://onmydoorstep.com.au/
>

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



Re: [VOTE] WICKET-3218 - Component#onInitialize is broken for Pages

2011-03-10 Thread Martijn Dashorst
Oh the horror I have been through the last 6 years where I could
randomly call add() inside my page's and panel's constructor. Over
1500 hand crafted pages by about 4 hands of developers and they are
all ready for anti-depressants because of the troubles the component
constructor has caused. Yes, things are really bad when you execute
code in a constructor.

Seriously, in my 6+ years of developing Wicket applications, adding
components to the component hierarchy, I have yet to encounter the
problems you say are so detrimental to developing with Wicket.

Similarly calling methods from constructors that may be overridden.
Those things are easily discovered with a debugger. At my company I
have not encountered anything bad happening because of this. Perhaps
in 5 years one or two days in total lost on a team with 25 developers.
 whooptidoo. not. a. big. deal. Using Subversion, Eclipse, Hibernate,
Maven and Spring has caused much more lost hours than any problem you
mentioned.

There are just a couple of components, or rather models that require
the component path in order to work properly. However those are
typically better rewritten to evaluate their stuff at render time
rather than construction time. If that doesn't work, those usually
were better added in onBeforeRender, or more recently onInitialize or
onConfigure.

Given that in all my Wicket time I have not encountered unsurmountable
problems with using constructors for what they are intended for, I
will not be voting favorable for something that will throw away 6
years of code, libraries, books, blogs, articles and presentations,
just because one person dislikes constructors. If I wanted such an
experience, I'd used Tapestry instead.

Yes, we break compatibility between releases. We do this to improve
our framework and the way applications can be built. We strive to
minimize compatibility breaks and try to keep upgrades of medium sized
applications to a couple of days. We learnt our valuable lesson with
the constructor change—and we're not about to repeat that fiasco again
[1]. We try to balance the improvements we can achieve with the pain
it will cause for upgrading between versions. In this instance, the
pain is huge and community wide. The benefits are slim at best, as
evidenced by 6 years of successful application development. The
balance in this issue is severely off.

So to summarize my rant:

-1 for removing the ability to use add inside a constructor.
+0 for improving the handling of oninitialize
+1 for improving the documentation on the lifecycle of components and
the event chain called during processing [2]

Martijn

[1] we had to rewrite Wicket in Action twice, and still discovered old
2.0 code in the examples days before going to the press
[2] I'll have a go at that soonish if no-one beats me to the punch

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



Re: [VOTE] WICKET-3218 - Component#onInitialize is broken for Pages

2011-03-10 Thread Maarten Billemont
On 10 Mar 2011, at 00:42, Igor Vaynberg wrote:
> i am +0 for refactoring the code so that oninitialize() cascade is not
> started from page#add() but from somewhere before page#onconfigure().
> this way oninitialize() is safe to override in pages because it will
> not be invoked from page's constructor but from some framework code at
> a later time.

Then I think that's the only actual solution that has positive votes.  Without 
any further feedback, can we agree to leave constructors as they are, make 
onInitialize overridable and do it this way?
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



radioGroup in DataView

2011-03-10 Thread Jehan
Dear All

I am using radioGroup example found at URL:
https://cwiki.apache.org/WICKET/using-radiogroups.html
when I am clicking on submit button then old/Dafault selected values are
printing.

Using following code(saveRoleAssignments method) I want to print user
selected radio button values (e.g., true or false)

for printing I am using info method.

Thanks

public class rdoTest extends WebPage {
 public rdoTest()
 {
  ArrayList list = new ArrayList();
  list.add(new Person(1,"Xyz"));
  list.add(new Person(2,"abc"));
  list.add(new Person(3,"def"));
  list.add(new Person(1,"ghi"));
  list.add(new Person(1,"jkl"));



  ListDataProvider myIDataProvider= new ListDataProvider(list);

  final Form profileForm = new Form("profile-form");
  final DataView dataView = new DataView("profile-rows", myIDataProvider) {
   private static final long serialVersionUID = 1L;
   private static final int ROLE_SYS_ADMIN = 1;
   private static final int ROLE_DEPT_ADMIN = 2;
   private static final int ROLE_NO_ADMIN = 3;
   /**
   * {@inheritDoc}
   */
   @Override
   protected void populateItem(final Item item) {
Person person = (Person) item.getModelObject();
item.add(new Label("first-name", person.getName()));
   // item.add(new Label("last-name", person.getLastName()));
// add the radio group to select system or department (organizational)
administrators
final RadioGroup adminRadioGroup = new RadioGroup("radio-admin");
item.add(adminRadioGroup);


// create our three models with corresponding object values
(PersonRoleXrefId = persistent model that holds person/role id)
final Model sysAdminModel = new Model(new
PersonRoleXrefId(person.getId(), ROLE_SYS_ADMIN));
final Model deptAdminModel = new Model(new
PersonRoleXrefId(person.getId(), ROLE_DEPT_ADMIN));
final Model noAdminModel = new Model(new
PersonRoleXrefId(person.getId(), ROLE_NO_ADMIN ));
// add the models to the radios and the radios to the radio group
adminRadioGroup.add(new Radio("radio-sys-admin", sysAdminModel));
adminRadioGroup.add(new Radio("radio-dept-admin", deptAdminModel));
adminRadioGroup.add(new Radio("radio-non-admin", noAdminModel));
// set current default role selection based upon the currently iterated
item
// ( hasRole(...) is example method that determines if the person has
the specified role or not)
if (person.getId() == ROLE_SYS_ADMIN) {
 adminRadioGroup.setModel(sysAdminModel);
} else if (person.getId() == ROLE_DEPT_ADMIN) {
 adminRadioGroup.setModel(deptAdminModel);
} else {
 adminRadioGroup.setModel(noAdminModel);
}
   }
  };
  profileForm.add(dataView);
  Button okButton = new Button("button-save")
  {
   private static final long serialVersionUID = 1L;
   /**
   * {@inheritDoc}
   */
   @Override
   public final void onSubmit() {
info("\n--\n");
   // radioGroup.getInput(), radio1.getValue());
// see section for "Processing more than one RadioGroup simultaneously"
for explanation
saveRoleAssignments(dataView);
   }
  };
  profileForm.add(okButton);
  add(profileForm);

 }

 private final void saveRoleAssignments(final DataView dataView) {
  final ArrayList saveXrefs = new
ArrayList();
  for (final Iterator it = dataView.getItems(); it.hasNext();) {
   final Item item = (Item) it.next();
   final Person person = (Person) item.getModelObject();
   item.visitChildren(new Component.IVisitor() {
/**
* {@inheritDoc}
*/
//@Override
public final Object component(final Component component) {
 if (component instanceof RadioGroup) {


  final PersonRoleXrefId prId = (PersonRoleXrefId)
component.getDefaultModelObject();//getModelObject();
  // compare with existing person's assigned roles and only add changed
associations
  if (person.getId() == prId.getId()) {
   //saveXrefs.add(prId);
   //info(person.getName() + "" + prId.getId());
  }
  ///here I want to show new selected radio buttons [true or false]
  info("\n"+person.getName() + "" + prId.getId());
 }
 // continue visiting children to locate other RadioGroup components
 return CONTINUE_TRAVERSAL;
}
   });
  }
  if (!saveXrefs.isEmpty()) {
   // save person/role assignments using a IDataProvider assigned to the
DataView
   //((MyIDataProvider)
dataView.getDataProvider()).saveRoleAssignments(saveXrefs);
  }
 }

}