Re: Wicket Visibility vs. CSS visibility

2008-05-16 Thread Johan Compagner
Many people expect that is the component is not visible also the
models and the data ias not called or touched. Because there state
cant be resolved correctly.
Als security is depending on it, it can never be that some thing where
security says it is not visible/cant render that is still renders
data, this would be a major security hole.

On 5/17/08, Kirk Israel <[EMAIL PROTECTED]> wrote:
> On Fri, May 16, 2008 at 7:34 PM, Eelco Hillenius
> <[EMAIL PROTECTED]> wrote:
>>> If you wanted to just a cosmetic, DHTM/CSS "display: none" type of
>>> visibility, is there something you can do other than
>>> making a new AttributeModifier (with a custom Visibility Model kind of
>>> thing) or a SimplleAttributeModifier with a CSS
>>> "display:none" String there?
>>
>> Well, if the component isn't visible (I typically override isVisible,
>> because there's typically an algorithm that determines whether the
>> component is visible), no rendering is done at all, which can save
>> things like database roundtrips if that component or it's children use
>> that, and it also often lets you avoid having to do null checks and
>> stuff in your models (e.g. you can depend on a model function only to
>> be executed when another object - the one that determines whether the
>> component is visible - is checked).
>
> I'm still not comfortable with "is it visible" being mixed up with "is
> it plain gone"...
> Here was my scenario, I'll tell you my error, the fix, and then I'd
> love to hear if there's a better way.
>
> Essentially we have a form where you can select countries, and we want
> to offer two different views, a flat list collection of checkboxes for
> all countries, and then a series of lists broken out by continent --
> two checkgroups w/ the same underlying model. For screen realestate
> reasons, the CheckGroups live in scrollable Divs, and the Checks live
> in a special ListView thing. So far so good. Then each of the
> Continents has a little summary part, a textual description of what's
> selected (the idea is the comma separated summary is always visible
> vs. the checks which might be scrolled away, and the summary can be
> clever and concise and say "ALL EUROPE except France, Spain") So - and
> I know this is a little bit of an anti-pattern - as I built each
> Continent I added the Summary label, and then kept a member variable
> list of those around, and then had the checkboxes (whether on the flat
> list or the by-continent list) call a function to add the summaries to
> the Ajax request target. What I didn't realize, when I made the
> by-continent view not visible and the flat list visible, and then
> back, the Continents actually got regenerated, with new Summary
> labels, and so the List was full of stale label referenes that barfed
> when I tried to update them.
>
> I know it's not encouraged to keep member variables of page components
> around, but I couldn't think of another way of getting to them...
>
>
> The net-net is, it seems very odd to me that "merely" switching around
> visibility should invalidate object references, that the complexity in
> actually USING the visibility outweighs the "efficiency for free", and
> I wish I had a simple "render this, but set its CSS visibility to
> hidden" switch without having to go and manually modify attributes.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Thread safety for components

2008-05-16 Thread Jonathan Locke

I wouldn't spend too much time worrying about the possibility of a mistake
that big at this point! There are 20 programmers on this project at this
point and almost all of them are architects with many years of experience.
Wicket is being used by many thousands of users on hundreds if not thousands
of projects. We used it at a venture funded startup called thoof to create a
fully scalable website with benchmarks you can read about here:

http://blog.thoof.com/index.php/geekery/build-to-scale-our-web-architecture/

I know of several Fortune 500 companies using Wicket and even one website
with millions of users that is converting to Wicket to save on maintenance
costs.  

While Wicket is not stateless, it is quite efficient for a stateful
framework with an excellent programming model. My expectation is that
stateful frameworks with good programming models will win in the end. Even
today, Wicket applications spend most of their time waiting for databases
and services. As hardware improves, this equation will only favor Wicket
more and more.


Brill Pappin wrote:
> 
> Ahh... I was getting worried that it synchronous per page-resource (as
> opposed to per client), the last person could be waiting for a while!
> 
> So essentially it's single threaded per client (or session) which is
> pretty
> much par for the course, and not a problem that I can see :)
> 
> - Brill Pappin
> 
> -Original Message-
> From: Eelco Hillenius [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, May 17, 2008 1:03 AM
> To: users@wicket.apache.org
> Subject: Re: Thread safety for components
> 
> On Fri, May 16, 2008 at 7:50 PM, Brill Pappin <[EMAIL PROTECTED]> wrote:
>> Does that mean that under heavy load, hitting the index page for 
>> instance, I can expect clients to block as each request is processed?
> 
> Yes, requests to pages/ components that belong to the same pagemap in a
> session are handled synchronously. Images and other resources like
> javascript and css files are handled asynchronously. Different clients
> never
> block each other.
> 
> Eelco
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Thread-safety-for-components-tp17265324p17288470.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Using ResourceReference in osgi bundle

2008-05-16 Thread james yong

Hi,

I have a javascript file inside a osgi bundle. ResourceReference is used to
refer to that file.

When running the application, the following exception occurs when the
resourceReference's renderhead method is run.

java.lang.NullPointerException 
at org.apache.wicket.SharedResources.resourceKey(SharedResources.java:322) 
at org.apache.wicket.SharedResources.get(SharedResources.java:238) 
at org.apache.wicket.ResourceReference.bind(ResourceReference.java:137) 
at
org.apache.wicket.ResourceReference.getSharedResourceKey(ResourceReference.java:224)
 
at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:996) 
at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:981) 
at
org.apache.wicket.markup.html.internal.HeaderResponse.renderJavascriptReference(HeaderResponse.java:157)
 
at
org.apache.wicket.ajax.AjaxRequestTarget$AjaxHeaderResponse.renderJavascriptReference(AjaxRequestTarget.java:783)

I am using wicket 1.3.3. NullPointerException comes about because the scope
variable is a null, as in 
alias = scope.getName();.
Not sure why scope is null in the 1st place.

Regards,
james

-- 
View this message in context: 
http://www.nabble.com/Using-ResourceReference-in-osgi-bundle-tp17288449p17288449.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Thread safety for components

2008-05-16 Thread Brill Pappin
Ahh... I was getting worried that it synchronous per page-resource (as
opposed to per client), the last person could be waiting for a while!

So essentially it's single threaded per client (or session) which is pretty
much par for the course, and not a problem that I can see :)

- Brill Pappin

-Original Message-
From: Eelco Hillenius [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 17, 2008 1:03 AM
To: users@wicket.apache.org
Subject: Re: Thread safety for components

On Fri, May 16, 2008 at 7:50 PM, Brill Pappin <[EMAIL PROTECTED]> wrote:
> Does that mean that under heavy load, hitting the index page for 
> instance, I can expect clients to block as each request is processed?

Yes, requests to pages/ components that belong to the same pagemap in a
session are handled synchronously. Images and other resources like
javascript and css files are handled asynchronously. Different clients never
block each other.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Thread safety for components

2008-05-16 Thread Eelco Hillenius
On Fri, May 16, 2008 at 7:50 PM, Brill Pappin <[EMAIL PROTECTED]> wrote:
> Does that mean that under heavy load, hitting the index page for instance, I
> can expect clients to block as each request is processed?

Yes, requests to pages/ components that belong to the same pagemap in
a session are handled synchronously. Images and other resources like
javascript and css files are handled asynchronously. Different clients
never block each other.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Thread safety for components

2008-05-16 Thread Brill Pappin
Does that mean that under heavy load, hitting the index page for instance, I
can expect clients to block as each request is processed?

Have anyone tested this on a site with heavy traffic?

- Brill 

-Original Message-
From: Johan Compagner [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 16, 2008 2:53 AM
To: users@wicket.apache.org
Subject: Re: Thread safety for components

It is not sync around session, for one thing the wicket Sessio object is not
thread safe.. Same for shared resources those 2 can be hit by multiply
rerquest at once.

Pages are threadsafe and that is not done by a big sync block, but by
placing a barrier. See Session.getPage() there there is code that makes sure
that 1 thread at a time gets a page from the session the rest just has to
wait

On 5/16/08, Maurice Marrink <[EMAIL PROTECTED]> wrote:
> wicket synchronizes on the session.
> So only one request is processed at a time, (except for resources like 
> images etc) So even ajax requests are synchronized.
>
> There might be some more details i am not aware of but this is in a 
> nutshell our synchronization.
>
> Maurice
>
> On Fri, May 16, 2008 at 4:33 AM, Jonathan Locke 
> <[EMAIL PROTECTED]> wrote:
>>
>>
>> I'm not sure precisely what the current synchronization 
>> implementation is and there may be some edge cases that are not 
>> perfect, but the overall design is single-threaded, meaning you 
>> should not need to provide synchronization. Some requests, like image 
>> resources would potentially be handled in parallel, but anything that 
>> calls user code ought to be synchronized by Wicket so you don't have 
>> to think about it. I suppose there might be complications with 
>> asynchronous Ajax events, but I would expect these cases are already 
>> handled.  Is there some specific problem you have run into?
>>
>>
>> Michael Allan wrote:
>>>
>>> I'm trying to get a handle on thread-safety for components.  I'm new 
>>> to Wicket.  My best information, so far, comes from the previous 
>>> discussion "Wicket Session and threading":
>>>
>>>
>>> http://mail-archives.apache.org/mod_mbox/wicket-users/200801.mbox/th
>>> read
>>>
>>> Eelco Hillenius, in response to Sebastiaan van Erk, wrote:
>>>
 Yes. We try our best to make pages/ components as thread safe as 
 possible...

 > Is there anywhere a small piece on how to deal with threading 
 > within Wicket (i.e., what is/is not synchronized in a 
 > request/response roundtrip?). I did some quick searching in the 
 > mailing list archives
 and
 > google, but could not find anything related to version 1.3.

 Pages are synced on pagemaps, which basically relates to browser 
 windows. RequestCycles are separate instances which are not reused, 
 so no sync needed there. Sessions are not synced so you need to 
 sync manually. Though in practice this wouldn't give much trouble 
 to start with. Applications are shared an not synced.
>>>
>>> During form processing, however, my own pages are *not* synced on 
>>> their pagemaps (at least not on their monitor locks).  I placed this 
>>> is in my code:
>>>
>>>   assert Thread.holdsLock( /*page*/this.getPageMap() );
>>>
>>> This asserts false during the setting of TextField models (Wicket 
>>> 1.3.2), and false during the call to Form.onSubmit().
>>>
>>> How can I ensure thread safety?  In other words, if I am coding a 
>>> model, what can I assume about my client threads?  Are they 
>>> synchronized somewhere, or must I code defensively within the model?
>>> Or, from the client side, if I have a thread that accesses a page's 
>>> components, how can it avoid tangling with the response/request 
>>> threads?
>>>
>>> --
>>> Michael Allan
>>>
>>> Toronto, 647-436-4521
>>> http://zelea.com/
>>>
>>>
>>> 
>>> - To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Thread-safety-for-components-tp17265324p1726655
>> 0.html Sent from the Wicket - User mailing list archive at 
>> Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket Visibility vs. CSS visibility

2008-05-16 Thread Jonathan Locke

by the way, don't forget that behaviors are reusable components too. there
can be advantages to encapsulating your hiding/showing logic in a behavior.
this can actually lead to less of this manual manipulation you're talking
about than the solution you seem to want. and because the logic is
encapsulated, it can work like a mix-in work where components don't need to
be aware of how they are being hidden and shown. this kind of decoupling can
actually be a big advantage for many problems over a simple set/isHidden
approach, which ties the component's visibility to logic embedded in the
component. i would step back and think about how you might use behaviors
here before jumping to conclusions.


Jonathan Locke wrote:
> 
> Of course there are many good counterarguments to this. There are already
> a lot of methods in Component, you can do this without any changes and it
> may be confusing to have a concept of hidden on top of the existing
> visible concept.
> 
> 
> Jonathan Locke wrote:
>> 
>> 
>> Again, you probably shouldn't be setting state like this, and you can
>> create a generic hiding behavior for now that should solve most of your
>> problems. All that is at stake here is really just convenience, not the
>> programming model.
>> 
>> On the other hand, this is a very common problem so it might be worth
>> discussing adding a generic solution to component like set/isHidden().
>> The implementation would be slightly tricky and would require two more
>> flag bits, but we could detect whether isHidden was overridden in
>> component and delegate to some kind of singleton behavior. I haven't
>> thought this through very far, but you should feel free to open a JIRA
>> issue for this feature request.
>> 
>> 
>> Kirk Israel-2 wrote:
>>> 
>>> On Fri, May 16, 2008 at 7:34 PM, Eelco Hillenius
>>> <[EMAIL PROTECTED]> wrote:
> If you wanted to just a cosmetic, DHTM/CSS "display: none" type of
> visibility, is there something you can do other than
> making a new AttributeModifier (with a custom Visibility Model kind of
> thing) or a SimplleAttributeModifier with a CSS
> "display:none" String there?

 Well, if the component isn't visible (I typically override isVisible,
 because there's typically an algorithm that determines whether the
 component is visible), no rendering is done at all, which can save
 things like database roundtrips if that component or it's children use
 that, and it also often lets you avoid having to do null checks and
 stuff in your models (e.g. you can depend on a model function only to
 be executed when another object - the one that determines whether the
 component is visible - is checked).
>>> 
>>> I'm still not comfortable with "is it visible" being mixed up with "is
>>> it plain gone"...
>>> Here was my scenario, I'll tell you my error, the fix, and then I'd
>>> love to hear if there's a better way.
>>> 
>>> Essentially we have a form where you can select countries, and we want
>>> to offer two different views, a flat list collection of checkboxes for
>>> all countries, and then a series of lists broken out by continent --
>>> two checkgroups w/ the same underlying model. For screen realestate
>>> reasons, the CheckGroups live in scrollable Divs, and the Checks live
>>> in a special ListView thing. So far so good. Then each of the
>>> Continents has a little summary part, a textual description of what's
>>> selected (the idea is the comma separated summary is always visible
>>> vs. the checks which might be scrolled away, and the summary can be
>>> clever and concise and say "ALL EUROPE except France, Spain") So - and
>>> I know this is a little bit of an anti-pattern - as I built each
>>> Continent I added the Summary label, and then kept a member variable
>>> list of those around, and then had the checkboxes (whether on the flat
>>> list or the by-continent list) call a function to add the summaries to
>>> the Ajax request target. What I didn't realize, when I made the
>>> by-continent view not visible and the flat list visible, and then
>>> back, the Continents actually got regenerated, with new Summary
>>> labels, and so the List was full of stale label referenes that barfed
>>> when I tried to update them.
>>> 
>>> I know it's not encouraged to keep member variables of page components
>>> around, but I couldn't think of another way of getting to them...
>>> 
>>> 
>>> The net-net is, it seems very odd to me that "merely" switching around
>>> visibility should invalidate object references, that the complexity in
>>> actually USING the visibility outweighs the "efficiency for free", and
>>> I wish I had a simple "render this, but set its CSS visibility to
>>> hidden" switch without having to go and manually modify attributes.
>>> 
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

Re: Account Activation Email generation and response processing: any design example?

2008-05-16 Thread Sam Stainsby
On Fri, 16 May 2008 21:15:34 +0300, Martin Makundi wrote:

> The benefit in digest is that the user (or another user) cannot
> fabricate it... so easily.

Just send a large random number that is unique on the server. Keep a copy 
and compare with what the recipient sends back. Simple - no need for 
expensive hash operations.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Nested form submission quirk/anomaly

2008-05-16 Thread Ritz123

Hi,

I have 3 nested forms inside main wrapper form. The idea is, each panels
have their own forms, just in case one wanted to use the panels
individually. And when used inside 1 bigger scope page individual forms will
be nested inside the bigger scoped (main form).

I have a submit button on the main form and have a debug statement printed
to indicate the form was submitted. Surprisingly there is no output both on
onsubmit of the button as well as on the form, indicating neither I getting
called. I put debug statements inside individual forms too to see if any one
of them was getting submitted. But thats not happening either. When hit
save, the page comes back and shows filled values.

Apologize for the longer HTML but here is the actual HTML



Username and Password



Your email address: 






Password: 






Please confirm your password: 







User Contact Information




Your Home phone number: 
-
-







Your Business phone number: 
-
-







Your fax number: 
-
-







Your Mobile number: 
-
-



  




Shipping Address




Title: 

Mr.
Mrs.
Ms.
Dr.




First name: 




 


Last name: 







Address1: 






Address2: 




City: 







Zipcode/Postal Code: 


  




State/Province: 
Select a state
Armed Forces Americas
Armed Forces Europe
Alaska





   
Country: 
Select a country
United States
   






Address: 
Add New Address







-- 
View this message in context: 
http://www.nabble.com/Nested-form-submission-quirk-anomaly-tp17287190p17287190.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket Visibility vs. CSS visibility

2008-05-16 Thread Jonathan Locke

Of course there are many good counterarguments to this. There are already a
lot of methods in Component, you can do this without any changes and it may
be confusing to have a concept of hidden on top of the existing visible
concept.


Jonathan Locke wrote:
> 
> 
> Again, you probably shouldn't be setting state like this, and you can
> create a generic hiding behavior for now that should solve most of your
> problems. All that is at stake here is really just convenience, not the
> programming model.
> 
> On the other hand, this is a very common problem so it might be worth
> discussing adding a generic solution to component like set/isHidden(). The
> implementation would be slightly tricky and would require two more flag
> bits, but we could detect whether isHidden was overridden in component and
> delegate to some kind of singleton behavior. I haven't thought this
> through very far, but you should feel free to open a JIRA issue for this
> feature request.
> 
> 
> Kirk Israel-2 wrote:
>> 
>> On Fri, May 16, 2008 at 7:34 PM, Eelco Hillenius
>> <[EMAIL PROTECTED]> wrote:
 If you wanted to just a cosmetic, DHTM/CSS "display: none" type of
 visibility, is there something you can do other than
 making a new AttributeModifier (with a custom Visibility Model kind of
 thing) or a SimplleAttributeModifier with a CSS
 "display:none" String there?
>>>
>>> Well, if the component isn't visible (I typically override isVisible,
>>> because there's typically an algorithm that determines whether the
>>> component is visible), no rendering is done at all, which can save
>>> things like database roundtrips if that component or it's children use
>>> that, and it also often lets you avoid having to do null checks and
>>> stuff in your models (e.g. you can depend on a model function only to
>>> be executed when another object - the one that determines whether the
>>> component is visible - is checked).
>> 
>> I'm still not comfortable with "is it visible" being mixed up with "is
>> it plain gone"...
>> Here was my scenario, I'll tell you my error, the fix, and then I'd
>> love to hear if there's a better way.
>> 
>> Essentially we have a form where you can select countries, and we want
>> to offer two different views, a flat list collection of checkboxes for
>> all countries, and then a series of lists broken out by continent --
>> two checkgroups w/ the same underlying model. For screen realestate
>> reasons, the CheckGroups live in scrollable Divs, and the Checks live
>> in a special ListView thing. So far so good. Then each of the
>> Continents has a little summary part, a textual description of what's
>> selected (the idea is the comma separated summary is always visible
>> vs. the checks which might be scrolled away, and the summary can be
>> clever and concise and say "ALL EUROPE except France, Spain") So - and
>> I know this is a little bit of an anti-pattern - as I built each
>> Continent I added the Summary label, and then kept a member variable
>> list of those around, and then had the checkboxes (whether on the flat
>> list or the by-continent list) call a function to add the summaries to
>> the Ajax request target. What I didn't realize, when I made the
>> by-continent view not visible and the flat list visible, and then
>> back, the Continents actually got regenerated, with new Summary
>> labels, and so the List was full of stale label referenes that barfed
>> when I tried to update them.
>> 
>> I know it's not encouraged to keep member variables of page components
>> around, but I couldn't think of another way of getting to them...
>> 
>> 
>> The net-net is, it seems very odd to me that "merely" switching around
>> visibility should invalidate object references, that the complexity in
>> actually USING the visibility outweighs the "efficiency for free", and
>> I wish I had a simple "render this, but set its CSS visibility to
>> hidden" switch without having to go and manually modify attributes.
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Wicket-Visibility-vs.-CSS-visibility-tp17285530p17287068.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket Visibility vs. CSS visibility

2008-05-16 Thread Jonathan Locke


Again, you probably shouldn't be setting state like this, and you can create
a generic hiding behavior for now that should solve most of your problems.
All that is at stake here is really just convenience, not the programming
model.

On the other hand, this is a very common problem so it might be worth
discussing adding a generic solution to component like set/isHidden(). The
implementation would be slightly tricky and would require two more flag
bits, but we could detect whether isHidden was overridden in component and
delegate to some kind of singleton behavior. I haven't thought this through
very far, but you should feel free to open a JIRA issue for this feature
request.


Kirk Israel-2 wrote:
> 
> On Fri, May 16, 2008 at 7:34 PM, Eelco Hillenius
> <[EMAIL PROTECTED]> wrote:
>>> If you wanted to just a cosmetic, DHTM/CSS "display: none" type of
>>> visibility, is there something you can do other than
>>> making a new AttributeModifier (with a custom Visibility Model kind of
>>> thing) or a SimplleAttributeModifier with a CSS
>>> "display:none" String there?
>>
>> Well, if the component isn't visible (I typically override isVisible,
>> because there's typically an algorithm that determines whether the
>> component is visible), no rendering is done at all, which can save
>> things like database roundtrips if that component or it's children use
>> that, and it also often lets you avoid having to do null checks and
>> stuff in your models (e.g. you can depend on a model function only to
>> be executed when another object - the one that determines whether the
>> component is visible - is checked).
> 
> I'm still not comfortable with "is it visible" being mixed up with "is
> it plain gone"...
> Here was my scenario, I'll tell you my error, the fix, and then I'd
> love to hear if there's a better way.
> 
> Essentially we have a form where you can select countries, and we want
> to offer two different views, a flat list collection of checkboxes for
> all countries, and then a series of lists broken out by continent --
> two checkgroups w/ the same underlying model. For screen realestate
> reasons, the CheckGroups live in scrollable Divs, and the Checks live
> in a special ListView thing. So far so good. Then each of the
> Continents has a little summary part, a textual description of what's
> selected (the idea is the comma separated summary is always visible
> vs. the checks which might be scrolled away, and the summary can be
> clever and concise and say "ALL EUROPE except France, Spain") So - and
> I know this is a little bit of an anti-pattern - as I built each
> Continent I added the Summary label, and then kept a member variable
> list of those around, and then had the checkboxes (whether on the flat
> list or the by-continent list) call a function to add the summaries to
> the Ajax request target. What I didn't realize, when I made the
> by-continent view not visible and the flat list visible, and then
> back, the Continents actually got regenerated, with new Summary
> labels, and so the List was full of stale label referenes that barfed
> when I tried to update them.
> 
> I know it's not encouraged to keep member variables of page components
> around, but I couldn't think of another way of getting to them...
> 
> 
> The net-net is, it seems very odd to me that "merely" switching around
> visibility should invalidate object references, that the complexity in
> actually USING the visibility outweighs the "efficiency for free", and
> I wish I had a simple "render this, but set its CSS visibility to
> hidden" switch without having to go and manually modify attributes.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Wicket-Visibility-vs.-CSS-visibility-tp17285530p17287030.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket Visibility vs. CSS visibility

2008-05-16 Thread Kirk Israel
On Fri, May 16, 2008 at 7:34 PM, Eelco Hillenius
<[EMAIL PROTECTED]> wrote:
>> If you wanted to just a cosmetic, DHTM/CSS "display: none" type of
>> visibility, is there something you can do other than
>> making a new AttributeModifier (with a custom Visibility Model kind of
>> thing) or a SimplleAttributeModifier with a CSS
>> "display:none" String there?
>
> Well, if the component isn't visible (I typically override isVisible,
> because there's typically an algorithm that determines whether the
> component is visible), no rendering is done at all, which can save
> things like database roundtrips if that component or it's children use
> that, and it also often lets you avoid having to do null checks and
> stuff in your models (e.g. you can depend on a model function only to
> be executed when another object - the one that determines whether the
> component is visible - is checked).

I'm still not comfortable with "is it visible" being mixed up with "is
it plain gone"...
Here was my scenario, I'll tell you my error, the fix, and then I'd
love to hear if there's a better way.

Essentially we have a form where you can select countries, and we want
to offer two different views, a flat list collection of checkboxes for
all countries, and then a series of lists broken out by continent --
two checkgroups w/ the same underlying model. For screen realestate
reasons, the CheckGroups live in scrollable Divs, and the Checks live
in a special ListView thing. So far so good. Then each of the
Continents has a little summary part, a textual description of what's
selected (the idea is the comma separated summary is always visible
vs. the checks which might be scrolled away, and the summary can be
clever and concise and say "ALL EUROPE except France, Spain") So - and
I know this is a little bit of an anti-pattern - as I built each
Continent I added the Summary label, and then kept a member variable
list of those around, and then had the checkboxes (whether on the flat
list or the by-continent list) call a function to add the summaries to
the Ajax request target. What I didn't realize, when I made the
by-continent view not visible and the flat list visible, and then
back, the Continents actually got regenerated, with new Summary
labels, and so the List was full of stale label referenes that barfed
when I tried to update them.

I know it's not encouraged to keep member variables of page components
around, but I couldn't think of another way of getting to them...


The net-net is, it seems very odd to me that "merely" switching around
visibility should invalidate object references, that the complexity in
actually USING the visibility outweighs the "efficiency for free", and
I wish I had a simple "render this, but set its CSS visibility to
hidden" switch without having to go and manually modify attributes.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Select a directory in a textfield

2008-05-16 Thread Scott Swank
Are you thinking about some sort of file upload?  It's not at all
clear what you're trying to accomplish.

On Fri, May 16, 2008 at 5:30 PM, James Carman
<[EMAIL PROTECTED]> wrote:
> A directory where?  On the client machine?  What will you do with that
> directory when you've selected it?
>
> On Fri, May 16, 2008 at 6:55 PM, Oncle Zebulon <[EMAIL PROTECTED]> wrote:
>>
>> Hi everybody,
>> I am a newbie with wicket and i would like to know if there is a way to
>> select a directory in a textfield ? I know that with the input tag
>> (type=file), it's not possible, but maybe with wicket...?
>> any ideas ?
>>
>> --
>> View this message in context: 
>> http://www.nabble.com/Select-a-directory-in-a-textfield-tp17285749p17285749.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Select a directory in a textfield

2008-05-16 Thread James Carman
A directory where?  On the client machine?  What will you do with that
directory when you've selected it?

On Fri, May 16, 2008 at 6:55 PM, Oncle Zebulon <[EMAIL PROTECTED]> wrote:
>
> Hi everybody,
> I am a newbie with wicket and i would like to know if there is a way to
> select a directory in a textfield ? I know that with the input tag
> (type=file), it's not possible, but maybe with wicket...?
> any ideas ?
>
> --
> View this message in context: 
> http://www.nabble.com/Select-a-directory-in-a-textfield-tp17285749p17285749.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket Visibility vs. CSS visibility

2008-05-16 Thread Eelco Hillenius
> If you wanted to just a cosmetic, DHTM/CSS "display: none" type of
> visibility, is there something you can do other than
> making a new AttributeModifier (with a custom Visibility Model kind of
> thing) or a SimplleAttributeModifier with a CSS
> "display:none" String there?

Well, if the component isn't visible (I typically override isVisible,
because there's typically an algorithm that determines whether the
component is visible), no rendering is done at all, which can save
things like database roundtrips if that component or it's children use
that, and it also often lets you avoid having to do null checks and
stuff in your models (e.g. you can depend on a model function only to
be executed when another object - the one that determines whether the
component is visible - is checked).

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket Visibility vs. CSS visibility

2008-05-16 Thread Jonathan Locke

You should use isVisible when possible. The notion of component's visibility
has to do with whether the component renderers or not. So yes, the list will
be reconstructed from scratch. If you're doing something Ajaxy, this might
not be what you want.

I personally wish that the Ajax implementation was a bit more automatic by
default. Adding a behavior for Ajax to a component could easily set the
right flags since this is the most common case. People who are doing custom
ID management could turn off the automatic default.

I usually look for places to handle this kind of thing centrally, whether
it's some component base class or a base behavior class or a custom
behavior.  Once you've defined a component that's good for your application,
you just repeat use of it.


Kirk Israel-2 wrote:
> 
> If I have a component with a nested ListView, and I make the parent
> component go away for a bit with setVisible, the List will be
> reconstructed from scratch?
> 
> Is the understanding that for Wicket "Invisible" means "the component
> objects (Labels, etc) have Gone Away"?
> 
> What are the advantages of that? I know it means there's a lot of
> boilerplate that has to be done for the opposite,
> when something starts out as Visible false, the old
> .setOutputMarkupId(true); and .setOutputMarkupPlaceholderTag(true);
> I think it's part of the philosophy of Wicket I don't get yet...
> 
> If you wanted to just a cosmetic, DHTM/CSS "display: none" type of
> visibility, is there something you can do other than
> making a new AttributeModifier (with a custom Visibility Model kind of
> thing) or a SimplleAttributeModifier with a CSS
> "display:none" String there?
> 
> Thanks!
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Wicket-Visibility-vs.-CSS-visibility-tp17285530p17286015.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Select a directory in a textfield

2008-05-16 Thread Oncle Zebulon

Hi everybody,
I am a newbie with wicket and i would like to know if there is a way to
select a directory in a textfield ? I know that with the input tag
(type=file), it's not possible, but maybe with wicket...?
any ideas ?

-- 
View this message in context: 
http://www.nabble.com/Select-a-directory-in-a-textfield-tp17285749p17285749.html
Sent from the Wicket - User mailing list archive at Nabble.com.


Wicket Visibility vs. CSS visibility

2008-05-16 Thread Kirk Israel
If I have a component with a nested ListView, and I make the parent
component go away for a bit with setVisible, the List will be
reconstructed from scratch?

Is the understanding that for Wicket "Invisible" means "the component
objects (Labels, etc) have Gone Away"?

What are the advantages of that? I know it means there's a lot of
boilerplate that has to be done for the opposite,
when something starts out as Visible false, the old
.setOutputMarkupId(true); and .setOutputMarkupPlaceholderTag(true);
I think it's part of the philosophy of Wicket I don't get yet...

If you wanted to just a cosmetic, DHTM/CSS "display: none" type of
visibility, is there something you can do other than
making a new AttributeModifier (with a custom Visibility Model kind of
thing) or a SimplleAttributeModifier with a CSS
"display:none" String there?

Thanks!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OK, more JPA questions

2008-05-16 Thread Igor Vaynberg
there are basically two things that you need no matter what web
framework you are integrating with:

1) a way to lookup your dao singleton

you can do this with servletcontextlistener, a lazy init static lookup
on the dao itself,  keep it in some other singleton like the wicket
application subclass, or make it a spring/guice/whatever bean. depends
on what you want to use, wicket doesnt really care. the only concern
is that you must than be careful not to let any component keep a
reference to the dao because it is not serializable.

wicket-ioc allows you to quickly build an annotation based injection
solution that wraps these kinds of dependencies in serializable
light-weight proxies, which allows you to keep references or pass
these dependencies around in wicket components. see wicket-spring or
wicket-guice for example implementations.

2) a way to scope the entity manager to request

you need this so that lazy loading works. you are already doing this
with a threadlocal already, the only thing you need to do is to wire
in that closeEntityManager() call.

you can either do this with a servlet filter that sits around the
wicket filter, or you can hook into wicket's requestcycle and do it
from there. there are really no advantages either way.

hope this helps some. you have to keep in mind that wicket is purely a
UI framework, that is why we do not have a single story on how to tie
in a perstistance service or any other kind of lower tier to the
framework - that is simply outside what we consider our scope.

-igor





On Fri, May 16, 2008 at 12:14 PM, David Nedrow <[EMAIL PROTECTED]> wrote:
> There doesn't seem to be one recommended way to inject/use JPA-based utility
> archives in Wicket. It looks as though most of it is based around Spring,
> which is fine, yet adds another app layer.
>
> I've generated a tiny Derby db using the JPA facilities provided by
> MyEclipse.
>
> The sources can be found at:
>
> http://nedron.net/JpaTest.jar
>
> A binary "library" was created, including the default generated
> persistence.xml file and can be downloaded at:
>
> http://nedron.net/JpaTest-bin.jar
>
> I think more people than just me would find it useful if someone could use
> this extremely simple database in a simple, single page Wicket app.
>
> Note that I have zero problem using this type of library in a standalone
> Java app, and given that I'm relatively new to Wicket, I don't want to go to
> a bunch of effort only to find that I've gone about it the wrong way.
>
> Basic questions...
>
> Do I need to get hold of the com.foo.jpa.JpaNet.EntityManagerHelper in the
> main WicketApplication class and then serve that out to pages and panels as
> needed? The question here is, do I need  EntityManagerHelper transaction
> wrappers around my DAO operations? Or is that handled auto-magically by some
> other mechanism (JTA)?
>
> I guess what I'm really getting at is, what is the recommended way to use
> the library directly without extracting it?
>
> All of the examples I've found so far include the dao/etc. along with the
> app code, so there is no clear indication as to how a "third-party" java
> library is used in Wicket(/Spring). And many examples and much of the
> documentation is remarkably framdibulous, along the lines of "What is
> session managed? Session managed is not container managed. What is container
> managed? Container managed is not session managed."
>
> I've gotten myself pretty confused on this, as you can tell. ;)
>
> -David
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket tags and IE6

2008-05-16 Thread John Krasnay
Yeah, that's the easy fix I mentioned, and it indeed fixes the problem.

jk

On Fri, May 16, 2008 at 01:43:07PM -0400, Ryan Gravener wrote:
> You can place
> getMarkupSettings().setStripWicketTags(true); into your Application.init().
> I believe these are automatically stripped when you are in deployment mode.
> 
> On Fri, May 16, 2008 at 1:33 PM, John Krasnay <[EMAIL PROTECTED]> wrote:
> 
> > I've just noticed a specific problem with Wicket tags interfering with
> > IE6. I have a page that uses the jqModal plugin for jQuery to display a
> > popup div. It works fine on FF, but on IE6 the overlay (the
> > semi-transparent div that blocks out the rest of the page while the
> > popup is active) pushes the rest of the content down instead of floating
> > above it, and the popup div itself is not visible.
> >
> > After quite a bit of debugging I narrowed it down to a Border I was
> > using on the page, and I suspect it was the  tag that was
> > giving IE fits.
> >
> > Of course, this is easily fixed by suppressing Wicket tags from the
> > output, but I was wondering if (a) anyone else had seen this and can
> > think of another workaround, and (b) if there's some way of fixing this
> > in Wicket itself short of renaming .
> >
> > jk
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> -- 
> Ryan Gravener
> http://twitter.com/ryangravener

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



OK, more JPA questions

2008-05-16 Thread David Nedrow
There doesn't seem to be one recommended way to inject/use JPA-based  
utility archives in Wicket. It looks as though most of it is based  
around Spring, which is fine, yet adds another app layer.


I've generated a tiny Derby db using the JPA facilities provided by  
MyEclipse.


The sources can be found at:

http://nedron.net/JpaTest.jar

A binary "library" was created, including the default generated  
persistence.xml file and can be downloaded at:


http://nedron.net/JpaTest-bin.jar

I think more people than just me would find it useful if someone could  
use this extremely simple database in a simple, single page Wicket app.


Note that I have zero problem using this type of library in a  
standalone Java app, and given that I'm relatively new to Wicket, I  
don't want to go to a bunch of effort only to find that I've gone  
about it the wrong way.


Basic questions...

Do I need to get hold of the com.foo.jpa.JpaNet.EntityManagerHelper in  
the main WicketApplication class and then serve that out to pages and  
panels as needed? The question here is, do I need  EntityManagerHelper  
transaction wrappers around my DAO operations? Or is that handled auto- 
magically by some other mechanism (JTA)?


I guess what I'm really getting at is, what is the recommended way to  
use the library directly without extracting it?


All of the examples I've found so far include the dao/etc. along with  
the app code, so there is no clear indication as to how a "third- 
party" java library is used in Wicket(/Spring). And many examples and  
much of the documentation is remarkably framdibulous, along the lines  
of "What is session managed? Session managed is not container managed.  
What is container managed? Container managed is not session managed."


I've gotten myself pretty confused on this, as you can tell. ;)

-David

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Account Activation Email generation and response processing: any design example?

2008-05-16 Thread greeklinux

Hello,

yes you can create an activation column that
stores a hash value that is created by UUID or MD5.

Then send this data in an activation url to the user email.
The url can be mounted (nice url) to a Page, which gets
the PageParameters. Then you can validate the hash value.



MYoung wrote:
> 
> I need to implement the usual account activation via email function.  Can
> anyone point me to some example of how this is implemented? If in Wicket
> even better but anything would help me a lot.
> 
> One question I have is how to generate hard to guess unique keys in the
> email link? I use Hibernate & MySql, does this give me some easy way to
> generate these keys? Use Jakarta common-id to generate uuid?
> 
> I plan to have an activation field in the user table to store the
> activation
> key, once the user respond to the activation email link, clear the field
> to
> indicate the account is activated. Is this how it's done?
> 
> Thanks for any help!
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Account-Activation-Email-generation-and-response-processing%3A-any-design-example--tp17264315p17281858.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Form validation and .properties

2008-05-16 Thread Ryan Gravener
The page does a pretty good job explaining how the .properties work.

If you have global properties, you want them to go in your
MyApplication.properties file which sits right along MyApplication.java.
For cases where you only need specific properties for a component, place the
properties file with the components name right alongside it.  Wicket will
start at the bottom and work its way up looking for the property key.  If
you look at the source (don't be scared)
http://svn.apache.org/repos/asf/wicket/trunk/wicket/src/main/java/org/apache/wicket/
there are a whole bunch of Application*.(properties|xml).

On Fri, May 16, 2008 at 12:30 PM, Blackbird <[EMAIL PROTECTED]> wrote:

>
> Hi, I am very interested in form validation as shown in the FormInput
> example
> at wicketstuff (http://wicketstuff.org/wicket13/forminput/)
> I also came upon this page
> (http://cwiki.apache.org/WICKET/form-validation-messages.html) in the
> wicket
> reference website.
>
> - This last web page reads "Some knowledge of wicket property-resource
> loading is required". Where can I get this knowledge ? A URL would have
> been
> convenient.
>
> - About the FormInput example, we can see that property values are
> retrieved
> from their key in FormInput.html, with this mechanism: "  key="value.between.0.and.100" /> "
> => How does Wicket know that this key is located in a file called
> FormInput.properties? Where is FormInput.properties located in the project?
> Does it have to be in the classpath? Does it have to be the same name (save
> extension) as the html file (in this case FormInput.html)?
>
> --
> View this message in context:
> http://www.nabble.com/Form-validation-and-.properties-tp17278934p17278934.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Ryan Gravener
http://twitter.com/ryangravener


Re: Not rendering DataGrid if empty

2008-05-16 Thread nitinkc

That works. Thanks Matej!


Matej Knopp-2 wrote:
> 
> setVisible is possible, but you have to call
> setOutputMarkupPlaceholderTag(true) on it.
> 
> -Matej
> 
> On Fri, May 16, 2008 at 6:44 PM, nitinkc <[EMAIL PROTECTED]> wrote:
>>
>> Currently the DataGrid outputs a datatable with column headers and a
>> message
>> 'No Records Found' if the datalist is empty. Does anyone know if it is
>> possible to render the datatable only if the list is not empty? Setting
>> the
>> visibility to 'false' is not an option as the markup is not rendered in
>> this
>> case and I need to be able to rerender the datatable if records are found
>> after an Ajax submit...
>> --
>> View this message in context:
>> http://www.nabble.com/Not-rendering-DataGrid-if-empty-tp17279244p17279244.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Not-rendering-DataGrid-if-empty-tp17279244p17281605.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RequiredBorder being applied multiple times in ajax calls

2008-05-16 Thread Sam Barnum
Awesome, that works!  I forgot that you can always get the request  
from that ThreadLocal.  Thanks a ton Gerolf, this doesn't seem too  
hacky.


--
Sam Barnum
360 Works

On May 15, 2008, at 10:58 AM, Gerolf Seitz wrote:


On Thu, May 15, 2008 at 6:25 PM, Sam Barnum <[EMAIL PROTECTED]> wrote:


* Somehow disable the border only for ajax calls



Sam,
I think you can do something like this in RequiredBorder#renderAfter:

AjaxRequestTarget target = AjaxRequestTarget.get();
if (target == null) {
  // we're in a normal request
  // put logic of the original renderAfter here
}

not sure if that works, but you might wanna give that a try.

cheers,
  Gerolf



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



SWARM Login

2008-05-16 Thread greeklinux

Hello,

I am using Wicket 1.3.3 with SWARM 1.3.0.
I have pages with a common layout (secure and not secure).
I can login and see the secure pages. Now I want to achieve
to be automaticaly redirected to "user home" when a user is
accessing the domain and logged in before...

I think I have to add a test to the base page and always 
check if a user is loggin in with WaspSession...?
Then redirect to the right page? I think this behaviour, if a
user is already logged in, should be handled by SWARM.

Thanks
-- 
View this message in context: 
http://www.nabble.com/SWARM-Login-tp17281596p17281596.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Account Activation Email generation and response processing: any design example?

2008-05-16 Thread Martin Makundi
The benefit in digest is that the user (or another user) cannot
fabricate it... so easily.

**
Martin

2008/5/16 Matthew Young <[EMAIL PROTECTED]>:
> What is the advantage of using message digest over uuid?  Isn't message
> digest not guaranteed to be unique where as UUID is always unique?
>
> On Thu, May 15, 2008 at 7:39 PM, Martin Makundi <
> [EMAIL PROTECTED]> wrote:
>
>> You could also just use a md5 hashkey with content specific to the account:
>>
>>MessageDigest messageDigest = MessageDigest.getInstance("MD5");
>>return new String(messageDigest.digest((encryptionKey +
>> value).getBytes()));
>>
>> **
>> Martin
>>
>> 2008/5/16 Ryan Gravener <[EMAIL PROTECTED]>:
>> > You may also want to have a enum/int to represent what kind of token it
>> is.
>> > New user, new email, forgot password, etc..
>> >
>> > On Thu, May 15, 2008 at 7:01 PM, James Carman <
>> [EMAIL PROTECTED]>
>> > wrote:
>> >
>> >> java.util.UUID.randomUUID().toString()
>> >>
>> >> On Thu, May 15, 2008 at 6:57 PM, Matthew Young <[EMAIL PROTECTED]>
>> wrote:
>> >> > I need to implement the usual account activation via email function.
>>  Can
>> >> > anyone point me to some example of how this is implemented? If in
>> Wicket
>> >> > even better but anything would help me a lot.
>> >> >
>> >> > One question I have is how to generate hard to guess unique keys in
>> the
>> >> > email link? I use Hibernate & MySql, does this give me some easy way
>> to
>> >> > generate these keys? Use Jakarta common-id to generate uuid?
>> >> >
>> >> > I plan to have an activation field in the user table to store the
>> >> activation
>> >> > key, once the user respond to the activation email link, clear the
>> field
>> >> to
>> >> > indicate the account is activated. Is this how it's done?
>> >> >
>> >> > Thanks for any help!
>> >> >
>> >>
>> >> -
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> > --
>> > Ryan Gravener
>> > http://twitter.com/ryangravener
>> >
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Account Activation Email generation and response processing: any design example?

2008-05-16 Thread Matthew Young
What is the advantage of using message digest over uuid?  Isn't message
digest not guaranteed to be unique where as UUID is always unique?

On Thu, May 15, 2008 at 7:39 PM, Martin Makundi <
[EMAIL PROTECTED]> wrote:

> You could also just use a md5 hashkey with content specific to the account:
>
>MessageDigest messageDigest = MessageDigest.getInstance("MD5");
>return new String(messageDigest.digest((encryptionKey +
> value).getBytes()));
>
> **
> Martin
>
> 2008/5/16 Ryan Gravener <[EMAIL PROTECTED]>:
> > You may also want to have a enum/int to represent what kind of token it
> is.
> > New user, new email, forgot password, etc..
> >
> > On Thu, May 15, 2008 at 7:01 PM, James Carman <
> [EMAIL PROTECTED]>
> > wrote:
> >
> >> java.util.UUID.randomUUID().toString()
> >>
> >> On Thu, May 15, 2008 at 6:57 PM, Matthew Young <[EMAIL PROTECTED]>
> wrote:
> >> > I need to implement the usual account activation via email function.
>  Can
> >> > anyone point me to some example of how this is implemented? If in
> Wicket
> >> > even better but anything would help me a lot.
> >> >
> >> > One question I have is how to generate hard to guess unique keys in
> the
> >> > email link? I use Hibernate & MySql, does this give me some easy way
> to
> >> > generate these keys? Use Jakarta common-id to generate uuid?
> >> >
> >> > I plan to have an activation field in the user table to store the
> >> activation
> >> > key, once the user respond to the activation email link, clear the
> field
> >> to
> >> > indicate the account is activated. Is this how it's done?
> >> >
> >> > Thanks for any help!
> >> >
> >>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> > --
> > Ryan Gravener
> > http://twitter.com/ryangravener
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Account Activation Email generation and response processing: any design example?

2008-05-16 Thread Matthew Young
>You may also want to have a enum/int to represent what kind of token it is.
New user, new email, forgot password, etc..

To have a field in the user-account table to store this value?  Or do you
mean to send this as part of the activation URL?

And what is the purpose to have this?

On Thu, May 15, 2008 at 6:42 PM, Ryan Gravener <[EMAIL PROTECTED]>
wrote:

> You may also want to have a enum/int to represent what kind of token it is.
> New user, new email, forgot password, etc..
>
> On Thu, May 15, 2008 at 7:01 PM, James Carman <[EMAIL PROTECTED]>
> wrote:
>
> > java.util.UUID.randomUUID().toString()
> >
> > On Thu, May 15, 2008 at 6:57 PM, Matthew Young <[EMAIL PROTECTED]>
> wrote:
> > > I need to implement the usual account activation via email function.
>  Can
> > > anyone point me to some example of how this is implemented? If in
> Wicket
> > > even better but anything would help me a lot.
> > >
> > > One question I have is how to generate hard to guess unique keys in the
> > > email link? I use Hibernate & MySql, does this give me some easy way to
> > > generate these keys? Use Jakarta common-id to generate uuid?
> > >
> > > I plan to have an activation field in the user table to store the
> > activation
> > > key, once the user respond to the activation email link, clear the
> field
> > to
> > > indicate the account is activated. Is this how it's done?
> > >
> > > Thanks for any help!
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Ryan Gravener
> http://twitter.com/ryangravener
>


Re: Wicket tags and IE6

2008-05-16 Thread Ryan Gravener
You can place
getMarkupSettings().setStripWicketTags(true); into your Application.init().
I believe these are automatically stripped when you are in deployment mode.

On Fri, May 16, 2008 at 1:33 PM, John Krasnay <[EMAIL PROTECTED]> wrote:

> I've just noticed a specific problem with Wicket tags interfering with
> IE6. I have a page that uses the jqModal plugin for jQuery to display a
> popup div. It works fine on FF, but on IE6 the overlay (the
> semi-transparent div that blocks out the rest of the page while the
> popup is active) pushes the rest of the content down instead of floating
> above it, and the popup div itself is not visible.
>
> After quite a bit of debugging I narrowed it down to a Border I was
> using on the page, and I suspect it was the  tag that was
> giving IE fits.
>
> Of course, this is easily fixed by suppressing Wicket tags from the
> output, but I was wondering if (a) anyone else had seen this and can
> think of another workaround, and (b) if there's some way of fixing this
> in Wicket itself short of renaming .
>
> jk
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Ryan Gravener
http://twitter.com/ryangravener


Wicket tags and IE6

2008-05-16 Thread John Krasnay
I've just noticed a specific problem with Wicket tags interfering with
IE6. I have a page that uses the jqModal plugin for jQuery to display a
popup div. It works fine on FF, but on IE6 the overlay (the
semi-transparent div that blocks out the rest of the page while the
popup is active) pushes the rest of the content down instead of floating
above it, and the popup div itself is not visible.

After quite a bit of debugging I narrowed it down to a Border I was
using on the page, and I suspect it was the  tag that was
giving IE fits.

Of course, this is easily fixed by suppressing Wicket tags from the
output, but I was wondering if (a) anyone else had seen this and can
think of another workaround, and (b) if there's some way of fixing this
in Wicket itself short of renaming .

jk

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Javascript + wicket

2008-05-16 Thread nanotech

Hi,

I want to know what are the different approaches that I can take in Wicket
to solve this simple problem.
Consider there are two radio buttons and they both have corresponding text
fields in front of them.

I want to enable /disable the other text fields when the radio button is
selected.


-- 
View this message in context: 
http://www.nabble.com/Javascript-%2B-wicket-tp17279716p17279716.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Not rendering DataGrid if empty

2008-05-16 Thread Ryan Gravener
Override the isVisible method of your component for which you do not want to
render.

@Override
boolean isVisible() {
   return dp.size()!=0;
}

On Fri, May 16, 2008 at 12:44 PM, nitinkc <[EMAIL PROTECTED]> wrote:

>
> Currently the DataGrid outputs a datatable with column headers and a
> message
> 'No Records Found' if the datalist is empty. Does anyone know if it is
> possible to render the datatable only if the list is not empty? Setting the
> visibility to 'false' is not an option as the markup is not rendered in
> this
> case and I need to be able to rerender the datatable if records are found
> after an Ajax submit...
> --
> View this message in context:
> http://www.nabble.com/Not-rendering-DataGrid-if-empty-tp17279244p17279244.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Ryan Gravener
http://twitter.com/ryangravener


Re: Not rendering DataGrid if empty

2008-05-16 Thread Matej Knopp
setVisible is possible, but you have to call
setOutputMarkupPlaceholderTag(true) on it.

-Matej

On Fri, May 16, 2008 at 6:44 PM, nitinkc <[EMAIL PROTECTED]> wrote:
>
> Currently the DataGrid outputs a datatable with column headers and a message
> 'No Records Found' if the datalist is empty. Does anyone know if it is
> possible to render the datatable only if the list is not empty? Setting the
> visibility to 'false' is not an option as the markup is not rendered in this
> case and I need to be able to rerender the datatable if records are found
> after an Ajax submit...
> --
> View this message in context: 
> http://www.nabble.com/Not-rendering-DataGrid-if-empty-tp17279244p17279244.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Not rendering DataGrid if empty

2008-05-16 Thread nitinkc

Currently the DataGrid outputs a datatable with column headers and a message
'No Records Found' if the datalist is empty. Does anyone know if it is
possible to render the datatable only if the list is not empty? Setting the
visibility to 'false' is not an option as the markup is not rendered in this
case and I need to be able to rerender the datatable if records are found
after an Ajax submit...
-- 
View this message in context: 
http://www.nabble.com/Not-rendering-DataGrid-if-empty-tp17279244p17279244.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Zip files containing ready to deploy wicketstuff examples

2008-05-16 Thread Blackbird

Hi, are there zip files of each example available at wicketstuff? Some
examples have many files, including configuration files (.properties, .xml)
It would be helpful to see how all these file should be organized ideally
(directory hierarchy).
Sorry if I've missed it.
-- 
View this message in context: 
http://www.nabble.com/Zip-files-containing-ready-to-deploy-wicketstuff-examples-tp17279039p17279039.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Image from resource outside tomcat container

2008-05-16 Thread Michael Sparer

i don't know if we're talking about the same thing :-). 

what i'm talking about is to serve static files that reside outside the
webapp context. e.g. after a fileupload by a user using a webform the file
gets saved to somewhere on the harddisk where it's not gonna be replaced on
redeploy.

what i do is to save the relative path to the file to my entity (e.g.
getImagePath() returns /img/foobar.png) and that's what you see in the
markup. then i set a filter to /img/*.
the filter extends jetty's DefaultServlet and implements filter. there I
override the method

@Override
public Resource getResource(final String pathInContext) {
return new FileResource(_fileRoot + pathInContext);
}

where _fileRoot is the place where the files are (e.g.
/opt/mywebapp/images).

anyway, if you have an apache in front of your servlet container, i'd rather
let apache serve the static files ...

and now? are we talking about the same thing? ;-)

regards,
Michael


Mathias P.W Nilsson wrote:
> 
> Really for now I do this for url
> 
> FileResourceServlet?fileResourceId=101
> 
> Else I need to do this.
> FileResourceServlet?path=very...veryvery.long...pathforthefile
> 
> How do you know wich file to fetch?
> 


-
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/Image-from-resource-outside-tomcat-container-tp17276444p17278962.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Form validation and .properties

2008-05-16 Thread Blackbird

Hi, I am very interested in form validation as shown in the FormInput example
at wicketstuff (http://wicketstuff.org/wicket13/forminput/)
I also came upon this page
(http://cwiki.apache.org/WICKET/form-validation-messages.html) in the wicket
reference website.

- This last web page reads "Some knowledge of wicket property-resource
loading is required". Where can I get this knowledge ? A URL would have been
convenient.

- About the FormInput example, we can see that property values are retrieved
from their key in FormInput.html, with this mechanism: "  "
=> How does Wicket know that this key is located in a file called
FormInput.properties? Where is FormInput.properties located in the project?
Does it have to be in the classpath? Does it have to be the same name (save
extension) as the html file (in this case FormInput.html)?

-- 
View this message in context: 
http://www.nabble.com/Form-validation-and-.properties-tp17278934p17278934.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

2008-05-16 Thread Hoover, William
It is valid to have a value on a checbox/radio
http://www.w3.org/TR/html401/interact/forms.html#h-17.4

I agree that the name of the interface needs to be addressed. The
concept is what I was attempting to convey.

-Original Message-
From: Igor Vaynberg [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 16, 2008 12:16 PM
To: users@wicket.apache.org
Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

afaik value is not used in checkbox or radio, not even sure that its
valid to have it.

iidentfierrenderer is a bad name since the id isnt actually rendered...

-igor


On Fri, May 16, 2008 at 9:07 AM, Hoover, William <[EMAIL PROTECTED]>
wrote:
> It could be left as is and use the display value as expected (i.e.
> ).
>
> Another option would be to have an identifier renderer:
>
> public interface IChoiceRenderer extends IIdentifierRenderer {
>Object getDisplayValue(Object object); }
>
> public interface IIdentifierRenderer extends IClusterable {
>String getIdValue(Object object, int index); }
>
> -Original Message-
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 16, 2008 11:47 AM
> To: users@wicket.apache.org
> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>
> if you use an ldm in choice/choicegroup then you should have instance 
> equality available since you will probably load the objects from the 
> same place, so during request processing they are consistent.
>
> as far as choicerenderer, i dont think thats a good idea, what do you 
> do with getdisplayvalue()?
>
> -igor
>
> On Fri, May 16, 2008 at 8:35 AM, Hoover, William <[EMAIL PROTECTED]>
> wrote:
>> I agree, but there are some cases where it will not be possible to 
>> implement equals/hashcode on the model object.
>>
>> I would be more of a proponent to have as much consistency across 
>> components as possible- which would mean that ICoiceRenderer would be

>> available, but not enforced, in any component that needs to handle 
>> choices (this is already the case for models ---> IModelComparator 
>> Component#getModelComparator(...)).
>>
>> I'm not sure I understand what you mean by using a 
>> LoadableDetachableModel to solve the issue. Could you elaborate?
>>
>> -Original Message-
>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>> Sent: Friday, May 16, 2008 11:12 AM
>> To: users@wicket.apache.org
>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>
>> then use loadable detachable models that will ensure instance
> equality.
>> we can let the group take a comparator, but its yet another 
>> complication. i see it as a reasonable enough requirement that 
>> objects
>
>> properly implement equals and hashcode.
>>
>> -igor
>>
>> On Fri, May 16, 2008 at 7:58 AM, Hoover, William 
>> <[EMAIL PROTECTED]>
>> wrote:
>>> yes, that will work in my example, but what if MyObjectOption is not

>>> part of my namespace?
>>>
>>> -Original Message-
>>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>>> Sent: Friday, May 16, 2008 10:14 AM
>>> To: users@wicket.apache.org
>>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>>
>>> why dont you just implement equals/hashcode on MyObjectOption???
>>>
>>> -igor
>>>
>>>
>>> On Fri, May 16, 2008 at 5:14 AM, Hoover, William 
>>> <[EMAIL PROTECTED]>
>>> wrote:
 Here is an example of what I'm referring to:

 class MyObject {
private Long id;
private MyObjectOption myObjectOption;

public MyObject(final Long id){
setId(id);
...
}
...
 }

 class MyObjectOption {
private Long id;
private String name;

public MyObjectOption(final Long id){
setId(id);
...
}
...
 }

 // in the WebPage
 final MyObject myObject = new MyObject(1L); ...
 myObject.setMyObjectOption(new MyObjectOption(200L));

 final List myObjectOptionList = new 
 ArrayList(); myObjectOptionList.add(new 
 MyObjectOption(100L)); myObjectOptionList.add(new 
 MyObjectOption(200L)); myObjectOptionList.add(new 
 MyObjectOption(300L));

 final Form myForm = new Form("form-myobject", new 
 CompoundPropertyModel(myObject)); ...
 final RadioGroup group = new RadioGroup("myObjectOption"); 
 group.add(new ListView("div-myobject-options-view", myObjectList) {
protected final void populateItem(final ListItem item) {
final MyObjectOption myObjectOption =
 (MyObjectOption)
>>
 item.getModelObject();
item.add(new Label("label-myobject-option-name",
 myObjectOption.getName()));
item.add(new Radio("input-radio-myobject-option", 
 new
>
 Model(myObjectOption)));
}
 });
 myForm.add(group);
 add(myForm);


 


  

Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

2008-05-16 Thread Igor Vaynberg
afaik value is not used in checkbox or radio, not even sure that its
valid to have it.

iidentfierrenderer is a bad name since the id isnt actually rendered...

-igor


On Fri, May 16, 2008 at 9:07 AM, Hoover, William <[EMAIL PROTECTED]> wrote:
> It could be left as is and use the display value as expected (i.e.
> ).
>
> Another option would be to have an identifier renderer:
>
> public interface IChoiceRenderer extends IIdentifierRenderer
> {
>Object getDisplayValue(Object object);
> }
>
> public interface IIdentifierRenderer extends IClusterable
> {
>String getIdValue(Object object, int index);
> }
>
> -Original Message-
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 16, 2008 11:47 AM
> To: users@wicket.apache.org
> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>
> if you use an ldm in choice/choicegroup then you should have instance
> equality available since you will probably load the objects from the
> same place, so during request processing they are consistent.
>
> as far as choicerenderer, i dont think thats a good idea, what do you do
> with getdisplayvalue()?
>
> -igor
>
> On Fri, May 16, 2008 at 8:35 AM, Hoover, William <[EMAIL PROTECTED]>
> wrote:
>> I agree, but there are some cases where it will not be possible to
>> implement equals/hashcode on the model object.
>>
>> I would be more of a proponent to have as much consistency across
>> components as possible- which would mean that ICoiceRenderer would be
>> available, but not enforced, in any component that needs to handle
>> choices (this is already the case for models ---> IModelComparator
>> Component#getModelComparator(...)).
>>
>> I'm not sure I understand what you mean by using a
>> LoadableDetachableModel to solve the issue. Could you elaborate?
>>
>> -Original Message-
>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>> Sent: Friday, May 16, 2008 11:12 AM
>> To: users@wicket.apache.org
>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>
>> then use loadable detachable models that will ensure instance
> equality.
>> we can let the group take a comparator, but its yet another
>> complication. i see it as a reasonable enough requirement that objects
>
>> properly implement equals and hashcode.
>>
>> -igor
>>
>> On Fri, May 16, 2008 at 7:58 AM, Hoover, William <[EMAIL PROTECTED]>
>> wrote:
>>> yes, that will work in my example, but what if MyObjectOption is not
>>> part of my namespace?
>>>
>>> -Original Message-
>>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>>> Sent: Friday, May 16, 2008 10:14 AM
>>> To: users@wicket.apache.org
>>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>>
>>> why dont you just implement equals/hashcode on MyObjectOption???
>>>
>>> -igor
>>>
>>>
>>> On Fri, May 16, 2008 at 5:14 AM, Hoover, William
>>> <[EMAIL PROTECTED]>
>>> wrote:
 Here is an example of what I'm referring to:

 class MyObject {
private Long id;
private MyObjectOption myObjectOption;

public MyObject(final Long id){
setId(id);
...
}
...
 }

 class MyObjectOption {
private Long id;
private String name;

public MyObjectOption(final Long id){
setId(id);
...
}
...
 }

 // in the WebPage
 final MyObject myObject = new MyObject(1L); ...
 myObject.setMyObjectOption(new MyObjectOption(200L));

 final List myObjectOptionList = new
 ArrayList(); myObjectOptionList.add(new
 MyObjectOption(100L)); myObjectOptionList.add(new
 MyObjectOption(200L)); myObjectOptionList.add(new
 MyObjectOption(300L));

 final Form myForm = new Form("form-myobject", new
 CompoundPropertyModel(myObject)); ...
 final RadioGroup group = new RadioGroup("myObjectOption");
 group.add(new ListView("div-myobject-options-view", myObjectList) {
protected final void populateItem(final ListItem item) {
final MyObjectOption myObjectOption =
 (MyObjectOption)
>>
 item.getModelObject();
item.add(new Label("label-myobject-option-name",
 myObjectOption.getName()));
item.add(new Radio("input-radio-myobject-option", new
>
 Model(myObjectOption)));
}
 });
 myForm.add(group);
 add(myForm);


 


 wicket:id="label-myobject-option-name">
[MyObjectOption Name]

 wicket:id="input-radio-myobject-option"
 type="radio" />


 

 In the example above myObjectOption would never be selected because
 it
>>>
 is not the same instance of the MyObjectOption that is in
 myObject

RE: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

2008-05-16 Thread Hoover, William
It could be left as is and use the display value as expected (i.e.
).

Another option would be to have an identifier renderer:

public interface IChoiceRenderer extends IIdentifierRenderer
{
Object getDisplayValue(Object object);
} 

public interface IIdentifierRenderer extends IClusterable
{
String getIdValue(Object object, int index);
}

-Original Message-
From: Igor Vaynberg [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 16, 2008 11:47 AM
To: users@wicket.apache.org
Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

if you use an ldm in choice/choicegroup then you should have instance
equality available since you will probably load the objects from the
same place, so during request processing they are consistent.

as far as choicerenderer, i dont think thats a good idea, what do you do
with getdisplayvalue()?

-igor

On Fri, May 16, 2008 at 8:35 AM, Hoover, William <[EMAIL PROTECTED]>
wrote:
> I agree, but there are some cases where it will not be possible to 
> implement equals/hashcode on the model object.
>
> I would be more of a proponent to have as much consistency across 
> components as possible- which would mean that ICoiceRenderer would be 
> available, but not enforced, in any component that needs to handle 
> choices (this is already the case for models ---> IModelComparator 
> Component#getModelComparator(...)).
>
> I'm not sure I understand what you mean by using a 
> LoadableDetachableModel to solve the issue. Could you elaborate?
>
> -Original Message-
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 16, 2008 11:12 AM
> To: users@wicket.apache.org
> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>
> then use loadable detachable models that will ensure instance
equality.
> we can let the group take a comparator, but its yet another 
> complication. i see it as a reasonable enough requirement that objects

> properly implement equals and hashcode.
>
> -igor
>
> On Fri, May 16, 2008 at 7:58 AM, Hoover, William <[EMAIL PROTECTED]>
> wrote:
>> yes, that will work in my example, but what if MyObjectOption is not 
>> part of my namespace?
>>
>> -Original Message-
>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>> Sent: Friday, May 16, 2008 10:14 AM
>> To: users@wicket.apache.org
>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>
>> why dont you just implement equals/hashcode on MyObjectOption???
>>
>> -igor
>>
>>
>> On Fri, May 16, 2008 at 5:14 AM, Hoover, William 
>> <[EMAIL PROTECTED]>
>> wrote:
>>> Here is an example of what I'm referring to:
>>>
>>> class MyObject {
>>>private Long id;
>>>private MyObjectOption myObjectOption;
>>>
>>>public MyObject(final Long id){
>>>setId(id);
>>>...
>>>}
>>>...
>>> }
>>>
>>> class MyObjectOption {
>>>private Long id;
>>>private String name;
>>>
>>>public MyObjectOption(final Long id){
>>>setId(id);
>>>...
>>>}
>>>...
>>> }
>>>
>>> // in the WebPage
>>> final MyObject myObject = new MyObject(1L); ...
>>> myObject.setMyObjectOption(new MyObjectOption(200L));
>>>
>>> final List myObjectOptionList = new 
>>> ArrayList(); myObjectOptionList.add(new 
>>> MyObjectOption(100L)); myObjectOptionList.add(new 
>>> MyObjectOption(200L)); myObjectOptionList.add(new 
>>> MyObjectOption(300L));
>>>
>>> final Form myForm = new Form("form-myobject", new 
>>> CompoundPropertyModel(myObject)); ...
>>> final RadioGroup group = new RadioGroup("myObjectOption"); 
>>> group.add(new ListView("div-myobject-options-view", myObjectList) {
>>>protected final void populateItem(final ListItem item) {
>>>final MyObjectOption myObjectOption = 
>>> (MyObjectOption)
>
>>> item.getModelObject();
>>>item.add(new Label("label-myobject-option-name",
>>> myObjectOption.getName()));
>>>item.add(new Radio("input-radio-myobject-option", new

>>> Model(myObjectOption)));
>>>}
>>> });
>>> myForm.add(group);
>>> add(myForm);
>>>
>>>
>>> 
>>>
>>>
>>>
>>>[MyObjectOption Name]
>>>
>>>>> type="radio" />
>>>
>>>
>>> 
>>>
>>> In the example above myObjectOption would never be selected because 
>>> it
>>
>>> is not the same instance of the MyObjectOption that is in 
>>> myObjectOptionList (index 1) even though they share the same ID. If 
>>> an
>>
>>> IChoiceRenderer was provided to the RadioGroup the following could 
>>> accomplish the task of making the selection work:
>>>
>>> final IChoiceRenderer myObjectOptionRenderer = new ChoiceRenderer()
{
>>>...
>>>public final String getIdValue(final Object object, final int
>>> index) {
>>>final Object id = ((MyObjectOption) object).getId();
>>>return (id !

Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

2008-05-16 Thread Igor Vaynberg
if you use an ldm in choice/choicegroup then you should have instance
equality available since you will probably load the objects from the
same place, so during request processing they are consistent.

as far as choicerenderer, i dont think thats a good idea, what do you
do with getdisplayvalue()?

-igor

On Fri, May 16, 2008 at 8:35 AM, Hoover, William <[EMAIL PROTECTED]> wrote:
> I agree, but there are some cases where it will not be possible to
> implement equals/hashcode on the model object.
>
> I would be more of a proponent to have as much consistency across
> components as possible- which would mean that ICoiceRenderer would be
> available, but not enforced, in any component that needs to handle
> choices (this is already the case for models ---> IModelComparator
> Component#getModelComparator(...)).
>
> I'm not sure I understand what you mean by using a
> LoadableDetachableModel to solve the issue. Could you elaborate?
>
> -Original Message-
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 16, 2008 11:12 AM
> To: users@wicket.apache.org
> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>
> then use loadable detachable models that will ensure instance equality.
> we can let the group take a comparator, but its yet another
> complication. i see it as a reasonable enough requirement that objects
> properly implement equals and hashcode.
>
> -igor
>
> On Fri, May 16, 2008 at 7:58 AM, Hoover, William <[EMAIL PROTECTED]>
> wrote:
>> yes, that will work in my example, but what if MyObjectOption is not
>> part of my namespace?
>>
>> -Original Message-
>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>> Sent: Friday, May 16, 2008 10:14 AM
>> To: users@wicket.apache.org
>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>
>> why dont you just implement equals/hashcode on MyObjectOption???
>>
>> -igor
>>
>>
>> On Fri, May 16, 2008 at 5:14 AM, Hoover, William <[EMAIL PROTECTED]>
>> wrote:
>>> Here is an example of what I'm referring to:
>>>
>>> class MyObject {
>>>private Long id;
>>>private MyObjectOption myObjectOption;
>>>
>>>public MyObject(final Long id){
>>>setId(id);
>>>...
>>>}
>>>...
>>> }
>>>
>>> class MyObjectOption {
>>>private Long id;
>>>private String name;
>>>
>>>public MyObjectOption(final Long id){
>>>setId(id);
>>>...
>>>}
>>>...
>>> }
>>>
>>> // in the WebPage
>>> final MyObject myObject = new MyObject(1L); ...
>>> myObject.setMyObjectOption(new MyObjectOption(200L));
>>>
>>> final List myObjectOptionList = new
>>> ArrayList(); myObjectOptionList.add(new
>>> MyObjectOption(100L)); myObjectOptionList.add(new
>>> MyObjectOption(200L)); myObjectOptionList.add(new
>>> MyObjectOption(300L));
>>>
>>> final Form myForm = new Form("form-myobject", new
>>> CompoundPropertyModel(myObject)); ...
>>> final RadioGroup group = new RadioGroup("myObjectOption");
>>> group.add(new ListView("div-myobject-options-view", myObjectList) {
>>>protected final void populateItem(final ListItem item) {
>>>final MyObjectOption myObjectOption = (MyObjectOption)
>
>>> item.getModelObject();
>>>item.add(new Label("label-myobject-option-name",
>>> myObjectOption.getName()));
>>>item.add(new Radio("input-radio-myobject-option", new
>>> Model(myObjectOption)));
>>>}
>>> });
>>> myForm.add(group);
>>> add(myForm);
>>>
>>>
>>> 
>>>
>>>
>>>
>>>[MyObjectOption Name]
>>>
>>>>> type="radio" />
>>>
>>>
>>> 
>>>
>>> In the example above myObjectOption would never be selected because
>>> it
>>
>>> is not the same instance of the MyObjectOption that is in
>>> myObjectOptionList (index 1) even though they share the same ID. If
>>> an
>>
>>> IChoiceRenderer was provided to the RadioGroup the following could
>>> accomplish the task of making the selection work:
>>>
>>> final IChoiceRenderer myObjectOptionRenderer = new ChoiceRenderer() {
>>>...
>>>public final String getIdValue(final Object object, final int
>>> index) {
>>>final Object id = ((MyObjectOption) object).getId();
>>>return (id != null) ? id.toString() :
>>> super.getIdValue(object, index);
>>>}
>>>...
>>> };
>>>
>>> -Original Message-
>>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>>> Sent: Thursday, May 15, 2008 7:16 PM
>>> To: users@wicket.apache.org
>>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>>
>>> On Thu, May 15, 2008 at 3:12 PM, Hoover, William
>>> <[EMAIL PROTECTED]>
>>> wrote:
 It's strange that that kind of functionality is provided when
 multiple
>>>
 selections is needed (i.e. CheckBoxMultipleChoice), but it is not
 when
>>>

Re: CheckGroup selection loss in Wizard

2008-05-16 Thread Igor Vaynberg
when the components are first created there are no request parameters,
they load their model object and initialize themselves to that.

-igor


On Fri, May 16, 2008 at 8:25 AM, Till Wenzinger <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> In my application, the check boxes are selected by default. According to my
> understanding, this loss of default settings is unexpected.
>
>
>
> I mentioned the following Check code:
>
>
>
>if (group.hasRawInput())
>
>{
>
>  final String[] input = group.getInputAsArray();
>
>
>
> FormComponent#getInputAsArray does not refer to the raw input. Instead,
> request parameters are read:
>
>
>
>  public String[] getInputAsArray()
>
>  {
>
>String[] values = getRequest().getParameters(getInputName());
>
>if (!isInputNullable())
>
>{
>
>  if (values != null && values.length == 1 &&
>
> ...
>
>
>
>
>
> As far as I understand it, wizard step handling is performed without request
> parameters. This does not make any sense to me.
>
>
>
> /Till
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

2008-05-16 Thread Hoover, William
I agree, but there are some cases where it will not be possible to
implement equals/hashcode on the model object.

I would be more of a proponent to have as much consistency across
components as possible- which would mean that ICoiceRenderer would be
available, but not enforced, in any component that needs to handle
choices (this is already the case for models ---> IModelComparator
Component#getModelComparator(...)).

I'm not sure I understand what you mean by using a
LoadableDetachableModel to solve the issue. Could you elaborate?

-Original Message-
From: Igor Vaynberg [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 16, 2008 11:12 AM
To: users@wicket.apache.org
Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

then use loadable detachable models that will ensure instance equality.
we can let the group take a comparator, but its yet another
complication. i see it as a reasonable enough requirement that objects
properly implement equals and hashcode.

-igor

On Fri, May 16, 2008 at 7:58 AM, Hoover, William <[EMAIL PROTECTED]>
wrote:
> yes, that will work in my example, but what if MyObjectOption is not 
> part of my namespace?
>
> -Original Message-
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 16, 2008 10:14 AM
> To: users@wicket.apache.org
> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>
> why dont you just implement equals/hashcode on MyObjectOption???
>
> -igor
>
>
> On Fri, May 16, 2008 at 5:14 AM, Hoover, William <[EMAIL PROTECTED]>
> wrote:
>> Here is an example of what I'm referring to:
>>
>> class MyObject {
>>private Long id;
>>private MyObjectOption myObjectOption;
>>
>>public MyObject(final Long id){
>>setId(id);
>>...
>>}
>>...
>> }
>>
>> class MyObjectOption {
>>private Long id;
>>private String name;
>>
>>public MyObjectOption(final Long id){
>>setId(id);
>>...
>>}
>>...
>> }
>>
>> // in the WebPage
>> final MyObject myObject = new MyObject(1L); ...
>> myObject.setMyObjectOption(new MyObjectOption(200L));
>>
>> final List myObjectOptionList = new 
>> ArrayList(); myObjectOptionList.add(new 
>> MyObjectOption(100L)); myObjectOptionList.add(new 
>> MyObjectOption(200L)); myObjectOptionList.add(new 
>> MyObjectOption(300L));
>>
>> final Form myForm = new Form("form-myobject", new 
>> CompoundPropertyModel(myObject)); ...
>> final RadioGroup group = new RadioGroup("myObjectOption"); 
>> group.add(new ListView("div-myobject-options-view", myObjectList) {
>>protected final void populateItem(final ListItem item) {
>>final MyObjectOption myObjectOption = (MyObjectOption)

>> item.getModelObject();
>>item.add(new Label("label-myobject-option-name",
>> myObjectOption.getName()));
>>item.add(new Radio("input-radio-myobject-option", new 
>> Model(myObjectOption)));
>>}
>> });
>> myForm.add(group);
>> add(myForm);
>>
>>
>> 
>>
>>
>>
>>[MyObjectOption Name]
>>
>>> type="radio" />
>>
>>
>> 
>>
>> In the example above myObjectOption would never be selected because 
>> it
>
>> is not the same instance of the MyObjectOption that is in 
>> myObjectOptionList (index 1) even though they share the same ID. If 
>> an
>
>> IChoiceRenderer was provided to the RadioGroup the following could 
>> accomplish the task of making the selection work:
>>
>> final IChoiceRenderer myObjectOptionRenderer = new ChoiceRenderer() {
>>...
>>public final String getIdValue(final Object object, final int
>> index) {
>>final Object id = ((MyObjectOption) object).getId();
>>return (id != null) ? id.toString() :
>> super.getIdValue(object, index);
>>}
>>...
>> };
>>
>> -Original Message-
>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, May 15, 2008 7:16 PM
>> To: users@wicket.apache.org
>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>
>> On Thu, May 15, 2008 at 3:12 PM, Hoover, William 
>> <[EMAIL PROTECTED]>
>> wrote:
>>> It's strange that that kind of functionality is provided when 
>>> multiple
>>
>>> selections is needed (i.e. CheckBoxMultipleChoice), but it is not 
>>> when
>>
>>> only one choice is needed (i.e. RadioGroup/CheckGroup).
>>
>> CheckGroup is a muti-selection component
>>
>>
>>
>>> It is an oddity
>>> that other components that have choices (i.e. DropDownChoice, etc.) 
>>> provide a means to use an IChoiceRenderer, but some do not.
>>
>> the whole point of Radio/CheckGroup is to give the user more control 
>> then what IChoiceRenderer offers.
>>
>>> What if
>>> someone is using a RadioGroup/CheckGroup that uses some form of a 
>>> RepeatingView to generate the Radio/Check options dynamical

Re: CheckGroup selection loss in Wizard

2008-05-16 Thread Till Wenzinger
Hi,



In my application, the check boxes are selected by default. According to my
understanding, this loss of default settings is unexpected.



I mentioned the following Check code:



if (group.hasRawInput())

{

  final String[] input = group.getInputAsArray();



FormComponent#getInputAsArray does not refer to the raw input. Instead,
request parameters are read:



  public String[] getInputAsArray()

  {

String[] values = getRequest().getParameters(getInputName());

if (!isInputNullable())

{

  if (values != null && values.length == 1 &&

...





As far as I understand it, wizard step handling is performed without request
parameters. This does not make any sense to me.



/Till


Re: Source code inconsistency in Check/CheckGroup

2008-05-16 Thread Igor Vaynberg
they are in the same package

-igor


On Fri, May 16, 2008 at 8:05 AM, Till Wenzinger <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> According to the source code of Wicket 1.3.3,
> Check#onComponentTag(ComponentTag) performs the following:
>
>
>
>CheckGroup group = (CheckGroup)findParent(CheckGroup.class);
>
> ...
>
>if (group.wantOnSelectionChangedNotifications())
>
>{
>
> ...
>
> }
>
>
>
> The CheckGroup method is implemented as
>
>
>
> public class CheckGroup extends FormComponent implements IOnChangeListener
>
> {
>
> ...
>
>  protected boolean wantOnSelectionChangedNotifications()
>
>  {
>
>*return* false;
>
>  }
>
>
>
>
>
> Check is not a subclass of CheckGroup. Thus, according to my understanding,
> it cannot call the protected method of CheckGroup. What is going wrong here?
>
>
>
> /Till
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Image from resource outside tomcat container

2008-05-16 Thread Igor Vaynberg
you need to set proper caching headers and have your servlet implement
an efficient HEAD support.

-igor


On Fri, May 16, 2008 at 7:43 AM, Mathias P.W Nilsson
<[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I have placed all my images in a folder outside my web application container
> to preserve the images when I deploy.
>
> My problem now is that to get an image I go thru my FileResourceServlet and
> writes the image.
> In every request to my FileResourceServlet I make a request to the database
> to get the image. This is slow when all my images go thru this servlet. can
> wicket handle resources outside the container?
> --
> View this message in context: 
> http://www.nabble.com/Image-from-resource-outside-tomcat-container-tp17276444p17276444.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

2008-05-16 Thread Igor Vaynberg
then use loadable detachable models that will ensure instance
equality. we can let the group take a comparator, but its yet another
complication. i see it as a reasonable enough requirement that objects
properly implement equals and hashcode.

-igor

On Fri, May 16, 2008 at 7:58 AM, Hoover, William <[EMAIL PROTECTED]> wrote:
> yes, that will work in my example, but what if MyObjectOption is not
> part of my namespace?
>
> -Original Message-
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 16, 2008 10:14 AM
> To: users@wicket.apache.org
> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>
> why dont you just implement equals/hashcode on MyObjectOption???
>
> -igor
>
>
> On Fri, May 16, 2008 at 5:14 AM, Hoover, William <[EMAIL PROTECTED]>
> wrote:
>> Here is an example of what I'm referring to:
>>
>> class MyObject {
>>private Long id;
>>private MyObjectOption myObjectOption;
>>
>>public MyObject(final Long id){
>>setId(id);
>>...
>>}
>>...
>> }
>>
>> class MyObjectOption {
>>private Long id;
>>private String name;
>>
>>public MyObjectOption(final Long id){
>>setId(id);
>>...
>>}
>>...
>> }
>>
>> // in the WebPage
>> final MyObject myObject = new MyObject(1L); ...
>> myObject.setMyObjectOption(new MyObjectOption(200L));
>>
>> final List myObjectOptionList = new
>> ArrayList(); myObjectOptionList.add(new
>> MyObjectOption(100L)); myObjectOptionList.add(new
>> MyObjectOption(200L)); myObjectOptionList.add(new
>> MyObjectOption(300L));
>>
>> final Form myForm = new Form("form-myobject", new
>> CompoundPropertyModel(myObject)); ...
>> final RadioGroup group = new RadioGroup("myObjectOption");
>> group.add(new ListView("div-myobject-options-view", myObjectList) {
>>protected final void populateItem(final ListItem item) {
>>final MyObjectOption myObjectOption = (MyObjectOption)
>> item.getModelObject();
>>item.add(new Label("label-myobject-option-name",
>> myObjectOption.getName()));
>>item.add(new Radio("input-radio-myobject-option", new
>> Model(myObjectOption)));
>>}
>> });
>> myForm.add(group);
>> add(myForm);
>>
>>
>> 
>>
>>
>>
>>[MyObjectOption Name]
>>
>>> type="radio" />
>>
>>
>> 
>>
>> In the example above myObjectOption would never be selected because it
>
>> is not the same instance of the MyObjectOption that is in
>> myObjectOptionList (index 1) even though they share the same ID. If an
>
>> IChoiceRenderer was provided to the RadioGroup the following could
>> accomplish the task of making the selection work:
>>
>> final IChoiceRenderer myObjectOptionRenderer = new ChoiceRenderer() {
>>...
>>public final String getIdValue(final Object object, final int
>> index) {
>>final Object id = ((MyObjectOption) object).getId();
>>return (id != null) ? id.toString() :
>> super.getIdValue(object, index);
>>}
>>...
>> };
>>
>> -Original Message-
>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, May 15, 2008 7:16 PM
>> To: users@wicket.apache.org
>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>
>> On Thu, May 15, 2008 at 3:12 PM, Hoover, William <[EMAIL PROTECTED]>
>> wrote:
>>> It's strange that that kind of functionality is provided when
>>> multiple
>>
>>> selections is needed (i.e. CheckBoxMultipleChoice), but it is not
>>> when
>>
>>> only one choice is needed (i.e. RadioGroup/CheckGroup).
>>
>> CheckGroup is a muti-selection component
>>
>>
>>
>>> It is an oddity
>>> that other components that have choices (i.e. DropDownChoice, etc.)
>>> provide a means to use an IChoiceRenderer, but some do not.
>>
>> the whole point of Radio/CheckGroup is to give the user more control
>> then what IChoiceRenderer offers.
>>
>>> What if
>>> someone is using a RadioGroup/CheckGroup that uses some form of a
>>> RepeatingView to generate the Radio/Check options dynamically? In the
>
>>> case where they need to make a selection using a separate choice
>>> instance than what is in the list, how would they accomplish that? If
>
>>> they set the choice on the RadioGroup/CheckGroup model it will never
>>> be selected because they are different instances, and because there
>>> is
>>
>>> not IChoiceRenderer it is not possible to define an ID value to
>>> determine the equality of the two instances.
>>
>> Not really sure what you mean here. The selection is based on the
>> model object of Radio/Check, not the Radio/Check instance itself...
>>
>> -igor
>>
>>
>>>
>>> -Original Message-
>>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>>> Sent: Thursday, May 15, 2008 5:50 PM
>>> To: users@wicket.apache.org
>>> Subject: Re: ICho

Re: CheckGroup selection loss in Wizard

2008-05-16 Thread Igor Vaynberg
i think that is intended. going back is like cancelling the current
screen. if that was changed thenyou would have to have a valid current
screen before you could go back, which is not something a user would
expect imho.

-igor


On Fri, May 16, 2008 at 7:47 AM, Till Wenzinger <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> In the second step of a Wizard, I am loosing selections of a CheckGroup if I
> am going back to the first step using the Previous Button and return using
> the Next Button. Consider the following code:
>
>
>
> public class CheckBug extends WebPage
>
> {
>
>  public CheckBug() {
>
>final Wizard wizard = new CheckBugWizard("wizard", PageWithParameters.
> class);
>
>add(wizard);
>
>wizard.add(wizard.getForm());
>
>  }
>
> }
>
>
>
> public class CheckBugWizard extends Wizard
>
> {
>
>  private static final long serialVersionUID = 1L;
>
>
>
>  private static final String value = "value";
>
>
>
>  private final Class exitPage;
>
>  private final Collection selection = new
> ArrayList(Arrays.asList(newString[] {
> value }));
>
>
>
>  public CheckBugWizard(final String id, final Class exitPage) {
>
>super(id);
>
>this.exitPage = exitPage;
>
>
>
>final WizardModel model = new WizardModel();
>
>model.add(new Step1("step1", "summary1"));
>
>model.add(new Step2("step2", "summary2", this.selection, value));
>
>init(model);
>
>  }
>
>
>
>  public void onCancel() {
>
>gotoExitPage();
>
>  }
>
>
>
>  public void onFinish() {
>
>gotoExitPage();
>
>  }
>
>
>
>  private void gotoExitPage() {
>
>final PageParameters p = new PageParameters();
>
>
>
>if (this.selection.contains(value)) {
>
>  p.put("selected", "true");
>
>}
>
>else {
>
>  p.put("selected", "false");
>
>}
>
>
>
>setResponsePage(this.exitPage, p);
>
>  }
>
> }
>
>
>
> public class Step1 extends WizardStep
>
> {
>
>  private static final long serialVersionUID = 1L;
>
>
>
>  public Step1(final String title, final String summary) {
>
>super(title, summary);
>
>  }
>
> }
>
>
>
> public class Step2 extends WizardStep
>
> {
>
>  private static final long serialVersionUID = 1L;
>
>
>
>  public Step2(final String title, final String summary, final Collection
> selection, final String value) {
>
>super(title, summary);
>
>
>
>final CheckGroup group = new CheckGroup("group", selection);
>
>add(group);
>
>
>
>final RepeatingView repeater = new RepeatingView("repeater");
>
>group.add(repeater);
>
>
>
>final WebMarkupContainer container =
> newWebMarkupContainer(repeater.newChildId());
>
>repeater.add(container);
>
>
>
>final Check check = new Check("box", new Model(value));
>
>check.setOutputMarkupId(true);
>
>container.add(check);
>
>
>
>final Label label = new Label("label", value);
>
>container.add(label);
>
>  }
>
> }
>
>
>
> public class PageWithParameters extends WebPage
>
> {
>
>  public PageWithParameters(final PageParameters parameters) {
>
>super(parameters);
>
>
>
>final MultiLineLabel label = new MultiLineLabel("label",
> newAbstractReadOnlyModel() {
>
>  private static final long serialVersionUID = 1L;
>
>
>
>  public Object getObject() {
>
>PageParameters pageParameters = getPageParameters();
>
>
>
>if (pageParameters == null) {
>
>  *return* "null";
>
>}
>
>
>
>*return* pageParameters.toString();
>
>  }
>
>});
>
>
>
>add(label);
>
>  }
>
> }
>
>
>
> If I replace
>
>
>
> public class Check extends LabeledWebMarkupContainer
>
> {
>
> ...
>
>  protected void onComponentTag(final ComponentTag tag)
>
>  {
>
>if (group.hasRawInput())
>
>{
>
>  final String[] input = group.getInputAsArray();
>
>
>
>  if (input != null)
>
>  {
>
>for (int i = 0; i < input.length; i++)
>
>{
>
> if (uuid.equals(input[i]))
>
> {
>
>   tag.put("checked", "checked");
>
> }
>
>}
>
>  }
>
>}
>
> ...
>
>
>
> by
>
>
>
>if (group.hasRawInput()) {
>
>  final String input = group.getRawInput();
>
>
>
>  if (input != null) {
>
>final StringTokenizer st = new StringTokenizer(input, ";");
>
>
>
>while (st.hasMoreElements()) {
>
>  if (value.equals(st.nextToken())) {
>
>tag.put("checked", "checked");
>
>  }
>
>}
>
>  }
>
>}
>
>
>
> then the check group selection is kept as intended. Am I right to consider
> the selection loss being a bug?
>
>
>
> /Till
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Source code inconsistency in Check/CheckGroup

2008-05-16 Thread Till Wenzinger
Hi,



According to the source code of Wicket 1.3.3,
Check#onComponentTag(ComponentTag) performs the following:



CheckGroup group = (CheckGroup)findParent(CheckGroup.class);

...

if (group.wantOnSelectionChangedNotifications())

{

...

}



The CheckGroup method is implemented as



public class CheckGroup extends FormComponent implements IOnChangeListener

{

...

  protected boolean wantOnSelectionChangedNotifications()

  {

*return* false;

  }





Check is not a subclass of CheckGroup. Thus, according to my understanding,
it cannot call the protected method of CheckGroup. What is going wrong here?



/Till


Re: access input-value of textfield via ajax before form-submit

2008-05-16 Thread Ryan Gravener
see AjaxFormComponentUpdatingBehavior.

2008/5/16 Oliver Mahnke <[EMAIL PROTECTED]>:

> Hi, i am new to wicket and have a question:
>
> is it possible to access the input-value of a textfield embedded in a form
> via ajax before the form is submitted?
>
> I have a second textfield which should display the input-value of the first
> when the focus leaves tf one.
>
> Therefore i connected the model of tf 2 to the model of tf 1 and have
> registered an "onblur" AjaxEventBehavior for
>
> tf 1, which adds the tf 2 to the ajax response.
>
> It seems that the value of tf 1 is written to the model only when the whole
> form is correct and submitted, the
>
> the output of tf 2 is only updated on form submit :(
>
> Thanks!!
>
>
> --
> Dipl.-Inf. Oliver Mahnke
> b+m Informatik GmbH Berlin
> Schumannstr. 5, 10117 Berlin
> Tel: +49 30 288788-132, Fax: +49 30 288788-111
> http://www.bmiag.de, [EMAIL PROTECTED]
>
> Weitere Angaben zur b+m Informatik GmbH Berlin:
> - Handelsregister des Amtsgerichts Charlottenburg, HRB 75036
> - Geschäftsführer: Dipl.-Inform. Jost Becker
> - Geschäftsführer: Dr. Carsten Jacobsen
>
> Aktuelle b+m Infos unter www.bmiag.de
>
> Diese E-Mail enthält vertrauliche und rechtlich geschützte
> Informationen, die ausschließlich für den vorgesehenen Adressaten
> bestimmt sind. Sollten Sie nicht der vorgesehene Adressat dieser E-Mail
> oder dessen Vertreter sein, so beachten Sie bitte, dass jede Form der
> Kenntnisnahme, Speicherung oder Weitergabe des Inhalts dieser E-Mail
> unzulässig ist. Wir bitten Sie, in diesem Fall den Absender zu
> informieren und die E-Mail mit sämtlichen Anlagen dauerhaft zu löschen.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Ryan Gravener
http://twitter.com/ryangravener


Re: Image from resource outside tomcat container

2008-05-16 Thread Mathias P.W Nilsson

Really for now I do this for url

FileResourceServlet?fileResourceId=101

Else I need to do this.
FileResourceServlet?path=very...veryvery.long...pathforthefile

How do you know wich file to fetch?
-- 
View this message in context: 
http://www.nabble.com/Image-from-resource-outside-tomcat-container-tp17276444p17276901.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



access input-value of textfield via ajax before form-submit

2008-05-16 Thread Oliver Mahnke

Hi, i am new to wicket and have a question:

is it possible to access the input-value of a textfield embedded in a 
form via ajax before the form is submitted?


I have a second textfield which should display the input-value of the 
first when the focus leaves tf one.


Therefore i connected the model of tf 2 to the model of tf 1 and have 
registered an "onblur" AjaxEventBehavior for


tf 1, which adds the tf 2 to the ajax response.

It seems that the value of tf 1 is written to the model only when the 
whole form is correct and submitted, the


the output of tf 2 is only updated on form submit :(

Thanks!!


--
Dipl.-Inf. Oliver Mahnke
b+m Informatik GmbH Berlin
Schumannstr. 5, 10117 Berlin
Tel: +49 30 288788-132, Fax: +49 30 288788-111
http://www.bmiag.de, [EMAIL PROTECTED]

Weitere Angaben zur b+m Informatik GmbH Berlin:
- Handelsregister des Amtsgerichts Charlottenburg, HRB 75036
- Geschäftsführer: Dipl.-Inform. Jost Becker
- Geschäftsführer: Dr. Carsten Jacobsen

Aktuelle b+m Infos unter www.bmiag.de

Diese E-Mail enthält vertrauliche und rechtlich geschützte
Informationen, die ausschließlich für den vorgesehenen Adressaten
bestimmt sind. Sollten Sie nicht der vorgesehene Adressat dieser E-Mail
oder dessen Vertreter sein, so beachten Sie bitte, dass jede Form der
Kenntnisnahme, Speicherung oder Weitergabe des Inhalts dieser E-Mail
unzulässig ist. Wir bitten Sie, in diesem Fall den Absender zu
informieren und die E-Mail mit sämtlichen Anlagen dauerhaft zu löschen. 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

2008-05-16 Thread Hoover, William
yes, that will work in my example, but what if MyObjectOption is not
part of my namespace?

-Original Message-
From: Igor Vaynberg [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 16, 2008 10:14 AM
To: users@wicket.apache.org
Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

why dont you just implement equals/hashcode on MyObjectOption???

-igor


On Fri, May 16, 2008 at 5:14 AM, Hoover, William <[EMAIL PROTECTED]>
wrote:
> Here is an example of what I'm referring to:
>
> class MyObject {
>private Long id;
>private MyObjectOption myObjectOption;
>
>public MyObject(final Long id){
>setId(id);
>...
>}
>...
> }
>
> class MyObjectOption {
>private Long id;
>private String name;
>
>public MyObjectOption(final Long id){
>setId(id);
>...
>}
>...
> }
>
> // in the WebPage
> final MyObject myObject = new MyObject(1L); ...
> myObject.setMyObjectOption(new MyObjectOption(200L));
>
> final List myObjectOptionList = new 
> ArrayList(); myObjectOptionList.add(new 
> MyObjectOption(100L)); myObjectOptionList.add(new 
> MyObjectOption(200L)); myObjectOptionList.add(new 
> MyObjectOption(300L));
>
> final Form myForm = new Form("form-myobject", new 
> CompoundPropertyModel(myObject)); ...
> final RadioGroup group = new RadioGroup("myObjectOption"); 
> group.add(new ListView("div-myobject-options-view", myObjectList) {
>protected final void populateItem(final ListItem item) {
>final MyObjectOption myObjectOption = (MyObjectOption) 
> item.getModelObject();
>item.add(new Label("label-myobject-option-name",
> myObjectOption.getName()));
>item.add(new Radio("input-radio-myobject-option", new 
> Model(myObjectOption)));
>}
> });
> myForm.add(group);
> add(myForm);
>
>
> 
>
>
>
>[MyObjectOption Name]
>
> type="radio" />
>
>
> 
>
> In the example above myObjectOption would never be selected because it

> is not the same instance of the MyObjectOption that is in 
> myObjectOptionList (index 1) even though they share the same ID. If an

> IChoiceRenderer was provided to the RadioGroup the following could 
> accomplish the task of making the selection work:
>
> final IChoiceRenderer myObjectOptionRenderer = new ChoiceRenderer() {
>...
>public final String getIdValue(final Object object, final int
> index) {
>final Object id = ((MyObjectOption) object).getId();
>return (id != null) ? id.toString() :
> super.getIdValue(object, index);
>}
>...
> };
>
> -Original Message-
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 15, 2008 7:16 PM
> To: users@wicket.apache.org
> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>
> On Thu, May 15, 2008 at 3:12 PM, Hoover, William <[EMAIL PROTECTED]>
> wrote:
>> It's strange that that kind of functionality is provided when 
>> multiple
>
>> selections is needed (i.e. CheckBoxMultipleChoice), but it is not 
>> when
>
>> only one choice is needed (i.e. RadioGroup/CheckGroup).
>
> CheckGroup is a muti-selection component
>
>
>
>> It is an oddity
>> that other components that have choices (i.e. DropDownChoice, etc.) 
>> provide a means to use an IChoiceRenderer, but some do not.
>
> the whole point of Radio/CheckGroup is to give the user more control 
> then what IChoiceRenderer offers.
>
>> What if
>> someone is using a RadioGroup/CheckGroup that uses some form of a 
>> RepeatingView to generate the Radio/Check options dynamically? In the

>> case where they need to make a selection using a separate choice 
>> instance than what is in the list, how would they accomplish that? If

>> they set the choice on the RadioGroup/CheckGroup model it will never 
>> be selected because they are different instances, and because there 
>> is
>
>> not IChoiceRenderer it is not possible to define an ID value to 
>> determine the equality of the two instances.
>
> Not really sure what you mean here. The selection is based on the 
> model object of Radio/Check, not the Radio/Check instance itself...
>
> -igor
>
>
>>
>> -Original Message-
>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, May 15, 2008 5:50 PM
>> To: users@wicket.apache.org
>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>
>> well, the whole point of radio/check group is to allow user complete 
>> control over markup. the whole point of choice renderer is to 
>> automate
>
>> markup generation, so there is just a big mismatch. eg i always use 
>> radio/check group when using a choice renderer would be inconvenient.
>>
>> you can always roll your own subclass, i just dont think something 
>> like that would belong in core, its just on

Re: Image from resource outside tomcat container

2008-05-16 Thread Michael Sparer

why do you make a request to the database?

in our app, we use a servletfilter to get the resources from harddisk ...
without hitting the wicket filter



Mathias P.W Nilsson wrote:
> 
> Hi!
> 
> I have placed all my images in a folder outside my web application
> container to preserve the images when I deploy.
> 
> My problem now is that to get an image I go thru my FileResourceServlet
> and writes the image.
> In every request to my FileResourceServlet I make a request to the
> database to get the image. This is slow when all my images go thru this
> servlet. can wicket handle resources outside the container?
> 


-
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/Image-from-resource-outside-tomcat-container-tp17276444p17276617.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



CheckGroup selection loss in Wizard

2008-05-16 Thread Till Wenzinger
Hi,



In the second step of a Wizard, I am loosing selections of a CheckGroup if I
am going back to the first step using the Previous Button and return using
the Next Button. Consider the following code:



public class CheckBug extends WebPage

{

  public CheckBug() {

final Wizard wizard = new CheckBugWizard("wizard", PageWithParameters.
class);

add(wizard);

wizard.add(wizard.getForm());

  }

}



public class CheckBugWizard extends Wizard

{

  private static final long serialVersionUID = 1L;



  private static final String value = "value";



  private final Class exitPage;

  private final Collection selection = new
ArrayList(Arrays.asList(newString[] {
value }));



  public CheckBugWizard(final String id, final Class exitPage) {

super(id);

this.exitPage = exitPage;



final WizardModel model = new WizardModel();

model.add(new Step1("step1", "summary1"));

model.add(new Step2("step2", "summary2", this.selection, value));

init(model);

  }



  public void onCancel() {

gotoExitPage();

  }



  public void onFinish() {

gotoExitPage();

  }



  private void gotoExitPage() {

final PageParameters p = new PageParameters();



if (this.selection.contains(value)) {

  p.put("selected", "true");

}

else {

  p.put("selected", "false");

}



setResponsePage(this.exitPage, p);

  }

}



public class Step1 extends WizardStep

{

  private static final long serialVersionUID = 1L;



  public Step1(final String title, final String summary) {

super(title, summary);

  }

}



public class Step2 extends WizardStep

{

  private static final long serialVersionUID = 1L;



  public Step2(final String title, final String summary, final Collection
selection, final String value) {

super(title, summary);



final CheckGroup group = new CheckGroup("group", selection);

add(group);



final RepeatingView repeater = new RepeatingView("repeater");

group.add(repeater);



final WebMarkupContainer container =
newWebMarkupContainer(repeater.newChildId());

repeater.add(container);



final Check check = new Check("box", new Model(value));

check.setOutputMarkupId(true);

container.add(check);



final Label label = new Label("label", value);

container.add(label);

  }

}



public class PageWithParameters extends WebPage

{

  public PageWithParameters(final PageParameters parameters) {

super(parameters);



final MultiLineLabel label = new MultiLineLabel("label",
newAbstractReadOnlyModel() {

  private static final long serialVersionUID = 1L;



  public Object getObject() {

PageParameters pageParameters = getPageParameters();



if (pageParameters == null) {

  *return* "null";

}



*return* pageParameters.toString();

  }

});



add(label);

  }

}



If I replace



public class Check extends LabeledWebMarkupContainer

{

...

  protected void onComponentTag(final ComponentTag tag)

  {

if (group.hasRawInput())

{

  final String[] input = group.getInputAsArray();



  if (input != null)

  {

for (int i = 0; i < input.length; i++)

{

 if (uuid.equals(input[i]))

 {

   tag.put("checked", "checked");

 }

}

  }

}

...



by



if (group.hasRawInput()) {

  final String input = group.getRawInput();



  if (input != null) {

final StringTokenizer st = new StringTokenizer(input, ";");



while (st.hasMoreElements()) {

  if (value.equals(st.nextToken())) {

tag.put("checked", "checked");

  }

}

  }

}



then the check group selection is kept as intended. Am I right to consider
the selection loss being a bug?



/Till


Image from resource outside tomcat container

2008-05-16 Thread Mathias P.W Nilsson

Hi!

I have placed all my images in a folder outside my web application container
to preserve the images when I deploy.

My problem now is that to get an image I go thru my FileResourceServlet and
writes the image.
In every request to my FileResourceServlet I make a request to the database
to get the image. This is slow when all my images go thru this servlet. can
wicket handle resources outside the container?
-- 
View this message in context: 
http://www.nabble.com/Image-from-resource-outside-tomcat-container-tp17276444p17276444.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Back button retrieving cached data even with proper headers.

2008-05-16 Thread Matej Knopp
Unfortunately that's not how it works now. So if you have ajax
application and don't want to get weird problems on back button the
only way now is to send the no-store header.

-Matej

On Fri, May 16, 2008 at 3:15 PM, Johan Compagner <[EMAIL PROTECTED]> wrote:
> i think that is more a problem of the browser and i think that will be fixed
> hopefully
> the browser should always go to the latest dom it came from, not the file in
> the cache..
>
> johan
>
>
> On Fri, May 16, 2008 at 2:18 PM, gumnaam23 <[EMAIL PROTECTED]> wrote:
>
>>
>> I guess you are right. But in an Ajax world, there really is no other way
>> around the problem, is there ?
>>
>>
>>
>> Johan Compagner wrote:
>> >
>> > no i am against no-store as default.
>> >
>> > back button should be quick. If the line is a bit slow then users get
>> very
>> > very very (i would) annoyed
>> > if the back button takes a while because it connects back to the server.
>> >
>> > A back button shouldnt do that. I know we in wicket wants it to do it but
>> > from an end user perspective it is a horrible experience.
>> >
>> > johan
>> >
>> >
>> > On Fri, May 16, 2008 at 11:01 AM, gumnaam23 <[EMAIL PROTECTED]> wrote:
>> >
>> >>
>> >> Adding "no-store" to the "Cache-Control" header did the trick.
>> >>
>> >> According to Page.setHeaders() javadoc , Wicket already adds cache
>> >> related
>> >> headers
>> >> response.setHeader("Pragma", "no-cache");
>> >> response.setHeader("Cache-Control", "no-cache, max-age=0,
>> >> must-revalidate")
>> >>
>> >> Is there any particular reason why "no-store" is not added to the
>> >> "Cache-Control" header ?
>> >> Or is this a bug and should be raised so ?
>> >>
>> >> Unfortunately even after "no-store" , I have problems.
>> >>
>> >> Here's my Page flow.
>> >> User Clicks on a Bookmarkable page (say /pages/Page1 ), Page1.class, has
>> >> a
>> >> BreadCrumbBar and a BreadCrumbPanel.
>> >>
>> >> The BreadCrumbPanel has an AjaxFallBackDefaultDataTable (AFDDT) . One of
>> >> the
>> >> Columns of the AFDDT
>> >> has BreadCrumbPanelLinks to navigate further down the hierarchy.
>> >>
>> >> The AFDDT is paginable, and fetches next/previous records over Ajax. So
>> >> when
>> >> a user fetches next records, the contents of AFDDT are fetched over
>> AJAX.
>> >> As
>> >> I said previously, One of the Columns contain
>> >> BreadCrumbBarPanelLink , which when the user clicks takes him down the
>> >> BreadCrumb hierarchy.
>> >>
>> >> So far so good, but now if the user clicks the back button, the request
>> >> that
>> >> is sent to the server is for the bookmarkable page /pages/Page1, So the
>> >> Page1.class is reinstanciated, instead of it's correct version being
>> >> fetched
>> >> from the Session. So when the user hits back button, the Navigation of
>> >> the
>> >> AFDDT is lost, and we are back to the first set of rows in the AFDDT.
>> >>
>> >> If I use DefaultDataTable instead of AFDDT then this problem doesn't
>> >> arise,
>> >> because next/previous records are fetched as normal requests, and not
>> >> over
>> >> ajax.
>> >>
>> >> Is this a known limitation , or can something be done to solve this
>> >> problem
>> >> ?
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> Are you sure you also send the cache-control: no-store header?
>> >> (no-cache is not enough). Also for opera there's no way to force the
>> >> reload.
>> >>
>> >> -Matje
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Back-button-retrieving-cached-data-even-with-proper-headers.-tp17260832p17270411.html
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> -
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Back-button-retrieving-cached-data-even-with-proper-headers.-tp17260832p17273368.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

2008-05-16 Thread Igor Vaynberg
why dont you just implement equals/hashcode on MyObjectOption???

-igor


On Fri, May 16, 2008 at 5:14 AM, Hoover, William <[EMAIL PROTECTED]> wrote:
> Here is an example of what I'm referring to:
>
> class MyObject {
>private Long id;
>private MyObjectOption myObjectOption;
>
>public MyObject(final Long id){
>setId(id);
>...
>}
>...
> }
>
> class MyObjectOption {
>private Long id;
>private String name;
>
>public MyObjectOption(final Long id){
>setId(id);
>...
>}
>...
> }
>
> // in the WebPage
> final MyObject myObject = new MyObject(1L);
> ...
> myObject.setMyObjectOption(new MyObjectOption(200L));
>
> final List myObjectOptionList = new
> ArrayList();
> myObjectOptionList.add(new MyObjectOption(100L));
> myObjectOptionList.add(new MyObjectOption(200L));
> myObjectOptionList.add(new MyObjectOption(300L));
>
> final Form myForm = new Form("form-myobject", new
> CompoundPropertyModel(myObject));
> ...
> final RadioGroup group = new RadioGroup("myObjectOption");
> group.add(new ListView("div-myobject-options-view", myObjectList) {
>protected final void populateItem(final ListItem item) {
>final MyObjectOption myObjectOption = (MyObjectOption)
> item.getModelObject();
>item.add(new Label("label-myobject-option-name",
> myObjectOption.getName()));
>item.add(new Radio("input-radio-myobject-option", new
> Model(myObjectOption)));
>}
> });
> myForm.add(group);
> add(myForm);
>
>
> 
>
>
>
>[MyObjectOption Name]
>
> type="radio" />
>
>
> 
>
> In the example above myObjectOption would never be selected because it
> is not the same instance of the MyObjectOption that is in
> myObjectOptionList (index 1) even though they share the same ID. If an
> IChoiceRenderer was provided to the RadioGroup the following could
> accomplish the task of making the selection work:
>
> final IChoiceRenderer myObjectOptionRenderer = new ChoiceRenderer() {
>...
>public final String getIdValue(final Object object, final int
> index) {
>final Object id = ((MyObjectOption) object).getId();
>return (id != null) ? id.toString() :
> super.getIdValue(object, index);
>}
>...
> };
>
> -Original Message-
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 15, 2008 7:16 PM
> To: users@wicket.apache.org
> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>
> On Thu, May 15, 2008 at 3:12 PM, Hoover, William <[EMAIL PROTECTED]>
> wrote:
>> It's strange that that kind of functionality is provided when multiple
>
>> selections is needed (i.e. CheckBoxMultipleChoice), but it is not when
>
>> only one choice is needed (i.e. RadioGroup/CheckGroup).
>
> CheckGroup is a muti-selection component
>
>
>
>> It is an oddity
>> that other components that have choices (i.e. DropDownChoice, etc.)
>> provide a means to use an IChoiceRenderer, but some do not.
>
> the whole point of Radio/CheckGroup is to give the user more control
> then what IChoiceRenderer offers.
>
>> What if
>> someone is using a RadioGroup/CheckGroup that uses some form of a
>> RepeatingView to generate the Radio/Check options dynamically? In the
>> case where they need to make a selection using a separate choice
>> instance than what is in the list, how would they accomplish that? If
>> they set the choice on the RadioGroup/CheckGroup model it will never
>> be selected because they are different instances, and because there is
>
>> not IChoiceRenderer it is not possible to define an ID value to
>> determine the equality of the two instances.
>
> Not really sure what you mean here. The selection is based on the model
> object of Radio/Check, not the Radio/Check instance itself...
>
> -igor
>
>
>>
>> -Original Message-
>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, May 15, 2008 5:50 PM
>> To: users@wicket.apache.org
>> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>>
>> well, the whole point of radio/check group is to allow user complete
>> control over markup. the whole point of choice renderer is to automate
>
>> markup generation, so there is just a big mismatch. eg i always use
>> radio/check group when using a choice renderer would be inconvenient.
>>
>> you can always roll your own subclass, i just dont think something
>> like that would belong in core, its just one more parallel way of
>> doing something.
>>
>> -igor
>>
>> On Thu, May 15, 2008 at 2:44 PM, Hoover, William <[EMAIL PROTECTED]>
>> wrote:
>>> yes... sorry CheckGroup is what I meant. It seems as though
>>> RadioGroup/CheckGroup should also have the capability of using an
>>> IChoiceRenderer as well, right? One reason I was thin

Re: PagingNavigator faster paging

2008-05-16 Thread Mathias P.W Nilsson

I was unclear with the class.

I use PagingNavigation with my dataProvider but it's still to slow. Must be
something else.

-- 
View this message in context: 
http://www.nabble.com/PagingNavigator-faster-paging-tp17272873p17274937.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: PagingNavigator faster paging

2008-05-16 Thread Mathias P.W Nilsson

Yes, I use the page navigator. 
-- 
View this message in context: 
http://www.nabble.com/PagingNavigator-faster-paging-tp17272873p17274891.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: PagingNavigator faster paging

2008-05-16 Thread Meindert Deen
You can use PagingNavigation to page trough everything in the DB:
http://www.wicketstuff.org/wicket13/repeater/;jsessionid=1A8942B5B6C08E39348C4E8923DB32CB?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.repeater.PagingPage

That way you don't get everything from the database all the time.

Grtz,

M

On Fri, May 16, 2008 at 3:27 PM, Mathias P.W Nilsson <[EMAIL PROTECTED]>
wrote:

>
> Thanks!
>
> I used this but I don't think it is any faster
>
> class ItemProvider implements IDataProvider{
>private static final long serialVersionUID = 1L;
>
>public Iterator iterator(int first, int count) {
>  return getItemDao().getItems(getFilters(), first, count
> ).iterator();
>}
>
>public int size() {
>return getItemDao().getItemCount( getFilters());
>}
>
>public IModel model(Object object) {
>  return new Model((Item) object);
>}
>
>public void detach() {
>// TODO Auto-generated method stub
>
>}
> }
> --
> View this message in context:
> http://www.nabble.com/PagingNavigator-faster-paging-tp17272873p17274697.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: PagingNavigator faster paging

2008-05-16 Thread Mathias P.W Nilsson

Thanks!

I used this but I don't think it is any faster

class ItemProvider implements IDataProvider{
private static final long serialVersionUID = 1L;

public Iterator iterator(int first, int count) {
  return getItemDao().getItems(getFilters(), first, count
).iterator();
}

public int size() {
return getItemDao().getItemCount( getFilters());
}

public IModel model(Object object) {
  return new Model((Item) object); 
}

public void detach() {
// TODO Auto-generated method stub

}
 }
-- 
View this message in context: 
http://www.nabble.com/PagingNavigator-faster-paging-tp17272873p17274697.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Back button retrieving cached data even with proper headers.

2008-05-16 Thread Johan Compagner
i think that is more a problem of the browser and i think that will be fixed
hopefully
the browser should always go to the latest dom it came from, not the file in
the cache..

johan


On Fri, May 16, 2008 at 2:18 PM, gumnaam23 <[EMAIL PROTECTED]> wrote:

>
> I guess you are right. But in an Ajax world, there really is no other way
> around the problem, is there ?
>
>
>
> Johan Compagner wrote:
> >
> > no i am against no-store as default.
> >
> > back button should be quick. If the line is a bit slow then users get
> very
> > very very (i would) annoyed
> > if the back button takes a while because it connects back to the server.
> >
> > A back button shouldnt do that. I know we in wicket wants it to do it but
> > from an end user perspective it is a horrible experience.
> >
> > johan
> >
> >
> > On Fri, May 16, 2008 at 11:01 AM, gumnaam23 <[EMAIL PROTECTED]> wrote:
> >
> >>
> >> Adding "no-store" to the "Cache-Control" header did the trick.
> >>
> >> According to Page.setHeaders() javadoc , Wicket already adds cache
> >> related
> >> headers
> >> response.setHeader("Pragma", "no-cache");
> >> response.setHeader("Cache-Control", "no-cache, max-age=0,
> >> must-revalidate")
> >>
> >> Is there any particular reason why "no-store" is not added to the
> >> "Cache-Control" header ?
> >> Or is this a bug and should be raised so ?
> >>
> >> Unfortunately even after "no-store" , I have problems.
> >>
> >> Here's my Page flow.
> >> User Clicks on a Bookmarkable page (say /pages/Page1 ), Page1.class, has
> >> a
> >> BreadCrumbBar and a BreadCrumbPanel.
> >>
> >> The BreadCrumbPanel has an AjaxFallBackDefaultDataTable (AFDDT) . One of
> >> the
> >> Columns of the AFDDT
> >> has BreadCrumbPanelLinks to navigate further down the hierarchy.
> >>
> >> The AFDDT is paginable, and fetches next/previous records over Ajax. So
> >> when
> >> a user fetches next records, the contents of AFDDT are fetched over
> AJAX.
> >> As
> >> I said previously, One of the Columns contain
> >> BreadCrumbBarPanelLink , which when the user clicks takes him down the
> >> BreadCrumb hierarchy.
> >>
> >> So far so good, but now if the user clicks the back button, the request
> >> that
> >> is sent to the server is for the bookmarkable page /pages/Page1, So the
> >> Page1.class is reinstanciated, instead of it's correct version being
> >> fetched
> >> from the Session. So when the user hits back button, the Navigation of
> >> the
> >> AFDDT is lost, and we are back to the first set of rows in the AFDDT.
> >>
> >> If I use DefaultDataTable instead of AFDDT then this problem doesn't
> >> arise,
> >> because next/previous records are fetched as normal requests, and not
> >> over
> >> ajax.
> >>
> >> Is this a known limitation , or can something be done to solve this
> >> problem
> >> ?
> >>
> >>
> >>
> >>
> >>
> >>
> >> Are you sure you also send the cache-control: no-store header?
> >> (no-cache is not enough). Also for opera there's no way to force the
> >> reload.
> >>
> >> -Matje
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Back-button-retrieving-cached-data-even-with-proper-headers.-tp17260832p17270411.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Back-button-retrieving-cached-data-even-with-proper-headers.-tp17260832p17273368.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Back button retrieving cached data even with proper headers.

2008-05-16 Thread gumnaam23

I guess you are right. But in an Ajax world, there really is no other way
around the problem, is there ?



Johan Compagner wrote:
> 
> no i am against no-store as default.
> 
> back button should be quick. If the line is a bit slow then users get very
> very very (i would) annoyed
> if the back button takes a while because it connects back to the server.
> 
> A back button shouldnt do that. I know we in wicket wants it to do it but
> from an end user perspective it is a horrible experience.
> 
> johan
> 
> 
> On Fri, May 16, 2008 at 11:01 AM, gumnaam23 <[EMAIL PROTECTED]> wrote:
> 
>>
>> Adding "no-store" to the "Cache-Control" header did the trick.
>>
>> According to Page.setHeaders() javadoc , Wicket already adds cache
>> related
>> headers
>> response.setHeader("Pragma", "no-cache");
>> response.setHeader("Cache-Control", "no-cache, max-age=0,
>> must-revalidate")
>>
>> Is there any particular reason why "no-store" is not added to the
>> "Cache-Control" header ?
>> Or is this a bug and should be raised so ?
>>
>> Unfortunately even after "no-store" , I have problems.
>>
>> Here's my Page flow.
>> User Clicks on a Bookmarkable page (say /pages/Page1 ), Page1.class, has
>> a
>> BreadCrumbBar and a BreadCrumbPanel.
>>
>> The BreadCrumbPanel has an AjaxFallBackDefaultDataTable (AFDDT) . One of
>> the
>> Columns of the AFDDT
>> has BreadCrumbPanelLinks to navigate further down the hierarchy.
>>
>> The AFDDT is paginable, and fetches next/previous records over Ajax. So
>> when
>> a user fetches next records, the contents of AFDDT are fetched over AJAX.
>> As
>> I said previously, One of the Columns contain
>> BreadCrumbBarPanelLink , which when the user clicks takes him down the
>> BreadCrumb hierarchy.
>>
>> So far so good, but now if the user clicks the back button, the request
>> that
>> is sent to the server is for the bookmarkable page /pages/Page1, So the
>> Page1.class is reinstanciated, instead of it's correct version being
>> fetched
>> from the Session. So when the user hits back button, the Navigation of
>> the
>> AFDDT is lost, and we are back to the first set of rows in the AFDDT.
>>
>> If I use DefaultDataTable instead of AFDDT then this problem doesn't
>> arise,
>> because next/previous records are fetched as normal requests, and not
>> over
>> ajax.
>>
>> Is this a known limitation , or can something be done to solve this
>> problem
>> ?
>>
>>
>>
>>
>>
>>
>> Are you sure you also send the cache-control: no-store header?
>> (no-cache is not enough). Also for opera there's no way to force the
>> reload.
>>
>> -Matje
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Back-button-retrieving-cached-data-even-with-proper-headers.-tp17260832p17270411.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Back-button-retrieving-cached-data-even-with-proper-headers.-tp17260832p17273368.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

2008-05-16 Thread Hoover, William
Here is an example of what I'm referring to:

class MyObject {
private Long id;
private MyObjectOption myObjectOption;

public MyObject(final Long id){
setId(id);
...
}
...
}

class MyObjectOption {
private Long id;
private String name;

public MyObjectOption(final Long id){
setId(id);
...
}
...
}

// in the WebPage
final MyObject myObject = new MyObject(1L);
...
myObject.setMyObjectOption(new MyObjectOption(200L));

final List myObjectOptionList = new
ArrayList();
myObjectOptionList.add(new MyObjectOption(100L));
myObjectOptionList.add(new MyObjectOption(200L));
myObjectOptionList.add(new MyObjectOption(300L));

final Form myForm = new Form("form-myobject", new
CompoundPropertyModel(myObject));
...
final RadioGroup group = new RadioGroup("myObjectOption");
group.add(new ListView("div-myobject-options-view", myObjectList) {
protected final void populateItem(final ListItem item) {
final MyObjectOption myObjectOption = (MyObjectOption)
item.getModelObject();
item.add(new Label("label-myobject-option-name",
myObjectOption.getName()));
item.add(new Radio("input-radio-myobject-option", new
Model(myObjectOption)));
}
});
myForm.add(group);
add(myForm);






[MyObjectOption Name]






In the example above myObjectOption would never be selected because it
is not the same instance of the MyObjectOption that is in
myObjectOptionList (index 1) even though they share the same ID. If an
IChoiceRenderer was provided to the RadioGroup the following could
accomplish the task of making the selection work:

final IChoiceRenderer myObjectOptionRenderer = new ChoiceRenderer() {
...
public final String getIdValue(final Object object, final int
index) {
final Object id = ((MyObjectOption) object).getId();
return (id != null) ? id.toString() :
super.getIdValue(object, index);
}
...
};

-Original Message-
From: Igor Vaynberg [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 15, 2008 7:16 PM
To: users@wicket.apache.org
Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice

On Thu, May 15, 2008 at 3:12 PM, Hoover, William <[EMAIL PROTECTED]>
wrote:
> It's strange that that kind of functionality is provided when multiple

> selections is needed (i.e. CheckBoxMultipleChoice), but it is not when

> only one choice is needed (i.e. RadioGroup/CheckGroup).

CheckGroup is a muti-selection component



> It is an oddity
> that other components that have choices (i.e. DropDownChoice, etc.) 
> provide a means to use an IChoiceRenderer, but some do not.

the whole point of Radio/CheckGroup is to give the user more control
then what IChoiceRenderer offers.

> What if
> someone is using a RadioGroup/CheckGroup that uses some form of a 
> RepeatingView to generate the Radio/Check options dynamically? In the 
> case where they need to make a selection using a separate choice 
> instance than what is in the list, how would they accomplish that? If 
> they set the choice on the RadioGroup/CheckGroup model it will never 
> be selected because they are different instances, and because there is

> not IChoiceRenderer it is not possible to define an ID value to 
> determine the equality of the two instances.

Not really sure what you mean here. The selection is based on the model
object of Radio/Check, not the Radio/Check instance itself...

-igor


>
> -Original Message-
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 15, 2008 5:50 PM
> To: users@wicket.apache.org
> Subject: Re: IChoiceRenderer: RadioGroup CheckBoxMultipleChoice
>
> well, the whole point of radio/check group is to allow user complete 
> control over markup. the whole point of choice renderer is to automate

> markup generation, so there is just a big mismatch. eg i always use 
> radio/check group when using a choice renderer would be inconvenient.
>
> you can always roll your own subclass, i just dont think something 
> like that would belong in core, its just one more parallel way of 
> doing something.
>
> -igor
>
> On Thu, May 15, 2008 at 2:44 PM, Hoover, William <[EMAIL PROTECTED]>
> wrote:
>> yes... sorry CheckGroup is what I meant. It seems as though 
>> RadioGroup/CheckGroup should also have the capability of using an 
>> IChoiceRenderer as well, right? One reason I was thinking that is if 
>> someone has a model object instance A that is a different instance 
>> than any of the choices in the list, they can override the
>> IChoiceRenderer#getIdValue(...) and provide the identifier. Even 
>> though none of the choices are the same instance of A they can still 
>> determine equality for selection purposes using the I

Re: PagingNavigator faster paging

2008-05-16 Thread Martijn Dashorst
Don't use the PageableListView, but use DataView with an IDataProvider.

Martijn

On 5/16/08, Mathias P.W Nilsson <[EMAIL PROTECTED]> wrote:
>
>  Hi!
>
>  I'm using a Pageable List view to list my items. The problem is that it is
>  to slow when there are many items
>
>  In the database I have 2000 items and when I hit all of them the rendering
>  is slow. This is because of translating, calculating and so on. To solve
>  this I would like to do something like
>
>  // Hibernate
>
>  getTotalCount
>  Build Pagenavigator from totalcount. Only fetch the exact amount of item
>  using setMax, setFirst with hibernate.
>
>  Is it possible to use the Pagenavigator  using this?
>
>
>  --
>  View this message in context: 
> http://www.nabble.com/PagingNavigator-faster-paging-tp17272873p17272873.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>  -
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: PagingNavigator faster paging

2008-05-16 Thread lars vonk
Ì am not sure about Pagenavigator (is this an existing Wicket class? I can't
find it).

We have implemented what you describe using DataView and by implementing the
IDataProvider to do the call to Hibernate with the given first and count
passed in the method *Iterator iterator(int first, int count);* you need to
implement.

Hope this helps,

Lars

On Fri, May 16, 2008 at 1:47 PM, Mathias P.W Nilsson <[EMAIL PROTECTED]>
wrote:

>
> Hi!
>
> I'm using a Pageable List view to list my items. The problem is that it is
> to slow when there are many items
>
> In the database I have 2000 items and when I hit all of them the rendering
> is slow. This is because of translating, calculating and so on. To solve
> this I would like to do something like
>
> // Hibernate
>
> getTotalCount
> Build Pagenavigator from totalcount. Only fetch the exact amount of item
> using setMax, setFirst with hibernate.
>
> Is it possible to use the Pagenavigator  using this?
>
> --
> View this message in context:
> http://www.nabble.com/PagingNavigator-faster-paging-tp17272873p17272873.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


PagingNavigator faster paging

2008-05-16 Thread Mathias P.W Nilsson

Hi!

I'm using a Pageable List view to list my items. The problem is that it is
to slow when there are many items

In the database I have 2000 items and when I hit all of them the rendering
is slow. This is because of translating, calculating and so on. To solve
this I would like to do something like

// Hibernate

getTotalCount
Build Pagenavigator from totalcount. Only fetch the exact amount of item
using setMax, setFirst with hibernate.

Is it possible to use the Pagenavigator  using this?

-- 
View this message in context: 
http://www.nabble.com/PagingNavigator-faster-paging-tp17272873p17272873.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: chaning background

2008-05-16 Thread Mathias P.W Nilsson

Thanks Jeremy that worked great
-- 
View this message in context: 
http://www.nabble.com/chaning-background-tp17268044p17272824.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How does Wicket load an object and combine it with a user's web input? (newbie question)

2008-05-16 Thread Maurice Marrink
You do not need a hidden form parameter, wicket automatically resolves
the form input with the component on the server side.
On submit the model of the component is loaded and set with the new
input. If you use a model such as LoadableDetachableModel, that knows
how to get the latest object from the database then the object is thus
updated and can be saved.
For example
Form form=new Form("form", new
CompoundPropertyModel(myLoadableDetachableUserModel))
form.add(new TextField("firstName");
form.add(new TextField("LastName");

We use a LoadableDetachableModel to get the user from the database on
each request.
We wrap it in a CompoundPropertyModel so we can then easy use other
components to set its fields.
Because we use a CompoundPropertyModel we do not have to specify
models for the textfields, instead the id of the textfields is used to
resolve the getter and setter on the user object.

For a more in depth example you should check out
http://www.theserverside.com/tt/articles/content/IntroducingApacheWicket/article.html
or one of the other tutorials floating around

Maurice

On Fri, May 16, 2008 at 11:59 AM, David Wicket <[EMAIL PROTECTED]> wrote:
> I just started learning Wicket. I have some experience with JSP+Spring.
> In Spring, based on a hidden id parameter from a form, I can use 
> formBackingObject method to load the object. Spring combines a user's input 
> in the form with the loaded object to form the latest version of this object 
> and then I can save it.
> I am not sure how to do the same thing in Wicket. I tried <
> and I got errors.
> In addition, how to let Wicket combine user input with the old version object 
> loaded from the database?
> Any pointers, examples, explanation?
> Thanks you so much for your help!!!
> Regards. input wicket:id="id" type="hidden"/>
>
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How does Wicket load an object and combine it with a user's web input? (newbie question)

2008-05-16 Thread David Wicket
I just started learning Wicket. I have some experience with JSP+Spring.
In Spring, based on a hidden id parameter from a form, I can use 
formBackingObject method to load the object. Spring combines a user's 
input in the form with the loaded object to form the latest version of this 
object and then I can save it.
I am not sure how to do the same thing in Wicket. I tried <
and I got errors.
In addition, how to let Wicket combine user input with the old version object 
loaded from the database?
Any pointers, examples, explanation?
Thanks you so much for your help!!!
Regards. input wicket:id="id" type="hidden"/>


  

Re: Back button retrieving cached data even with proper headers.

2008-05-16 Thread Johan Compagner
no i am against no-store as default.

back button should be quick. If the line is a bit slow then users get very
very very (i would) annoyed
if the back button takes a while because it connects back to the server.

A back button shouldnt do that. I know we in wicket wants it to do it but
from an end user perspective it is a horrible experience.

johan


On Fri, May 16, 2008 at 11:01 AM, gumnaam23 <[EMAIL PROTECTED]> wrote:

>
> Adding "no-store" to the "Cache-Control" header did the trick.
>
> According to Page.setHeaders() javadoc , Wicket already adds cache related
> headers
> response.setHeader("Pragma", "no-cache");
> response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate")
>
> Is there any particular reason why "no-store" is not added to the
> "Cache-Control" header ?
> Or is this a bug and should be raised so ?
>
> Unfortunately even after "no-store" , I have problems.
>
> Here's my Page flow.
> User Clicks on a Bookmarkable page (say /pages/Page1 ), Page1.class, has a
> BreadCrumbBar and a BreadCrumbPanel.
>
> The BreadCrumbPanel has an AjaxFallBackDefaultDataTable (AFDDT) . One of
> the
> Columns of the AFDDT
> has BreadCrumbPanelLinks to navigate further down the hierarchy.
>
> The AFDDT is paginable, and fetches next/previous records over Ajax. So
> when
> a user fetches next records, the contents of AFDDT are fetched over AJAX.
> As
> I said previously, One of the Columns contain
> BreadCrumbBarPanelLink , which when the user clicks takes him down the
> BreadCrumb hierarchy.
>
> So far so good, but now if the user clicks the back button, the request
> that
> is sent to the server is for the bookmarkable page /pages/Page1, So the
> Page1.class is reinstanciated, instead of it's correct version being
> fetched
> from the Session. So when the user hits back button, the Navigation of the
> AFDDT is lost, and we are back to the first set of rows in the AFDDT.
>
> If I use DefaultDataTable instead of AFDDT then this problem doesn't arise,
> because next/previous records are fetched as normal requests, and not over
> ajax.
>
> Is this a known limitation , or can something be done to solve this problem
> ?
>
>
>
>
>
>
> Are you sure you also send the cache-control: no-store header?
> (no-cache is not enough). Also for opera there's no way to force the
> reload.
>
> -Matje
>
> --
> View this message in context:
> http://www.nabble.com/Back-button-retrieving-cached-data-even-with-proper-headers.-tp17260832p17270411.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Back button retrieving cached data even with proper headers.

2008-05-16 Thread Matej Knopp
Mount your page using HybridUrlCodingStrategy.

-Matej

On Fri, May 16, 2008 at 11:01 AM, gumnaam23 <[EMAIL PROTECTED]> wrote:
>
> Adding "no-store" to the "Cache-Control" header did the trick.
>
> According to Page.setHeaders() javadoc , Wicket already adds cache related
> headers
> response.setHeader("Pragma", "no-cache");
> response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate")
>
> Is there any particular reason why "no-store" is not added to the
> "Cache-Control" header ?
> Or is this a bug and should be raised so ?
>
> Unfortunately even after "no-store" , I have problems.
>
> Here's my Page flow.
> User Clicks on a Bookmarkable page (say /pages/Page1 ), Page1.class, has a
> BreadCrumbBar and a BreadCrumbPanel.
>
> The BreadCrumbPanel has an AjaxFallBackDefaultDataTable (AFDDT) . One of the
> Columns of the AFDDT
> has BreadCrumbPanelLinks to navigate further down the hierarchy.
>
> The AFDDT is paginable, and fetches next/previous records over Ajax. So when
> a user fetches next records, the contents of AFDDT are fetched over AJAX. As
> I said previously, One of the Columns contain
> BreadCrumbBarPanelLink , which when the user clicks takes him down the
> BreadCrumb hierarchy.
>
> So far so good, but now if the user clicks the back button, the request that
> is sent to the server is for the bookmarkable page /pages/Page1, So the
> Page1.class is reinstanciated, instead of it's correct version being fetched
> from the Session. So when the user hits back button, the Navigation of the
> AFDDT is lost, and we are back to the first set of rows in the AFDDT.
>
> If I use DefaultDataTable instead of AFDDT then this problem doesn't arise,
> because next/previous records are fetched as normal requests, and not over
> ajax.
>
> Is this a known limitation , or can something be done to solve this problem
> ?
>
>
>
>
>
>
> Are you sure you also send the cache-control: no-store header?
> (no-cache is not enough). Also for opera there's no way to force the
> reload.
>
> -Matje
>
> --
> View this message in context: 
> http://www.nabble.com/Back-button-retrieving-cached-data-even-with-proper-headers.-tp17260832p17270411.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Back button retrieving cached data even with proper headers.

2008-05-16 Thread gumnaam23

Adding "no-store" to the "Cache-Control" header did the trick.

According to Page.setHeaders() javadoc , Wicket already adds cache related
headers
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate")

Is there any particular reason why "no-store" is not added to the
"Cache-Control" header ?
Or is this a bug and should be raised so ?

Unfortunately even after "no-store" , I have problems.

Here's my Page flow.
User Clicks on a Bookmarkable page (say /pages/Page1 ), Page1.class, has a
BreadCrumbBar and a BreadCrumbPanel.
 
The BreadCrumbPanel has an AjaxFallBackDefaultDataTable (AFDDT) . One of the
Columns of the AFDDT 
has BreadCrumbPanelLinks to navigate further down the hierarchy.

The AFDDT is paginable, and fetches next/previous records over Ajax. So when
a user fetches next records, the contents of AFDDT are fetched over AJAX. As
I said previously, One of the Columns contain
BreadCrumbBarPanelLink , which when the user clicks takes him down the
BreadCrumb hierarchy.

So far so good, but now if the user clicks the back button, the request that
is sent to the server is for the bookmarkable page /pages/Page1, So the
Page1.class is reinstanciated, instead of it's correct version being fetched
from the Session. So when the user hits back button, the Navigation of the
AFDDT is lost, and we are back to the first set of rows in the AFDDT.

If I use DefaultDataTable instead of AFDDT then this problem doesn't arise,
because next/previous records are fetched as normal requests, and not over
ajax.

Is this a known limitation , or can something be done to solve this problem
?






Are you sure you also send the cache-control: no-store header?
(no-cache is not enough). Also for opera there's no way to force the
reload.

-Matje

-- 
View this message in context: 
http://www.nabble.com/Back-button-retrieving-cached-data-even-with-proper-headers.-tp17260832p17270411.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: wicket xml - add label as xml element atribute

2008-05-16 Thread Martijn Dashorst
http://www.google.com/search?q=remove+wicket+attribute+markup

On 5/16/08, Milan Křápek <[EMAIL PROTECTED]> wrote:
> Yeah, thanks a lot that was the thing I was searching for. But there is one 
> more problem.
>  When I do that this way, I get on the output something like:
>
>  
>
>  Is there any way to remove wicket:id attribute from the output code?
>
>
>  -
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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


Re: Null pointer I don't understand

2008-05-16 Thread Martijn Dashorst
The full stack trace would be helpful

Martijn

On 5/16/08, Mathias P.W Nilsson <[EMAIL PROTECTED]> wrote:
>
>  I have this page class. When submitting the form via the AjaxButton I get a
>  null pointer exception.
>  It passes the instanceof in onSubmit but all data is null. I dont get this.
>  In the LoadableDetachable model I do new CartItem and when displaying the
>  page the first time I see the drop down choice correctly.
>
>  public class ItemPage extends RootPage {
> Long itemId;
> Item item;
> WebPage backPage;
>
> public ItemPage(){
> throw new RestartResponseAtInterceptPageException(Base.class);
> }
>
> public ItemPage(  PageParameters parameters ){
> this( parameters , null );
> }
>
> public ItemPage( PageParameters parameters, WebPage backPage  ){
>
> this.backPage = backPage;
>
> try{
> itemId = new Long( parameters.getString( "ItemId", "" 
> ) );
> }catch( NumberFormatException nex ){
> throw new 
> RestartResponseAtInterceptPageException(Base.class);
> }
>
> item = getItemDao().getItem( itemId );
> if( item == null )throw new
>  RestartResponseAtInterceptPageException(Base.class);
>
> IModel cartItemsModel = new LoadableDetachableModel(){
> private static final long serialVersionUID = 1L;
>
> @Override
> protected Object load() {
> List subItems = 
> getItemDao().getSubItems(item);
> List cartItems = new 
> LinkedList();
>
> for( SubItem subItem : subItems ){
> if( subItem.getBalance() > 0 ){
> StringBuffer buf = new 
> StringBuffer();
> for( Attribute attribute : 
> subItem.getAttributes() ){
> buf.append( 
> attribute.getData() + " : " );
> }
>
> if( buf.length() > 0 ){
> 
> buf.delete(buf.length() - 3, buf.length() );
> }
>
> CartItem item = new 
> CartItem();
> item.setAmount( 1 );
> item.setSubItem(subItem);
> item.setAttributes(  
> buf.toString() );
> cartItems.add( item );
>
> }
> }
> return cartItems;
> }
>
> };
>
>
> final DropDownChoice choice = new DropDownChoice( "subItems", 
> new Model(),
>  cartItemsModel, new ChoiceRenderer( "attributes", "subItem.id" ) );
> choice.setNullValid( true );
> Form itemForm = new Form( "itemForm" );
>
> AjaxButton addToCart = new AjaxButton( "addToCart" , itemForm 
> ){
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void onSubmit(AjaxRequestTarget target, 
> Form form ) {
> target.addComponent( this );
> if( choice.getModelObject() instanceof 
> CartItem ){
> System.out.println( 
> choice.getModelObject() );
> Cart cart = getCart();
>
> CartItem item = (CartItem) getModel();
> System.out.println( 
> item.getAttributes() );
>
> //cart.addCartItem( (CartItem) 
> getModelObject() );
> //updateCart();
> }
> }
>
> };
> addToCart.setOutputMarkupId( true );
> itemForm.add( addToCart );
> itemForm.add( choice );
>  add( itemForm );
>
>
>  Link back = new Link( "backLink" ){
> private static final long serialVersionUID = 1L;
>
> @Override
> public void onClick() {
> setResponsePage( getBackPage() );
> }
>
>  };
>
>  if( getBackPage() == null ) back.setVisible( false );
>  add( back );
>
>   

getRequestCycle().urlFor(Class clazz, PageParameters pageParameters) bug?

2008-05-16 Thread pracha

Hi guys,

Within a certain page that was invoked with PageParameters, I tried
retrieving the absolute path to the URL for another page. However the
getRequestCycle().urlFor(Class clazz, PageParameters pageParameters) method
returned to me something like "../../verify/code/1234/agent/5678" with code
and agent being parameters and /verify as the mount point for that class.

As a result, when I used RequestUtils.urlFor on that relative URL, it
returned something like "http://verify/code/1234/agent/5678";, stripping the
server:port and mount points. I made a utility method to clean up the
relative url to "verify/code/1234/agent/5678" and the RequestUtils.urlFor
method was able to give me the proper absolute URL.

Is this a bug or is this how it really is intended to be? If so, what's the
proper way of getting the absolute URL for a certain page from within a page
that was invoked with parameters?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/getRequestCycle%28%29.urlFor%28Class-clazz%2C-PageParameters-pageParameters%29-bug--tp17269961p17269961.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Null pointer I don't understand

2008-05-16 Thread Mathias P.W Nilsson

I use getModel() it's an error. I have tried with getModelObject as well.
-- 
View this message in context: 
http://www.nabble.com/Null-pointer-I-don%27t-understand-tp17269836p17269846.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Null pointer I don't understand

2008-05-16 Thread Mathias P.W Nilsson

I have this page class. When submitting the form via the AjaxButton I get a
null pointer exception.
It passes the instanceof in onSubmit but all data is null. I dont get this.
In the LoadableDetachable model I do new CartItem and when displaying the
page the first time I see the drop down choice correctly.

public class ItemPage extends RootPage {
Long itemId;
Item item;
WebPage backPage;

public ItemPage(){
throw new RestartResponseAtInterceptPageException(Base.class);
}

public ItemPage(  PageParameters parameters ){
this( parameters , null );
}

public ItemPage( PageParameters parameters, WebPage backPage  ){

this.backPage = backPage;

try{
itemId = new Long( parameters.getString( "ItemId", "" ) 
);
}catch( NumberFormatException nex ){
throw new 
RestartResponseAtInterceptPageException(Base.class);
}

item = getItemDao().getItem( itemId );
if( item == null )throw new
RestartResponseAtInterceptPageException(Base.class);

IModel cartItemsModel = new LoadableDetachableModel(){
private static final long serialVersionUID = 1L;

@Override
protected Object load() {
List subItems = 
getItemDao().getSubItems(item);
List cartItems = new 
LinkedList();

for( SubItem subItem : subItems ){
if( subItem.getBalance() > 0 ){
StringBuffer buf = new 
StringBuffer();
for( Attribute attribute : 
subItem.getAttributes() ){
buf.append( 
attribute.getData() + " : " );
}

if( buf.length() > 0 ){
buf.delete(buf.length() 
- 3, buf.length() );
}

CartItem item = new CartItem();
item.setAmount( 1 );
item.setSubItem(subItem);
item.setAttributes(  
buf.toString() );
cartItems.add( item );

}
}
return cartItems;
}

};


final DropDownChoice choice = new DropDownChoice( "subItems", 
new Model(),
cartItemsModel, new ChoiceRenderer( "attributes", "subItem.id" ) );
choice.setNullValid( true );
Form itemForm = new Form( "itemForm" );

AjaxButton addToCart = new AjaxButton( "addToCart" , itemForm ){
private static final long serialVersionUID = 1L;

@Override
protected void onSubmit(AjaxRequestTarget target, Form 
form ) {
target.addComponent( this );
if( choice.getModelObject() instanceof CartItem 
){
System.out.println( 
choice.getModelObject() );
Cart cart = getCart();

CartItem item = (CartItem) getModel();
System.out.println( 
item.getAttributes() );

//cart.addCartItem( (CartItem) 
getModelObject() );
//updateCart();
}
}

};
addToCart.setOutputMarkupId( true );
itemForm.add( addToCart );
itemForm.add( choice );
 add( itemForm );
 
 
 Link back = new Link( "backLink" ){
private static final long serialVersionUID = 1L;

@Override
public void onClick() {
setResponsePage( getBackPage() );
}
 

Re: wicket xml - add label as xml element atribute

2008-05-16 Thread Milan Křápek
Yeah, thanks a lot that was the thing I was searching for. But there is one 
more problem. 
When I do that this way, I get on the output something like:



Is there any way to remove wicket:id attribute from the output code?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Invoulentary session sharing/leakage in Wicket 1.3.x

2008-05-16 Thread Martijn Dashorst
Has this fix been confirmed to help? If so, I'm +1 for releasing 1.3.4

Martijn

On 5/16/08, Johan Compagner <[EMAIL PROTECTED]> wrote:
> Or get the snapshot build from or wicketstuff maven repo
>
>
>  On 5/16/08, Erik van Oosten <[EMAIL PROTECTED]> wrote:
>  > Chris,
>  >
>  > If you read the thread carefuly you can extract a quick fix. You'll need
>  > it as the core developers argumented against a quick bugfix release.
>  > Just checkout Wicket from SVN and apply the patch (2 lines in the Wicket
>  > filter). Its a pain, but if you can not wait...
>  >
>  > Regards,
>  > Erik.
>  >
>  >
>  > Chris Lintz wrote:
>  >> Guys has this been resolved??  We have been having some customers complain
>  >> as
>  >> well (some sending screen shots of others peoples data as proof).
>  >> Because
>  >> our users click streams are available publically at their control, we had
>  >> thought jsessionids occurring in the click stream were being maliciously
>  >> hijacked. We  plugged that hole disallowing any jsessionid to be part of
>  >> url
>  >> (via Servlet filter) - yes this of course means JavaScript must be
>  >> enabled.
>  >> This involuntary session sharing is still occurring.  We are running
>  >> release
>  >> 1.3.2.
>  >>
>  >>
>  >>
>  > --
>  > Erik van Oosten
>  > http://day-to-day-stuff.blogspot.com/
>  >
>  >
>  >
>  > -
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>  -
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Thread safety for components

2008-05-16 Thread Maurice Marrink
Like i said: details i am blissfully unaware of :)

Thanks for clearing that up Johan.

Maurice

On Fri, May 16, 2008 at 8:53 AM, Johan Compagner <[EMAIL PROTECTED]> wrote:
> It is not sync around session, for one thing the wicket Sessio object
> is not thread safe.. Same for shared resources those 2 can be hit by
> multiply rerquest at once.
>
> Pages are threadsafe and that is not done by a big sync block, but by
> placing a barrier. See Session.getPage() there there is code that
> makes sure that 1 thread at a time gets a page from the session the
> rest just has to wait
>
> On 5/16/08, Maurice Marrink <[EMAIL PROTECTED]> wrote:
>> wicket synchronizes on the session.
>> So only one request is processed at a time, (except for resources like
>> images etc)
>> So even ajax requests are synchronized.
>>
>> There might be some more details i am not aware of but this is in a
>> nutshell our synchronization.
>>
>> Maurice
>>
>> On Fri, May 16, 2008 at 4:33 AM, Jonathan Locke
>> <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>> I'm not sure precisely what the current synchronization implementation is
>>> and there may be some edge cases that are not perfect, but the overall
>>> design is single-threaded, meaning you should not need to provide
>>> synchronization. Some requests, like image resources would potentially be
>>> handled in parallel, but anything that calls user code ought to be
>>> synchronized by Wicket so you don't have to think about it. I suppose
>>> there
>>> might be complications with asynchronous Ajax events, but I would expect
>>> these cases are already handled.  Is there some specific problem you have
>>> run into?
>>>
>>>
>>> Michael Allan wrote:

 I'm trying to get a handle on thread-safety for components.  I'm new
 to Wicket.  My best information, so far, comes from the previous
 discussion "Wicket Session and threading":


 http://mail-archives.apache.org/mod_mbox/wicket-users/200801.mbox/thread

 Eelco Hillenius, in response to Sebastiaan van Erk, wrote:

> Yes. We try our best to make pages/ components as thread safe as
> possible...
>
> > Is there anywhere a small piece on how to deal with threading within
> > Wicket (i.e., what is/is not synchronized in a request/response
> > roundtrip?). I did some quick searching in the mailing list archives
> and
> > google, but could not find anything related to version 1.3.
>
> Pages are synced on pagemaps, which basically relates to browser
> windows. RequestCycles are separate instances which are not reused, so
> no sync needed there. Sessions are not synced so you need to sync
> manually. Though in practice this wouldn't give much trouble to start
> with. Applications are shared an not synced.

 During form processing, however, my own pages are *not* synced on
 their pagemaps (at least not on their monitor locks).  I placed this
 is in my code:

   assert Thread.holdsLock( /*page*/this.getPageMap() );

 This asserts false during the setting of TextField models (Wicket
 1.3.2), and false during the call to Form.onSubmit().

 How can I ensure thread safety?  In other words, if I am coding a
 model, what can I assume about my client threads?  Are they
 synchronized somewhere, or must I code defensively within the model?
 Or, from the client side, if I have a thread that accesses a page's
 components, how can it avoid tangling with the response/request
 threads?

 --
 Michael Allan

 Toronto, 647-436-4521
 http://zelea.com/


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Thread-safety-for-components-tp17265324p17266550.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]