newbie problem witch wicket...

2008-09-08 Thread dlipski

Hi

Im developing with Wicket for short time so forgive me if I misanderstood
some Wicket concepts. 
Recently I was asked for develop SSO-like feature for Wicket powered web
application. 
Application uses wicket-auth-roles + Acegi for securing wicket pages. 
What I have to do is to let authenticate users to this web app only by
typing URL in their web browsers (or clicking some prepared link). 
This URL will contain username and password but user will not be forced to
fill in any form or press any button - just typing url or cliciking some
prepared link.
Actual way of uthentication (via Wicket page) must remain, so there will be
two ways to login to application: either by filling in form or typing url in
web browser. 
Because this application is using wicket-auth-roles what I have to do is to
retrive from request user login and password and call signIn(username,
password) on Session object. 
This is the moment where problem begins (for me). 
I've tried to write simple servlet to do this but when I've accessed Wicket
session by: Session.get() runtime exception was thrown because Wicket
session cant be created outside request cycle... 
...so I decided to do this inside request cycle, but actually I dont know
any simple solution to execute some code (after sending bookmarkable
request) and redirect to some WicketPage.
What I need is something like BookmarkablePage but dont displaying any page,
only redirecting to other page (after executing autentication,or some other
code), something which might be called BookmarkableAction ;). 
Probably it is possible to write custom request target and extend request
target processor (to create such target) but it looks too complicated for me
to perform some simple task. 
In action oriented frameworks (Struts/SpringMVC/...) its trivial, I know
that Wicket is page oriented framework but Im wondering if there is any
support for such 'actions'.

Maybe there is some other way to achive such SSO-like feature ?

Regards
Daniel
-- 
View this message in context: 
http://www.nabble.com/newbie-problem-witch-wicket...-tp19379967p19379967.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



newbie problem with wicket...

2008-09-08 Thread dlipski

Hi

Im developing with Wicket for short time so forgive me if I misanderstood
some Wicket concepts. 
Recently I was asked for develop SSO-like feature for Wicket powered web
application. 
Application uses wicket-auth-roles + Acegi for securing wicket pages. 
What I have to do is to let authenticate users to this web app only by
typing URL in their web browsers (or clicking some prepared link). 
This URL will contain username and password but user will not be forced to
fill in any form or press any button - just typing url or cliciking some
prepared link.
Actual way of uthentication (via Wicket page) must remain, so there will be
two ways to login to application: either by filling in form or typing url in
web browser. 
Because this application is using wicket-auth-roles what I have to do is to
retrive from request user login and password and call signIn(username,
password) on Session object. 
This is the moment where problem begins (for me). 
I've tried to write simple servlet to do this but when I've accessed Wicket
session by: Session.get() runtime exception was thrown because Wicket
session cant be created outside request cycle... 
...so I decided to do this inside request cycle, but actually I dont know
any simple solution to execute some code (after sending bookmarkable
request) and redirect to some WicketPage.
What I need is something like BookmarkablePage but dont displaying any page,
only redirecting to other page (after executing autentication,or some other
code), something which might be called BookmarkableAction ;). 
Probably it is possible to write custom request target and extend request
target processor (to create such target) but it looks too complicated for me
to perform some simple task. 
In action oriented frameworks (Struts/SpringMVC/...) its trivial, I know
that Wicket is page oriented framework but Im wondering if there is any
support for such 'actions'.

Maybe there is some other way to achive such SSO-like feature ?

Regards
Daniel
-- 
View this message in context: 
http://www.nabble.com/newbie-problem-with-wicket...-tp19379970p19379970.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: newbie problem with wicket...

2008-09-09 Thread dlipski

I don't have secure base page because project is using wicket-auth-roles with
AnnotationsRoleAuthorizationStrategy so there is no need for such page. 

Maybe I misunderstood your idea ?


Johan Compagner wrote:
> 
> Why dont you have a securebasepage class where you do that check for
> login and login if there is that data in the request?
> 
> On 9/8/08, dlipski <[EMAIL PROTECTED]> wrote:
>>
>> Hi
>>
>> Im developing with Wicket for short time so forgive me if I misanderstood
>> some Wicket concepts.
>> Recently I was asked for develop SSO-like feature for Wicket powered web
>> application.
>> Application uses wicket-auth-roles + Acegi for securing wicket pages.
>> What I have to do is to let authenticate users to this web app only by
>> typing URL in their web browsers (or clicking some prepared link).
>> This URL will contain username and password but user will not be forced
>> to
>> fill in any form or press any button - just typing url or cliciking some
>> prepared link.
>> Actual way of uthentication (via Wicket page) must remain, so there will
>> be
>> two ways to login to application: either by filling in form or typing url
>> in
>> web browser.
>> Because this application is using wicket-auth-roles what I have to do is
>> to
>> retrive from request user login and password and call signIn(username,
>> password) on Session object.
>> This is the moment where problem begins (for me).
>> I've tried to write simple servlet to do this but when I've accessed
>> Wicket
>> session by: Session.get() runtime exception was thrown because Wicket
>> session cant be created outside request cycle...
>> ...so I decided to do this inside request cycle, but actually I dont know
>> any simple solution to execute some code (after sending bookmarkable
>> request) and redirect to some WicketPage.
>> What I need is something like BookmarkablePage but dont displaying any
>> page,
>> only redirecting to other page (after executing autentication,or some
>> other
>> code), something which might be called BookmarkableAction ;).
>> Probably it is possible to write custom request target and extend request
>> target processor (to create such target) but it looks too complicated for
>> me
>> to perform some simple task.
>> In action oriented frameworks (Struts/SpringMVC/...) its trivial, I know
>> that Wicket is page oriented framework but Im wondering if there is any
>> support for such 'actions'.
>>
>> Maybe there is some other way to achive such SSO-like feature ?
>>
>> Regards
>> Daniel
>> --
>> View this message in context:
>> http://www.nabble.com/newbie-problem-with-wicket...-tp19379970p19379970.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/newbie-problem-with-wicket...-tp19379970p19387046.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: newbie problem witch wicket...

2008-09-09 Thread dlipski

Hi

It's some idea but I think that its a little bit of hacking (sending GET
request to formSubmitListener). I found other (are they better ?) solutions:
1)Use usual WebPage and in constructor of this page write code to execute
and then at the end call setRedirect(true) and setResponsePage(somePage)
2)Use Statless page and statless link, write code in link onclick method.

Both solutions assume that acces to this page is done through 'bookmarkable'
URL.

None of these two solutions satisfy me completly because each of them is
some kind of hacking for me. 
In first aproach we use Page constructor to execute some code/action not to
display page, this page even doesnt need any markup file (it will never be
rendered), whats more, replacing responsePage in constructor of another page
looks strange - for me it is breaking of contract(or maybe my understanding)
of WebPage.

In second solution we use statless page and statless link not to display
link to the user but just to allow call any code/action throught
'bookmarkable url'. For me this is also breaking of statless page and
statless link contracts.

Because both of this solutions work, I probably choose one of them but Im
curious why there is no support in wicket for such (simple in action based
framework) cases (or maybe there is but I cant find it ?). 

For me it will be great if I could create 'action' like class and call it
from wicket (inside request cycle) and forward/redirect to some page. I
think it could be done by extending RequestCycleProcessor (to accept
wicket:action url) and write new base class for ActionRequestTargets.

I know that Wicket is page oriented framework but wouldnt be great if it
could also support some simple 'ations' ? As I said Im new to Wicket and
maybe it is impossible or its breaking some of wicket vision/assumptions ?
What do you think about such feature ?

Of course when nature of web application is rather action then page oriented
we should use some of existing action based frameworks, but I think (as
newbie) there are scenarios where in page oriented application such feature
(call some code inside request cycle and redirect to page) will be very
helpfull.

Waiting for your opinions.
Reagrds, Daniel


Wayne Pope wrote:
> 
> Hi,
> 
> I've only been using Wicket a very short time, but why don;t you just
> create
> a simple login form page.
> Then look at the source and you'll see something like:
>  action="?wicket:bookmarkablePage=:com.youpackage.LoginPage&wicket:interface=:0:signInPanel:signInForm::IFormSubmitListener::"
> wicket:id="signInForm" id="signInForm" method="post">
> 
> 
> Then you need to just to POST the username and password parameters to the
> above URL , and it'll log you in.
> 
> I not sure how you set to us GET in wicket which would be more easy for
> you.
> But I''m sure someone get tell you how to set that up for a form.
> 
> cheers
> Wayne
> 
> On Mon, Sep 8, 2008 at 9:59 PM, dlipski <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> Hi
>>
>> Im developing with Wicket for short time so forgive me if I misanderstood
>> some Wicket concepts.
>> Recently I was asked for develop SSO-like feature for Wicket powered web
>> application.
>> Application uses wicket-auth-roles + Acegi for securing wicket pages.
>> What I have to do is to let authenticate users to this web app only by
>> typing URL in their web browsers (or clicking some prepared link).
>> This URL will contain username and password but user will not be forced
>> to
>> fill in any form or press any button - just typing url or cliciking some
>> prepared link.
>> Actual way of uthentication (via Wicket page) must remain, so there will
>> be
>> two ways to login to application: either by filling in form or typing url
>> in
>> web browser.
>> Because this application is using wicket-auth-roles what I have to do is
>> to
>> retrive from request user login and password and call signIn(username,
>> password) on Session object.
>> This is the moment where problem begins (for me).
>> I've tried to write simple servlet to do this but when I've accessed
>> Wicket
>> session by: Session.get() runtime exception was thrown because Wicket
>> session cant be created outside request cycle...
>> ...so I decided to do this inside request cycle, but actually I dont know
>> any simple solution to execute some code (after sending bookmarkable
>> request) and redirect to some WicketPage.
>> What I need is something like BookmarkablePage but dont displaying any
>> page,
>> only redirecting to other page (after executing autentication,or some
>> other
>> code), somet

Re: newbie problem witch wicket...

2008-09-10 Thread dlipski

Its very similar to my solution number 1. Instead of executing
setRedirect(true) and setResponsePage(somePage) you propose to throw
RestartResponseAtInterceptPageException.
Could you explain why its better to throw this exception rather then
redirect to resposne page ?

If I understand RestartResponseAtInterceptPageException class it is usefull
when we would like to come back to the page where this exception was thrown
(to MyBookmarkableSimpleSignOnPage in your example) I think this is not a
case in this situtation. However your solution is similar to main so its
make me sure to choose solution number 1.

According to security concerns, I know that passing username and password in
'plain' link its not the most secure way but I wanted to keep my example
simple (witout any tokens etc), but thanks for your comment.
 
Regards Daniel


Jeremy Thomerson-5 wrote:
> 
> How about something like:
> 
> public MyBookmarkableSimpleSignOnPage(PageParameters parameters) {
> super(parameters);
> String username = parameters.getString("un");
> String password = parameters.getString("pw");
> signIn(username, password);
> throw new
> RestartResponseAtInterceptPageException(DestinationPage.class);
> }
> 
> Of course, there are security concerns with having URLs with username and
> password in it.  But, that wasn't what you asked.  You asked specifically
> how to pull username and password from the request, authenticate, and
> redirect to authenticated page.
> 
> Depending on use case, you might think about having a single-use token
> that
> is in the URL instead, or a time-restricted token, and in your DB you
> store
> a reference that relates that token, an expiration, and the user it works
> for.  This could easily be adapted for that.
> 
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> On Tue, Sep 9, 2008 at 2:43 PM, dlipski <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> Hi
>>
>> It's some idea but I think that its a little bit of hacking (sending GET
>> request to formSubmitListener). I found other (are they better ?)
>> solutions:
>> 1)Use usual WebPage and in constructor of this page write code to execute
>> and then at the end call setRedirect(true) and setResponsePage(somePage)
>> 2)Use Statless page and statless link, write code in link onclick method.
>>
>> Both solutions assume that acces to this page is done through
>> 'bookmarkable'
>> URL.
>>
>> None of these two solutions satisfy me completly because each of them is
>> some kind of hacking for me.
>> In first aproach we use Page constructor to execute some code/action not
>> to
>> display page, this page even doesnt need any markup file (it will never
>> be
>> rendered), whats more, replacing responsePage in constructor of another
>> page
>> looks strange - for me it is breaking of contract(or maybe my
>> understanding)
>> of WebPage.
>>
>> In second solution we use statless page and statless link not to display
>> link to the user but just to allow call any code/action throught
>> 'bookmarkable url'. For me this is also breaking of statless page and
>> statless link contracts.
>>
>> Because both of this solutions work, I probably choose one of them but Im
>> curious why there is no support in wicket for such (simple in action
>> based
>> framework) cases (or maybe there is but I cant find it ?).
>>
>> For me it will be great if I could create 'action' like class and call it
>> from wicket (inside request cycle) and forward/redirect to some page. I
>> think it could be done by extending RequestCycleProcessor (to accept
>> wicket:action url) and write new base class for ActionRequestTargets.
>>
>> I know that Wicket is page oriented framework but wouldnt be great if it
>> could also support some simple 'ations' ? As I said Im new to Wicket and
>> maybe it is impossible or its breaking some of wicket vision/assumptions
>> ?
>> What do you think about such feature ?
>>
>> Of course when nature of web application is rather action then page
>> oriented
>> we should use some of existing action based frameworks, but I think (as
>> newbie) there are scenarios where in page oriented application such
>> feature
>> (call some code inside request cycle and redirect to page) will be very
>> helpfull.
>>
>> Waiting for your opinions.
>> Reagrds, Daniel
>>
>>
>> Wayne Pope wrote:
>> >
>> > Hi,
>> >
>> > I've only been using Wicket a very sh

PropertyModel type of key map

2008-09-30 Thread dlipski

Hi

Im trying to 'force' PropertyModel to put into map key different then String
but after few trials I have no idea how to do this. 

Example:
I have field myMap in my page initialized as follows:

Map myMap = new HashMap();

then I create property model for my page(this == page containing myMap
field):
PropertyModel p = new PropertyModel (this, "myMap[123]");

now when I execute:
p.setObject(true);
model puts into map expected boolean but key is of type String not Long. 
How I can force this property model to put with key of choosen class (in
this example Long)? 

Regards
Daniel Lipski
-- 
View this message in context: 
http://www.nabble.com/PropertyModel-type-of-key-map-tp19744489p19744489.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: PropertyModel type of key map

2008-09-30 Thread dlipski

If there is no option to force (why? I can imagine setMapKeyClass method in
PropertyModel...) PropertyModel to do this and I have to use different
Model, I would like to ask does Wicket(or one of Wicket subprojects such as
WicketExtensions) provide such ready to use model ?

Daniel Lipski

igor.vaynberg wrote:
> 
> dont use a property model, roll your own
> 
> -igor
> 
> On Tue, Sep 30, 2008 at 8:31 AM, dlipski <[EMAIL PROTECTED]>
> wrote:
>>
>> Hi
>>
>> Im trying to 'force' PropertyModel to put into map key different then
>> String
>> but after few trials I have no idea how to do this.
>>
>> Example:
>> I have field myMap in my page initialized as follows:
>>
>> Map myMap = new HashMap();
>>
>> then I create property model for my page(this == page containing myMap
>> field):
>> PropertyModel p = new PropertyModel (this, "myMap[123]");
>>
>> now when I execute:
>> p.setObject(true);
>> model puts into map expected boolean but key is of type String not Long.
>> How I can force this property model to put with key of choosen class (in
>> this example Long)?
>>
>> Regards
>> Daniel Lipski
>> --
>> View this message in context:
>> http://www.nabble.com/PropertyModel-type-of-key-map-tp19744489p19744489.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/PropertyModel-type-of-key-map-tp19744489p19747226.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: PropertyModel type of key map

2008-10-01 Thread dlipski

Ok, maybe you are right that adding such method to PropertyModel will make it
bloated, but I think that some model dedicated to work with maps(MapModel ?)
will be nice feature of Wicket.

I know that questions bellow dont stick to the subject of this thread but
maybe you can help me with them. Recently i started to 'study' Wicket API
and Wicket sources and have two questions(so far ;)):

1)What IChainingModel interface is for ? I thought that it will be used
inside model implementations in getObject method checkig if nested model
object is a ChainingModel object but the instance of operator in this
methods checks against IModel interface (what is correct). If I understand
Wicket API correctly it is possible to implement some model with chainnig
ability without implementing IChaininig model - its internal implementation
of get/setObject methods. Could you explain me what I(or rather my model)
gain when my model implements IChaininigModel interface ?

2)When I looked at getTarget() method inside  PropertyModel class I found
that retriving of model object is done inside a loop. I dont understand why
PropertyModel cares about how nested model is implemented. Why it cares ?
because it checks if object returned but nested model is another nested
model or not. I thought that retriving of model object is responisbility of
each model class individually and PropertyModel should only check if its
model object is IModel object (if so return
((IModel)myModelObject).getObject) or is it a 'real' model object(if so
return it).

Answers for this questions will help me implementing my MapModel class.

Tanks for your help,
Regards Daniel


igor.vaynberg wrote:
> 
> why? because propertymodel is a convinience class only. once we start
> adding things like this into it it will get bloated. it is pretty easy
> to roll your own implementing imodel directly.
> 
> -igor
> 
> On Tue, Sep 30, 2008 at 10:53 AM, dlipski <[EMAIL PROTECTED]>
> wrote:
>>
>> If there is no option to force (why? I can imagine setMapKeyClass method
>> in
>> PropertyModel...) PropertyModel to do this and I have to use different
>> Model, I would like to ask does Wicket(or one of Wicket subprojects such
>> as
>> WicketExtensions) provide such ready to use model ?
>>
>> Daniel Lipski
>>
>> igor.vaynberg wrote:
>>>
>>> dont use a property model, roll your own
>>>
>>> -igor
>>>
>>> On Tue, Sep 30, 2008 at 8:31 AM, dlipski <[EMAIL PROTECTED]>
>>> wrote:
>>>>
>>>> Hi
>>>>
>>>> Im trying to 'force' PropertyModel to put into map key different then
>>>> String
>>>> but after few trials I have no idea how to do this.
>>>>
>>>> Example:
>>>> I have field myMap in my page initialized as follows:
>>>>
>>>> Map myMap = new HashMap();
>>>>
>>>> then I create property model for my page(this == page containing myMap
>>>> field):
>>>> PropertyModel p = new PropertyModel (this, "myMap[123]");
>>>>
>>>> now when I execute:
>>>> p.setObject(true);
>>>> model puts into map expected boolean but key is of type String not
>>>> Long.
>>>> How I can force this property model to put with key of choosen class
>>>> (in
>>>> this example Long)?
>>>>
>>>> Regards
>>>> Daniel Lipski
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/PropertyModel-type-of-key-map-tp19744489p19744489.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> -
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/PropertyModel-type-of-key-map-tp19744489p19747226.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/PropertyModel-type-of-key-map-tp19744489p19755807.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



few (not only) AutoCompleteTextField questions

2008-10-23 Thread dlipski

Hi,

First, problem description:
Recently I was asked to change DropDownChoice field into
AutoCompleteTextField. 
Everything was ok untill I noticed that old DropDownChoice field has
attached OnChangeAjaxBehavior.
Ofcourse what works well with DropDownChoice doesnt work as I want with
AutoCompleteTextField. 
The problem is that I want to update a model after user selects one of
choices(from autocomplete) not after any change of text field. 
I found getOnSelectJavascriptExpression method in
AbstractAutoCompleteRenderer (since Wicket 1.4 ?) and I thought that it
would be a good place to call some JS to update text field model.
I looked at
http://cwiki.apache.org/WICKET/calling-wicket-from-javascript.html to see
how to call server side Wicket code from JavaScript. 
Next I had the idea to attach to text field
AjaxFormComponentUpdatingBehavior and call its getCallbackUrl() from
JavaScript returned from mentioned earlier
getOnSelectJavascriptExpression().
The problem is that AjaxFormComponentUpdatingBehavior expects event name in
constructor  - in this case I dont need any onXXX event because I will call
its getCallbackUrl() directly from JS.

Now few questions:
1)How to update (via Ajax) model of some FormComponents from JavaScript? Do
I have to attach AjaxFormComponentUpdatingBehavior to some dummy event and
call its getCallbackUrl() directly in JavaScript ? If so, its kind of
hacking for me and AjaxFormComponentUpdatingBehavior should provide
no-argument constructor.

2)Does JavaScript returned from getOnSelectJavascriptExpression is called
after corresponding TextField value has been set ?

3)At Wicket wiki I found description how to work with AutoCompleteTextField
and Models:
http://cwiki.apache.org/WICKET/autocomplete-using-a-wicket-model.html
I dont understand why this problem is not solved by subclassing directly
form AutoCompleteTextField and overriding getConverter and provide some
custom converter ?

Ps. My colegue told me to attach AjaxFormComponentUpdatingBehavior to onBlur
event, maybe this is the solution ? (but still, for me better place to
update a model is in Javasript from getOnSelectJavascriptExpression() than
in onblur event handler...)

Best regards
Daniel
-- 
View this message in context: 
http://www.nabble.com/few-%28not-only%29-AutoCompleteTextField-questions-tp20131044p20131044.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



DataTable cell link

2008-10-28 Thread dlipski

Hi 

I have one short question:
How to make entire cell in a DataTable a link ?
I've read that Link component can be attached not only to  tags but
also to any other html elements (like  and ) but I dont know how to
use it with DataTable API.

Regards Daniel
-- 
View this message in context: 
http://www.nabble.com/DataTable-cell-link-tp20204702p20204702.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: few (not only) AutoCompleteTextField questions

2008-10-28 Thread dlipski



dlipski wrote:
> 
> Hi,
> 
> First, problem description:
> Recently I was asked to change DropDownChoice field into
> AutoCompleteTextField. 
> Everything was ok untill I noticed that old DropDownChoice field has
> attached OnChangeAjaxBehavior.
> Ofcourse what works well with DropDownChoice doesnt work as I want with
> AutoCompleteTextField. 
> The problem is that I want to update a model after user selects one of
> choices(from autocomplete) not after any change of text field. 
> I found getOnSelectJavascriptExpression method in
> AbstractAutoCompleteRenderer (since Wicket 1.4 ?) and I thought that it
> would be a good place to call some JS to update text field model.
> I looked at
> http://cwiki.apache.org/WICKET/calling-wicket-from-javascript.html to see
> how to call server side Wicket code from JavaScript. 
> Next I had the idea to attach to text field
> AjaxFormComponentUpdatingBehavior and call its getCallbackUrl() from
> JavaScript returned from mentioned earlier
> getOnSelectJavascriptExpression().
> The problem is that AjaxFormComponentUpdatingBehavior expects event name
> in constructor  - in this case I dont need any onXXX event because I will
> call its getCallbackUrl() directly from JS.
> 
> Now few questions:
> 1)How to update (via Ajax) model of some FormComponents from JavaScript?
> Do I have to attach AjaxFormComponentUpdatingBehavior to some dummy event
> and call its getCallbackUrl() directly in JavaScript ? If so, its kind of
> hacking for me and AjaxFormComponentUpdatingBehavior should provide
> no-argument constructor.
> 
> 2)Does JavaScript returned from getOnSelectJavascriptExpression is called
> after corresponding TextField value has been set ?
> 
> 3)At Wicket wiki I found description how to work with
> AutoCompleteTextField and Models:
> http://cwiki.apache.org/WICKET/autocomplete-using-a-wicket-model.html
> I dont understand why this problem is not solved by subclassing directly
> form AutoCompleteTextField and overriding getConverter and provide some
> custom converter ?
> 
> Ps. My colegue told me to attach AjaxFormComponentUpdatingBehavior to
> onBlur event, maybe this is the solution ? (but still, for me better place
> to update a model is in Javasript from getOnSelectJavascriptExpression()
> than in onblur event handler...)
> 
> Best regards
> Daniel
> 

It was as simple as using a AjaxFormComponentUpdatingBehavior... I was
confused because I started with OnChangeAjaxBehavior and it was broking
AutoCompleteTextField - thats why I started thinking of diffrent approaches.

BTW. Why AjaxFormComponentUpdatingBehavior works well with
AutoCompleteTextField  and OnChangeAjaxBehavior doesnt ? Is it a bug in
OnChangeAjaxBehavior or the purpose of this class is different ?

Regards Daniel 

-- 
View this message in context: 
http://www.nabble.com/few-%28not-only%29-AutoCompleteTextField-questions-tp20131044p20207012.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: DataTable cell link

2008-10-28 Thread dlipski

Hi
I dont know wicketopia project (and any of its classes like FragmentColumn)
so I can misunderstand your idea but as far as I am able to read that code
It looks like you are adding a link to the table cell, not making a cell
itself a link.

If I understand your code it is familar to:

<a>text</a>

but Im wondering how to achive:
text

where xyz is code generated by Wicket (like in Link component class)

If I misundestood you could you give me some more details hot to make cell
itself a link ? (not adding a link to the cell) ?

Regards 
Daniel



jwcarman wrote:
> 
> Here's an example where I put a remove link in a DefaultDataTable cell:
> 
> https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/example/src/main/java/org/wicketopia/example/web/page/HomePage.java
> 
> 
> On Tue, Oct 28, 2008 at 6:33 AM, dlipski <[EMAIL PROTECTED]>
> wrote:
>>
>> Hi
>>
>> I have one short question:
>> How to make entire cell in a DataTable a link ?
>> I've read that Link component can be attached not only to <a> tags
>> but
>> also to any other html elements (like  and ) but I dont know how
>> to
>> use it with DataTable API.
>>
>> Regards Daniel
>> --
>> View this message in context:
>> http://www.nabble.com/DataTable-cell-link-tp20204702p20204702.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/DataTable-cell-link-tp20204702p20207438.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: DataTable cell link

2008-10-28 Thread dlipski

All this solutions are correct but the problem is not in attaching some
custom Javascript to  element (which can be done in multiple ways) but
in making td element work as a link.

What exactly should I do to achive this ? What components should I add at
server side at what JavaScript should I render at markup ? 
If I have to copy-paste bunch of Link class code it looks like some
design/implementation problem of DataTable (or one of components it has).

Its really supprising that such common issue is such problematic.
I hope there is some simple and intuitive solution(if I find one I'll post
it here)

Thanks for your help
Regards Daniel


Michael O'Cleirigh wrote:
> 
> Hi Daniel,
> 
> If you subclass DefaultDataTable there is a protected method call 
> newCellItem(...) that you can use to attach the onclick class onto the
> .
> 
> like:
> 
> class MyDataTable extends DefaultDataTable {
>  /* (non-Javadoc)
>  * @see 
> org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable#newCellItem(java.lang.String,
>  
> int, org.apache.wicket.model.IModel)
>  */
> @Override
> protected Item newCellItem(String id, int index, IModel model) {
> 
>  
> Item cell = super.newCellItem(id, index, model);
> 
> 
> cell.add(new AttributeAppender("onclick", new Model 
> ("someJavascriptCall();"));
> 
> return cell;
> }
> }
> 
> Alternately you can use a custom column implementation like the 
> FragrementColumn and add the onclick when the cell is created like:
> 
> class MyOnClickColumn extends AbstractColumn {
> ...
> public void populateItem(Item cellItem, String componentId, IModel
> rowModel)
> {
>Label cell = new Label(componentId, new PropertyModel(rowModel, 
> property))
> 
> cell.add (new AttributeAppender("onclick", new Model 
> ("someJavascriptCall();"));
> 
> cellItem.add(cell);
> }
> }
> 
> 
> I think the second version would attach the onclick to the label within 
> the  of a cell.
> 
> Regards,
> 
> Mike
>> I dont know wicketopia project (and any of its classes like
>> FragmentColumn)
>> so I can misunderstand your idea but as far as I am able to read that
>> code
>> It looks like you are adding a link to the table cell, not making a cell
>> itself a link.
>>
>> If I understand your code it is familar to:
>>
>> <a>text</a>
>>
>> but Im wondering how to achive:
>> text
>>
>> where xyz is code generated by Wicket (like in Link component class)
>>
>> If I misundestood you could you give me some more details hot to make
>> cell
>> itself a link ? (not adding a link to the cell) ?
>>
>> Regards 
>> Daniel
>>
>>
>>
>> jwcarman wrote:
>>   
>>> Here's an example where I put a remove link in a DefaultDataTable cell:
>>>
>>> https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/example/src/main/java/org/wicketopia/example/web/page/HomePage.java
>>>
>>>
>>> On Tue, Oct 28, 2008 at 6:33 AM, dlipski <[EMAIL PROTECTED]>
>>> wrote:
>>> 
>>>> Hi
>>>>
>>>> I have one short question:
>>>> How to make entire cell in a DataTable a link ?
>>>> I've read that Link component can be attached not only to <a>
>>>> tags
>>>> but
>>>> also to any other html elements (like  and ) but I dont know
>>>> how
>>>> to
>>>> use it with DataTable API.
>>>>
>>>> Regards Daniel
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/DataTable-cell-link-tp20204702p20204702.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> -
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>   
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>> 
>>
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/DataTable-cell-link-tp20204702p20213839.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: few (not only) AutoCompleteTextField questions

2008-10-28 Thread dlipski

Textfields do recive onchange event, even AutocompleteTextField has modified
version off onchange event handler.
Whats more new AjaxFormComponentUpdatingBehavior("onchange"){..}; works well
in this scenario but
OnChangeAjaxBehavior not. 
I looked at OnChangeAjaxBehavior implemenation and this is a subclass of
AjaxFormComponentUpdatingBehavior class with super("onchange"); call in its
constructor. 
This class only provides its own implementation of onComponentRendered
method so there should be a problem. 
When I looked at OnChangeAjaxBehavior class contract description in JavaDoc
("A behavior that updates the hosting FormComponent via ajax when value of
the component is changed. This behavior uses best available method to track
changes on different types of form components.") there is no mention that it
shouldnt be used with some components so I think its bug either in
OnChangeAjaxBehavior class or AutocompleteTextField class.

Correct me if I'm wrong.
Regards Daniel


igor.vaynberg wrote:
> 
> probably because textfields do not receive onchange event, or
> something else was hijacking it.
> 
> -igor
> 
> On Tue, Oct 28, 2008 at 6:17 AM, dlipski <[EMAIL PROTECTED]>
> wrote:
>>
>>
>>
>> dlipski wrote:
>>>
>>> Hi,
>>>
>>> First, problem description:
>>> Recently I was asked to change DropDownChoice field into
>>> AutoCompleteTextField.
>>> Everything was ok untill I noticed that old DropDownChoice field has
>>> attached OnChangeAjaxBehavior.
>>> Ofcourse what works well with DropDownChoice doesnt work as I want with
>>> AutoCompleteTextField.
>>> The problem is that I want to update a model after user selects one of
>>> choices(from autocomplete) not after any change of text field.
>>> I found getOnSelectJavascriptExpression method in
>>> AbstractAutoCompleteRenderer (since Wicket 1.4 ?) and I thought that it
>>> would be a good place to call some JS to update text field model.
>>> I looked at
>>> http://cwiki.apache.org/WICKET/calling-wicket-from-javascript.html to
>>> see
>>> how to call server side Wicket code from JavaScript.
>>> Next I had the idea to attach to text field
>>> AjaxFormComponentUpdatingBehavior and call its getCallbackUrl() from
>>> JavaScript returned from mentioned earlier
>>> getOnSelectJavascriptExpression().
>>> The problem is that AjaxFormComponentUpdatingBehavior expects event name
>>> in constructor  - in this case I dont need any onXXX event because I
>>> will
>>> call its getCallbackUrl() directly from JS.
>>>
>>> Now few questions:
>>> 1)How to update (via Ajax) model of some FormComponents from JavaScript?
>>> Do I have to attach AjaxFormComponentUpdatingBehavior to some dummy
>>> event
>>> and call its getCallbackUrl() directly in JavaScript ? If so, its kind
>>> of
>>> hacking for me and AjaxFormComponentUpdatingBehavior should provide
>>> no-argument constructor.
>>>
>>> 2)Does JavaScript returned from getOnSelectJavascriptExpression is
>>> called
>>> after corresponding TextField value has been set ?
>>>
>>> 3)At Wicket wiki I found description how to work with
>>> AutoCompleteTextField and Models:
>>> http://cwiki.apache.org/WICKET/autocomplete-using-a-wicket-model.html
>>> I dont understand why this problem is not solved by subclassing directly
>>> form AutoCompleteTextField and overriding getConverter and provide some
>>> custom converter ?
>>>
>>> Ps. My colegue told me to attach AjaxFormComponentUpdatingBehavior to
>>> onBlur event, maybe this is the solution ? (but still, for me better
>>> place
>>> to update a model is in Javasript from getOnSelectJavascriptExpression()
>>> than in onblur event handler...)
>>>
>>> Best regards
>>> Daniel
>>>
>>
>> It was as simple as using a AjaxFormComponentUpdatingBehavior... I was
>> confused because I started with OnChangeAjaxBehavior and it was broking
>> AutoCompleteTextField - thats why I started thinking of diffrent
>> approaches.
>>
>> BTW. Why AjaxFormComponentUpdatingBehavior works well with
>> AutoCompleteTextField  and OnChangeAjaxBehavior doesnt ? Is it a bug in
>> OnChangeAjaxBehavior or the purpose of this class is different ?
>>
>> Regards Daniel
>>
>> --
>> View this message in context:
>> http://www.nabble.com/few-%28not-only%29-AutoCompleteTextField-questions-tp20131044p20207012.html
>> Sent from the Wicket - User mailing list 

Re: DataTable cell link

2008-10-28 Thread dlipski

Exaclty, problem is with 'consuming' td element by Item object.

The problem is that if you have wide column but short text in it some users
have problem with hitting the text (which is a link) .The idea is to make
whole td element 'clickable'(or linkable). 
The solution would be if table could have any component as row or cell
element not only Item object. 
But I know that this is a big change in DataTable class (or one of its child
component class) .



jwcarman wrote:
> 
> On Tue, Oct 28, 2008 at 3:05 PM, dlipski <[EMAIL PROTECTED]>
> wrote:
>>
>> All this solutions are correct but the problem is not in attaching some
>> custom Javascript to  element (which can be done in multiple ways)
>> but
>> in making td element work as a link.
>>
> 
> Right, the  element is already consumed by the Item object, so you
> can't attach your link to it.
> 
>> What exactly should I do to achive this ? What components should I add at
>> server side at what JavaScript should I render at markup ?
>> If I have to copy-paste bunch of Link class code it looks like some
>> design/implementation problem of DataTable (or one of components it has).
>>
> 
> What is your requirement exactly?  Is there going to be any text (or
> image) in your cell?  If so, why can't it be a link?
> 
>> Its really supprising that such common issue is such problematic.
>> I hope there is some simple and intuitive solution(if I find one I'll
>> post
>> it here)
>>
>> Thanks for your help
>> Regards Daniel
>>
>>
>> Michael O'Cleirigh wrote:
>>>
>>> Hi Daniel,
>>>
>>> If you subclass DefaultDataTable there is a protected method call
>>> newCellItem(...) that you can use to attach the onclick class onto the
>>> .
>>>
>>> like:
>>>
>>> class MyDataTable extends DefaultDataTable {
>>>  /* (non-Javadoc)
>>>  * @see
>>> org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable#newCellItem(java.lang.String,
>>> int, org.apache.wicket.model.IModel)
>>>  */
>>> @Override
>>> protected Item newCellItem(String id, int index, IModel model) {
>>>
>>>
>>> Item cell = super.newCellItem(id, index, model);
>>>
>>>
>>> cell.add(new AttributeAppender("onclick", new Model
>>> ("someJavascriptCall();"));
>>>
>>> return cell;
>>> }
>>> }
>>>
>>> Alternately you can use a custom column implementation like the
>>> FragrementColumn and add the onclick when the cell is created like:
>>>
>>> class MyOnClickColumn extends AbstractColumn {
>>> ...
>>> public void populateItem(Item cellItem, String componentId, IModel
>>> rowModel)
>>> {
>>>Label cell = new Label(componentId, new PropertyModel(rowModel,
>>> property))
>>>
>>> cell.add (new AttributeAppender("onclick", new Model
>>> ("someJavascriptCall();"));
>>>
>>> cellItem.add(cell);
>>> }
>>> }
>>>
>>>
>>> I think the second version would attach the onclick to the label within
>>> the  of a cell.
>>>
>>> Regards,
>>>
>>> Mike
>>>> I dont know wicketopia project (and any of its classes like
>>>> FragmentColumn)
>>>> so I can misunderstand your idea but as far as I am able to read that
>>>> code
>>>> It looks like you are adding a link to the table cell, not making a
>>>> cell
>>>> itself a link.
>>>>
>>>> If I understand your code it is familar to:
>>>>
>>>> <a>text</a>
>>>>
>>>> but Im wondering how to achive:
>>>> text
>>>>
>>>> where xyz is code generated by Wicket (like in Link component class)
>>>>
>>>> If I misundestood you could you give me some more details hot to make
>>>> cell
>>>> itself a link ? (not adding a link to the cell) ?
>>>>
>>>> Regards
>>>> Daniel
>>>>
>>>>
>>>>
>>>> jwcarman wrote:
>>>>
>>>>> Here's an example where I put a remove link in a DefaultDataTable
>>>>> cell:
>>>>>
>>>>> https://wicketopia.svn.sou

Re: DataTable cell link

2008-10-29 Thread dlipski

Hi,
Thanks for help but the problem with your solution is that it doesnt work in
IE (when I have multiple columns with such links only links in first column
'fills' entire cells) in Firefox that works.


Jeremy Thomerson-5 wrote:
> 
> If that's your problem, I'd suggest using CSS, something like:
> 
> TD A {
> display: block;
> }
> 
> This is much better because the anchor will fill the box (fixing your
> problem), and you are more compatible (if JS is off, etc).
> 
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> On Tue, Oct 28, 2008 at 2:42 PM, dlipski <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> Exaclty, problem is with 'consuming' td element by Item object.
>>
>> The problem is that if you have wide column but short text in it some
>> users
>> have problem with hitting the text (which is a link) .The idea is to make
>> whole td element 'clickable'(or linkable).
>> The solution would be if table could have any component as row or cell
>> element not only Item object.
>> But I know that this is a big change in DataTable class (or one of its
>> child
>> component class) .
>>
>>
>>
>> jwcarman wrote:
>> >
>> > On Tue, Oct 28, 2008 at 3:05 PM, dlipski <[EMAIL PROTECTED]>
>> > wrote:
>> >>
>> >> All this solutions are correct but the problem is not in attaching
>> some
>> >> custom Javascript to  element (which can be done in multiple ways)
>> >> but
>> >> in making td element work as a link.
>> >>
>> >
>> > Right, the  element is already consumed by the Item object, so you
>> > can't attach your link to it.
>> >
>> >> What exactly should I do to achive this ? What components should I add
>> at
>> >> server side at what JavaScript should I render at markup ?
>> >> If I have to copy-paste bunch of Link class code it looks like some
>> >> design/implementation problem of DataTable (or one of components it
>> has).
>> >>
>> >
>> > What is your requirement exactly?  Is there going to be any text (or
>> > image) in your cell?  If so, why can't it be a link?
>> >
>> >> Its really supprising that such common issue is such problematic.
>> >> I hope there is some simple and intuitive solution(if I find one I'll
>> >> post
>> >> it here)
>> >>
>> >> Thanks for your help
>> >> Regards Daniel
>> >>
>> >>
>> >> Michael O'Cleirigh wrote:
>> >>>
>> >>> Hi Daniel,
>> >>>
>> >>> If you subclass DefaultDataTable there is a protected method call
>> >>> newCellItem(...) that you can use to attach the onclick class onto
>> the
>> >>> .
>> >>>
>> >>> like:
>> >>>
>> >>> class MyDataTable extends DefaultDataTable {
>> >>>  /* (non-Javadoc)
>> >>>  * @see
>> >>>
>> org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable#newCellItem(java.lang.String,
>> >>> int, org.apache.wicket.model.IModel)
>> >>>  */
>> >>> @Override
>> >>> protected Item newCellItem(String id, int index, IModel model) {
>> >>>
>> >>>
>> >>> Item cell = super.newCellItem(id, index, model);
>> >>>
>> >>>
>> >>> cell.add(new AttributeAppender("onclick", new Model
>> >>> ("someJavascriptCall();"));
>> >>>
>> >>> return cell;
>> >>> }
>> >>> }
>> >>>
>> >>> Alternately you can use a custom column implementation like the
>> >>> FragrementColumn and add the onclick when the cell is created like:
>> >>>
>> >>> class MyOnClickColumn extends AbstractColumn {
>> >>> ...
>> >>> public void populateItem(Item cellItem, String componentId, IModel
>> >>> rowModel)
>> >>> {
>> >>>Label cell = new Label(componentId, new
>> PropertyModel(rowModel,
>> >>> property))
>> >>>
>> >>> cell.add (new AttributeAppender("onclick", new Model
>> >>> ("someJavascriptCall();"));
>> >>>
>> >>> cellItem.

Re: DataTable cell link

2008-10-29 Thread dlipski

Because I havent found better solution then adding 'onclick' handler to
cellItem I have to do it your way.
I looked at urlFor methods in Component class and didnt found the one with
Component attribute. 
How should I generate url for Link component, AjaxLink or AjaxFallbackLink ?
Do I have to add this components to the page and set its visiblity to false
?
I understand 'general concept' of this solution but dont know how to
implement this in specific scenarion (ie. linking to Link, AjaxLink,
AjaxFallbackLink).

Using diffrent repeater could be a option but DataTable (or
AjaxFallbackDefaultDataTable) provides a lot of functionality (sorting,
paging, fallback links etc) so it would be a waste of time to implement its
from scratch just because its hard to make a table cell (or row) a link. It
must be a way to achive this... if not it serious limitation of DataTable
component.

Regards Daniel


Jeremy Thomerson-5 wrote:
> 
> Depending on what you are linking TO, it can be very simple.  You can call
> urlFor(YourBookmarkablePage.class, pageParamsOrNullIfNone).  So, you could
> do:
> 
> cellItem.add(new SimpleAttributeModifier("onclick", "location.href = '" +
> urlFor(YourBookmarkablePage.class, pageParamsOrNullIfNone) + "'"));
> 
> Of course, that JS could be better for triple click problems, etc.
> 
> Really, you may just consider using another Repeater rather than
> DataTable.
> DataTable is for a very specific purpose, and it is often easier to roll
> your own than make DT fit your purpose.
> 
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> On Tue, Oct 28, 2008 at 2:05 PM, dlipski <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> All this solutions are correct but the problem is not in attaching some
>> custom Javascript to  element (which can be done in multiple ways)
>> but
>> in making td element work as a link.
>>
>> What exactly should I do to achive this ? What components should I add at
>> server side at what JavaScript should I render at markup ?
>> If I have to copy-paste bunch of Link class code it looks like some
>> design/implementation problem of DataTable (or one of components it has).
>>
>> Its really supprising that such common issue is such problematic.
>> I hope there is some simple and intuitive solution(if I find one I'll
>> post
>> it here)
>>
>> Thanks for your help
>> Regards Daniel
>>
>>
>> Michael O'Cleirigh wrote:
>> >
>> > Hi Daniel,
>> >
>> > If you subclass DefaultDataTable there is a protected method call
>> > newCellItem(...) that you can use to attach the onclick class onto the
>> > .
>> >
>> > like:
>> >
>> > class MyDataTable extends DefaultDataTable {
>> >  /* (non-Javadoc)
>> >  * @see
>> >
>> org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable#newCellItem(java.lang.String,
>> > int, org.apache.wicket.model.IModel)
>> >  */
>> > @Override
>> > protected Item newCellItem(String id, int index, IModel model) {
>> >
>> >
>> > Item cell = super.newCellItem(id, index, model);
>> >
>> >
>> > cell.add(new AttributeAppender("onclick", new Model
>> > ("someJavascriptCall();"));
>> >
>> > return cell;
>> > }
>> > }
>> >
>> > Alternately you can use a custom column implementation like the
>> > FragrementColumn and add the onclick when the cell is created like:
>> >
>> > class MyOnClickColumn extends AbstractColumn {
>> > ...
>> > public void populateItem(Item cellItem, String componentId, IModel
>> > rowModel)
>> > {
>> >Label cell = new Label(componentId, new PropertyModel(rowModel,
>> > property))
>> >
>> > cell.add (new AttributeAppender("onclick", new Model
>> > ("someJavascriptCall();"));
>> >
>> > cellItem.add(cell);
>> > }
>> > }
>> >
>> >
>> > I think the second version would attach the onclick to the label within
>> > the  of a cell.
>> >
>> > Regards,
>> >
>> > Mike
>> >> I dont know wicketopia project (and any of its classes like
>> >> FragmentColumn)
>> >> so I can misunderstand your idea but as far as I am able to read that
>> >> code
>> >> It looks like you are adding a link to the table cell, not making a
>> 

Re: DataTable cell link

2008-10-29 Thread dlipski

My colegue point out that for Ajax requests AjaxEventBehavior can be used,
and it works fine. so now I need only solution for normal (non Ajax)
requests.


dlipski wrote:
> 
> Because I havent found better solution then adding 'onclick' handler to
> cellItem I have to do it your way.
> I looked at urlFor methods in Component class and didnt found the one with
> Component attribute. 
> How should I generate url for Link component, AjaxLink or AjaxFallbackLink
> ?
> Do I have to add this components to the page and set its visiblity to
> false ?
> I understand 'general concept' of this solution but dont know how to
> implement this in specific scenarion (ie. linking to Link, AjaxLink,
> AjaxFallbackLink).
> 
> Using diffrent repeater could be a option but DataTable (or
> AjaxFallbackDefaultDataTable) provides a lot of functionality (sorting,
> paging, fallback links etc) so it would be a waste of time to implement
> its from scratch just because its hard to make a table cell (or row) a
> link. It must be a way to achive this... if not it serious limitation of
> DataTable component.
> 
> Regards Daniel
> 
> 
> Jeremy Thomerson-5 wrote:
>> 
>> Depending on what you are linking TO, it can be very simple.  You can
>> call
>> urlFor(YourBookmarkablePage.class, pageParamsOrNullIfNone).  So, you
>> could
>> do:
>> 
>> cellItem.add(new SimpleAttributeModifier("onclick", "location.href = '" +
>> urlFor(YourBookmarkablePage.class, pageParamsOrNullIfNone) + "'"));
>> 
>> Of course, that JS could be better for triple click problems, etc.
>> 
>> Really, you may just consider using another Repeater rather than
>> DataTable.
>> DataTable is for a very specific purpose, and it is often easier to roll
>> your own than make DT fit your purpose.
>> 
>> 
>> -- 
>> Jeremy Thomerson
>> http://www.wickettraining.com
>> 
>> 
>> On Tue, Oct 28, 2008 at 2:05 PM, dlipski <[EMAIL PROTECTED]>
>> wrote:
>> 
>>>
>>> All this solutions are correct but the problem is not in attaching some
>>> custom Javascript to  element (which can be done in multiple ways)
>>> but
>>> in making td element work as a link.
>>>
>>> What exactly should I do to achive this ? What components should I add
>>> at
>>> server side at what JavaScript should I render at markup ?
>>> If I have to copy-paste bunch of Link class code it looks like some
>>> design/implementation problem of DataTable (or one of components it
>>> has).
>>>
>>> Its really supprising that such common issue is such problematic.
>>> I hope there is some simple and intuitive solution(if I find one I'll
>>> post
>>> it here)
>>>
>>> Thanks for your help
>>> Regards Daniel
>>>
>>>
>>> Michael O'Cleirigh wrote:
>>> >
>>> > Hi Daniel,
>>> >
>>> > If you subclass DefaultDataTable there is a protected method call
>>> > newCellItem(...) that you can use to attach the onclick class onto the
>>> > .
>>> >
>>> > like:
>>> >
>>> > class MyDataTable extends DefaultDataTable {
>>> >  /* (non-Javadoc)
>>> >  * @see
>>> >
>>> org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable#newCellItem(java.lang.String,
>>> > int, org.apache.wicket.model.IModel)
>>> >  */
>>> > @Override
>>> > protected Item newCellItem(String id, int index, IModel model) {
>>> >
>>> >
>>> > Item cell = super.newCellItem(id, index, model);
>>> >
>>> >
>>> > cell.add(new AttributeAppender("onclick", new Model
>>> > ("someJavascriptCall();"));
>>> >
>>> > return cell;
>>> > }
>>> > }
>>> >
>>> > Alternately you can use a custom column implementation like the
>>> > FragrementColumn and add the onclick when the cell is created like:
>>> >
>>> > class MyOnClickColumn extends AbstractColumn {
>>> > ...
>>> > public void populateItem(Item cellItem, String componentId, IModel
>>> > rowModel)
>>> > {
>>> >Label cell = new Label(componentId, new PropertyModel(rowModel,
>>> > property))
>>> >
>>> > cell.add (new AttributeAppender("onclick", new M

Re: DataTable cell link

2008-10-29 Thread dlipski

That was the solution I was looking for.
I havent know that it is possible to do thinks that way !
I supose that I have to override newCellItem and newRowItem method in
DataTable class and return ClickableItem instead of Item. 

Good to know that it is possible to do this in standard Wicket way without
'magic code'. Although it works and all classes follows their contracts in
my opinion it would be more coherent and obvious if DataTable could work
with any somponent as cell/row but its only my notice...



igor.vaynberg wrote:
> 
> abstract class clickableitem extends item implements ilinklistener {
> 
>  protected oncomponenttag(tag) {
>super
>   
> tag.put("onclick","window.location='"+urlfor(ilinklistenerinterface.interface)+"';");
>  }
> 
> }
> 
> thats about all it takes
> 
> -igor
> 
> On Wed, Oct 29, 2008 at 4:20 AM, dlipski <[EMAIL PROTECTED]>
> wrote:
>>
>> My colegue point out that for Ajax requests AjaxEventBehavior can be
>> used,
>> and it works fine. so now I need only solution for normal (non Ajax)
>> requests.
>>
>>
>> dlipski wrote:
>>>
>>> Because I havent found better solution then adding 'onclick' handler to
>>> cellItem I have to do it your way.
>>> I looked at urlFor methods in Component class and didnt found the one
>>> with
>>> Component attribute.
>>> How should I generate url for Link component, AjaxLink or
>>> AjaxFallbackLink
>>> ?
>>> Do I have to add this components to the page and set its visiblity to
>>> false ?
>>> I understand 'general concept' of this solution but dont know how to
>>> implement this in specific scenarion (ie. linking to Link, AjaxLink,
>>> AjaxFallbackLink).
>>>
>>> Using diffrent repeater could be a option but DataTable (or
>>> AjaxFallbackDefaultDataTable) provides a lot of functionality (sorting,
>>> paging, fallback links etc) so it would be a waste of time to implement
>>> its from scratch just because its hard to make a table cell (or row) a
>>> link. It must be a way to achive this... if not it serious limitation of
>>> DataTable component.
>>>
>>> Regards Daniel
>>>
>>>
>>> Jeremy Thomerson-5 wrote:
>>>>
>>>> Depending on what you are linking TO, it can be very simple.  You can
>>>> call
>>>> urlFor(YourBookmarkablePage.class, pageParamsOrNullIfNone).  So, you
>>>> could
>>>> do:
>>>>
>>>> cellItem.add(new SimpleAttributeModifier("onclick", "location.href = '"
>>>> +
>>>> urlFor(YourBookmarkablePage.class, pageParamsOrNullIfNone) + "'"));
>>>>
>>>> Of course, that JS could be better for triple click problems, etc.
>>>>
>>>> Really, you may just consider using another Repeater rather than
>>>> DataTable.
>>>> DataTable is for a very specific purpose, and it is often easier to
>>>> roll
>>>> your own than make DT fit your purpose.
>>>>
>>>>
>>>> --
>>>> Jeremy Thomerson
>>>> http://www.wickettraining.com
>>>>
>>>>
>>>> On Tue, Oct 28, 2008 at 2:05 PM, dlipski <[EMAIL PROTECTED]>
>>>> wrote:
>>>>
>>>>>
>>>>> All this solutions are correct but the problem is not in attaching
>>>>> some
>>>>> custom Javascript to  element (which can be done in multiple ways)
>>>>> but
>>>>> in making td element work as a link.
>>>>>
>>>>> What exactly should I do to achive this ? What components should I add
>>>>> at
>>>>> server side at what JavaScript should I render at markup ?
>>>>> If I have to copy-paste bunch of Link class code it looks like some
>>>>> design/implementation problem of DataTable (or one of components it
>>>>> has).
>>>>>
>>>>> Its really supprising that such common issue is such problematic.
>>>>> I hope there is some simple and intuitive solution(if I find one I'll
>>>>> post
>>>>> it here)
>>>>>
>>>>> Thanks for your help
>>>>> Regards Daniel
>>>>>
>>>>>
>>>>> Michael O'Cleirigh wrote:
>>>>> >
>>>>> > Hi Daniel,
>>>>> >
>>>

testing borders with WicketTester

2008-10-31 Thread dlipski

Hi 

Is it possible (if not why?) to test Border components in a way similar to
testing Panels ?  -WicketTester.startPanel(TestPanelSource) ? Its strange
but I cant find corresponding method for Borders.

Thanks in advance.

Daniel Lipski
-- 
View this message in context: 
http://www.nabble.com/testing-borders-with-WicketTester-tp20268028p20268028.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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