Re: Dynamic Generation of wicket Screen

2010-03-02 Thread Martin Makundi
Show me a code snipplet of component that you want to hide or show
conditionally. I will do the same for that component.

**
Martin

2010/3/3 sravang :
>
> Didn't understand. pls explain me.
>
> MartinM wrote:
>>
>> Hi!
>>
>> You can always use:
>>
>> field = new Field(...) {
>>   �...@override
>>    public boolean isVisible() {
>>        return showIfVisible;
>>    }
>> }
>>
>> **
>> Martin
>>
>> 2010/3/3 sravang :
>>>
>>> Thank u for your reply.
>>>
>>> I will explain my work. if have any idea pls let me know.
>>>
>>> My screen have one TextField name is like Customer.
>>>
>>> That customer's name come from DB through search option.
>>>
>>> Based on the customer screen will display field-wise(some fields display
>>> for
>>> some customer and some fields disable for some customer based on the
>>> fields
>>> stored in DB)
>>>
>>> Awaiting for your reply.
>>>
>>> Thanks,
>>> Sravang.
>>>
>>>
>>>
>>> MartinM wrote:

 Hi!

 You mean likea a table or like markup from db?

 Or maybe mashup approach? http://code.google.com/p/wicket-mashup/

 **
 Martin

 2010/3/3 sravan g :
> Hi, Any one have idea about Dynamic Generation of wicket Screen depends
> on
> value Stored on Database?
>

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



>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Dynamic-Generation-of-wicket-Screen-tp27764572p27764659.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Dynamic-Generation-of-wicket-Screen-tp27764572p27765090.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Dynamic Generation of wicket Screen

2010-03-02 Thread sravang

Didn't understand. pls explain me.

MartinM wrote:
> 
> Hi!
> 
> You can always use:
> 
> field = new Field(...) {
>@Override
>public boolean isVisible() {
>return showIfVisible;
>}
> }
> 
> **
> Martin
> 
> 2010/3/3 sravang :
>>
>> Thank u for your reply.
>>
>> I will explain my work. if have any idea pls let me know.
>>
>> My screen have one TextField name is like Customer.
>>
>> That customer's name come from DB through search option.
>>
>> Based on the customer screen will display field-wise(some fields display
>> for
>> some customer and some fields disable for some customer based on the
>> fields
>> stored in DB)
>>
>> Awaiting for your reply.
>>
>> Thanks,
>> Sravang.
>>
>>
>>
>> MartinM wrote:
>>>
>>> Hi!
>>>
>>> You mean likea a table or like markup from db?
>>>
>>> Or maybe mashup approach? http://code.google.com/p/wicket-mashup/
>>>
>>> **
>>> Martin
>>>
>>> 2010/3/3 sravan g :
 Hi, Any one have idea about Dynamic Generation of wicket Screen depends
 on
 value Stored on Database?

>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Dynamic-Generation-of-wicket-Screen-tp27764572p27764659.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Dynamic-Generation-of-wicket-Screen-tp27764572p27765090.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Dynamic Generation of wicket Screen

2010-03-02 Thread Martin Makundi
Hi!

You can always use:

field = new Field(...) {
   @Override
   public boolean isVisible() {
   return showIfVisible;
   }
}

**
Martin

2010/3/3 sravang :
>
> Thank u for your reply.
>
> I will explain my work. if have any idea pls let me know.
>
> My screen have one TextField name is like Customer.
>
> That customer's name come from DB through search option.
>
> Based on the customer screen will display field-wise(some fields display for
> some customer and some fields disable for some customer based on the fields
> stored in DB)
>
> Awaiting for your reply.
>
> Thanks,
> Sravang.
>
>
>
> MartinM wrote:
>>
>> Hi!
>>
>> You mean likea a table or like markup from db?
>>
>> Or maybe mashup approach? http://code.google.com/p/wicket-mashup/
>>
>> **
>> Martin
>>
>> 2010/3/3 sravan g :
>>> Hi, Any one have idea about Dynamic Generation of wicket Screen depends
>>> on
>>> value Stored on Database?
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Dynamic-Generation-of-wicket-Screen-tp27764572p27764659.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Dynamic Generation of wicket Screen

2010-03-02 Thread sravang

Thank u for your reply.

I will explain my work. if have any idea pls let me know.

My screen have one TextField name is like Customer.

That customer's name come from DB through search option.

Based on the customer screen will display field-wise(some fields display for
some customer and some fields disable for some customer based on the fields
stored in DB)

Awaiting for your reply.

Thanks,
Sravang. 



MartinM wrote:
> 
> Hi!
> 
> You mean likea a table or like markup from db?
> 
> Or maybe mashup approach? http://code.google.com/p/wicket-mashup/
> 
> **
> Martin
> 
> 2010/3/3 sravan g :
>> Hi, Any one have idea about Dynamic Generation of wicket Screen depends
>> on
>> value Stored on Database?
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Dynamic-Generation-of-wicket-Screen-tp27764572p27764659.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Dynamic Generation of wicket Screen

2010-03-02 Thread Martin Makundi
Hi!

You mean likea a table or like markup from db?

Or maybe mashup approach? http://code.google.com/p/wicket-mashup/

**
Martin

2010/3/3 sravan g :
> Hi, Any one have idea about Dynamic Generation of wicket Screen depends on
> value Stored on Database?
>

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



Dynamic Generation of wicket Screen

2010-03-02 Thread sravan g
Hi, Any one have idea about Dynamic Generation of wicket Screen depends on
value Stored on Database?


FeedbackPanel for Dynamic Form

2010-03-02 Thread Brad Grier
I've written a dynamic form engine which does its work using a ListView and 
Fragment subclasses representing the various form fields. Everything works 
great including saving and retrieving form information. Now that the fun is 
over, I've run into a problem adding validation. In the markup for the fragment 
subclasses, the wicket:id is always "field". That's okay...until I try to add a 
FeebackPanel to the form to report validation errors. Since the identifier for 
every form field is the same, the messages displayed in the panel are useless. 
Any advice?

Thanks,
Brad

Re: wiQuery components with server side state - live demo

2010-03-02 Thread Early Morning
These look really great Cemal, thanks for sharing. I'm looking forward to
trying them out, as they seem really useful :)

As an aside, regarding storing component position/settings as mentioned by
Vladimir, does anyone have any resources/advice how to best do that for a
multi-user system where users can save their personal preferences? I was
thinking of doing an ajax call whenever the sorting is changed in order to
store the settings in a DB, but that may have too much overhead. Storing
data client side would still have the problem of how to synchronize the data
on the server side. Is there a recommended way to do this? Thanks!


Regards,

Ces

On Wed, Mar 3, 2010 at 12:58 AM, Cemal A Bayramoglu wrote:

> We've been building a few wiQuery components [0], for clients' and
> internal projects. These wiQuery components typically maintain some of
> their state server-side, in the spirit of standard Wicket components.
>
> Here's a simple demo [1] to show some of them in action.
>
> Look carefully and you'll find lots of stuff to click on [2]. We could
> plan to open up the ones we may [3] if they look useful to you or
> you'd like to get involved with design/development/testing.
>
> Regards - Cemal
> jWeekend
> OO & Java Technologies, Wicket
> Consulting, Development, Training
> http://jWeekend.com
>
> [0] includes components based on sortable "portlet", jqGrid/Tree,
> jGrowl, jQuery UI: Accordian, Dialog, Tabs all integrated with Wicket
> using wiQuery (http://code.google.com/p/wiquery/)
> [1] http://labs.jWeekend.com/public/
> [2] We'd naturally prefer if you didn't zap _all_ the records from our
> toy database! Yes, we know some of you will take this as an invitation
> to have a go!
> [3] No promises on dates just now, but it is something we'd like to do
> soon.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


RE: Extended Form Question

2010-03-02 Thread Josh Chappelle
Thanks that works great!

-Original Message-
From: James Carman [mailto:jcar...@carmanconsulting.com] 
Sent: Tuesday, March 02, 2010 9:01 PM
To: users@wicket.apache.org
Subject: Re: Extended Form Question

You would instantiate your FeedbackPanel with an IFeedbackMessageFilter:

http://wicket.apache.org/docs/1.4/org/apache/wicket/feedback/IFeedbackMessag
eFilter.html

Perhaps you would check to see if the form itself is the "reporter" of
the message?

On Tue, Mar 2, 2010 at 9:54 PM, Josh Chappelle  wrote:
> Hi,
>
>
>
> I have extended the Form component to include a visitor that adds some
> behaviors to required fields so that the validation errors are rendered
next
> to the corresponding fields. My problem is that I have a form that has a
> form level validator that is not specific to a component. So I still need
a
> feedback panel to be included. My problem is that the feedback panel also
> lists all of the component's individual errors.
>
>
>
> How can I make my feedback panel not filter out form level messages but
> filter out component level messages?
>
>
>
> Thanks,
>
>
>
> Josh
>
>

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


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



Re: Extended Form Question

2010-03-02 Thread James Carman
You would instantiate your FeedbackPanel with an IFeedbackMessageFilter:

http://wicket.apache.org/docs/1.4/org/apache/wicket/feedback/IFeedbackMessageFilter.html

Perhaps you would check to see if the form itself is the "reporter" of
the message?

On Tue, Mar 2, 2010 at 9:54 PM, Josh Chappelle  wrote:
> Hi,
>
>
>
> I have extended the Form component to include a visitor that adds some
> behaviors to required fields so that the validation errors are rendered next
> to the corresponding fields. My problem is that I have a form that has a
> form level validator that is not specific to a component. So I still need a
> feedback panel to be included. My problem is that the feedback panel also
> lists all of the component's individual errors.
>
>
>
> How can I make my feedback panel not filter out form level messages but
> filter out component level messages?
>
>
>
> Thanks,
>
>
>
> Josh
>
>

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



Extended Form Question

2010-03-02 Thread Josh Chappelle
Hi, 

 

I have extended the Form component to include a visitor that adds some
behaviors to required fields so that the validation errors are rendered next
to the corresponding fields. My problem is that I have a form that has a
form level validator that is not specific to a component. So I still need a
feedback panel to be included. My problem is that the feedback panel also
lists all of the component's individual errors.

 

How can I make my feedback panel not filter out form level messages but
filter out component level messages?

 

Thanks,

 

Josh



Re: wiQuery components with server side state - live demo

2010-03-02 Thread John Armstrong
Wow, this is fantastic. Wish I'd had it 4 months ago before I had to start
dealing with GXT for its grid support :(

We'll pick it up for our next project if possible, its exactly what we need.

Nice stuff guys.

John-

PS : RowExpanders would be awesome ;)

On Tue, Mar 2, 2010 at 3:10 PM, Vladimir K  wrote:

>
> Looks great!
>
> One thing is missing - the components don't restore their state on refresh.
> I believe cookie, window name or dom storage can be used to keep the
> position and settings of components that are available for
> dragging/re-arrangement.
>
>
> Roman Ilin wrote:
> >
> > Great, ready for use components.
> >
> >
> >
> > On Tue, Mar 2, 2010 at 5:58 PM, Cemal A Bayramoglu 
> > wrote:
> >> We've been building a few wiQuery components [0], for clients' and
> >> internal projects. These wiQuery components typically maintain some of
> >> their state server-side, in the spirit of standard Wicket components.
> >>
> >> Here's a simple demo [1] to show some of them in action.
> >>
> >> Look carefully and you'll find lots of stuff to click on [2]. We could
> >> plan to open up the ones we may [3] if they look useful to you or
> >> you'd like to get involved with design/development/testing.
> >>
> >> Regards - Cemal
> >> jWeekend
> >> OO & Java Technologies, Wicket
> >> Consulting, Development, Training
> >> http://jWeekend.com
> >>
> >> [0] includes components based on sortable "portlet", jqGrid/Tree,
> >> jGrowl, jQuery UI: Accordian, Dialog, Tabs all integrated with Wicket
> >> using wiQuery (http://code.google.com/p/wiquery/)
> >> [1] http://labs.jWeekend.com/public/
> >> [2] We'd naturally prefer if you didn't zap _all_ the records from our
> >> toy database! Yes, we know some of you will take this as an invitation
> >> to have a go!
> >> [3] No promises on dates just now, but it is something we'd like to do
> >> soon.
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/wiQuery-components-with-server-side-state---live-demo-tp27758298p27762474.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: wiQuery components with server side state - live demo

2010-03-02 Thread Vladimir K

Looks great!

One thing is missing - the components don't restore their state on refresh.
I believe cookie, window name or dom storage can be used to keep the
position and settings of components that are available for
dragging/re-arrangement.


Roman Ilin wrote:
> 
> Great, ready for use components.
> 
> 
> 
> On Tue, Mar 2, 2010 at 5:58 PM, Cemal A Bayramoglu 
> wrote:
>> We've been building a few wiQuery components [0], for clients' and
>> internal projects. These wiQuery components typically maintain some of
>> their state server-side, in the spirit of standard Wicket components.
>>
>> Here's a simple demo [1] to show some of them in action.
>>
>> Look carefully and you'll find lots of stuff to click on [2]. We could
>> plan to open up the ones we may [3] if they look useful to you or
>> you'd like to get involved with design/development/testing.
>>
>> Regards - Cemal
>> jWeekend
>> OO & Java Technologies, Wicket
>> Consulting, Development, Training
>> http://jWeekend.com
>>
>> [0] includes components based on sortable "portlet", jqGrid/Tree,
>> jGrowl, jQuery UI: Accordian, Dialog, Tabs all integrated with Wicket
>> using wiQuery (http://code.google.com/p/wiquery/)
>> [1] http://labs.jWeekend.com/public/
>> [2] We'd naturally prefer if you didn't zap _all_ the records from our
>> toy database! Yes, we know some of you will take this as an invitation
>> to have a go!
>> [3] No promises on dates just now, but it is something we'd like to do
>> soon.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/wiQuery-components-with-server-side-state---live-demo-tp27758298p27762474.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Bookmarkable root page with PageParameters

2010-03-02 Thread Riyad Kalla
I *thought* I recall this being a known issue that will be addressed
in 1.5 with some of the new bookmarkable work?

On Tue, Mar 2, 2010 at 1:38 PM, Anthony DePalma  wrote:
> I added a bookmarkablePagingNavigator to my page to enhance seo, and
> when the homepage was bound to the context '/stories', it worked very
> well (http://www.luckeffect.com/stories/page/1). However I wanted to
> remove the stories context so the homepage was bound directly to the
> root, and now it seems all my bookmarkable urls are session based like
> so: http://www.luckeffect.com/?x=b8xFzszfimM.
>
> Is there anyway to achieve the bookmarkable functionality with the
> root context? For example, http://www.luckeffect.com/?page=1.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Bookmarkable root page with PageParameters

2010-03-02 Thread Anthony DePalma
I added a bookmarkablePagingNavigator to my page to enhance seo, and
when the homepage was bound to the context '/stories', it worked very
well (http://www.luckeffect.com/stories/page/1). However I wanted to
remove the stories context so the homepage was bound directly to the
root, and now it seems all my bookmarkable urls are session based like
so: http://www.luckeffect.com/?x=b8xFzszfimM.

Is there anyway to achieve the bookmarkable functionality with the
root context? For example, http://www.luckeffect.com/?page=1.

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



Re: Wicket button label

2010-03-02 Thread Riyad Kalla
Natalie,

What have you tried thus far to change the label? Another approach
might be to set the visibility on the CancelButton to false and true
on another FinishButton and then refresh the whole button bar to paint
that state for the last panel?

-R

On Tue, Mar 2, 2010 at 10:09 AM, Metzger, Natalie J.  wrote:
> Hi all,
>
> I'm comparatively new to Wicket and have a question about the wizard button 
> labels. I'm using a Wizard with an AjaxButtonBar and AjaxButtons for previous 
> and next. I would like to change the labels on the last step of the wizard of 
> the cancel and finish buttons. I know how to change those labels for the 
> whole wizard, but it escapes me how do change them in the last step only. Is 
> there any elegant solution to this?
>
> Thanks,
>    Natalie
>

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



Re: [newbie] Wicket, Spring, Hibernate and transactions in views.

2010-03-02 Thread James Carman
Introduce AspectJ and spring-aspects into your build.  You can see an
example of it in my wicket-advanced sample project:

http://svn.carmanconsulting.com/public/wicket-advanced/trunk/

Then, AspectJ will weave the transaction support into your
Page/Component classes like you want.  There are limits on what type
of methods can be transactional, though.  I would also recommend the
OpenSessionInView filter (which my example project also uses).

On Tue, Mar 2, 2010 at 11:25 AM, Colin Rogers  wrote:
> All,
>
>
>
> I've got a bit of a newbie Wicket question involving Spring, Hibernate
> and transactions.
>
>
>
> The question that I can't seem to find an answer to;
>
>
>
> Can a view be a created/injected/aop'd like a spring bean so that it
> honours @Transactional methods for hibernate?
>
>
>
> An example;
>
>
>
> public class HomePage extends WebPage {
>
>
>
> @SpringBean // this is working fine
>
> private SessionFactory sessionFactory;
>
>
>
> public HomePage(final PageParameters parameters) {
>
>
>
> this.init();
>
>      }
>
>
>
>     �...@transactional // this is not working
>
>      public void init() {
>
>
>
>            Criteria criteria =
> sessionFactory.getCurrentSession().createCriteria(MyEntity.class);
>
>            List myEntities = criteria.list();
>
>            for( MyEntity myEntity : myEntities ) {
>
>
>
>                  // where subEntities is a lazy collection
>
>                  for( SubEntity subEntity : myEntity.getSubEntities() )
> {
>
>
>
>                        // ...
>
>                  }
>
>            }
>
> }
>
> }
>
>
>
> I've been reading Wicket In Action book, various places on the net and
> of course, emails on the subject on this list and this particular
> tutorial;
>
>
>
> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
>
>
>
> And I'm still wondering, is this something that is actually possible? I
> could full understand that it wouldn't be - i.e. that the injector only
> works for Spring injection dependency and not AOP or anything else. So
> you inject your dependencies - and they have transaction support etc.
> But that means I'll be having to force fetching of lazily fetched
> children from outside the views themselves, which is obviously very
> painful. It would be so much easier to have transaction support in the
> view itself and not have to delegate.
>
>
>
> Any help would be greatly appreciated.
>
>
>
> The error message I'm receiving is;
>
>
>
> Caused by: org.hibernate.HibernateException: createCriteria is not valid
> without active transaction
>
>      at
> org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWra
> pper.invoke(ThreadLocalSessionContext.java:338)
>
>      at $Proxy15.createCriteria(Unknown Source)
>
>      at com.tenthart.tacs.testpres.HomePage.init(HomePage.java:39)
>
>      at com.tenthart.tacs.testpres.HomePage.(HomePage.java:28)
>
>      ... 34 more
>
>
>
> Cheers,
>
> Col
>
>
>
>
>
>
>
>
>
> Emap delivers intelligence, inspiration and access through publications, 
> events and data businesses in retail, media, the public sector and the built 
> environment. www.emap.com.
>
> The information in or attached to this email is confidential and may be 
> legally privileged. If you are not the intended recipient of this message any 
> use, disclosure, copying, distribution or any action taken in reliance on it 
> is prohibited and may be unlawful. If you have received this message in 
> error, please notify the sender immediately by return email or by telephone 
> on +44(0)207 728 5000 and delete this message and any copies from your 
> computer and network. The Emap group does not warrant that this email and any 
> attachments are free from viruses and accepts no liability for any loss 
> resulting from infected email transmissions.
>
> The Emap group reserves the right to monitor all e-mail communications 
> through its networks. Please note that any views expressed in this email may 
> be those of the originator and do not necessarily reflect those of the Emap 
> group.
>
> GroundSure Ltd. Company number 03421028 (England and Wales)
> Emap Limited. Company number: 0537204 (England and Wales).
> Registered Office: Greater London House, Hampstead Road, London NW1 7EJ, 
> United Kingdom.
> Details of the operating companies forming part of the Emap group can be 
> found at www.emap.com

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



RE: [newbie] Wicket, Spring, Hibernate and transactions in views.

2010-03-02 Thread Colin Rogers
Thats exactly what I am using, but it doesn't seem to work.

I've set up as per the original posts tutorial (that includes
OpenSessionInViewFilter).

The log below show me calling it - and supposedly opening the
transaction (although it does do everything twice);

2010-03-02 17:19:08.690::INFO:  Started
selectchannelconnec...@0.0.0.0:8080
2010-03-02 17:19:12,439 DEBUG  239:OpenSessionInViewFilter - Using
SessionFactory 'sessionFactory' for OpenSessionInViewFilter
2010-03-02 17:19:12,439 DEBUG  239:OpenSessionInViewFilter - Using
SessionFactory 'sessionFactory' for OpenSessionInViewFilter
2010-03-02 17:19:12,439 DEBUG  181:OpenSessionInViewFilter - Opening
single Hibernate Session in OpenSessionInViewFilter
2010-03-02 17:19:12,439 DEBUG  181:OpenSessionInViewFilter - Opening
single Hibernate Session in OpenSessionInViewFilter
2010-03-02 17:19:12,595 ERROR 1521:RequestCycle - Can't
instantiate page using constructor public
com.tenthart.tacs.testpres.HomePage(org.apache.wicket.PageParameters)
and argument 
org.apache.wicket.WicketRuntimeException: Can't instantiate page using
constructor public
com.tenthart.tacs.testpres.HomePage(org.apache.wicket.PageParameters)
and argument 
at
org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFacto
ry.java:212)
at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.
java:65)
at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget
.newPage(BookmarkablePageRequestTarget.java:298)
at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget
.getPage(BookmarkablePageRequestTarget.java:320)
at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget
.processEvents(BookmarkablePageRequestTarget.java:234)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
stractRequestCycleProcessor.java:92)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java
:1250)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479
)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
312)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
dler.java:1084)
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFil
terInternal(OpenSessionInViewFilter.java:198)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequ
estFilter.java:76)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
dler.java:1084)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
16)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:404)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne
ction.java:828)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
395)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.ja
va:450)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
ccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
tructorAccessorImpl.java:27)
at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFacto
ry.java:188)
... 29 more
Caused by: org.hibernate.HibernateException: createCriteria is not valid
without active transaction
at
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWra
pper.invoke(ThreadLocalSessionContext.java:338)
at $Proxy15.createCriteria(Unknown Source)
at com.tenthart.tacs.testpres.HomePage.init(HomePage.java:41)
at com.tenthart.tacs.testpres.HomePage.(HomePage.java:28)
... 34 more
2010-03-02 17:19:12,751 DEBUG 

Re: wiQuery components with server side state - live demo

2010-03-02 Thread Roman Ilin
Great, ready for use components.



On Tue, Mar 2, 2010 at 5:58 PM, Cemal A Bayramoglu  wrote:
> We've been building a few wiQuery components [0], for clients' and
> internal projects. These wiQuery components typically maintain some of
> their state server-side, in the spirit of standard Wicket components.
>
> Here's a simple demo [1] to show some of them in action.
>
> Look carefully and you'll find lots of stuff to click on [2]. We could
> plan to open up the ones we may [3] if they look useful to you or
> you'd like to get involved with design/development/testing.
>
> Regards - Cemal
> jWeekend
> OO & Java Technologies, Wicket
> Consulting, Development, Training
> http://jWeekend.com
>
> [0] includes components based on sortable "portlet", jqGrid/Tree,
> jGrowl, jQuery UI: Accordian, Dialog, Tabs all integrated with Wicket
> using wiQuery (http://code.google.com/p/wiquery/)
> [1] http://labs.jWeekend.com/public/
> [2] We'd naturally prefer if you didn't zap _all_ the records from our
> toy database! Yes, we know some of you will take this as an invitation
> to have a go!
> [3] No promises on dates just now, but it is something we'd like to do soon.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: [newbie] Wicket, Spring, Hibernate and transactions in views.

2010-03-02 Thread Pedro Santos
Consider to use OpenSessionInViewFilter

http://static.springsource.org/spring/docs/1.2.9/api/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.html

The doc: "Intended for the "Open Session in View" pattern, i.e. to allow for
lazy loading in web views despite the original transactions already being
completed."

On Tue, Mar 2, 2010 at 2:05 PM, Colin Rogers  wrote:

> " I'm not DB expert, but why are you using transactions for "read only"
> (SELECTs) queries?"
>
> "If you aren't concerned with "good design" then I wouldn't worry about
> transactions at all"
>
> Because you need the transactions for lazy fetching of child elements in
> hibernate.
>
> -Original Message-
> From: Riyad Kalla [mailto:rka...@gmail.com]
> Sent: 02 March 2010 16:53
> To: users@wicket.apache.org
> Subject: Re: [newbie] Wicket, Spring, Hibernate and transactions in
> views.
>
> I'm not DB expert, but why are you using transactions for "read only"
> (SELECTs) queries? I've only ever seen transactions used to wrap
> INSERT/UPDATE/DELETE statements (writes)
>
> -R
>
> On Tue, Mar 2, 2010 at 9:46 AM, Colin Rogers 
> wrote:
>
> > "I'd recommend you to make your transactional control in your services
> > and call them from your pages instead of trying to control it in your
> > view."
> >
> > I'd agree in terms of "good design", but I'm coding something for
> myself
> > - and I'm trying to make it easy and as little time consuming as
> > possible. So, yes, transactions in the presentation layer is "bad" -
> but
> > it's only read-only transactions, so I'm letting myself off! ;)
> >
> > Having the transactionally controlled service methods, individually
> > instantiate all child entities by hand is also time consuming and
> would
> > potentially harm performance (if the view didn't need the children,
> for
> > example).
> >
> > -Original Message-
> > From: Pedro Sena [mailto:sena.pe...@gmail.com]
> > Sent: 02 March 2010 16:39
> > To: users@wicket.apache.org
> > Subject: Re: [newbie] Wicket, Spring, Hibernate and transactions in
> > views.
> >
> > I don't think so.
> >
> > I'd recommend you to make your transactional control in your services
> > and
> > call them from your pages instead of trying to control it in your
> view.
> >
> > Best Regards,
> >
> > On Tue, Mar 2, 2010 at 1:25 PM, Colin Rogers 
> > wrote:
> >
> > > All,
> > >
> > >
> > >
> > > I've got a bit of a newbie Wicket question involving Spring,
> Hibernate
> > > and transactions.
> > >
> > >
> > >
> > > The question that I can't seem to find an answer to;
> > >
> > >
> > >
> > > Can a view be a created/injected/aop'd like a spring bean so that it
> > > honours @Transactional methods for hibernate?
> > >
> > >
> > >
> > > An example;
> > >
> > >
> > >
> > > public class HomePage extends WebPage {
> > >
> > >
> > >
> > > @SpringBean // this is working fine
> > >
> > > private SessionFactory sessionFactory;
> > >
> > >
> > >
> > > public HomePage(final PageParameters parameters) {
> > >
> > >
> > >
> > > this.init();
> > >
> > >  }
> > >
> > >
> > >
> > >  @Transactional // this is not working
> > >
> > >  public void init() {
> > >
> > >
> > >
> > >Criteria criteria =
> > > sessionFactory.getCurrentSession().createCriteria(MyEntity.class);
> > >
> > >List myEntities = criteria.list();
> > >
> > >for( MyEntity myEntity : myEntities ) {
> > >
> > >
> > >
> > >  // where subEntities is a lazy collection
> > >
> > >  for( SubEntity subEntity :
> myEntity.getSubEntities()
> > )
> > > {
> > >
> > >
> > >
> > >// ...
> > >
> > >  }
> > >
> > >}
> > >
> > > }
> > >
> > > }
> > >
> > >
> > >
> > > I've been reading Wicket In Action book, various places on the net
> and
> > > of course, emails on the subject on this list and this particular
> > > tutorial;
> > >
> > >
> > >
> > >
> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> > >
> > >
> > >
> > > And I'm still wondering, is this something that is actually
> possible?
> > I
> > > could full understand that it wouldn't be - i.e. that the injector
> > only
> > > works for Spring injection dependency and not AOP or anything else.
> So
> > > you inject your dependencies - and they have transaction support
> etc.
> > > But that means I'll be having to force fetching of lazily fetched
> > > children from outside the views themselves, which is obviously very
> > > painful. It would be so much easier to have transaction support in
> the
> > > view itself and not have to delegate.
> > >
> > >
> > >
> > > Any help would be greatly appreciated.
> > >
> > >
> > >
> > > The error message I'm receiving is;
> > >
> > >
> > >
> > > Caused by: org.hibernate.HibernateException: createCriteria is not
> > valid
> > > without active transaction
> > >
> > >  at
> > >
> >
> org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWra
> > > pper.invoke(Threa

Wicket button label

2010-03-02 Thread Metzger, Natalie J.
Hi all,

I'm comparatively new to Wicket and have a question about the wizard button 
labels. I'm using a Wizard with an AjaxButtonBar and AjaxButtons for previous 
and next. I would like to change the labels on the last step of the wizard of 
the cancel and finish buttons. I know how to change those labels for the whole 
wizard, but it escapes me how do change them in the last step only. Is there 
any elegant solution to this?

Thanks,
Natalie


RE: [newbie] Wicket, Spring, Hibernate and transactions in views.

2010-03-02 Thread Colin Rogers
" I'm not DB expert, but why are you using transactions for "read only"
(SELECTs) queries?"

"If you aren't concerned with "good design" then I wouldn't worry about
transactions at all"

Because you need the transactions for lazy fetching of child elements in
hibernate.

-Original Message-
From: Riyad Kalla [mailto:rka...@gmail.com] 
Sent: 02 March 2010 16:53
To: users@wicket.apache.org
Subject: Re: [newbie] Wicket, Spring, Hibernate and transactions in
views.

I'm not DB expert, but why are you using transactions for "read only"
(SELECTs) queries? I've only ever seen transactions used to wrap
INSERT/UPDATE/DELETE statements (writes)

-R

On Tue, Mar 2, 2010 at 9:46 AM, Colin Rogers 
wrote:

> "I'd recommend you to make your transactional control in your services
> and call them from your pages instead of trying to control it in your
> view."
>
> I'd agree in terms of "good design", but I'm coding something for
myself
> - and I'm trying to make it easy and as little time consuming as
> possible. So, yes, transactions in the presentation layer is "bad" -
but
> it's only read-only transactions, so I'm letting myself off! ;)
>
> Having the transactionally controlled service methods, individually
> instantiate all child entities by hand is also time consuming and
would
> potentially harm performance (if the view didn't need the children,
for
> example).
>
> -Original Message-
> From: Pedro Sena [mailto:sena.pe...@gmail.com]
> Sent: 02 March 2010 16:39
> To: users@wicket.apache.org
> Subject: Re: [newbie] Wicket, Spring, Hibernate and transactions in
> views.
>
> I don't think so.
>
> I'd recommend you to make your transactional control in your services
> and
> call them from your pages instead of trying to control it in your
view.
>
> Best Regards,
>
> On Tue, Mar 2, 2010 at 1:25 PM, Colin Rogers 
> wrote:
>
> > All,
> >
> >
> >
> > I've got a bit of a newbie Wicket question involving Spring,
Hibernate
> > and transactions.
> >
> >
> >
> > The question that I can't seem to find an answer to;
> >
> >
> >
> > Can a view be a created/injected/aop'd like a spring bean so that it
> > honours @Transactional methods for hibernate?
> >
> >
> >
> > An example;
> >
> >
> >
> > public class HomePage extends WebPage {
> >
> >
> >
> > @SpringBean // this is working fine
> >
> > private SessionFactory sessionFactory;
> >
> >
> >
> > public HomePage(final PageParameters parameters) {
> >
> >
> >
> > this.init();
> >
> >  }
> >
> >
> >
> >  @Transactional // this is not working
> >
> >  public void init() {
> >
> >
> >
> >Criteria criteria =
> > sessionFactory.getCurrentSession().createCriteria(MyEntity.class);
> >
> >List myEntities = criteria.list();
> >
> >for( MyEntity myEntity : myEntities ) {
> >
> >
> >
> >  // where subEntities is a lazy collection
> >
> >  for( SubEntity subEntity :
myEntity.getSubEntities()
> )
> > {
> >
> >
> >
> >// ...
> >
> >  }
> >
> >}
> >
> > }
> >
> > }
> >
> >
> >
> > I've been reading Wicket In Action book, various places on the net
and
> > of course, emails on the subject on this list and this particular
> > tutorial;
> >
> >
> >
> >
http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> >
> >
> >
> > And I'm still wondering, is this something that is actually
possible?
> I
> > could full understand that it wouldn't be - i.e. that the injector
> only
> > works for Spring injection dependency and not AOP or anything else.
So
> > you inject your dependencies - and they have transaction support
etc.
> > But that means I'll be having to force fetching of lazily fetched
> > children from outside the views themselves, which is obviously very
> > painful. It would be so much easier to have transaction support in
the
> > view itself and not have to delegate.
> >
> >
> >
> > Any help would be greatly appreciated.
> >
> >
> >
> > The error message I'm receiving is;
> >
> >
> >
> > Caused by: org.hibernate.HibernateException: createCriteria is not
> valid
> > without active transaction
> >
> >  at
> >
>
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWra
> > pper.invoke(ThreadLocalSessionContext.java:338)
> >
> >  at $Proxy15.createCriteria(Unknown Source)
> >
> >  at com.tenthart.tacs.testpres.HomePage.init(HomePage.java:39)
> >
> >  at com.tenthart.tacs.testpres.HomePage.(HomePage.java:28)
> >
> >  ... 34 more
> >
> >
> >
> > Cheers,
> >
> > Col
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Emap delivers intelligence, inspiration and access through
> publications,
> > events and data businesses in retail, media, the public sector and
the
> built
> > environment. www.emap.com.
> >
> > The information in or attached to this email is confidential and may
> be
> > legally privileged. If you are not the intended recipient of this
> message
> > any use, disclosure, copying, distribution or any action taken

add attributes to options elements within a palette

2010-03-02 Thread wic...@geofflancaster.com
Is it possible to add attributes to elements within a palette?

I'd like to assign the "title" attribute so i can have tooltips.


mail2web.com – What can On Demand Business Solutions do for you?
http://link.mail2web.com/Business/SharePoint



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



wiQuery components with server side state - live demo

2010-03-02 Thread Cemal A Bayramoglu
We've been building a few wiQuery components [0], for clients' and
internal projects. These wiQuery components typically maintain some of
their state server-side, in the spirit of standard Wicket components.

Here's a simple demo [1] to show some of them in action.

Look carefully and you'll find lots of stuff to click on [2]. We could
plan to open up the ones we may [3] if they look useful to you or
you'd like to get involved with design/development/testing.

Regards - Cemal
jWeekend
OO & Java Technologies, Wicket
Consulting, Development, Training
http://jWeekend.com

[0] includes components based on sortable "portlet", jqGrid/Tree,
jGrowl, jQuery UI: Accordian, Dialog, Tabs all integrated with Wicket
using wiQuery (http://code.google.com/p/wiquery/)
[1] http://labs.jWeekend.com/public/
[2] We'd naturally prefer if you didn't zap _all_ the records from our
toy database! Yes, we know some of you will take this as an invitation
to have a go!
[3] No promises on dates just now, but it is something we'd like to do soon.

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



RE: DownloadLink problem

2010-03-02 Thread Martin Asenov
It doesn't... :-)

Thank you anyway! :-)
-Original Message-
From: Riyad Kalla [mailto:rka...@gmail.com] 
Sent: Tuesday, March 02, 2010 6:35 PM
To: users@wicket.apache.org
Subject: Re: DownloadLink problem

Martin,

If it makes you feel any better, it would have been a week or longer before
I thought to change that, good fine :)

-R

On Tue, Mar 2, 2010 at 9:32 AM, Martin Asenov  wrote:

> Oh my God!!! The problem was that the button that is supposed to do the
> export was of type submit and it reloads the page, instead of refreshing
> components. I changed to type=button and everything's fine...
>
> As people say - there is no patch for human stupidity...
>
> Thank you all for the help!
>
> Best,
> Martin
>
> -Original Message-
> From: Martin Asenov [mailto:mase...@velti.com]
> Sent: Tuesday, March 02, 2010 4:34 PM
> To: users@wicket.apache.org
> Subject: RE: DownloadLink problem
>
> Thanks Ernesto!
>
> But I want to have the link invisible on startup (because the file's
> empty). So I have this: (doesn't work, but has to)
>
>exportedFileLink = new DownloadLink("exported_file_link", new
> LoadableDetachableModel() {
>
>  private static final long serialVersionUID = 1L;
>
>  @Override
>  protected File load() {
>return exportedFile;
>  }
>}, PhonebookExporter.OUTPUT_FILE_NAME) {
>
>  private static final long serialVersionUID = 1L;
>
>  @Override
>  public boolean isVisible() {
>return exportedFile != null;
>  }
>};
>final WebMarkupContainer exportedFileLinkHolder = new
> WebMarkupContainer("link_holder");
>exportedFileLinkHolder.setOutputMarkupId(true);
>exportedFileLinkHolder.add(exportedFileLink);
>
>rightForm.add(exportedFileLinkHolder);
>rightForm.add(new AjaxButton("export_button") {
>
>  private static final long serialVersionUID = 1L;
>
>  @Override
>  protected void onSubmit(AjaxRequestTarget target, Form form) {
>
>PhonebookExporter exporter = getExporter();
>exportedFile = exporter.export(uploadFolder);
>
>if (exportedFile == null) {
>  error(getString("not_exported"));
>} else {
>  info(getString("exported"));
>}
>
>target.addComponent(exportedFileLinkHolder);
>target.addComponent(feed);
>  }
>
>});
>
> I really start to get pissed off by this one!!! g
>
> Regards,
> Martin
>
> -Original Message-
> From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Sent: Tuesday, March 02, 2010 3:50 PM
> To: users@wicket.apache.org
> Subject: Re: DownloadLink problem
>
> Weird. Just try this example:
>
> import java.io.File;
>
> import org.apache.wicket.ajax.AjaxRequestTarget;
> import org.apache.wicket.ajax.markup.html.AjaxLink;
> import org.apache.wicket.markup.html.link.DownloadLink;
> import org.apache.wicket.markup.html.panel.Panel;
> import org.apache.wicket.model.AbstractReadOnlyModel;
>
> /**
>  * @author Ernesto Reinaldo Barreiro (reier...@gmail.com)
>  *
>  */
> public class TestDownLoadLink extends Panel {
>
>
>private static final long serialVersionUID = 1L;
>
>private File test = null;
>
>private DownloadLink download;
>/**
> * @param id
> */
>public TestDownLoadLink(String id) {
>super(id);
>
>this.download = new DownloadLink("download", new
> AbstractReadOnlyModel(){
>
> private static final long
> serialVersionUID = 1L;
>
>@Override
>public File getObject() {
>return test;
>}
>
> },"TestDownLoadLink.html") {
>
>private static final long serialVersionUID = 1L;
>
>@Override
>public boolean isEnabled() {
>
>return test != null;
>}
> };
> download.setOutputMarkupId(true);
> add(download);
>
> AjaxLink update = new AjaxLink("update") {
>
>private static final long serialVersionUID = 1L;
>
>@Override
>public void onClick(AjaxRequestTarget target) {
>test = new
>
> File(TestDownLoadLink.class.getResource("TestDownLoadLink.html").getFile());
>if(target != null) {
>target.addComponent(TestDownLoadLink.this.download);
>}
>}
> };
>
> add(update);
>}
> }
>
> and the HTML
>
> 
> 
> 
> 
> 
> download
> Click me to update download
> 
> 
> 
>
> Just place them somewhere and do
>
> new TestDownLoadLink("xxx");
>
> It works for me. First time the download link is disable and when you click
> on the AJAX link file is assigned, link is refreshed and you can download
> your file;-)
>
> Best,
>
> Ernesto
>
> On Tue, Mar 2, 2010 at 2:24 PM, Martin Asenov  wrote:
>
> > Unfortunately doesn't work this way... The model is never refreshed...
> >
> > -Original Message-
> > From: Ernesto Reinaldo Barre

Re: [newbie] Wicket, Spring, Hibernate and transactions in views.

2010-03-02 Thread Riyad Kalla
I'm not DB expert, but why are you using transactions for "read only"
(SELECTs) queries? I've only ever seen transactions used to wrap
INSERT/UPDATE/DELETE statements (writes)

-R

On Tue, Mar 2, 2010 at 9:46 AM, Colin Rogers  wrote:

> "I'd recommend you to make your transactional control in your services
> and call them from your pages instead of trying to control it in your
> view."
>
> I'd agree in terms of "good design", but I'm coding something for myself
> - and I'm trying to make it easy and as little time consuming as
> possible. So, yes, transactions in the presentation layer is "bad" - but
> it's only read-only transactions, so I'm letting myself off! ;)
>
> Having the transactionally controlled service methods, individually
> instantiate all child entities by hand is also time consuming and would
> potentially harm performance (if the view didn't need the children, for
> example).
>
> -Original Message-
> From: Pedro Sena [mailto:sena.pe...@gmail.com]
> Sent: 02 March 2010 16:39
> To: users@wicket.apache.org
> Subject: Re: [newbie] Wicket, Spring, Hibernate and transactions in
> views.
>
> I don't think so.
>
> I'd recommend you to make your transactional control in your services
> and
> call them from your pages instead of trying to control it in your view.
>
> Best Regards,
>
> On Tue, Mar 2, 2010 at 1:25 PM, Colin Rogers 
> wrote:
>
> > All,
> >
> >
> >
> > I've got a bit of a newbie Wicket question involving Spring, Hibernate
> > and transactions.
> >
> >
> >
> > The question that I can't seem to find an answer to;
> >
> >
> >
> > Can a view be a created/injected/aop'd like a spring bean so that it
> > honours @Transactional methods for hibernate?
> >
> >
> >
> > An example;
> >
> >
> >
> > public class HomePage extends WebPage {
> >
> >
> >
> > @SpringBean // this is working fine
> >
> > private SessionFactory sessionFactory;
> >
> >
> >
> > public HomePage(final PageParameters parameters) {
> >
> >
> >
> > this.init();
> >
> >  }
> >
> >
> >
> >  @Transactional // this is not working
> >
> >  public void init() {
> >
> >
> >
> >Criteria criteria =
> > sessionFactory.getCurrentSession().createCriteria(MyEntity.class);
> >
> >List myEntities = criteria.list();
> >
> >for( MyEntity myEntity : myEntities ) {
> >
> >
> >
> >  // where subEntities is a lazy collection
> >
> >  for( SubEntity subEntity : myEntity.getSubEntities()
> )
> > {
> >
> >
> >
> >// ...
> >
> >  }
> >
> >}
> >
> > }
> >
> > }
> >
> >
> >
> > I've been reading Wicket In Action book, various places on the net and
> > of course, emails on the subject on this list and this particular
> > tutorial;
> >
> >
> >
> > http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
> >
> >
> >
> > And I'm still wondering, is this something that is actually possible?
> I
> > could full understand that it wouldn't be - i.e. that the injector
> only
> > works for Spring injection dependency and not AOP or anything else. So
> > you inject your dependencies - and they have transaction support etc.
> > But that means I'll be having to force fetching of lazily fetched
> > children from outside the views themselves, which is obviously very
> > painful. It would be so much easier to have transaction support in the
> > view itself and not have to delegate.
> >
> >
> >
> > Any help would be greatly appreciated.
> >
> >
> >
> > The error message I'm receiving is;
> >
> >
> >
> > Caused by: org.hibernate.HibernateException: createCriteria is not
> valid
> > without active transaction
> >
> >  at
> >
> org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWra
> > pper.invoke(ThreadLocalSessionContext.java:338)
> >
> >  at $Proxy15.createCriteria(Unknown Source)
> >
> >  at com.tenthart.tacs.testpres.HomePage.init(HomePage.java:39)
> >
> >  at com.tenthart.tacs.testpres.HomePage.(HomePage.java:28)
> >
> >  ... 34 more
> >
> >
> >
> > Cheers,
> >
> > Col
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Emap delivers intelligence, inspiration and access through
> publications,
> > events and data businesses in retail, media, the public sector and the
> built
> > environment. www.emap.com.
> >
> > The information in or attached to this email is confidential and may
> be
> > legally privileged. If you are not the intended recipient of this
> message
> > any use, disclosure, copying, distribution or any action taken in
> reliance
> > on it is prohibited and may be unlawful. If you have received this
> message
> > in error, please notify the sender immediately by return email or by
> > telephone on +44(0)207 728 5000 and delete this message and any copies
> from
> > your computer and network. The Emap group does not warrant that this
> email
> > and any attachments are free from viruses and accepts no liability for
> any
> > loss resulting from infected email transmissions.
> >
> >

RE: [newbie] Wicket, Spring, Hibernate and transactions in views.

2010-03-02 Thread Josh Chappelle
If you aren't concerned with "good design" then I wouldn't worry about
transactions at all. Especially if you are doing read only data retrieval. 

Once you get the code working the way you want you can always add
transactions later and refactor the code into your service methods. That's
the agile method anyway. :-)

Josh

-Original Message-
From: Colin Rogers [mailto:coli...@groundsure.com] 
Sent: Tuesday, March 02, 2010 10:46 AM
To: users@wicket.apache.org
Subject: RE: [newbie] Wicket, Spring, Hibernate and transactions in views.

"I'd recommend you to make your transactional control in your services
and call them from your pages instead of trying to control it in your
view."

I'd agree in terms of "good design", but I'm coding something for myself
- and I'm trying to make it easy and as little time consuming as
possible. So, yes, transactions in the presentation layer is "bad" - but
it's only read-only transactions, so I'm letting myself off! ;)

Having the transactionally controlled service methods, individually
instantiate all child entities by hand is also time consuming and would
potentially harm performance (if the view didn't need the children, for
example).

-Original Message-
From: Pedro Sena [mailto:sena.pe...@gmail.com] 
Sent: 02 March 2010 16:39
To: users@wicket.apache.org
Subject: Re: [newbie] Wicket, Spring, Hibernate and transactions in
views.

I don't think so.

I'd recommend you to make your transactional control in your services
and
call them from your pages instead of trying to control it in your view.

Best Regards,

On Tue, Mar 2, 2010 at 1:25 PM, Colin Rogers 
wrote:

> All,
>
>
>
> I've got a bit of a newbie Wicket question involving Spring, Hibernate
> and transactions.
>
>
>
> The question that I can't seem to find an answer to;
>
>
>
> Can a view be a created/injected/aop'd like a spring bean so that it
> honours @Transactional methods for hibernate?
>
>
>
> An example;
>
>
>
> public class HomePage extends WebPage {
>
>
>
> @SpringBean // this is working fine
>
> private SessionFactory sessionFactory;
>
>
>
> public HomePage(final PageParameters parameters) {
>
>
>
> this.init();
>
>  }
>
>
>
>  @Transactional // this is not working
>
>  public void init() {
>
>
>
>Criteria criteria =
> sessionFactory.getCurrentSession().createCriteria(MyEntity.class);
>
>List myEntities = criteria.list();
>
>for( MyEntity myEntity : myEntities ) {
>
>
>
>  // where subEntities is a lazy collection
>
>  for( SubEntity subEntity : myEntity.getSubEntities()
)
> {
>
>
>
>// ...
>
>  }
>
>}
>
> }
>
> }
>
>
>
> I've been reading Wicket In Action book, various places on the net and
> of course, emails on the subject on this list and this particular
> tutorial;
>
>
>
> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
>
>
>
> And I'm still wondering, is this something that is actually possible?
I
> could full understand that it wouldn't be - i.e. that the injector
only
> works for Spring injection dependency and not AOP or anything else. So
> you inject your dependencies - and they have transaction support etc.
> But that means I'll be having to force fetching of lazily fetched
> children from outside the views themselves, which is obviously very
> painful. It would be so much easier to have transaction support in the
> view itself and not have to delegate.
>
>
>
> Any help would be greatly appreciated.
>
>
>
> The error message I'm receiving is;
>
>
>
> Caused by: org.hibernate.HibernateException: createCriteria is not
valid
> without active transaction
>
>  at
>
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWra
> pper.invoke(ThreadLocalSessionContext.java:338)
>
>  at $Proxy15.createCriteria(Unknown Source)
>
>  at com.tenthart.tacs.testpres.HomePage.init(HomePage.java:39)
>
>  at com.tenthart.tacs.testpres.HomePage.(HomePage.java:28)
>
>  ... 34 more
>
>
>
> Cheers,
>
> Col
>
>
>
>
>
>
>
>
>
> Emap delivers intelligence, inspiration and access through
publications,
> events and data businesses in retail, media, the public sector and the
built
> environment. www.emap.com.
>
> The information in or attached to this email is confidential and may
be
> legally privileged. If you are not the intended recipient of this
message
> any use, disclosure, copying, distribution or any action taken in
reliance
> on it is prohibited and may be unlawful. If you have received this
message
> in error, please notify the sender immediately by return email or by
> telephone on +44(0)207 728 5000 and delete this message and any copies
from
> your computer and network. The Emap group does not warrant that this
email
> and any attachments are free from viruses and accepts no liability for
any
> loss resulting from infected email transmissions.
>
> The Emap group reserves the right to monitor all e-mail communicatio

RE: [newbie] Wicket, Spring, Hibernate and transactions in views.

2010-03-02 Thread Colin Rogers
"I'd recommend you to make your transactional control in your services
and call them from your pages instead of trying to control it in your
view."

I'd agree in terms of "good design", but I'm coding something for myself
- and I'm trying to make it easy and as little time consuming as
possible. So, yes, transactions in the presentation layer is "bad" - but
it's only read-only transactions, so I'm letting myself off! ;)

Having the transactionally controlled service methods, individually
instantiate all child entities by hand is also time consuming and would
potentially harm performance (if the view didn't need the children, for
example).

-Original Message-
From: Pedro Sena [mailto:sena.pe...@gmail.com] 
Sent: 02 March 2010 16:39
To: users@wicket.apache.org
Subject: Re: [newbie] Wicket, Spring, Hibernate and transactions in
views.

I don't think so.

I'd recommend you to make your transactional control in your services
and
call them from your pages instead of trying to control it in your view.

Best Regards,

On Tue, Mar 2, 2010 at 1:25 PM, Colin Rogers 
wrote:

> All,
>
>
>
> I've got a bit of a newbie Wicket question involving Spring, Hibernate
> and transactions.
>
>
>
> The question that I can't seem to find an answer to;
>
>
>
> Can a view be a created/injected/aop'd like a spring bean so that it
> honours @Transactional methods for hibernate?
>
>
>
> An example;
>
>
>
> public class HomePage extends WebPage {
>
>
>
> @SpringBean // this is working fine
>
> private SessionFactory sessionFactory;
>
>
>
> public HomePage(final PageParameters parameters) {
>
>
>
> this.init();
>
>  }
>
>
>
>  @Transactional // this is not working
>
>  public void init() {
>
>
>
>Criteria criteria =
> sessionFactory.getCurrentSession().createCriteria(MyEntity.class);
>
>List myEntities = criteria.list();
>
>for( MyEntity myEntity : myEntities ) {
>
>
>
>  // where subEntities is a lazy collection
>
>  for( SubEntity subEntity : myEntity.getSubEntities()
)
> {
>
>
>
>// ...
>
>  }
>
>}
>
> }
>
> }
>
>
>
> I've been reading Wicket In Action book, various places on the net and
> of course, emails on the subject on this list and this particular
> tutorial;
>
>
>
> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
>
>
>
> And I'm still wondering, is this something that is actually possible?
I
> could full understand that it wouldn't be - i.e. that the injector
only
> works for Spring injection dependency and not AOP or anything else. So
> you inject your dependencies - and they have transaction support etc.
> But that means I'll be having to force fetching of lazily fetched
> children from outside the views themselves, which is obviously very
> painful. It would be so much easier to have transaction support in the
> view itself and not have to delegate.
>
>
>
> Any help would be greatly appreciated.
>
>
>
> The error message I'm receiving is;
>
>
>
> Caused by: org.hibernate.HibernateException: createCriteria is not
valid
> without active transaction
>
>  at
>
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWra
> pper.invoke(ThreadLocalSessionContext.java:338)
>
>  at $Proxy15.createCriteria(Unknown Source)
>
>  at com.tenthart.tacs.testpres.HomePage.init(HomePage.java:39)
>
>  at com.tenthart.tacs.testpres.HomePage.(HomePage.java:28)
>
>  ... 34 more
>
>
>
> Cheers,
>
> Col
>
>
>
>
>
>
>
>
>
> Emap delivers intelligence, inspiration and access through
publications,
> events and data businesses in retail, media, the public sector and the
built
> environment. www.emap.com.
>
> The information in or attached to this email is confidential and may
be
> legally privileged. If you are not the intended recipient of this
message
> any use, disclosure, copying, distribution or any action taken in
reliance
> on it is prohibited and may be unlawful. If you have received this
message
> in error, please notify the sender immediately by return email or by
> telephone on +44(0)207 728 5000 and delete this message and any copies
from
> your computer and network. The Emap group does not warrant that this
email
> and any attachments are free from viruses and accepts no liability for
any
> loss resulting from infected email transmissions.
>
> The Emap group reserves the right to monitor all e-mail communications
> through its networks. Please note that any views expressed in this
email may
> be those of the originator and do not necessarily reflect those of the
Emap
> group.
>
> GroundSure Ltd. Company number 03421028 (England and Wales)
> Emap Limited. Company number: 0537204 (England and Wales).
> Registered Office: Greater London House, Hampstead Road, London NW1
7EJ,
> United Kingdom.
> Details of the operating companies forming part of the Emap group can
be
> found at www.emap.com




-- 
/**
* Pedro Sena
* Systems Architect
* Sun Certified 

Re: [newbie] Wicket, Spring, Hibernate and transactions in views.

2010-03-02 Thread Pedro Sena
I don't think so.

I'd recommend you to make your transactional control in your services and
call them from your pages instead of trying to control it in your view.

Best Regards,

On Tue, Mar 2, 2010 at 1:25 PM, Colin Rogers  wrote:

> All,
>
>
>
> I've got a bit of a newbie Wicket question involving Spring, Hibernate
> and transactions.
>
>
>
> The question that I can't seem to find an answer to;
>
>
>
> Can a view be a created/injected/aop'd like a spring bean so that it
> honours @Transactional methods for hibernate?
>
>
>
> An example;
>
>
>
> public class HomePage extends WebPage {
>
>
>
> @SpringBean // this is working fine
>
> private SessionFactory sessionFactory;
>
>
>
> public HomePage(final PageParameters parameters) {
>
>
>
> this.init();
>
>  }
>
>
>
>  @Transactional // this is not working
>
>  public void init() {
>
>
>
>Criteria criteria =
> sessionFactory.getCurrentSession().createCriteria(MyEntity.class);
>
>List myEntities = criteria.list();
>
>for( MyEntity myEntity : myEntities ) {
>
>
>
>  // where subEntities is a lazy collection
>
>  for( SubEntity subEntity : myEntity.getSubEntities() )
> {
>
>
>
>// ...
>
>  }
>
>}
>
> }
>
> }
>
>
>
> I've been reading Wicket In Action book, various places on the net and
> of course, emails on the subject on this list and this particular
> tutorial;
>
>
>
> http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
>
>
>
> And I'm still wondering, is this something that is actually possible? I
> could full understand that it wouldn't be - i.e. that the injector only
> works for Spring injection dependency and not AOP or anything else. So
> you inject your dependencies - and they have transaction support etc.
> But that means I'll be having to force fetching of lazily fetched
> children from outside the views themselves, which is obviously very
> painful. It would be so much easier to have transaction support in the
> view itself and not have to delegate.
>
>
>
> Any help would be greatly appreciated.
>
>
>
> The error message I'm receiving is;
>
>
>
> Caused by: org.hibernate.HibernateException: createCriteria is not valid
> without active transaction
>
>  at
> org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWra
> pper.invoke(ThreadLocalSessionContext.java:338)
>
>  at $Proxy15.createCriteria(Unknown Source)
>
>  at com.tenthart.tacs.testpres.HomePage.init(HomePage.java:39)
>
>  at com.tenthart.tacs.testpres.HomePage.(HomePage.java:28)
>
>  ... 34 more
>
>
>
> Cheers,
>
> Col
>
>
>
>
>
>
>
>
>
> Emap delivers intelligence, inspiration and access through publications,
> events and data businesses in retail, media, the public sector and the built
> environment. www.emap.com.
>
> The information in or attached to this email is confidential and may be
> legally privileged. If you are not the intended recipient of this message
> any use, disclosure, copying, distribution or any action taken in reliance
> on it is prohibited and may be unlawful. If you have received this message
> in error, please notify the sender immediately by return email or by
> telephone on +44(0)207 728 5000 and delete this message and any copies from
> your computer and network. The Emap group does not warrant that this email
> and any attachments are free from viruses and accepts no liability for any
> loss resulting from infected email transmissions.
>
> The Emap group reserves the right to monitor all e-mail communications
> through its networks. Please note that any views expressed in this email may
> be those of the originator and do not necessarily reflect those of the Emap
> group.
>
> GroundSure Ltd. Company number 03421028 (England and Wales)
> Emap Limited. Company number: 0537204 (England and Wales).
> Registered Office: Greater London House, Hampstead Road, London NW1 7EJ,
> United Kingdom.
> Details of the operating companies forming part of the Emap group can be
> found at www.emap.com




-- 
/**
* Pedro Sena
* Systems Architect
* Sun Certified Java Programmer
* Sun Certified Web Component Developer
*/


Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Sergey Olefir



bgooren wrote:
> 
> You gotta love Wicket for making it quite easy to do this stuff; 
> 


Actually I think in this particular case Wicket didn't make it 'easy' to do
what I needed to do. It would've been easy and logical if I could change
SharedResources method so it doesn't use class name in the first place.

The second logical option (or maybe even first) would've been
CryptedUrlWebRequestCodingStrategy -- but modifications there for this
purpose appear to be non-trivial.

Modifications I've made to WebRequestCodingStrategy are closer to a dirty
hack -- they depend on internal format used by SharedResources and are doing
a guesswork as to what is FQN and what is not. But at least modifications
there are possible and are minor (not likely to break something else).
-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27757987.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: DownloadLink problem

2010-03-02 Thread Riyad Kalla
Martin,

If it makes you feel any better, it would have been a week or longer before
I thought to change that, good fine :)

-R

On Tue, Mar 2, 2010 at 9:32 AM, Martin Asenov  wrote:

> Oh my God!!! The problem was that the button that is supposed to do the
> export was of type submit and it reloads the page, instead of refreshing
> components. I changed to type=button and everything's fine...
>
> As people say - there is no patch for human stupidity...
>
> Thank you all for the help!
>
> Best,
> Martin
>
> -Original Message-
> From: Martin Asenov [mailto:mase...@velti.com]
> Sent: Tuesday, March 02, 2010 4:34 PM
> To: users@wicket.apache.org
> Subject: RE: DownloadLink problem
>
> Thanks Ernesto!
>
> But I want to have the link invisible on startup (because the file's
> empty). So I have this: (doesn't work, but has to)
>
>exportedFileLink = new DownloadLink("exported_file_link", new
> LoadableDetachableModel() {
>
>  private static final long serialVersionUID = 1L;
>
>  @Override
>  protected File load() {
>return exportedFile;
>  }
>}, PhonebookExporter.OUTPUT_FILE_NAME) {
>
>  private static final long serialVersionUID = 1L;
>
>  @Override
>  public boolean isVisible() {
>return exportedFile != null;
>  }
>};
>final WebMarkupContainer exportedFileLinkHolder = new
> WebMarkupContainer("link_holder");
>exportedFileLinkHolder.setOutputMarkupId(true);
>exportedFileLinkHolder.add(exportedFileLink);
>
>rightForm.add(exportedFileLinkHolder);
>rightForm.add(new AjaxButton("export_button") {
>
>  private static final long serialVersionUID = 1L;
>
>  @Override
>  protected void onSubmit(AjaxRequestTarget target, Form form) {
>
>PhonebookExporter exporter = getExporter();
>exportedFile = exporter.export(uploadFolder);
>
>if (exportedFile == null) {
>  error(getString("not_exported"));
>} else {
>  info(getString("exported"));
>}
>
>target.addComponent(exportedFileLinkHolder);
>target.addComponent(feed);
>  }
>
>});
>
> I really start to get pissed off by this one!!! g
>
> Regards,
> Martin
>
> -Original Message-
> From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Sent: Tuesday, March 02, 2010 3:50 PM
> To: users@wicket.apache.org
> Subject: Re: DownloadLink problem
>
> Weird. Just try this example:
>
> import java.io.File;
>
> import org.apache.wicket.ajax.AjaxRequestTarget;
> import org.apache.wicket.ajax.markup.html.AjaxLink;
> import org.apache.wicket.markup.html.link.DownloadLink;
> import org.apache.wicket.markup.html.panel.Panel;
> import org.apache.wicket.model.AbstractReadOnlyModel;
>
> /**
>  * @author Ernesto Reinaldo Barreiro (reier...@gmail.com)
>  *
>  */
> public class TestDownLoadLink extends Panel {
>
>
>private static final long serialVersionUID = 1L;
>
>private File test = null;
>
>private DownloadLink download;
>/**
> * @param id
> */
>public TestDownLoadLink(String id) {
>super(id);
>
>this.download = new DownloadLink("download", new
> AbstractReadOnlyModel(){
>
> private static final long
> serialVersionUID = 1L;
>
>@Override
>public File getObject() {
>return test;
>}
>
> },"TestDownLoadLink.html") {
>
>private static final long serialVersionUID = 1L;
>
>@Override
>public boolean isEnabled() {
>
>return test != null;
>}
> };
> download.setOutputMarkupId(true);
> add(download);
>
> AjaxLink update = new AjaxLink("update") {
>
>private static final long serialVersionUID = 1L;
>
>@Override
>public void onClick(AjaxRequestTarget target) {
>test = new
>
> File(TestDownLoadLink.class.getResource("TestDownLoadLink.html").getFile());
>if(target != null) {
>target.addComponent(TestDownLoadLink.this.download);
>}
>}
> };
>
> add(update);
>}
> }
>
> and the HTML
>
> 
> 
> 
> 
> 
> download
> Click me to update download
> 
> 
> 
>
> Just place them somewhere and do
>
> new TestDownLoadLink("xxx");
>
> It works for me. First time the download link is disable and when you click
> on the AJAX link file is assigned, link is refreshed and you can download
> your file;-)
>
> Best,
>
> Ernesto
>
> On Tue, Mar 2, 2010 at 2:24 PM, Martin Asenov  wrote:
>
> > Unfortunately doesn't work this way... The model is never refreshed...
> >
> > -Original Message-
> > From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> > Sent: Tuesday, March 02, 2010 2:31 PM
> > To: users@wicket.apache.org
> > Subject: Re: DownloadLink problem
> >
> > Not sure... but could you try something like:
> >
> > Download

RE: DownloadLink problem

2010-03-02 Thread Martin Asenov
Oh my God!!! The problem was that the button that is supposed to do the export 
was of type submit and it reloads the page, instead of refreshing components. I 
changed to type=button and everything's fine...

As people say - there is no patch for human stupidity...

Thank you all for the help!

Best,
Martin

-Original Message-
From: Martin Asenov [mailto:mase...@velti.com] 
Sent: Tuesday, March 02, 2010 4:34 PM
To: users@wicket.apache.org
Subject: RE: DownloadLink problem

Thanks Ernesto!

But I want to have the link invisible on startup (because the file's empty). So 
I have this: (doesn't work, but has to)

exportedFileLink = new DownloadLink("exported_file_link", new 
LoadableDetachableModel() {

  private static final long serialVersionUID = 1L;

  @Override
  protected File load() {
return exportedFile;
  }
}, PhonebookExporter.OUTPUT_FILE_NAME) {

  private static final long serialVersionUID = 1L;

  @Override
  public boolean isVisible() {
return exportedFile != null;
  }
};
final WebMarkupContainer exportedFileLinkHolder = new 
WebMarkupContainer("link_holder");
exportedFileLinkHolder.setOutputMarkupId(true);
exportedFileLinkHolder.add(exportedFileLink);

rightForm.add(exportedFileLinkHolder);
rightForm.add(new AjaxButton("export_button") {

  private static final long serialVersionUID = 1L;

  @Override
  protected void onSubmit(AjaxRequestTarget target, Form form) {

PhonebookExporter exporter = getExporter();
exportedFile = exporter.export(uploadFolder);

if (exportedFile == null) {
  error(getString("not_exported"));
} else {
  info(getString("exported"));
}

target.addComponent(exportedFileLinkHolder);
target.addComponent(feed);
  }
  
});

I really start to get pissed off by this one!!! g

Regards,
Martin

-Original Message-
From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] 
Sent: Tuesday, March 02, 2010 3:50 PM
To: users@wicket.apache.org
Subject: Re: DownloadLink problem

Weird. Just try this example:

import java.io.File;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.link.DownloadLink;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.AbstractReadOnlyModel;

/**
 * @author Ernesto Reinaldo Barreiro (reier...@gmail.com)
 *
 */
public class TestDownLoadLink extends Panel {


private static final long serialVersionUID = 1L;

private File test = null;

private DownloadLink download;
/**
 * @param id
 */
public TestDownLoadLink(String id) {
super(id);

this.download = new DownloadLink("download", new
AbstractReadOnlyModel(){

 private static final long
serialVersionUID = 1L;

@Override
public File getObject() {
return test;
}

 },"TestDownLoadLink.html") {

private static final long serialVersionUID = 1L;

@Override
public boolean isEnabled() {

return test != null;
}
 };
 download.setOutputMarkupId(true);
 add(download);

 AjaxLink update = new AjaxLink("update") {

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
test = new
File(TestDownLoadLink.class.getResource("TestDownLoadLink.html").getFile());
if(target != null) {
target.addComponent(TestDownLoadLink.this.download);
}
}
 };

 add(update);
}
}

and the HTML






download
Click me to update download




Just place them somewhere and do

new TestDownLoadLink("xxx");

It works for me. First time the download link is disable and when you click
on the AJAX link file is assigned, link is refreshed and you can download
your file;-)

Best,

Ernesto

On Tue, Mar 2, 2010 at 2:24 PM, Martin Asenov  wrote:

> Unfortunately doesn't work this way... The model is never refreshed...
>
> -Original Message-
> From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Sent: Tuesday, March 02, 2010 2:31 PM
> To: users@wicket.apache.org
> Subject: Re: DownloadLink problem
>
> Not sure... but could you try something like:
>
> DownloadLink downloadLink = new DownloadLink("link_id", new
> AbstractReadOnlyModel(){
>public File getObject() {
>return this.linkModel;
>};
>},"myfile.xxx");
>downloadLink.setOutputMarkupId(true);
>
> and make linkModel a member variable? This way file will be "refreshed".
>
> Best,
>
> Ernnesto
>
> On Tue, Mar 2, 2010 at 1:14 PM, Martin Asenov  w

Re: CompoundPropertyModel issue

2010-03-02 Thread Xavier López
I think the Model you are passing to the constructor refers to the choices
Model. Try using EmployeeDropDownChoice("approvaloficer",new Model(), new
Model(""));

Cheers,
Xavier

2010/3/2 chinedu efoagui 

> hello,
>
> i am added a dropdownchoice to a form. The form's model is set to a
> CompoundPropertyModel
> as shown below
> IModel zaModel=new CompoundPropertyModel(selected);
> leaveform.setModel(zaModel);
>
> Now the dropdown shows a list of Employees
>
> EmployeeDropDownChoice approvalofficers=new
> EmployeeDropDownChoice("approvaloficer",new Model(""));
>leaveform.add(approvalofficers);
> Now when I run it gives me error that it can find the getter property
> of component "approvaloficer"
> Now the thing is the component is
> So how do i exclude the component from the CompoundPropertyModel and
> still have  it show ?
> I thought i could achieve that with by passing an emppty model into
> its constructor like new model?
> how do i solve this??
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
"Klein bottle for rent--inquire within."


Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread bgooren

Good to know I contributed something useful to this thread haha.

The code looks like the stuff I had in mind.

You gotta love Wicket for making it quite easy to do this stuff; Although
the URL encoding/decoding can be quite complex for beginners, but that is
likely to be fixed in the future (I've had a look at Matej's wicket-ng
implementation, and it looks very promising).


Sergey Olefir wrote:
> 
> 
> Thanks to your idea, I played around with WebRequestCodingStrategy and
> below is what I came up with.
> 
> It uses jasypt, but feel free to replace it with whatever you like more.
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27757852.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



[newbie] Wicket, Spring, Hibernate and transactions in views.

2010-03-02 Thread Colin Rogers
All,

 

I've got a bit of a newbie Wicket question involving Spring, Hibernate
and transactions.

 

The question that I can't seem to find an answer to;

 

Can a view be a created/injected/aop'd like a spring bean so that it
honours @Transactional methods for hibernate?

 

An example;

 

public class HomePage extends WebPage {

 

@SpringBean // this is working fine

private SessionFactory sessionFactory;

  

public HomePage(final PageParameters parameters) {

 

this.init();

  }

  

  @Transactional // this is not working

  public void init() {



Criteria criteria =
sessionFactory.getCurrentSession().createCriteria(MyEntity.class);

List myEntities = criteria.list();

for( MyEntity myEntity : myEntities ) {

  

  // where subEntities is a lazy collection

  for( SubEntity subEntity : myEntity.getSubEntities() )
{



// ...

  }

} 

}

}

 

I've been reading Wicket In Action book, various places on the net and
of course, emails on the subject on this list and this particular
tutorial;

 

http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/

 

And I'm still wondering, is this something that is actually possible? I
could full understand that it wouldn't be - i.e. that the injector only
works for Spring injection dependency and not AOP or anything else. So
you inject your dependencies - and they have transaction support etc.
But that means I'll be having to force fetching of lazily fetched
children from outside the views themselves, which is obviously very
painful. It would be so much easier to have transaction support in the
view itself and not have to delegate.

 

Any help would be greatly appreciated.

 

The error message I'm receiving is;

 

Caused by: org.hibernate.HibernateException: createCriteria is not valid
without active transaction

  at
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWra
pper.invoke(ThreadLocalSessionContext.java:338)

  at $Proxy15.createCriteria(Unknown Source)

  at com.tenthart.tacs.testpres.HomePage.init(HomePage.java:39)

  at com.tenthart.tacs.testpres.HomePage.(HomePage.java:28)

  ... 34 more

 

Cheers,

Col

 

 

 

 

Emap delivers intelligence, inspiration and access through publications, events 
and data businesses in retail, media, the public sector and the built 
environment. www.emap.com.

The information in or attached to this email is confidential and may be legally 
privileged. If you are not the intended recipient of this message any use, 
disclosure, copying, distribution or any action taken in reliance on it is 
prohibited and may be unlawful. If you have received this message in error, 
please notify the sender immediately by return email or by telephone on 
+44(0)207 728 5000 and delete this message and any copies from your computer 
and network. The Emap group does not warrant that this email and any 
attachments are free from viruses and accepts no liability for any loss 
resulting from infected email transmissions.

The Emap group reserves the right to monitor all e-mail communications through 
its networks. Please note that any views expressed in this email may be those 
of the originator and do not necessarily reflect those of the Emap group.

GroundSure Ltd. Company number 03421028 (England and Wales)
Emap Limited. Company number: 0537204 (England and Wales).
Registered Office: Greater London House, Hampstead Road, London NW1 7EJ, United 
Kingdom.
Details of the operating companies forming part of the Emap group can be found 
at www.emap.com

CompoundPropertyModel issue

2010-03-02 Thread chinedu efoagui
hello,

i am added a dropdownchoice to a form. The form's model is set to a
CompoundPropertyModel
as shown below
IModel zaModel=new CompoundPropertyModel(selected);
leaveform.setModel(zaModel);

Now the dropdown shows a list of Employees

EmployeeDropDownChoice approvalofficers=new
EmployeeDropDownChoice("approvaloficer",new Model(""));
leaveform.add(approvalofficers);
Now when I run it gives me error that it can find the getter property
of component "approvaloficer"
Now the thing is the component is
So how do i exclude the component from the CompoundPropertyModel and
still have  it show ?
I thought i could achieve that with by passing an emppty model into
its constructor like new model?
how do i solve this??

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



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Sergey Olefir


bgooren wrote:
> 
> So I had a quick look at the source code of WebRequestCodingStrategy, and
> I think it should be possible to create a solution for your problem quite
> easily:
> 


Thanks to your idea, I played around with WebRequestCodingStrategy and below
is what I came up with.

It uses jasypt, but feel free to replace it with whatever you like more.


package crypt.wicket;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.wicket.Request;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.protocol.http.request.WebRequestCodingStrategy;
import org.apache.wicket.request.RequestParameters;
import
org.apache.wicket.request.target.resource.ISharedResourceRequestTarget;
import org.apache.wicket.util.string.AppendingStringBuffer;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.salt.ZeroSaltGenerator;

/**
 * Version of standard {...@link WebRequestCodingStrategy} that encrypts FQNs
 * (full qualified names of classes) in resource references.
 *
 * @author Sergey Olefir
 */
public class CryptWebRequestCodingStrategy extends WebRequestCodingStrategy
{
/**
 * Prefix for encrypted FQNs.
 */
public static final String ENCRYPTED_FQN_PREFIX = "---";

/**
 * Map of unencrypted -> encrypted strings.
 */
protected static final Map toEncryptedMap = new
ConcurrentHashMap();

/**
 * Map of encrypted -> unencrypted strings.
 */
protected static final Map toUnencryptedMap = new
ConcurrentHashMap();

/**
 * Encrypted used to encrypt FQNs.
 */
private static final StandardPBEStringEncryptor encryptor;

static
{
encryptor = new StandardPBEStringEncryptor();
encryptor.setAlgorithm("PBEWithMD5AndDES");
encryptor.setSaltGenerator(new ZeroSaltGenerator()); // Need to use
zero salt so that URLs are stable.
encryptor.setStringOutputType("hexadecimal"); // To avoid slashes in
the result (base64 can produce slashes).

encryptor.setPassword("");
}

/* (non-Javadoc)
 * @see
org.apache.wicket.protocol.http.request.WebRequestCodingStrategy#addResourceParameters(org.apache.wicket.Request,
org.apache.wicket.request.RequestParameters)
 */
@Override
protected void addResourceParameters(Request request,
RequestParameters parameters)
{
String pathInfo = request.getPath();
if (pathInfo != null && pathInfo.startsWith(RESOURCES_PATH_PREFIX))
{
int ix = RESOURCES_PATH_PREFIX.length();
if (pathInfo.length() > ix)
{
StringBuffer path = new
StringBuffer(pathInfo.substring(ix));
int ixSemiColon = path.indexOf(";");
// strip off any jsession id
if (ixSemiColon != -1)
{
int ixEnd = path.indexOf("?");
if (ixEnd == -1)
{
ixEnd = path.length();
}
path.delete(ixSemiColon, ixEnd);
}

// Check if we need to decrypt FQN.
String pathString = path.toString();
if (pathString.startsWith(ENCRYPTED_FQN_PREFIX))
{
if (pathString.length() > ENCRYPTED_FQN_PREFIX.length())
{
// Need to decrypt.
pathString =
pathString.substring(ENCRYPTED_FQN_PREFIX.length());
String head;
String tail;
int slash = pathString.indexOf('/');
if (slash < 0)
{
head = pathString;
tail = "";
}
else if (slash == 0)
{
head = "";
tail = pathString;
}
else
{
head = pathString.substring(0, slash);
tail = pathString.substring(slash);
}

// Do decrypt.
pathString = decrypt(head) + tail;
}
}

parameters.setResourceKey(pathString);
}
}
}


/* (non-Javadoc)
 * @see
org.apache.wicket.protocol.http.request.WebRequestCodingStrategy#encode(org.apache.wicket.RequestCycle,
org.apache.wicket.request.target.resource.ISharedResourceRequestTarget)
 */
@SuppressWarnings("unchecked")
@Override
protected CharSequence encode(RequestCycle requestCycle,
ISharedResourceRequestTarget requestTarget)
{
final Strin

Re: validate

2010-03-02 Thread Ivan Dudko
Thanks a lot!

2010/3/2 Riyad Kalla :
> If you have that string literally copy-pasted in some Java code somewhere,
> you need to double escape the escape chars...
>
> \\b and so on.
>
> On Tue, Mar 2, 2010 at 8:32 AM, Ivan Dudko  wrote:
>
>> For this expression
>>
>> \b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
>> eclipse says: invalid escape sequence
>>
>> 2010/3/2 Martijn Dashorst :
>> > Why do you want to use a UrlValidator? An ip-address is not a URL?
>> > Maybe a pattern validator with
>> > http://www.regular-expressions.info/regexbuddy/ipaccurate.html would
>> > be better?
>> >
>> > Martijn
>> >
>> > On Tue, Mar 2, 2010 at 4:09 PM, Ivan Dudko  wrote:
>> >> Hello!
>> >>
>> >> I can't understand how can i validate ip address (e.g. 192.168.0.238)
>> >> using UrlValidator.
>> >>
>> >> Thank you for help.
>> >> Ivan Dudko
>> >>
>> >> -
>> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >> For additional commands, e-mail: users-h...@wicket.apache.org
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > Become a Wicket expert, learn from the best: http://wicketinaction.com
>> > Apache Wicket 1.4 increases type safety for web applications
>> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>

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



Re: Page Expired

2010-03-02 Thread Alexander Monakhov
Hi.

I'm using org.apache.wicket.protocol.http.HttpSessionStore.
Guess it's not cause, because other links from other pages work well.

Best regards, Alexander.


Re: validate

2010-03-02 Thread Riyad Kalla
If you have that string literally copy-pasted in some Java code somewhere,
you need to double escape the escape chars...

\\b and so on.

On Tue, Mar 2, 2010 at 8:32 AM, Ivan Dudko  wrote:

> For this expression
>
> \b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
> eclipse says: invalid escape sequence
>
> 2010/3/2 Martijn Dashorst :
> > Why do you want to use a UrlValidator? An ip-address is not a URL?
> > Maybe a pattern validator with
> > http://www.regular-expressions.info/regexbuddy/ipaccurate.html would
> > be better?
> >
> > Martijn
> >
> > On Tue, Mar 2, 2010 at 4:09 PM, Ivan Dudko  wrote:
> >> Hello!
> >>
> >> I can't understand how can i validate ip address (e.g. 192.168.0.238)
> >> using UrlValidator.
> >>
> >> Thank you for help.
> >> Ivan Dudko
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
> >
> >
> > --
> > Become a Wicket expert, learn from the best: http://wicketinaction.com
> > Apache Wicket 1.4 increases type safety for web applications
> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: validate

2010-03-02 Thread Ivan Dudko
For this expression
\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
eclipse says: invalid escape sequence

2010/3/2 Martijn Dashorst :
> Why do you want to use a UrlValidator? An ip-address is not a URL?
> Maybe a pattern validator with
> http://www.regular-expressions.info/regexbuddy/ipaccurate.html would
> be better?
>
> Martijn
>
> On Tue, Mar 2, 2010 at 4:09 PM, Ivan Dudko  wrote:
>> Hello!
>>
>> I can't understand how can i validate ip address (e.g. 192.168.0.238)
>> using UrlValidator.
>>
>> Thank you for help.
>> Ivan Dudko
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: validate

2010-03-02 Thread Martijn Dashorst
Why do you want to use a UrlValidator? An ip-address is not a URL?
Maybe a pattern validator with
http://www.regular-expressions.info/regexbuddy/ipaccurate.html would
be better?

Martijn

On Tue, Mar 2, 2010 at 4:09 PM, Ivan Dudko  wrote:
> Hello!
>
> I can't understand how can i validate ip address (e.g. 192.168.0.238)
> using UrlValidator.
>
> Thank you for help.
> Ivan Dudko
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4

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



Re: Page Expired

2010-03-02 Thread Riyad Kalla
Alexander,

Maybe this has to do with the persistence store you are using to make Wicket
work on GAE not actually persisting your pages to a location that they can
be retrieved again? I know by default the DiskStore that Wicket uses won't
work on GAE, so I imagine you plugged something else in -- if you did and
it's just tossing out the previous versions of the pages, that would explain
what you are seeing "no version  of page" errors.

What store do you have configured?

-R

On Tue, Mar 2, 2010 at 6:59 AM, Alexander Monakhov wrote:

> Hi, guys.
>
> I've got problem with 'Page Expired' message. I'm developing application
> that is worked on GAE.
> It has one page with help content. There is two help pages. Help page
> contains two separated divs. One div for table of content, second - for
> content.
> When user clicks on link, page is reloaded with appropriated content. So,
> when I load this page first time all works fine. But when I click on any
> link,
> I get 'Page Expired' message.
> I set log level to debug. Here is some messages:
>
> 13:46:14,140 DEBUG [org.apache.wicket.Session] - Getting page [path =
> 3:tabpanel:panel:toc-panel:help.panel.navigation:1:help.panel.link,
> versionNumber = 1
> 13:46:14,141 INFO [org.apache.wicket.Page] - No version manager available
> to
> retrieve requested versionNumber 1
> 13:46:14,141 INFO [org.apache.wicket.AccessStackPageMap] - Unable to get
> version 1 of page [Page class =
> com.dominity.web2care.wicket.pages.BasePage,
> id = 3, version = 0]
> 13:46:14,142 DEBUG [org.apache.wicket.RequestCycle] - setting request
> target
> to [bookmarkablepagerequesttar...@974813593pageclass
> =org.apache.wicket.markup.html.pages.PageExpiredErrorPage]
>
> So, could you explain me what's wrong with this and what is it about: No
> version manager available?
>
> If you'd like I show you source code and markup.
>
> BTW, please, bear in mind, that the same page works fine of GAE SDK without
> any page expirations, but on server side I get always Page Expired message.
>
> Best regards, Alexander.
>


validate

2010-03-02 Thread Ivan Dudko
Hello!

I can't understand how can i validate ip address (e.g. 192.168.0.238)
using UrlValidator.

Thank you for help.
Ivan Dudko

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



Re: image from outside web application directory

2010-03-02 Thread Riyad Kalla
Mike,

The solution is writing a wicket component that finds the image on-disk and
streams the bits back to the browser. Try these search results:
http://old.nabble.com/forum/Search.jtp?forum=13974&local=y&query=dynamic+image

and
these:
http://old.nabble.com/forum/Search.jtp?query=image+on+disk&local=y&forum=13974&daterange=0&startdate=&enddate=

Your
answer is in there somewhere. The thread recently (3 weeks ago?) about it
was pretty long and someone pasted a complete impl that they were using that
folks said worked great. I just don't recall the class name otherwise I'd
search for it :)

-R

On Tue, Mar 2, 2010 at 4:46 AM, Gw  wrote:

> Hi all,
>
> I'd like to know how to display an image which is located outside web
> application directory (eg: C:\images) .
> Many thanks in advance for your assists.
>
> Regards,
> Mike
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


ResourceLink with pagerefresh(update)

2010-03-02 Thread Boydens Joeri (OZ)
Hello,

 

I've created an ResourceLink wich shows the user a download window for
the PDF resource. 

 

Now I want the page to be refreshed when the user clicks the link so I
can update the page and show the user he clicked this link.  How would I
do this ?

 

Regards

Joeri

 

 

ResourceLink pdfAanvragenLink = new
ResourceLink("pdfAanvragenLink", new
DynamicWebResource(documentVO.getDocumentNaam() + "_" +
documentVO.getDocumentId() + ".pdf") {

 

 /**

  * serialVersionUID 

  * Aangepast door: C501BBJO op 2-mrt-2010 -
14:29:13

  */

 private static final long
serialVersionUID  = 4564654656L;

 

 /* (non-javadoc)

  * @see
org.apache.wicket.markup.html.WebResource#getCacheDuration()   

  * Aangepast door: C501BBJO op 2-mrt-2010 -
14:44:39

  */

 protected int getCacheDuration() {

   return 30;

 }

  

 /* (non-javadoc)

  * @see
org.apache.wicket.markup.html.DynamicWebResource#getResourceState()   

  * Aangepast door: C501BBJO op 2-mrt-2010 -
14:44:44

  */

 protected ResourceState getResourceState()
{

   return new ResourceState() {

 

 public byte[] getData() {

   return
getPDFAsByteArray();

 }

 

 public String getContentType()
{

   return "application/pdf";

 }

   };

 

 }

 

 

}) ;

 



RE: DownloadLink problem

2010-03-02 Thread Martin Asenov
Thanks Ernesto!

But I want to have the link invisible on startup (because the file's empty). So 
I have this: (doesn't work, but has to)

exportedFileLink = new DownloadLink("exported_file_link", new 
LoadableDetachableModel() {

  private static final long serialVersionUID = 1L;

  @Override
  protected File load() {
return exportedFile;
  }
}, PhonebookExporter.OUTPUT_FILE_NAME) {

  private static final long serialVersionUID = 1L;

  @Override
  public boolean isVisible() {
return exportedFile != null;
  }
};
final WebMarkupContainer exportedFileLinkHolder = new 
WebMarkupContainer("link_holder");
exportedFileLinkHolder.setOutputMarkupId(true);
exportedFileLinkHolder.add(exportedFileLink);

rightForm.add(exportedFileLinkHolder);
rightForm.add(new AjaxButton("export_button") {

  private static final long serialVersionUID = 1L;

  @Override
  protected void onSubmit(AjaxRequestTarget target, Form form) {

PhonebookExporter exporter = getExporter();
exportedFile = exporter.export(uploadFolder);

if (exportedFile == null) {
  error(getString("not_exported"));
} else {
  info(getString("exported"));
}

target.addComponent(exportedFileLinkHolder);
target.addComponent(feed);
  }
  
});

I really start to get pissed off by this one!!! g

Regards,
Martin

-Original Message-
From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] 
Sent: Tuesday, March 02, 2010 3:50 PM
To: users@wicket.apache.org
Subject: Re: DownloadLink problem

Weird. Just try this example:

import java.io.File;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.link.DownloadLink;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.AbstractReadOnlyModel;

/**
 * @author Ernesto Reinaldo Barreiro (reier...@gmail.com)
 *
 */
public class TestDownLoadLink extends Panel {


private static final long serialVersionUID = 1L;

private File test = null;

private DownloadLink download;
/**
 * @param id
 */
public TestDownLoadLink(String id) {
super(id);

this.download = new DownloadLink("download", new
AbstractReadOnlyModel(){

 private static final long
serialVersionUID = 1L;

@Override
public File getObject() {
return test;
}

 },"TestDownLoadLink.html") {

private static final long serialVersionUID = 1L;

@Override
public boolean isEnabled() {

return test != null;
}
 };
 download.setOutputMarkupId(true);
 add(download);

 AjaxLink update = new AjaxLink("update") {

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
test = new
File(TestDownLoadLink.class.getResource("TestDownLoadLink.html").getFile());
if(target != null) {
target.addComponent(TestDownLoadLink.this.download);
}
}
 };

 add(update);
}
}

and the HTML






download
Click me to update download




Just place them somewhere and do

new TestDownLoadLink("xxx");

It works for me. First time the download link is disable and when you click
on the AJAX link file is assigned, link is refreshed and you can download
your file;-)

Best,

Ernesto

On Tue, Mar 2, 2010 at 2:24 PM, Martin Asenov  wrote:

> Unfortunately doesn't work this way... The model is never refreshed...
>
> -Original Message-
> From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Sent: Tuesday, March 02, 2010 2:31 PM
> To: users@wicket.apache.org
> Subject: Re: DownloadLink problem
>
> Not sure... but could you try something like:
>
> DownloadLink downloadLink = new DownloadLink("link_id", new
> AbstractReadOnlyModel(){
>public File getObject() {
>return this.linkModel;
>};
>},"myfile.xxx");
>downloadLink.setOutputMarkupId(true);
>
> and make linkModel a member variable? This way file will be "refreshed".
>
> Best,
>
> Ernnesto
>
> On Tue, Mar 2, 2010 at 1:14 PM, Martin Asenov  wrote:
>
> > Hi, guys!
> >
> > I experience some DownloadLink problem - I have these fields:
> >
> > File linkModel;
> > DownloadLink theLink = new DownloadLink("link_id", new
> > Model(linkModel));
> > theLink.setOutputMarkupId(true);
> >
> > After another button click I have the linkModel field pointing to real
> file
> > on the file system. And then I say:
> >
> > target.addComponent(theLink);
> >
> > the link name is still invisible, and when I click on the small clickable
> > ar

Page Expired

2010-03-02 Thread Alexander Monakhov
Hi, guys.

I've got problem with 'Page Expired' message. I'm developing application
that is worked on GAE.
It has one page with help content. There is two help pages. Help page
contains two separated divs. One div for table of content, second - for
content.
When user clicks on link, page is reloaded with appropriated content. So,
when I load this page first time all works fine. But when I click on any
link,
I get 'Page Expired' message.
I set log level to debug. Here is some messages:

13:46:14,140 DEBUG [org.apache.wicket.Session] - Getting page [path =
3:tabpanel:panel:toc-panel:help.panel.navigation:1:help.panel.link,
versionNumber = 1
13:46:14,141 INFO [org.apache.wicket.Page] - No version manager available to
retrieve requested versionNumber 1
13:46:14,141 INFO [org.apache.wicket.AccessStackPageMap] - Unable to get
version 1 of page [Page class = com.dominity.web2care.wicket.pages.BasePage,
id = 3, version = 0]
13:46:14,142 DEBUG [org.apache.wicket.RequestCycle] - setting request target
to 
[bookmarkablepagerequesttar...@974813593pageclass=org.apache.wicket.markup.html.pages.pageexpirederrorpage]

So, could you explain me what's wrong with this and what is it about: No
version manager available?

If you'd like I show you source code and markup.

BTW, please, bear in mind, that the same page works fine of GAE SDK without
any page expirations, but on server side I get always Page Expired message.

Best regards, Alexander.


Re: DownloadLink problem

2010-03-02 Thread Ernesto Reinaldo Barreiro
Weird. Just try this example:

import java.io.File;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.link.DownloadLink;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.AbstractReadOnlyModel;

/**
 * @author Ernesto Reinaldo Barreiro (reier...@gmail.com)
 *
 */
public class TestDownLoadLink extends Panel {


private static final long serialVersionUID = 1L;

private File test = null;

private DownloadLink download;
/**
 * @param id
 */
public TestDownLoadLink(String id) {
super(id);

this.download = new DownloadLink("download", new
AbstractReadOnlyModel(){

 private static final long
serialVersionUID = 1L;

@Override
public File getObject() {
return test;
}

 },"TestDownLoadLink.html") {

private static final long serialVersionUID = 1L;

@Override
public boolean isEnabled() {

return test != null;
}
 };
 download.setOutputMarkupId(true);
 add(download);

 AjaxLink update = new AjaxLink("update") {

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
test = new
File(TestDownLoadLink.class.getResource("TestDownLoadLink.html").getFile());
if(target != null) {
target.addComponent(TestDownLoadLink.this.download);
}
}
 };

 add(update);
}
}

and the HTML






download
Click me to update download




Just place them somewhere and do

new TestDownLoadLink("xxx");

It works for me. First time the download link is disable and when you click
on the AJAX link file is assigned, link is refreshed and you can download
your file;-)

Best,

Ernesto

On Tue, Mar 2, 2010 at 2:24 PM, Martin Asenov  wrote:

> Unfortunately doesn't work this way... The model is never refreshed...
>
> -Original Message-
> From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Sent: Tuesday, March 02, 2010 2:31 PM
> To: users@wicket.apache.org
> Subject: Re: DownloadLink problem
>
> Not sure... but could you try something like:
>
> DownloadLink downloadLink = new DownloadLink("link_id", new
> AbstractReadOnlyModel(){
>public File getObject() {
>return this.linkModel;
>};
>},"myfile.xxx");
>downloadLink.setOutputMarkupId(true);
>
> and make linkModel a member variable? This way file will be "refreshed".
>
> Best,
>
> Ernnesto
>
> On Tue, Mar 2, 2010 at 1:14 PM, Martin Asenov  wrote:
>
> > Hi, guys!
> >
> > I experience some DownloadLink problem - I have these fields:
> >
> > File linkModel;
> > DownloadLink theLink = new DownloadLink("link_id", new
> > Model(linkModel));
> > theLink.setOutputMarkupId(true);
> >
> > After another button click I have the linkModel field pointing to real
> file
> > on the file system. And then I say:
> >
> > target.addComponent(theLink);
> >
> > the link name is still invisible, and when I click on the small clickable
> > area, Wicket comes up with:
> >
> > WicketMessage: Method onLinkClicked of interface
> > org.apache.wicket.markup.html.link.ILinkListener targeted at component
> > [MarkupContainer [Component id = exported_file_link]] threw an exception
> >
> > Root cause:
> >
> > java.lang.IllegalStateException:
> > org.apache.wicket.markup.html.link.DownloadLink failed to retrieve a File
> > object from model
> > at
> >
> org.apache.wicket.markup.html.link.DownloadLink.onClick(DownloadLink.java:141)
> > at
> org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:224)
> > at java.lang.reflect.Method.invoke(Method.java:597)
> > I thought I've made everything perfect, but it seems that I haven't.
> > Any help is appreciated!
> >
> > Best regards,
> > Martin
> >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread James Carman
You might also look into the "scannotation" project.

On Tue, Mar 2, 2010 at 8:33 AM, Martijn Dashorst
 wrote:
> Take a look at the spring component scanner for an implementation of
> how to search the class path. Then it is just a series of
> ResourceReference.class.isAssignableFrom(clz) queries and applying
> your specific logic.
>
> For example we use the following code to scan for specific patterns in
> html files (such as style= attributes in html code, which we consider
> illegal—use classes and stylesheets instead).
>
> ResourcePatternResolver, PathMatchingResourcePatternResolver are
> classes that comes from Spring.
>
> ResourcePatternResolver resourcePatternResolver = new
> PathMatchingResourcePatternResolver();
> for (String packageName : getPackageNames())
> {
>    String usePackageName = packageName;
>    if (!usePackageName.endsWith("."))
>        usePackageName += ".";
>    String filePatter =
>        ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
>            + ClassUtils.convertClassNameToResourcePath(usePackageName)
> + "**/*.html";
>    try
>    {
>        Resource[] resources = 
> resourcePatternResolver.getResources(filePatter);
>        for (Resource resource : resources)
>        {
>            if (resource.isReadable())
>            {
>                List matches =
> getMatches(resource.getInputStream(), pattern);
>                String fileName = resource.getURI().getPath();
>                if (errorWhenFound)
>                {
>                    if (!matches.isEmpty())
>                        addError(fileName + ": " + matches);
>                }
>                else
>                {
>                    if (matches.isEmpty())
>                        addError(fileName);
>                }
>            }
>        }
>    }
>    catch (IOException e)
>    {
>        addError(e.getMessage());
>    }
> }
> assertNoErrors(message);
>
> Martijn
>
> On Tue, Mar 2, 2010 at 12:56 PM, Sergey Olefir  wrote:
>>
>>
>> Err, I guess I don't quite understand what you're proposing... My
>> understanding is that I need to know all class names that are used by
>> application as part of ResourceReference (and possibly something else too).
>> How would I scan for that?
>>
>>
>> Martijn Dashorst wrote:
>>>
>>> Create a unit test case that scans your application for resources and
>>> checks if the class is set. If not, fail. If set, check if it is
>>> unique, if not fail.
>>>
>>> Martijn
>>>
>>
>> --
>> View this message in context: 
>> http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754984.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Sergey Olefir


I admit I didn't research in-depth what you've suggested, but from the
quoted piece it seems that your suggestion will find all subclasses of
ResourceReference. But to actually test that all resources are properly
mapped, it would be necessary to locate all invocations of the
ResourceReference constructors and scan their parameters. I have hard time
imagining how it could possibly work without resorting to AspectJ (or AOP in
general).

Also the same problem may be relevant for e.g. Image() and possibly other
stuff.

Basically, unless I completely misunderstand what you're suggesting, I don't
really see how such scanning might work.


Martijn Dashorst wrote:
> 
> Take a look at the spring component scanner for an implementation of
> how to search the class path. Then it is just a series of
> ResourceReference.class.isAssignableFrom(clz) queries and applying
> your specific logic.
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27756016.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Martijn Dashorst
Take a look at the spring component scanner for an implementation of
how to search the class path. Then it is just a series of
ResourceReference.class.isAssignableFrom(clz) queries and applying
your specific logic.

For example we use the following code to scan for specific patterns in
html files (such as style= attributes in html code, which we consider
illegal—use classes and stylesheets instead).

ResourcePatternResolver, PathMatchingResourcePatternResolver are
classes that comes from Spring.

ResourcePatternResolver resourcePatternResolver = new
PathMatchingResourcePatternResolver();
for (String packageName : getPackageNames())
{
String usePackageName = packageName;
if (!usePackageName.endsWith("."))
usePackageName += ".";
String filePatter =
ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ ClassUtils.convertClassNameToResourcePath(usePackageName)
+ "**/*.html";
try
{
Resource[] resources = resourcePatternResolver.getResources(filePatter);
for (Resource resource : resources)
{
if (resource.isReadable())
{
List matches =
getMatches(resource.getInputStream(), pattern);
String fileName = resource.getURI().getPath();
if (errorWhenFound)
{
if (!matches.isEmpty())
addError(fileName + ": " + matches);
}
else
{
if (matches.isEmpty())
addError(fileName);
}
}
}
}
catch (IOException e)
{
addError(e.getMessage());
}
}
assertNoErrors(message);

Martijn

On Tue, Mar 2, 2010 at 12:56 PM, Sergey Olefir  wrote:
>
>
> Err, I guess I don't quite understand what you're proposing... My
> understanding is that I need to know all class names that are used by
> application as part of ResourceReference (and possibly something else too).
> How would I scan for that?
>
>
> Martijn Dashorst wrote:
>>
>> Create a unit test case that scans your application for resources and
>> checks if the class is set. If not, fail. If set, check if it is
>> unique, if not fail.
>>
>> Martijn
>>
>
> --
> View this message in context: 
> http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754984.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4

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



Re: DownloadLink problem

2010-03-02 Thread James Carman
Use a LoadableDetachableModel?

On Tue, Mar 2, 2010 at 8:24 AM, Martin Asenov  wrote:
> Unfortunately doesn't work this way... The model is never refreshed...
>
> -Original Message-
> From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Sent: Tuesday, March 02, 2010 2:31 PM
> To: users@wicket.apache.org
> Subject: Re: DownloadLink problem
>
> Not sure... but could you try something like:
>
> DownloadLink downloadLink = new DownloadLink("link_id", new
> AbstractReadOnlyModel(){
>            public File getObject() {
>                return this.linkModel;
>            };
>        },"myfile.xxx");
>        downloadLink.setOutputMarkupId(true);
>
> and make linkModel a member variable? This way file will be "refreshed".
>
> Best,
>
> Ernnesto
>
> On Tue, Mar 2, 2010 at 1:14 PM, Martin Asenov  wrote:
>
>> Hi, guys!
>>
>> I experience some DownloadLink problem - I have these fields:
>>
>> File linkModel;
>> DownloadLink theLink = new DownloadLink("link_id", new
>> Model(linkModel));
>> theLink.setOutputMarkupId(true);
>>
>> After another button click I have the linkModel field pointing to real file
>> on the file system. And then I say:
>>
>> target.addComponent(theLink);
>>
>> the link name is still invisible, and when I click on the small clickable
>> area, Wicket comes up with:
>>
>> WicketMessage: Method onLinkClicked of interface
>> org.apache.wicket.markup.html.link.ILinkListener targeted at component
>> [MarkupContainer [Component id = exported_file_link]] threw an exception
>>
>> Root cause:
>>
>> java.lang.IllegalStateException:
>> org.apache.wicket.markup.html.link.DownloadLink failed to retrieve a File
>> object from model
>>     at
>> org.apache.wicket.markup.html.link.DownloadLink.onClick(DownloadLink.java:141)
>>     at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:224)
>>     at java.lang.reflect.Method.invoke(Method.java:597)
>> I thought I've made everything perfect, but it seems that I haven't.
>> Any help is appreciated!
>>
>> Best regards,
>> Martin
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



RE: DownloadLink problem

2010-03-02 Thread Martin Asenov
Unfortunately doesn't work this way... The model is never refreshed...

-Original Message-
From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] 
Sent: Tuesday, March 02, 2010 2:31 PM
To: users@wicket.apache.org
Subject: Re: DownloadLink problem

Not sure... but could you try something like:

DownloadLink downloadLink = new DownloadLink("link_id", new
AbstractReadOnlyModel(){
public File getObject() {
return this.linkModel;
};
},"myfile.xxx");
downloadLink.setOutputMarkupId(true);

and make linkModel a member variable? This way file will be "refreshed".

Best,

Ernnesto

On Tue, Mar 2, 2010 at 1:14 PM, Martin Asenov  wrote:

> Hi, guys!
>
> I experience some DownloadLink problem - I have these fields:
>
> File linkModel;
> DownloadLink theLink = new DownloadLink("link_id", new
> Model(linkModel));
> theLink.setOutputMarkupId(true);
>
> After another button click I have the linkModel field pointing to real file
> on the file system. And then I say:
>
> target.addComponent(theLink);
>
> the link name is still invisible, and when I click on the small clickable
> area, Wicket comes up with:
>
> WicketMessage: Method onLinkClicked of interface
> org.apache.wicket.markup.html.link.ILinkListener targeted at component
> [MarkupContainer [Component id = exported_file_link]] threw an exception
>
> Root cause:
>
> java.lang.IllegalStateException:
> org.apache.wicket.markup.html.link.DownloadLink failed to retrieve a File
> object from model
> at
> org.apache.wicket.markup.html.link.DownloadLink.onClick(DownloadLink.java:141)
> at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:224)
> at java.lang.reflect.Method.invoke(Method.java:597)
> I thought I've made everything perfect, but it seems that I haven't.
> Any help is appreciated!
>
> Best regards,
> Martin
>
>

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



Re: Ajax File Upload (Safari and Chrome)?

2010-03-02 Thread bgooren

Just perform a google search for WICKET-2657 in that case, or copy the
following link http://issues.apache.org/jira/browse/WICKET-2657


Pierre Goupil wrote:
> 
> The link is broken, unfortunately: "The project you are trying to view
> does
> not exist. Try browsing  for
> projects.
> "
> 
> Regards,
> 
> Pierre
> 
> 
> 
> On Tue, Mar 2, 2010 at 1:27 PM, bgooren  wrote:
> 
>>
>> Possibly this is related to
>> http://issues.apache.org/jira/browse/WICKET-2657
>> WICKET-2657?
>> That bug only mentions Chrome though, so it is unclear if it also occurs
>> on
>> Safari.
>>
>> Did you check if AjaxButton.onSubmit() gets called to isolate the problem
>> area (server vs client)?
>>
>>
>> Corbin, James-2 wrote:
>> >
>> > Are there any known issues with the FileUploadField when submitting via
>> > Ajax on Safari 4.x or Chrome 5.x?
>> >
>> > In the AjaxButton.onSubmit(), I am attempting to update other
>> components
>> > and it doesn't seem to repaint the component(s) in Safari or Chrome,
>> but
>> > does work as I expect in Firefox 3.x.
>> >
>> > J.D.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Ajax-File-Upload-%28Safari-and-Chrome%29--tp27748810p27755256.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> 
> -- 
> Les deux règles universelles du bide :
> 
> 1) on n'explique pas un bide
> 
> 2) dans le futur, un bide sera toujours un bide.
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Ajax-File-Upload-%28Safari-and-Chrome%29--tp27748810p27755431.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Ajax File Upload (Safari and Chrome)?

2010-03-02 Thread Pierre Goupil
The link is broken, unfortunately: "The project you are trying to view does
not exist. Try browsing  for projects.
"

Regards,

Pierre



On Tue, Mar 2, 2010 at 1:27 PM, bgooren  wrote:

>
> Possibly this is related to
> http://issues.apache.org/jira/browse/WICKET-2657
> WICKET-2657?
> That bug only mentions Chrome though, so it is unclear if it also occurs on
> Safari.
>
> Did you check if AjaxButton.onSubmit() gets called to isolate the problem
> area (server vs client)?
>
>
> Corbin, James-2 wrote:
> >
> > Are there any known issues with the FileUploadField when submitting via
> > Ajax on Safari 4.x or Chrome 5.x?
> >
> > In the AjaxButton.onSubmit(), I am attempting to update other components
> > and it doesn't seem to repaint the component(s) in Safari or Chrome, but
> > does work as I expect in Firefox 3.x.
> >
> > J.D.
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Ajax-File-Upload-%28Safari-and-Chrome%29--tp27748810p27755256.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Les deux règles universelles du bide :

1) on n'explique pas un bide

2) dans le futur, un bide sera toujours un bide.


Re: DownloadLink problem

2010-03-02 Thread Ernesto Reinaldo Barreiro
Not sure... but could you try something like:

DownloadLink downloadLink = new DownloadLink("link_id", new
AbstractReadOnlyModel(){
public File getObject() {
return this.linkModel;
};
},"myfile.xxx");
downloadLink.setOutputMarkupId(true);

and make linkModel a member variable? This way file will be "refreshed".

Best,

Ernnesto

On Tue, Mar 2, 2010 at 1:14 PM, Martin Asenov  wrote:

> Hi, guys!
>
> I experience some DownloadLink problem - I have these fields:
>
> File linkModel;
> DownloadLink theLink = new DownloadLink("link_id", new
> Model(linkModel));
> theLink.setOutputMarkupId(true);
>
> After another button click I have the linkModel field pointing to real file
> on the file system. And then I say:
>
> target.addComponent(theLink);
>
> the link name is still invisible, and when I click on the small clickable
> area, Wicket comes up with:
>
> WicketMessage: Method onLinkClicked of interface
> org.apache.wicket.markup.html.link.ILinkListener targeted at component
> [MarkupContainer [Component id = exported_file_link]] threw an exception
>
> Root cause:
>
> java.lang.IllegalStateException:
> org.apache.wicket.markup.html.link.DownloadLink failed to retrieve a File
> object from model
> at
> org.apache.wicket.markup.html.link.DownloadLink.onClick(DownloadLink.java:141)
> at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:224)
> at java.lang.reflect.Method.invoke(Method.java:597)
> I thought I've made everything perfect, but it seems that I haven't.
> Any help is appreciated!
>
> Best regards,
> Martin
>
>


Re: Ajax File Upload (Safari and Chrome)?

2010-03-02 Thread bgooren

Possibly this is related to  http://issues.apache.org/jira/browse/WICKET-2657
WICKET-2657 ?
That bug only mentions Chrome though, so it is unclear if it also occurs on
Safari.

Did you check if AjaxButton.onSubmit() gets called to isolate the problem
area (server vs client)?


Corbin, James-2 wrote:
> 
> Are there any known issues with the FileUploadField when submitting via
> Ajax on Safari 4.x or Chrome 5.x?
> 
> In the AjaxButton.onSubmit(), I am attempting to update other components
> and it doesn't seem to repaint the component(s) in Safari or Chrome, but
> does work as I expect in Firefox 3.x.
> 
> J.D.
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Ajax-File-Upload-%28Safari-and-Chrome%29--tp27748810p27755256.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: autolink not work ?

2010-03-02 Thread marioosh.net


kinabalu wrote:
> 
> Index1 and Index2 are generated as italics because you are on the same
> page.  If you use autolink and you're on the same page, they show up as
> italics
> 
> Index3 doesn't work because you've got a slash preceding the package name. 
> And linkownia isn't one of the packages defined in your root, so Wicket
> can't find it, thus it passes through and just gives you the exact items
> inside the href rather than converting to the Wicket equivalent.
> 
> On Feb 26, 2010, at 12:42 AM, marioosh.net wrote:
> 
>> I have packages:
>> 
>> net.marioosh.wicket.learn1.lesson4
>> net.marioosh.wicket.learn1.linkownia
>> 
>> and webpage: Index.html in linkownia package:
>> 
>>   ../lesson4/Lesson4.html Lesson4 
>>   ../linkownia/Index.html Index1 
>>   Index.html Index2 
>>   /linkownia/Index.html Index3 
>> 
> 
> 

You are great! :) 
Thank You very much.


-- 
View this message in context: 
http://old.nabble.com/autolink-not-work---tp27715679p27755210.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Need Help Wicket Stuff push

2010-03-02 Thread Stevenson Cunanan
On Tue, Mar 2, 2010 at 7:35 PM, Stevenson Cunanan <
stevenson.cuna...@gmail.com> wrote:

> I tried the wicket push chat example which i found at wicket stuff
> svn..wicket-stuff/wicketstuff-core/push-parent/push-examples
> I got the examples to work fine. Now I am trying to create something like a
> notification using TimerPushService. So i make 2 pages one for sending...
> and another for receiving. I added listeners to both pages using
>
>
> sorry please ignore this message i wasnt able to compose the message
properly


RE: RE: How can i know when a users redirects to other page

2010-03-02 Thread Martin Asenov
Hi, Ernesto!

This is most likely the way I'll do the thing. I have a quartz scheduler and 
will arrange a recurring job that will clean files older than a day for 
instance.

Thank you all!
Best regards,
Martin

-Original Message-
From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] 
Sent: Tuesday, March 02, 2010 12:35 PM
To: users@wicket.apache.org
Subject: Re: RE: How can i know when a users redirects to other page

just answered what he was asking;-). Another thing is if this is the best
solution for the use case. Maybe another possibility is to have a
background job that does clean unused files from time to time.

Best,

Ernesto

On Tue, Mar 2, 2010 at 11:28 AM, Sergey Olefir  wrote:

>
>
> I'm not sure if session invalidation will be carried out if server
> stops/crashes. Although I think the session invalidation mechanism is still
> the most reliable of all that was proposed (my personal first reaction was
> "you can't do it reliably" -- although after reading the thread I have to
> agree that e.g. session invalidation might work).
>
> Anyway, if going session invalidation route, it might be necessary to clean
> up the directory at the server startup to make sure all stray files are
> cleaned up.
>
>
> reiern70 wrote:
> >
> >
> http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSessionListener.html
> >
> > Ernesto
> >
>
> --
> View this message in context:
> http://old.nabble.com/How-can-i-know-when-a-users-redirects-to-other-page-tp27742803p27754252.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



DownloadLink problem

2010-03-02 Thread Martin Asenov
Hi, guys!

I experience some DownloadLink problem - I have these fields:

File linkModel;
DownloadLink theLink = new DownloadLink("link_id", new Model(linkModel));
theLink.setOutputMarkupId(true);

After another button click I have the linkModel field pointing to real file on 
the file system. And then I say:

target.addComponent(theLink);

the link name is still invisible, and when I click on the small clickable area, 
Wicket comes up with:

WicketMessage: Method onLinkClicked of interface 
org.apache.wicket.markup.html.link.ILinkListener targeted at component 
[MarkupContainer [Component id = exported_file_link]] threw an exception

Root cause:

java.lang.IllegalStateException: 
org.apache.wicket.markup.html.link.DownloadLink failed to retrieve a File 
object from model
 at 
org.apache.wicket.markup.html.link.DownloadLink.onClick(DownloadLink.java:141)
 at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:224)
 at java.lang.reflect.Method.invoke(Method.java:597)
I thought I've made everything perfect, but it seems that I haven't.
Any help is appreciated!

Best regards,
Martin



Help with wicket stuff push

2010-03-02 Thread Stevenson Cunanan
Hi,
I am trying to create a notify using the TimerPushService of wicket stuff
push
I want to send a message from 1 page and listen with another. from what i
understand the basic, you need to add a listerner to poll for changes
what I dont understand is what the line
final IPushTarget pushTarget = getTimerPushService().installPush(this);
is suppose to do?
how am i suppose to use a IPushTarget implementation, triggers, and
TimerChannelBehavior?

Best Regards,
Stevenson Lee


Re: image from outside web application directory

2010-03-02 Thread Ernesto Reinaldo Barreiro
Hi Mike,

search the list this have been answered many time before.

Best,

Ernesto

On Tue, Mar 2, 2010 at 12:46 PM, Gw  wrote:

> Hi all,
>
> I'd like to know how to display an image which is located outside web
> application directory (eg: C:\images) .
> Many thanks in advance for your assists.
>
> Regards,
> Mike
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Sergey Olefir


Err, I guess I don't quite understand what you're proposing... My
understanding is that I need to know all class names that are used by
application as part of ResourceReference (and possibly something else too).
How would I scan for that?


Martijn Dashorst wrote:
> 
> Create a unit test case that scans your application for resources and
> checks if the class is set. If not, fail. If set, check if it is
> unique, if not fail.
> 
> Martijn
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754984.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Martijn Dashorst
Create a unit test case that scans your application for resources and
checks if the class is set. If not, fail. If set, check if it is
unique, if not fail.

Martijn

On Tue, Mar 2, 2010 at 12:40 PM, Sergey Olefir  wrote:
>
>
> Thanks for heads up.
>
> I guess it's back to hacking WebRequestCodingStrategy for me, the flag is
> better than nothing, but I'm not eager in having application crash in
> production because someone forgot to map something and somehow it slipped
> past testing.
>
>
> Antoine van Wel wrote:
>>
>> A flag has been introduced that when set will throw an error when an
>> fqn would be used. It will be in 1.4.7, which is currently in the
>> voting phase, so it will be available within a week.
>>
>> But this would mean you'd have to alias all the classes anyway.
>>
>
> --
> View this message in context: 
> http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754862.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4

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



image from outside web application directory

2010-03-02 Thread Gw
Hi all,

I'd like to know how to display an image which is located outside web
application directory (eg: C:\images) .
Many thanks in advance for your assists.

Regards,
Mike

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



Re: ListView + dynamic database Model

2010-03-02 Thread marioosh.net



Thomas Kappler-3 wrote:
> 
> On 03/02/10 11:55, marioosh.net wrote:
>> Sorry for my poor english ;)
>>
>> I have ListView and model like below. I need tabs to reload sometimes,
>> so my model is dynamic and get tabs from database.
>> But i see that something is wrong. When i want to get Tab object by
>> getModelObject() in populateItem method i suppoused that i got it
>> directly, but i see that all the times the getObject() method of model
>> is triggered making for all items new list (new db request) !
> 
> That's exactly what is supposed to happen, as getModelObject() is just a 
> shorthand for getModel().getObject(). And in your getObject(), you do 
> the database request.
> 
> If you need to avoid those database reloads, look into 
> LoadableDetachableModels.
> 
> -- Thomas
> 

Thank You very much Thomas. 

I move code from getObject() method in IModel to load() method in
LoadableDetachableModel and everything works! - no more useless requests to
db :)

LoadableDetachableModel model2 = new LoadableDetachableModel() {

@Override
protected Object load() {
   ...
   // getting list from DB
   List  list = ;
   return list;
}
};


-- 
View this message in context: 
http://old.nabble.com/ListView-%2B-dynamic-database-Model-tp27754495p27754908.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Sergey Olefir


Thanks for heads up.

I guess it's back to hacking WebRequestCodingStrategy for me, the flag is
better than nothing, but I'm not eager in having application crash in
production because someone forgot to map something and somehow it slipped
past testing.


Antoine van Wel wrote:
> 
> A flag has been introduced that when set will throw an error when an
> fqn would be used. It will be in 1.4.7, which is currently in the
> voting phase, so it will be available within a week.
> 
> But this would mean you'd have to alias all the classes anyway.
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754862.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: color of message

2010-03-02 Thread Gw
OK, thx for your help, Cemal.
Will try it right away...
GBU

On Tue, Feb 23, 2010 at 4:31 AM, Cemal Bayramoglu
 wrote:
> Mike,
>
> Use CSS.
>
> eg on feedback errors, Wicket puts class="feedbackPanelERROR"
>
> Regards - Cemal
> jWeekend
> OO & Java Technologies, Wicket
> Consulting, Development, Training
> http://jWeekend.com
>
> On 23 February 2010 12:27, Gw  wrote:
>> Hi, folks...
>>
>> Does anyone know how to change the color of feedback messages, say: red for
>> errors, green for info, etc...
>> Many thanks before...
>>
>> Mike
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Antoine van Wel
A flag has been introduced that when set will throw an error when an
fqn would be used. It will be in 1.4.7, which is currently in the
voting phase, so it will be available within a week.

But this would mean you'd have to alias all the classes anyway.


Antoine


On Tue, Mar 2, 2010 at 12:33 PM, Sergey Olefir  wrote:
>
>
> Thing is, I already toyed with WebRequestCodingStrategy -- specifically I
> changed how resources are encoded by replacing URL path with URL parameter.
> And I broke CSS/relative references in the process as I found out much later
> :) (as you found out already in your another post ;))
>
> Although if I do something less drastic -- such as simply encoding the
> section with FQN -- I might break less stuff... Ah well, as you pointed out
> (and special thanks for that :)), 1.4.7 hopefully will be out soon with the
> some fix for the issue, maybe I can just wait it out.
>
>
> bgooren wrote:
>>
>> So I had a quick look at the source code of WebRequestCodingStrategy, and
>> I think it should be possible to create a solution for your problem quite
>> easily:
>>
>
> --
> View this message in context: 
> http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754796.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
take your photos everywhere you go - https://www.memolio.com
follow us on Twitter - http://twitter.com/Memolio

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



Need Help Wicket Stuff push

2010-03-02 Thread Stevenson Cunanan
I tried the wicket push chat example which i found at wicket stuff
svn..wicket-stuff/wicketstuff-core/push-parent/push-examples
I got the examples to work fine. Now I am trying to create something like a
notification using TimerPushService. So i make 2 pages one for sending...
and another for receiving. I added listeners to both pages using


Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Sergey Olefir


Thing is, I already toyed with WebRequestCodingStrategy -- specifically I
changed how resources are encoded by replacing URL path with URL parameter.
And I broke CSS/relative references in the process as I found out much later
:) (as you found out already in your another post ;))

Although if I do something less drastic -- such as simply encoding the
section with FQN -- I might break less stuff... Ah well, as you pointed out
(and special thanks for that :)), 1.4.7 hopefully will be out soon with the
some fix for the issue, maybe I can just wait it out.


bgooren wrote:
> 
> So I had a quick look at the source code of WebRequestCodingStrategy, and
> I think it should be possible to create a solution for your problem quite
> easily:
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754796.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread bgooren

Ok, scratch that comment too...

I see Antoine dug up an old thread of yours where you already found out
about the possibility to override WebRequestCodingStrategy.

I also see that Antoine created WICKET-2731 and that it has been closed as
resolved/fixed, so there should be some hooks available in wicket 1.4.7
(which is to be release shortly according to the dev mailing list).


Sergey Olefir wrote:
> 
> As I briefly mentioned before, class aliases are, IMO, a terribly
> unreliable thing to maintain. Every time someone comes up with new
> component that uses resource reference they must not forget to go and
> register the alias for it. 
> 
> I'm predicting a 100% probability that soon enough someone will forget it
> and it'll go into production -- thus defeating the entire purpose behind
> the encryption/obfuscation :)
> 
> And to comment on what Antoine is saying -- I'm not entirely sure what did
> you mean, but if I tried to implement encryption at
> CryptedUrlWebRequestCodingStrategy, I will have to ensure that encrypted
> URL will have format that will be fully parseable after browser appends
> relative CSS URL to it. This is manageable by, say, encrypting only the
> section of the path containing the class name. But then I'm completely
> unsure as to how properly decode it / fake request for Wicket. The
> existing code only 'fakes' parameters string -- but there are API methods
> that deal with request path as well, and if those are not correct, I'm not
> sure what issues that may cause.
> 
> Bottom line -- it must be possible to do encryption at
> CryptedUrlWebRequestCodingStrategy, but it will take some serious digging
> to make sure all parts fit correctly. It would be far easier to e.g.
> automatically add alias in SharedResources method that deals with
> assigning the name to shared resource -- the only thing it'll require is
> to modify Application class so that e.g. getSharedResources() is not
> final.
> 
> But I'm still hoping for some 'easy' solution that doesn't entail
> modifying Wicket source code to avoid headaches when upgrading.
> 
> 
> 
> bgooren wrote:
>> 
>> The easiest way around this is to specify 
>> http://wicket.apache.org/docs/1.4/org/apache/wicket/SharedResources.html#putClassAlias(java.lang.Class,
>> java.lang.String) class aliases .
>> 
>> The upside is that you control the generated URL, the downside is that
>> you have to make sure the alias is unique.
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754749.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread bgooren

Sorry, I overlooked that part of your original post.

I've been toying with the same idea, since class aliases are bound to cause
problems as projects grow bigger. As long as the aliases are user-generated,
they might not be unique.

So I had a quick look at the source code of WebRequestCodingStrategy, and I
think it should be possible to create a solution for your problem quite
easily:

1) subclass WebRequestCodingStrategy, and use it by overriding
newRequestCycleProcessor() in your application, and return a subclasses
WebRequestCycleProcessor which returns your custom WebRequestCodingStrategy
in the call to newRequestCodingStrategy(). Quickest solution is to create an
anonymous inner class for the custom WebRequestCycleProcessor
2) override the 
http://wicket.apache.org/docs/1.4/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.html#encode(org.apache.wicket.RequestCycle,
org.apache.wicket.request.target.resource.ISharedResourceRequestTarget)
encode  method which deals with shared resources, and implement "encryption"
(or simply an obfuscated, stable alias for classes)
3) override 
http://wicket.apache.org/docs/1.4/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.html#addResourceParameters(org.apache.wicket.Request,
org.apache.wicket.request.RequestParameters) addResourceParameters()  and
implement "decryption"



Sergey Olefir wrote:
> 
> As I briefly mentioned before, class aliases are, IMO, a terribly
> unreliable thing to maintain. Every time someone comes up with new
> component that uses resource reference they must not forget to go and
> register the alias for it. 
> 
> I'm predicting a 100% probability that soon enough someone will forget it
> and it'll go into production -- thus defeating the entire purpose behind
> the encryption/obfuscation :)
> 
> And to comment on what Antoine is saying -- I'm not entirely sure what did
> you mean, but if I tried to implement encryption at
> CryptedUrlWebRequestCodingStrategy, I will have to ensure that encrypted
> URL will have format that will be fully parseable after browser appends
> relative CSS URL to it. This is manageable by, say, encrypting only the
> section of the path containing the class name. But then I'm completely
> unsure as to how properly decode it / fake request for Wicket. The
> existing code only 'fakes' parameters string -- but there are API methods
> that deal with request path as well, and if those are not correct, I'm not
> sure what issues that may cause.
> 
> Bottom line -- it must be possible to do encryption at
> CryptedUrlWebRequestCodingStrategy, but it will take some serious digging
> to make sure all parts fit correctly. It would be far easier to e.g.
> automatically add alias in SharedResources method that deals with
> assigning the name to shared resource -- the only thing it'll require is
> to modify Application class so that e.g. getSharedResources() is not
> final.
> 
> But I'm still hoping for some 'easy' solution that doesn't entail
> modifying Wicket source code to avoid headaches when upgrading.
> 
> 
> 
> bgooren wrote:
>> 
>> The easiest way around this is to specify 
>> http://wicket.apache.org/docs/1.4/org/apache/wicket/SharedResources.html#putClassAlias(java.lang.Class,
>> java.lang.String) class aliases .
>> 
>> The upside is that you control the generated URL, the downside is that
>> you have to make sure the alias is unique.
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754615.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: ListView + dynamic database Model

2010-03-02 Thread Thomas Kappler

On 03/02/10 11:55, marioosh.net wrote:

Sorry for my poor english ;)

I have ListView and model like below. I need tabs to reload sometimes,
so my model is dynamic and get tabs from database.
But i see that something is wrong. When i want to get Tab object by
getModelObject() in populateItem method i suppoused that i got it
directly, but i see that all the times the getObject() method of model
is triggered making for all items new list (new db request) !


That's exactly what is supposed to happen, as getModelObject() is just a 
shorthand for getModel().getObject(). And in your getObject(), you do 
the database request.


If you need to avoid those database reloads, look into 
LoadableDetachableModels.


-- Thomas




How to get Tab objects for items without making wasting time database
request ???


IModel model = new IModel() {
public Object getObject() {
System.out.println("getObject...");
...
// getting list from DB
List  list = ;
return list;
}

public void setObject(Object object) {}
public void detach() {
}};

ListView tabs = new ListView("tabs", model) {
@Override
protected void populateItem(ListItem item) {
item.getModelObject(); /*<- new 
list, and new list,
and new list.. :(
}
};




--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



ListView + dynamic database Model

2010-03-02 Thread marioosh.net
Sorry for my poor english ;)

I have ListView and model like below. I need tabs to reload sometimes,
so my model is dynamic and get tabs from database.
But i see that something is wrong. When i want to get Tab object by
getModelObject() in populateItem method i suppoused that i got it
directly, but i see that all the times the getObject() method of model
is triggered making for all items new list (new db request) !

How to get Tab objects for items without making wasting time database
request ???


IModel model = new IModel() {
public Object getObject() {
System.out.println("getObject...");
...
// getting list from DB
List list = ;
return list;
}

public void setObject(Object object) {}
public void detach() {
}};

ListView tabs = new ListView("tabs", model) {
@Override
protected void populateItem(ListItem item) {
item.getModelObject(); /* <- new 
list, and new list,
and new list.. :(
}
};

-- 
Greetings,
marioosh

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



Re: Re: FormTester and Select component?

2010-03-02 Thread Leo . Erlandsson
You could easily extend WicketTester and FormTester to support selecting 
in org.apache.wicket.extensions.markup.html.form.select.Select.

Take a look at the

public void select(String formComponentId, int index)

method in FormTester and

public FormTester newFormTester(String path, boolean fillBlankString)

in BaseWicketTester on how to do it.


>Thank you for the reply. Unfortunately this is not easier for me since
>we already have this function implemented using the Select component.
>If there is no way of getting FormTester to work with that component
>i'll have a look at your code - i really want to have this test
>automated without having to use a heavier test framework.



Re: RE: How can i know when a users redirects to other page

2010-03-02 Thread Ernesto Reinaldo Barreiro
just answered what he was asking;-). Another thing is if this is the best
solution for the use case. Maybe another possibility is to have a
background job that does clean unused files from time to time.

Best,

Ernesto

On Tue, Mar 2, 2010 at 11:28 AM, Sergey Olefir  wrote:

>
>
> I'm not sure if session invalidation will be carried out if server
> stops/crashes. Although I think the session invalidation mechanism is still
> the most reliable of all that was proposed (my personal first reaction was
> "you can't do it reliably" -- although after reading the thread I have to
> agree that e.g. session invalidation might work).
>
> Anyway, if going session invalidation route, it might be necessary to clean
> up the directory at the server startup to make sure all stray files are
> cleaned up.
>
>
> reiern70 wrote:
> >
> >
> http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSessionListener.html
> >
> > Ernesto
> >
>
> --
> View this message in context:
> http://old.nabble.com/How-can-i-know-when-a-users-redirects-to-other-page-tp27742803p27754252.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: FormTester and Select component?

2010-03-02 Thread Jan Eriksson
Thank you for the reply. Unfortunately this is not easier for me since
we already have this function implemented using the Select component.
If there is no way of getting FormTester to work with that component
i'll have a look at your code - i really want to have this test
automated without having to use a heavier test framework.

/jan

On Tue, Mar 2, 2010 at 10:48 AM, Martin Makundi
 wrote:
> No, there is an easier way:
>
> /**
>  * @author Martin
>  *
>  * @param 
>  */
> public interface IStyledChoiceRenderer extends IChoiceRenderer {
>  /**
>   * @param t
>   * @return String
>   */
>  public String getOptGroupLabel(T t);
>
>  /**
>   * @param t
>   * @return String
>   */
>  public String getOptionCssClassName(T t);
> }
>
>
> /**
>  * @author Martin
>  *
>  * @param 
>  */
> public class DropDownChoiceWithStylingOptions extends DropDownChoice {
>  private String previouslyAppendedOptGroupLabel;
>  private int choices;
>
>  /**
>   * @param id
>   * @param choices
>   * @param renderer
>   */
>  public DropDownChoiceWithStylingOptions(String id,
>      IModel> choices,
>      IChoiceRenderer renderer) {
>    super(id, choices, renderer);
>  }
>
>  /**
>   * @param id
>   * @param choices
>   */
>  public DropDownChoiceWithStylingOptions(String id,
>      IModel> choices) {
>    super(id, choices);
>  }
>
>  /**
>   * @param id
>   * @param model
>   * @param choices
>   * @param renderer
>   */
>  public DropDownChoiceWithStylingOptions(String id, IModel model,
>      IModel> choices,
>      IChoiceRenderer renderer) {
>    super(id, model, choices, renderer);
>  }
>
>  /**
>   * @param id
>   * @param model
>   * @param choices
>   */
>  public DropDownChoiceWithStylingOptions(String id, IModel model,
>      IModel> choices) {
>    super(id, model, choices);
>  }
>
>  /**
>   * @param id
>   * @param model
>   * @param data
>   * @param renderer
>   */
>  public DropDownChoiceWithStylingOptions(String id, IModel model,
>      List data, IChoiceRenderer renderer) {
>    super(id, model, data, renderer);
>  }
>
>  /**
>   * @param id
>   * @param model
>   * @param choices
>   */
>  public DropDownChoiceWithStylingOptions(String id, IModel model,
>      List choices) {
>    super(id, model, choices);
>  }
>
>  /**
>   * @param id
>   * @param data
>   * @param renderer
>   */
>  public DropDownChoiceWithStylingOptions(String id, List data,
>      IChoiceRenderer renderer) {
>    super(id, data, renderer);
>  }
>
>  /**
>   * @param id
>   * @param choices
>   */
>  public DropDownChoiceWithStylingOptions(String id, List
> choices) {
>    super(id, choices);
>  }
>
>  /**
>   * @param id
>   */
>  public DropDownChoiceWithStylingOptions(String id) {
>    super(id);
>  }
>
>  /**
>   * @see 
> org.apache.wicket.markup.html.form.AbstractChoice#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
> org.apache.wicket.markup.ComponentTag)
>   */
> �...@override
>  protected void onComponentTagBody(MarkupStream markupStream,
>      ComponentTag openTag) {
>    previouslyAppendedOptGroupLabel = null;
>    choices = getChoices().size();
>    super.onComponentTagBody(markupStream, openTag);
>  }
>
>  /**
>   * @see 
> org.apache.wicket.markup.html.form.AbstractChoice#appendOptionHtml(org.apache.wicket.util.string.AppendingStringBuffer,
> java.lang.Object, int, java.lang.String)
>   */
> �...@override
>  protected void appendOptionHtml(AppendingStringBuffer buffer, T choice,
>      int index, String selected) {
>    AppendingStringBuffer tmp = new AppendingStringBuffer(50);
>    super.appendOptionHtml(tmp, choice, index, selected);
>
>    if (getChoiceRenderer() instanceof IStyledChoiceRenderer) {
>      IStyledChoiceRenderer styledChoiceRenderer =
> (IStyledChoiceRenderer) getChoiceRenderer();
>
>      String currentOptGroupLabel =
> styledChoiceRenderer.getOptGroupLabel(choice);
>
>      if (!Utils.equalsOrNull(currentOptGroupLabel,
> previouslyAppendedOptGroupLabel)) {
>        // OptGroup changed
>        if (previouslyAppendedOptGroupLabel != null) {
>          endOptGroup(buffer);
>        }
>
>        if (currentOptGroupLabel != null) {
>          // OptGroup started
>          int start = tmp.indexOf("          StringBuilder label = new
> StringBuilder(currentOptGroupLabel.length() + 19);
>          label.append(" label=\"").append(currentOptGroupLabel).append("\">");
>          tmp.insert(start, label);
>        }
>      }
>
>      if ((currentOptGroupLabel != null) && (index == (choices-1))) {
>        // Last option group must end too
>        endOptGroup(tmp);
>      }
>
>      {
>        String cssClass = styledChoiceRenderer.getOptionCssClassName(choice);
>        if (cssClass != null) {
>          int start = tmp.indexOf("          tmp.insert(start + 7, new StringBuilder("
> class=\"").append(cssClass).append("\""));
>        }
>      }
>
>      previouslyAppendedOptGroupLabel = currentOptGroupLabel;
>    }
>
>    buffer.append(tmp);
>  }
>
>  /**
>   * @param tmp
>   */
>  private void endOptG

Re: RE: How can i know when a users redirects to other page

2010-03-02 Thread Sergey Olefir


I'm not sure if session invalidation will be carried out if server
stops/crashes. Although I think the session invalidation mechanism is still
the most reliable of all that was proposed (my personal first reaction was
"you can't do it reliably" -- although after reading the thread I have to
agree that e.g. session invalidation might work).

Anyway, if going session invalidation route, it might be necessary to clean
up the directory at the server startup to make sure all stray files are
cleaned up.


reiern70 wrote:
> 
> http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSessionListener.html
> 
> Ernesto
> 

-- 
View this message in context: 
http://old.nabble.com/How-can-i-know-when-a-users-redirects-to-other-page-tp27742803p27754252.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread Sergey Olefir

As I briefly mentioned before, class aliases are, IMO, a terribly unreliable
thing to maintain. Every time someone comes up with new component that uses
resource reference they must not forget to go and register the alias for it. 

I'm predicting a 100% probability that soon enough someone will forget it
and it'll go into production -- thus defeating the entire purpose behind the
encryption/obfuscation :)

And to comment on what Antoine is saying -- I'm not entirely sure what did
you mean, but if I tried to implement encryption at
CryptedUrlWebRequestCodingStrategy, I will have to ensure that encrypted URL
will have format that will be fully parseable after browser appends relative
CSS URL to it. This is manageable by, say, encrypting only the section of
the path containing the class name. But then I'm completely unsure as to how
properly decode it / fake request for Wicket. The existing code only 'fakes'
parameters string -- but there are API methods that deal with request path
as well, and if those are not correct, I'm not sure what issues that may
cause.

Bottom line -- it must be possible to do encryption at
CryptedUrlWebRequestCodingStrategy, but it will take some serious digging to
make sure all parts fit correctly. It would be far easier to e.g.
automatically add alias in SharedResources method that deals with assigning
the name to shared resource -- the only thing it'll require is to modify
Application class so that e.g. getSharedResources() is not final.

But I'm still hoping for some 'easy' solution that doesn't entail modifying
Wicket source code to avoid headaches when upgrading.



bgooren wrote:
> 
> The easiest way around this is to specify 
> http://wicket.apache.org/docs/1.4/org/apache/wicket/SharedResources.html#putClassAlias(java.lang.Class,
> java.lang.String) class aliases .
> 
> The upside is that you control the generated URL, the downside is that you
> have to make sure the alias is unique.
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754197.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: FormTester and Select component?

2010-03-02 Thread Martin Makundi
No, there is an easier way:

/**
 * @author Martin
 *
 * @param 
 */
public interface IStyledChoiceRenderer extends IChoiceRenderer {
  /**
   * @param t
   * @return String
   */
  public String getOptGroupLabel(T t);

  /**
   * @param t
   * @return String
   */
  public String getOptionCssClassName(T t);
}


/**
 * @author Martin
 *
 * @param 
 */
public class DropDownChoiceWithStylingOptions extends DropDownChoice {
  private String previouslyAppendedOptGroupLabel;
  private int choices;

  /**
   * @param id
   * @param choices
   * @param renderer
   */
  public DropDownChoiceWithStylingOptions(String id,
  IModel> choices,
  IChoiceRenderer renderer) {
super(id, choices, renderer);
  }

  /**
   * @param id
   * @param choices
   */
  public DropDownChoiceWithStylingOptions(String id,
  IModel> choices) {
super(id, choices);
  }

  /**
   * @param id
   * @param model
   * @param choices
   * @param renderer
   */
  public DropDownChoiceWithStylingOptions(String id, IModel model,
  IModel> choices,
  IChoiceRenderer renderer) {
super(id, model, choices, renderer);
  }

  /**
   * @param id
   * @param model
   * @param choices
   */
  public DropDownChoiceWithStylingOptions(String id, IModel model,
  IModel> choices) {
super(id, model, choices);
  }

  /**
   * @param id
   * @param model
   * @param data
   * @param renderer
   */
  public DropDownChoiceWithStylingOptions(String id, IModel model,
  List data, IChoiceRenderer renderer) {
super(id, model, data, renderer);
  }

  /**
   * @param id
   * @param model
   * @param choices
   */
  public DropDownChoiceWithStylingOptions(String id, IModel model,
  List choices) {
super(id, model, choices);
  }

  /**
   * @param id
   * @param data
   * @param renderer
   */
  public DropDownChoiceWithStylingOptions(String id, List data,
  IChoiceRenderer renderer) {
super(id, data, renderer);
  }

  /**
   * @param id
   * @param choices
   */
  public DropDownChoiceWithStylingOptions(String id, List
choices) {
super(id, choices);
  }

  /**
   * @param id
   */
  public DropDownChoiceWithStylingOptions(String id) {
super(id);
  }

  /**
   * @see 
org.apache.wicket.markup.html.form.AbstractChoice#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
org.apache.wicket.markup.ComponentTag)
   */
  @Override
  protected void onComponentTagBody(MarkupStream markupStream,
  ComponentTag openTag) {
previouslyAppendedOptGroupLabel = null;
choices = getChoices().size();
super.onComponentTagBody(markupStream, openTag);
  }

  /**
   * @see 
org.apache.wicket.markup.html.form.AbstractChoice#appendOptionHtml(org.apache.wicket.util.string.AppendingStringBuffer,
java.lang.Object, int, java.lang.String)
   */
  @Override
  protected void appendOptionHtml(AppendingStringBuffer buffer, T choice,
  int index, String selected) {
AppendingStringBuffer tmp = new AppendingStringBuffer(50);
super.appendOptionHtml(tmp, choice, index, selected);

if (getChoiceRenderer() instanceof IStyledChoiceRenderer) {
  IStyledChoiceRenderer styledChoiceRenderer =
(IStyledChoiceRenderer) getChoiceRenderer();

  String currentOptGroupLabel =
styledChoiceRenderer.getOptGroupLabel(choice);

  if (!Utils.equalsOrNull(currentOptGroupLabel,
previouslyAppendedOptGroupLabel)) {
// OptGroup changed
if (previouslyAppendedOptGroupLabel != null) {
  endOptGroup(buffer);
}

if (currentOptGroupLabel != null) {
  // OptGroup started
  int start = tmp.indexOf("");
  tmp.insert(start, label);
}
  }

  if ((currentOptGroupLabel != null) && (index == (choices-1))) {
// Last option group must end too
endOptGroup(tmp);
  }

  {
String cssClass = styledChoiceRenderer.getOptionCssClassName(choice);
if (cssClass != null) {
  int start = tmp.indexOf("");
tmp.insert(start + 9, "");
  }
}

**
Martin

**
Martin


2010/3/2 Jan Eriksson :
> We're using a Select component
> (org.apache.wicket.extensions.markup.html.form.select.Select) to
> display two groups of SelectionOptions in a Form. I guess that is the
> correct component to use when you want to group options and render
> them in optgroup's?
>
> Anyway, we would like to test the form using FormTester but when i try
> to select a value we get the following exception:
>
> org.apache.wicket.WicketRuntimeException: Selecting on the
> component:'0:paymentFormForm:paymentType' is not supported.
>        at org.apache.wicket.util.tester.FormTester.fail(FormTester.java:824)
>        at 
> org.apache.wicket.util.tester.FormTester.access$100(FormTester.java:59)
>        at 
> org.apache.wicket.util.tester.FormTester$ChoiceSelectorFactory.create(FormTester.java:308)
> ..
> ..
>
> and the test code:
>
> FormTester ft = tester.newFormTester("paymentForm", true);
> ft.select("paymentType", 0); // paymentType is the id of the Selec

FormTester and Select component?

2010-03-02 Thread Jan Eriksson
We're using a Select component
(org.apache.wicket.extensions.markup.html.form.select.Select) to
display two groups of SelectionOptions in a Form. I guess that is the
correct component to use when you want to group options and render
them in optgroup's?

Anyway, we would like to test the form using FormTester but when i try
to select a value we get the following exception:

org.apache.wicket.WicketRuntimeException: Selecting on the
component:'0:paymentFormForm:paymentType' is not supported.
at org.apache.wicket.util.tester.FormTester.fail(FormTester.java:824)
at 
org.apache.wicket.util.tester.FormTester.access$100(FormTester.java:59)
at 
org.apache.wicket.util.tester.FormTester$ChoiceSelectorFactory.create(FormTester.java:308)
..
..

and the test code:

FormTester ft = tester.newFormTester("paymentForm", true);
ft.select("paymentType", 0); // paymentType is the id of the Select component


Any help would be appreciated!

thanks,
jan

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



Bug in DateTimeField related to Daylight Savings Time

2010-03-02 Thread Tauren Mills
In case anyone else is having troubles using the DateTimeField (date picker
included in wicket-datetime) with dates on the day daylight savings time
begins (3/14/2010), I've created a Jira issue with a quickstart
demonstrating the problem:
https://issues.apache.org/jira/browse/WICKET-2763

Essentially, I'm having troubles with an exception being thrown when using a
DateTimeField. This is only happening on 3/14/2010 when the Hour field
contains a 2, regardless if it is AM or PM. I believe this is related to
daylight savings time starting at 2AM on 3/14/2010. Times between 2:00AM and
2:59AM don't exist, since at the moment 2:00AM happens, it is actually
3:00AM. This wouldn't be that big of a deal in my app for the 2AM times, but
it even causes an exception when the the date is set to 2PM, because the
logic is setting the JodaTime hour to 2 (not 14) before checking the AM/PM
setting.

Here is the exception:

Caused by: org.joda.time.
IllegalFieldValueException: Value 2 for hourOfDay is not supported: Illegal
instant due to time zone offset transition: 2010-03-14T02:00:00.000
(America/Los_Angeles)

At the moment, I'm using 24 hour mode instead of 12 hour mode so that the
only time there is an error is at 2AM and not also 2PM.

DateTimeField start = new DateTimeField("start", new
PropertyModel(itemModel,"start")) {
@Override
protected boolean use12HourFormat() {
return false;
}
};
add(start);

Tauren


Re: persisting a javascript object via wicket

2010-03-02 Thread Romeo Sheshi
hi

I used wiquery for drag'n drop very easy


Re: RE: How can i know when a users redirects to other page

2010-03-02 Thread Ernesto Reinaldo Barreiro
http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSessionListener.html

Ernesto

On Tue, Mar 2, 2010 at 8:52 AM, Martin Asenov  wrote:

> Hi, Ed!
>
> How do I know when the session expires? I can't see a method onInvalidate()
> for instance. Would you give me a hint on this?
>
> Thank you all for the help!
>
> Best regards,
> Martin
>
> -Original Message-
> From: Edward Zarecor [mailto:edw...@indeterminate.org]
> Sent: Tuesday, March 02, 2010 1:46 AM
> To: users@wicket.apache.org
> Subject: Re: RE: How can i know when a users redirects to other page
>
> Would on session expiry be a better place to handle this?  Implementation
> would be simple and you could avoid ever needing to regenerate a file if
> that is useful to you.  It also naturally handles the case where a user
> doesn't leave the page.
>
> Ed.
>
> On Mar 1, 2010 10:09 AM, "Martin Asenov"  wrote:
>
> The use case is that I generate a file located in a temp folder that
> appears
> on page under a download link. I want to delete the file when the user goes
> in another page.
>
> Regards,
> Martin
>
>
> -Original Message-
> From: Riyad Kalla [mailto:rka...@gmail.com]
> Sent: Monday, March 01, 201...
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>