Re: Problem getting data from a 'CharSequenceResource'

2014-09-09 Thread manumoreno
Martin Grigorov-4 wrote
> Hi,
> 
> The 

>  element has two JavaScript event listeners for 'click' event - one
> by Wicket's AjaxFallbackLink and another by (Knockout.js ?!) data-bind
> attribute.
> The order of their execution is not determined.
> If Wicket's listener is called first then it will get the old value: 
> null,
> click1, click2, etc.
> While data-bind's listener will get: click1, click2, click3, etc.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov

Ough!, yes, there are two event listeners for click,. (Knockout, good
guess!), I think I'll try to make two components separately or use different
events. 

Do you think is feasible use two events in the same
component  ?, for example,. an 'event: {onfocus}' from Knockout and the
AjaxFallbacklink?

Thanks a lot Martin,. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-getting-data-from-a-CharSequenceResource-tp4667434p4667443.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
The usecase requires it :-) I send an example to you.

I hope this will be possible because then you are also able to do ajax requests 
from embedded jsp files. :-D

thanks anyway! 

> Am 09.09.2014 um 16:29 schrieb "Richter, Marvin" 
> :
> 
> That definitely sounds like a really odd use case or am I wrong?
> 
> Do you really want to generate the URL outside from the Wicket context?
> I mean this is something which is heavily tied to wicket anyway so why not 
> generating it inside it's context?
> And where do you need/use the final generated URL? I guess inside the Wicket 
> context ... 
> 
> Maybe you should rethinking your use case, I bet the problem you're trying to 
> solve can be solved much, much easier!
> 
> Anyway .. wish you luck ;)
> 
> -Original Message-
> From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com] 
> Sent: Tuesday, September 09, 2014 2:58 PM
> To: users@wicket.apache.org
> Subject: Re: Global Ajax Event Handler
> 
> Thats the point. It is not used within a Component / Behavior - so I cant use 
> getPage() ...
> 
>> Am 09.09.2014 um 14:50 schrieb Martin Grigorov :
>> 
>> The UrlGenerator class is used somewhere where the Page is available, no ?
>> In SomeComponent/SomeBehavior:
>> 
>> UrlGenerator generator = new UrlGenerator(); Url url = 
>> generator.generate(getPage().getPageId());
>> 
>> Session.get().getPageManager().getPage(exisingAndNonExpiredPageId) is 
>> the way to get a reference to the page.
>> Wicket uses this API internally every time you click a link or button.
>> 
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>> 
>> 
>> On Tue, Sep 9, 2014 at 3:45 PM, Tobias Soloschenko < 
>> tobiassolosche...@googlemail.com> wrote:
>> 
>>> And thats the question I was looking for - how do I get the current 
>>> page id within the class that generates the url which is no component 
>>> and the second question was how do I get the page to that id, because 
>>> (Page)
>>> WebSession.get().getPageManager().getPage(i.get()) returns null for 
>>> int i 0-10, event if I cleared the browsers cache / restarted the server.
>>> 
>>> kind regards and big thanks for all the help!
>>> 
>>> Tobias
>>> 
>>> 2014-09-09 14:28 GMT+02:00 Martin Grigorov :
>>> 
 Session#pageId is a counter that is used to give an id to the next
>>> created
 page.
 It is not the id of the currently used page!
 
 You will need to provide the pageId somehow to the class that 
 generates
>>> the
 url.
 
 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 
 On Tue, Sep 9, 2014 at 3:13 PM, Tobias Soloschenko < 
 tobiassolosche...@googlemail.com> wrote:
 
> The method getPage() is not available at the place where I'm 
> building
>>> the
> link - I'm not within a component and I try to get the page by 
> content
>>> of
> the session. :-)
> 
> I didn't modified the Session - the pageId is stored in 
> org.apache.wicket.Session.pageId which is an AtomicInteger
> 
> 
> 2014-09-09 14:06 GMT+02:00 Martin Grigorov :
> 
>> Pass the pageId as a query string parameter.
>> 
>> PageParameters params = new PageParameters(); params.set("pageId", 
>> getPage().getPageId()); theUrlToTheReference = 
>> requestCycle.urlFor(yourResRef, params);
>> 
>> Then in the IResource (better extend AbstractResource) just read 
>> it
 from
>> the request parameters.
>> 
>> Storing the pageId in the session is not OK because the user may 
>> open
 two
>> different pages in separate tabs/windows and this will break.
>> 
>> 
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>> 
>> 
>> On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko < 
>> tobiassolosche...@googlemail.com> wrote:
>> 
>>> Thanks again for the fast answer. My code now looks this way:
>>> 
>>>   Field declaredField =
>>> WebSession.get().getClass().getSuperclass()
>>>   .getDeclaredField("pageId");
>>> 
>>>   declaredField.setAccessible(true);
>>>   AtomicInteger i = (AtomicInteger) 
>>> declaredField.get(WebSession.get());
>>>   Page page = (Page) WebSession.get().getPageManager()
>>>   .getPage(i.get());
>>> 
>>>   AjaxRequestTarget newAjaxRequestTarget =
 ((WebApplication)
>>> Application.get())
>>>   .newAjaxRequestTarget(page);
>>> 
>>>   RequestCycle.get().scheduleRequestHandlerAfterCurrent(
>>>   newAjaxRequestTarget);
>>> 
>>> I dont know how to get the current pageId but from the Session. 
>>> The
> page
>> at
>>> this place is null. :-(
>>> 
>>> 
>>> 
>>> 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
>>> 
 On Tue, Sep 9, 2014 at 2:

Re: Referencing DataTable rows within the table column header

2014-09-09 Thread Paul Bors
Another piece of advice,

Avoid unnecessary casts (Wicket 6 supports generics) and try not to use
code to navigate the wicket component tree unnecessary like this line of
code:

WebMarkupContainer container = ((WebMarkupContainer)
dropDownChoice.findParent(DataTable.class).get(1));

Get familiar with the best practices documented at:
http://wicket.apache.org/guide/guide/single.html#bestpractices

You should give the free guide a read back to back and treat it as your
bible until you get a bit more intimate with Wicket :)

Other resources available for you to learn and master Wicket are the Wicket
Stuff (http://wicketstuff.org/) and the examples at:
http://www.wicket-library.com/wicket-examples-6.0.x/index.html

Get familiar to those as well.

For a filter toolbar see:
http://www.wicket-library.com/wicket-examples-6.0.x/repeater/wicket/bookmarkable/org.apache.wicket.examples.repeater.DataTableFilterToolbarPage;jsessionid=03E1374082C8198F0F052CED6E54F7A1?0

Although is not using a drop-down but you'll get the idea :)

~ Thank you,
   Paul Bors


On Tue, Sep 9, 2014 at 2:57 PM, Paul Bors  wrote:

> Hey Ephraim,
>
> At Knoa for the console code I created an API around those components.
> You don't have to re-invent the wheel, all you have to do is get familiar
> with the console commons and which DropDown component to use.
>
> Remember wicket is a component driven framework similar to Swing.
>
> I would recommend using one of the Ajax enabled drop downs and override
> the method to refresh the data table rows of interest. There are plenty of
> examples in the console's code base... look at how other table such as the
> ones for the End User attributes are refreshed or how the edit button in a
> table cell will turn the table row into form components. Use the same
> principle.
>
> Also, if this is just a filter toolbar, then look at how other Ajax filter
> toolbars work and you won't loos focus of the drop down since it's Ajax
> that does the refresh.
>
> If you are to re-implement this from scratch and re-invent the wheel you
> can also but I won't recommend it.
> Just look over the current available components in your commons API and
> use the appropriate one, or extend it and make it do what you need.
>
> Martin was referring to the event mechanism build in Wicket documented in
> the Wicket Guide at:
> http://wicket.apache.org/guide/guide/single.html#advanced_1
>
> But for a simple filter toolbar you don't need to get that complicated.
>
> ~ Have fun,
>Paul Bors
>
> On Tue, Sep 9, 2014 at 12:29 PM, Ephraim Rosenfeld 
> wrote:
>
>> Hi Martin:
>>
>>
>>
>> Thank you for your quick response.
>>
>>
>>
>> I was initially updating the entire table, but that was causing me to
>> lose focus from the drop-down menu in which I made the selection. Also, my
>> hope was that I could update as few row items/components as possible,
>> thereby expediting the table-refresh process.
>>
>>
>>
>> When you mention 'Wicket's Event System', are you referring to
>> inter-component events, like the example portrayed here:
>> http://savicprvoslav.blogspot.com/2012/06/wicket-15-inter-component-events.html
>>
>>
>>
>> Regards,
>>
>>
>>
>> - Ephraim
>>
>>
>>
>> -Original Message-
>> From: Martin Grigorov [mailto:mgrigo...@apache.org]
>> Sent: Tuesday, September 09, 2014 12:10 PM
>> To: users@wicket.apache.org
>> Subject: Re: Referencing DataTable rows within the table column header
>>
>>
>>
>> Hi,
>>
>>
>>
>> Why don't you update the table itself ? This will update all its children
>> components too.
>>
>>
>>
>> Otherwise I'd use Wicket's Event system to send a notification to all
>> interested parties.
>>
>>
>>
>> Martin Grigorov
>>
>> Wicket Training and Consulting
>>
>> https://twitter.com/mtgrigorov
>>
>>
>>
>>
>>
>> On Tue, Sep 9, 2014 at 7:01 PM, Ephraim Rosenfeld > >
>>
>> wrote:
>>
>>
>>
>> > Hello All,
>>
>> >
>>
>> > I am creating a table with a DropDownChoice component in the header of
>>
>> > one of the columns. When a selection is made in the drop down in the
>>
>> > column header, I want to update all of the rows in the table.
>>
>> >
>>
>> > Would the following snippet be the best approach to reference each row
>>
>> > Item component from the column header, or is there an alternative to
>>
>> > using the get() method?
>>
>> >
>>
>> > Thank you in advance,
>>
>> >
>>
>> > - Ephraim
>>
>> >
>>
>> > WebMarkupContainer container =
>>
>> > ((WebMarkupContainer)dropDownChoice.findParent(DataTable.class).get(1));
>>
>> >DataGridView gridView  =
>>
>> > (DataGridView)container.get(0);
>>
>> >for(int i = 0; i < NUM_OF_ROWS; i++) {
>>
>> >Item item = (Item)gridView.get(i);
>>
>> > // do row updates
>>
>> > }
>>
>> >
>>
>
>


Re: Referencing DataTable rows within the table column header

2014-09-09 Thread Paul Bors
Hey Ephraim,

At Knoa for the console code I created an API around those components.
You don't have to re-invent the wheel, all you have to do is get familiar
with the console commons and which DropDown component to use.

Remember wicket is a component driven framework similar to Swing.

I would recommend using one of the Ajax enabled drop downs and override the
method to refresh the data table rows of interest. There are plenty of
examples in the console's code base... look at how other table such as the
ones for the End User attributes are refreshed or how the edit button in a
table cell will turn the table row into form components. Use the same
principle.

Also, if this is just a filter toolbar, then look at how other Ajax filter
toolbars work and you won't loos focus of the drop down since it's Ajax
that does the refresh.

If you are to re-implement this from scratch and re-invent the wheel you
can also but I won't recommend it.
Just look over the current available components in your commons API and use
the appropriate one, or extend it and make it do what you need.

Martin was referring to the event mechanism build in Wicket documented in
the Wicket Guide at:
http://wicket.apache.org/guide/guide/single.html#advanced_1

But for a simple filter toolbar you don't need to get that complicated.

~ Have fun,
   Paul Bors

On Tue, Sep 9, 2014 at 12:29 PM, Ephraim Rosenfeld 
wrote:

> Hi Martin:
>
>
>
> Thank you for your quick response.
>
>
>
> I was initially updating the entire table, but that was causing me to lose
> focus from the drop-down menu in which I made the selection. Also, my hope
> was that I could update as few row items/components as possible, thereby
> expediting the table-refresh process.
>
>
>
> When you mention 'Wicket's Event System', are you referring to
> inter-component events, like the example portrayed here:
> http://savicprvoslav.blogspot.com/2012/06/wicket-15-inter-component-events.html
>
>
>
> Regards,
>
>
>
> - Ephraim
>
>
>
> -Original Message-
> From: Martin Grigorov [mailto:mgrigo...@apache.org]
> Sent: Tuesday, September 09, 2014 12:10 PM
> To: users@wicket.apache.org
> Subject: Re: Referencing DataTable rows within the table column header
>
>
>
> Hi,
>
>
>
> Why don't you update the table itself ? This will update all its children
> components too.
>
>
>
> Otherwise I'd use Wicket's Event system to send a notification to all
> interested parties.
>
>
>
> Martin Grigorov
>
> Wicket Training and Consulting
>
> https://twitter.com/mtgrigorov
>
>
>
>
>
> On Tue, Sep 9, 2014 at 7:01 PM, Ephraim Rosenfeld  >
>
> wrote:
>
>
>
> > Hello All,
>
> >
>
> > I am creating a table with a DropDownChoice component in the header of
>
> > one of the columns. When a selection is made in the drop down in the
>
> > column header, I want to update all of the rows in the table.
>
> >
>
> > Would the following snippet be the best approach to reference each row
>
> > Item component from the column header, or is there an alternative to
>
> > using the get() method?
>
> >
>
> > Thank you in advance,
>
> >
>
> > - Ephraim
>
> >
>
> > WebMarkupContainer container =
>
> > ((WebMarkupContainer)dropDownChoice.findParent(DataTable.class).get(1));
>
> >DataGridView gridView  =
>
> > (DataGridView)container.get(0);
>
> >for(int i = 0; i < NUM_OF_ROWS; i++) {
>
> >Item item = (Item)gridView.get(i);
>
> > // do row updates
>
> > }
>
> >
>


RE: Referencing DataTable rows within the table column header

2014-09-09 Thread Ephraim Rosenfeld
Hi Martin:



Thank you for your quick response.



I was initially updating the entire table, but that was causing me to lose 
focus from the drop-down menu in which I made the selection. Also, my hope was 
that I could update as few row items/components as possible, thereby expediting 
the table-refresh process.



When you mention 'Wicket's Event System', are you referring to inter-component 
events, like the example portrayed here: 
http://savicprvoslav.blogspot.com/2012/06/wicket-15-inter-component-events.html



Regards,



- Ephraim



-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org]
Sent: Tuesday, September 09, 2014 12:10 PM
To: users@wicket.apache.org
Subject: Re: Referencing DataTable rows within the table column header



Hi,



Why don't you update the table itself ? This will update all its children 
components too.



Otherwise I'd use Wicket's Event system to send a notification to all 
interested parties.



Martin Grigorov

Wicket Training and Consulting

https://twitter.com/mtgrigorov





On Tue, Sep 9, 2014 at 7:01 PM, Ephraim Rosenfeld 
mailto:erosenf...@knoa.com>>

wrote:



> Hello All,

>

> I am creating a table with a DropDownChoice component in the header of

> one of the columns. When a selection is made in the drop down in the

> column header, I want to update all of the rows in the table.

>

> Would the following snippet be the best approach to reference each row

> Item component from the column header, or is there an alternative to

> using the get() method?

>

> Thank you in advance,

>

> - Ephraim

>

> WebMarkupContainer container =

> ((WebMarkupContainer)dropDownChoice.findParent(DataTable.class).get(1));

>DataGridView gridView  =

> (DataGridView)container.get(0);

>for(int i = 0; i < NUM_OF_ROWS; i++) {

>Item item = (Item)gridView.get(i);

> // do row updates

> }

>


Re: Problem getting data from a 'CharSequenceResource'

2014-09-09 Thread Martin Grigorov
Hi,

The  element has two JavaScript event listeners for 'click' event - one
by Wicket's AjaxFallbackLink and another by (Knockout.js ?!) data-bind
attribute.
The order of their execution is not determined.
If Wicket's listener is called first then it will get the old value:  null,
click1, click2, etc.
While data-bind's listener will get: click1, click2, click3, etc.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 6:59 PM, manumoreno  wrote:

> Hi, I need some advice to get data from a CharSequenceResource:
>
> The Resource:
>
>
>
> The request is provided by an asynchronous ajax request (from JQuery)
> to a url like 'http:///getjson'
>
>
>
> and that is mounted as:
>
>
>
>
> The component is an   tag, binded in wicket,.
>
>
>
>
>
> The 'click: save' launchs the $.ajax.
>
> The problem is that  is Ok,
> but  is first a null string and later is desynchronized,
> it writes one string from behind.
>
> How can I refer to that string from the AjaxFallbackLink?, the
> "MyResource._str" reference
> is obviously incorrect. :(
>
> Thx
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Problem-getting-data-from-a-CharSequenceResource-tp4667434.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Referencing DataTable rows within the table column header

2014-09-09 Thread Martin Grigorov
Hi,

Why don't you update the table itself ? This will update all its children
components too.

Otherwise I'd use Wicket's Event system to send a notification to all
interested parties.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 7:01 PM, Ephraim Rosenfeld 
wrote:

> Hello All,
>
> I am creating a table with a DropDownChoice component in the header of one
> of the columns. When a selection is made in the drop down in the column
> header, I want to update all of the rows in the table.
>
> Would the following snippet be the best approach to reference each row
> Item component from the column header, or is there an alternative to using
> the get() method?
>
> Thank you in advance,
>
> - Ephraim
>
> WebMarkupContainer container =
> ((WebMarkupContainer)dropDownChoice.findParent(DataTable.class).get(1));
>DataGridView gridView  =
> (DataGridView)container.get(0);
>for(int i = 0; i < NUM_OF_ROWS; i++) {
>Item item = (Item)gridView.get(i);
> // do row updates
> }
>


Problem getting data from a 'CharSequenceResource'

2014-09-09 Thread manumoreno
Hi, I need some advice to get data from a CharSequenceResource:

The Resource:



The request is provided by an asynchronous ajax request (from JQuery) 
to a url like 'http:///getjson'



and that is mounted as:




The component is an   tag, binded in wicket,.





The 'click: save' launchs the $.ajax.

The problem is that  is Ok, 
but  is first a null string and later is desynchronized, 
it writes one string from behind.

How can I refer to that string from the AjaxFallbackLink?, the
"MyResource._str" reference
is obviously incorrect. :(

Thx




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-getting-data-from-a-CharSequenceResource-tp4667434.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Referencing DataTable rows within the table column header

2014-09-09 Thread Ephraim Rosenfeld
Hello All,

I am creating a table with a DropDownChoice component in the header of one of 
the columns. When a selection is made in the drop down in the column header, I 
want to update all of the rows in the table.

Would the following snippet be the best approach to reference each row Item 
component from the column header, or is there an alternative to using the get() 
method?

Thank you in advance,

- Ephraim

WebMarkupContainer container = 
((WebMarkupContainer)dropDownChoice.findParent(DataTable.class).get(1));
   DataGridView gridView  = 
(DataGridView)container.get(0);
   for(int i = 0; i < NUM_OF_ROWS; i++) {
   Item item = (Item)gridView.get(i);
// do row updates
}


New chapter in the user guide

2014-09-09 Thread Andrea Del Bene

Hi,

I just updated the user guide with a new chapter for "internals" topics. 
I've started porting wiki page at 
https://cwiki.apache.org/confluence/display/WICKET/Page+Storage.


Bye!

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



RE: Global Ajax Event Handler

2014-09-09 Thread Richter, Marvin
That definitely sounds like a really odd use case or am I wrong?

Do you really want to generate the URL outside from the Wicket context?
I mean this is something which is heavily tied to wicket anyway so why not 
generating it inside it's context?
And where do you need/use the final generated URL? I guess inside the Wicket 
context ... 

Maybe you should rethinking your use case, I bet the problem you're trying to 
solve can be solved much, much easier!

Anyway .. wish you luck ;)

-Original Message-
From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com] 
Sent: Tuesday, September 09, 2014 2:58 PM
To: users@wicket.apache.org
Subject: Re: Global Ajax Event Handler

Thats the point. It is not used within a Component / Behavior - so I cant use 
getPage() ...

> Am 09.09.2014 um 14:50 schrieb Martin Grigorov :
> 
> The UrlGenerator class is used somewhere where the Page is available, no ?
> In SomeComponent/SomeBehavior:
> 
> UrlGenerator generator = new UrlGenerator(); Url url = 
> generator.generate(getPage().getPageId());
> 
> Session.get().getPageManager().getPage(exisingAndNonExpiredPageId) is 
> the way to get a reference to the page.
> Wicket uses this API internally every time you click a link or button.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 3:45 PM, Tobias Soloschenko < 
> tobiassolosche...@googlemail.com> wrote:
> 
>> And thats the question I was looking for - how do I get the current 
>> page id within the class that generates the url which is no component 
>> and the second question was how do I get the page to that id, because 
>> (Page)
>> WebSession.get().getPageManager().getPage(i.get()) returns null for 
>> int i 0-10, event if I cleared the browsers cache / restarted the server.
>> 
>> kind regards and big thanks for all the help!
>> 
>> Tobias
>> 
>> 2014-09-09 14:28 GMT+02:00 Martin Grigorov :
>> 
>>> Session#pageId is a counter that is used to give an id to the next
>> created
>>> page.
>>> It is not the id of the currently used page!
>>> 
>>> You will need to provide the pageId somehow to the class that 
>>> generates
>> the
>>> url.
>>> 
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>> 
>>> 
>>> On Tue, Sep 9, 2014 at 3:13 PM, Tobias Soloschenko < 
>>> tobiassolosche...@googlemail.com> wrote:
>>> 
 The method getPage() is not available at the place where I'm 
 building
>> the
 link - I'm not within a component and I try to get the page by 
 content
>> of
 the session. :-)
 
 I didn't modified the Session - the pageId is stored in 
 org.apache.wicket.Session.pageId which is an AtomicInteger
 
 
 2014-09-09 14:06 GMT+02:00 Martin Grigorov :
 
> Pass the pageId as a query string parameter.
> 
> PageParameters params = new PageParameters(); params.set("pageId", 
> getPage().getPageId()); theUrlToTheReference = 
> requestCycle.urlFor(yourResRef, params);
> 
> Then in the IResource (better extend AbstractResource) just read 
> it
>>> from
> the request parameters.
> 
> Storing the pageId in the session is not OK because the user may 
> open
>>> two
> different pages in separate tabs/windows and this will break.
> 
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko < 
> tobiassolosche...@googlemail.com> wrote:
> 
>> Thanks again for the fast answer. My code now looks this way:
>> 
>>Field declaredField =
>> WebSession.get().getClass().getSuperclass()
>>.getDeclaredField("pageId");
>> 
>>declaredField.setAccessible(true);
>>AtomicInteger i = (AtomicInteger) 
>> declaredField.get(WebSession.get());
>>Page page = (Page) WebSession.get().getPageManager()
>>.getPage(i.get());
>> 
>>AjaxRequestTarget newAjaxRequestTarget =
>>> ((WebApplication)
>> Application.get())
>>.newAjaxRequestTarget(page);
>> 
>>RequestCycle.get().scheduleRequestHandlerAfterCurrent(
>>newAjaxRequestTarget);
>> 
>> I dont know how to get the current pageId but from the Session. 
>> The
 page
> at
>> this place is null. :-(
>> 
>> 
>> 
>> 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
>> 
>>> On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko < 
>>> tobiassolosche...@googlemail.com> wrote:
>>> 
 Hi again,
 
 I tried out that code you mentioned here.
 WebSession.get().getPageManager().getPage(int i) returns
>> IManageablePage
 which is not applicable as argument for newAjaxRequestTarget.
>>> 
>>> cast it
>>> it is known that in your environment 

Re: Wicket meet-and-greet at JavaOne 2014?

2014-09-09 Thread Shawn McKinney

On 09/08/2014 06:17 PM, Garret Wilson wrote:
Hi, all. I'm traveling at the moment, but I plan to be back in San 
Francisco around the start of JavaOne. Do any Wicket users plan on 
being in town for the conference? Would you like me to organize a 
meet-and-greet at a local restaurant or even (depending on the number 
of guests) at my place? Perhaps it would be helpful and fun to put 
some faces with some names on the list. Let me know if you like the idea.


Hello Garret, I will be there and would like to meet.  Also will be 
presenting at a couple of sessions:


Monday: The Anatomy of a Secure Web Application Using Java [CON3479] : 
https://oracleus.activeevents.com/2014/connect/sessionDetail.ww?SESSION_ID=3479
Tuesday: Open Source Identity and Access Management Expert Panel, Part 3 
[BOF3478] : 
https://oracleus.activeevents.com/2014/connect/sessionDetail.ww?SESSION_ID=3478


Shawn


Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
Ok the id is now generated right - but the code to get the page by the given 
page id is still returning null if the ajax call is made.

Tobias 

> Am 09.09.2014 um 15:11 schrieb Martin Grigorov :
> 
> Yes.
> This should be OK.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 4:09 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> PageRequestHandlerTracker.getLastHandler(RequestCycle.get()).getPageId() ?
>> Is this a valid Way to get the last pageid?
>> 
>> Kind regards
>> 
>> Tobias
>> 
>>> Am 09.09.2014 um 14:50 schrieb Martin Grigorov :
>>> 
>>> The UrlGenerator class is used somewhere where the Page is available, no
>> ?
>>> In SomeComponent/SomeBehavior:
>>> 
>>> UrlGenerator generator = new UrlGenerator();
>>> Url url = generator.generate(getPage().getPageId());
>>> 
>>> Session.get().getPageManager().getPage(exisingAndNonExpiredPageId) is the
>>> way to get a reference to the page.
>>> Wicket uses this API internally every time you click a link or button.
>>> 
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>> 
>>> 
>>> On Tue, Sep 9, 2014 at 3:45 PM, Tobias Soloschenko <
>>> tobiassolosche...@googlemail.com> wrote:
>>> 
 And thats the question I was looking for - how do I get the current
>> page id
 within the class that generates the url which is no component and the
 second question was how do I get the page to that id, because (Page)
 WebSession.get().getPageManager().getPage(i.get()) returns null for int
>> i
 0-10, event if I cleared the browsers cache / restarted the server.
 
 kind regards and big thanks for all the help!
 
 Tobias
 
 2014-09-09 14:28 GMT+02:00 Martin Grigorov :
 
> Session#pageId is a counter that is used to give an id to the next
 created
> page.
> It is not the id of the currently used page!
> 
> You will need to provide the pageId somehow to the class that generates
 the
> url.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 3:13 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> The method getPage() is not available at the place where I'm building
 the
>> link - I'm not within a component and I try to get the page by content
 of
>> the session. :-)
>> 
>> I didn't modified the Session - the pageId is stored in
>> org.apache.wicket.Session.pageId which is an AtomicInteger
>> 
>> 
>> 2014-09-09 14:06 GMT+02:00 Martin Grigorov :
>> 
>>> Pass the pageId as a query string parameter.
>>> 
>>> PageParameters params = new PageParameters();
>>> params.set("pageId", getPage().getPageId());
>>> theUrlToTheReference = requestCycle.urlFor(yourResRef, params);
>>> 
>>> Then in the IResource (better extend AbstractResource) just read it
> from
>>> the request parameters.
>>> 
>>> Storing the pageId in the session is not OK because the user may open
> two
>>> different pages in separate tabs/windows and this will break.
>>> 
>>> 
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>> 
>>> 
>>> On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko <
>>> tobiassolosche...@googlemail.com> wrote:
>>> 
 Thanks again for the fast answer. My code now looks this way:
 
   Field declaredField =
 WebSession.get().getClass().getSuperclass()
   .getDeclaredField("pageId");
 
   declaredField.setAccessible(true);
   AtomicInteger i = (AtomicInteger)
 declaredField.get(WebSession.get());
   Page page = (Page) WebSession.get().getPageManager()
   .getPage(i.get());
 
   AjaxRequestTarget newAjaxRequestTarget =
> ((WebApplication)
 Application.get())
   .newAjaxRequestTarget(page);
 
   RequestCycle.get().scheduleRequestHandlerAfterCurrent(
   newAjaxRequestTarget);
 
 I dont know how to get the current pageId but from the Session. The
>> page
>>> at
 this place is null. :-(
 
 
 
 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
 
> On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> Hi again,
>> 
>> I tried out that code you mentioned here.
>> WebSession.get().getPageManager().getPage(int i) returns
 IManageablePage
>> which is not applicable as argument for newAjaxRequestTarget.
> 
> cast it
> it is known that in your environment you don't

Re: Global Ajax Event Handler

2014-09-09 Thread Martin Grigorov
Yes.
This should be OK.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 4:09 PM, Tobias Soloschenko <
tobiassolosche...@googlemail.com> wrote:

> PageRequestHandlerTracker.getLastHandler(RequestCycle.get()).getPageId() ?
> Is this a valid Way to get the last pageid?
>
> Kind regards
>
> Tobias
>
> > Am 09.09.2014 um 14:50 schrieb Martin Grigorov :
> >
> > The UrlGenerator class is used somewhere where the Page is available, no
> ?
> > In SomeComponent/SomeBehavior:
> >
> > UrlGenerator generator = new UrlGenerator();
> > Url url = generator.generate(getPage().getPageId());
> >
> > Session.get().getPageManager().getPage(exisingAndNonExpiredPageId) is the
> > way to get a reference to the page.
> > Wicket uses this API internally every time you click a link or button.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> >
> > On Tue, Sep 9, 2014 at 3:45 PM, Tobias Soloschenko <
> > tobiassolosche...@googlemail.com> wrote:
> >
> >> And thats the question I was looking for - how do I get the current
> page id
> >> within the class that generates the url which is no component and the
> >> second question was how do I get the page to that id, because (Page)
> >> WebSession.get().getPageManager().getPage(i.get()) returns null for int
> i
> >> 0-10, event if I cleared the browsers cache / restarted the server.
> >>
> >> kind regards and big thanks for all the help!
> >>
> >> Tobias
> >>
> >> 2014-09-09 14:28 GMT+02:00 Martin Grigorov :
> >>
> >>> Session#pageId is a counter that is used to give an id to the next
> >> created
> >>> page.
> >>> It is not the id of the currently used page!
> >>>
> >>> You will need to provide the pageId somehow to the class that generates
> >> the
> >>> url.
> >>>
> >>> Martin Grigorov
> >>> Wicket Training and Consulting
> >>> https://twitter.com/mtgrigorov
> >>>
> >>>
> >>> On Tue, Sep 9, 2014 at 3:13 PM, Tobias Soloschenko <
> >>> tobiassolosche...@googlemail.com> wrote:
> >>>
>  The method getPage() is not available at the place where I'm building
> >> the
>  link - I'm not within a component and I try to get the page by content
> >> of
>  the session. :-)
> 
>  I didn't modified the Session - the pageId is stored in
>  org.apache.wicket.Session.pageId which is an AtomicInteger
> 
> 
>  2014-09-09 14:06 GMT+02:00 Martin Grigorov :
> 
> > Pass the pageId as a query string parameter.
> >
> > PageParameters params = new PageParameters();
> > params.set("pageId", getPage().getPageId());
> > theUrlToTheReference = requestCycle.urlFor(yourResRef, params);
> >
> > Then in the IResource (better extend AbstractResource) just read it
> >>> from
> > the request parameters.
> >
> > Storing the pageId in the session is not OK because the user may open
> >>> two
> > different pages in separate tabs/windows and this will break.
> >
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> >
> > On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko <
> > tobiassolosche...@googlemail.com> wrote:
> >
> >> Thanks again for the fast answer. My code now looks this way:
> >>
> >>Field declaredField =
> >> WebSession.get().getClass().getSuperclass()
> >>.getDeclaredField("pageId");
> >>
> >>declaredField.setAccessible(true);
> >>AtomicInteger i = (AtomicInteger)
> >> declaredField.get(WebSession.get());
> >>Page page = (Page) WebSession.get().getPageManager()
> >>.getPage(i.get());
> >>
> >>AjaxRequestTarget newAjaxRequestTarget =
> >>> ((WebApplication)
> >> Application.get())
> >>.newAjaxRequestTarget(page);
> >>
> >>RequestCycle.get().scheduleRequestHandlerAfterCurrent(
> >>newAjaxRequestTarget);
> >>
> >> I dont know how to get the current pageId but from the Session. The
>  page
> > at
> >> this place is null. :-(
> >>
> >>
> >>
> >> 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
> >>
> >>> On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
> >>> tobiassolosche...@googlemail.com> wrote:
> >>>
>  Hi again,
> 
>  I tried out that code you mentioned here.
>  WebSession.get().getPageManager().getPage(int i) returns
> >> IManageablePage
>  which is not applicable as argument for newAjaxRequestTarget.
> >>>
> >>> cast it
> >>> it is known that in your environment you don't use any custom
> >>> IManageablePage/IRequestablePage impls (see IPageFactory)
> >>>
> >>>
> 
>  The second thing is how do I get the instance of a page by
> >> class
>  with
> >> the
>  last page id not from within a co

Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
PageRequestHandlerTracker.getLastHandler(RequestCycle.get()).getPageId() ? Is 
this a valid Way to get the last pageid? 

Kind regards

Tobias 

> Am 09.09.2014 um 14:50 schrieb Martin Grigorov :
> 
> The UrlGenerator class is used somewhere where the Page is available, no ?
> In SomeComponent/SomeBehavior:
> 
> UrlGenerator generator = new UrlGenerator();
> Url url = generator.generate(getPage().getPageId());
> 
> Session.get().getPageManager().getPage(exisingAndNonExpiredPageId) is the
> way to get a reference to the page.
> Wicket uses this API internally every time you click a link or button.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 3:45 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> And thats the question I was looking for - how do I get the current page id
>> within the class that generates the url which is no component and the
>> second question was how do I get the page to that id, because (Page)
>> WebSession.get().getPageManager().getPage(i.get()) returns null for int i
>> 0-10, event if I cleared the browsers cache / restarted the server.
>> 
>> kind regards and big thanks for all the help!
>> 
>> Tobias
>> 
>> 2014-09-09 14:28 GMT+02:00 Martin Grigorov :
>> 
>>> Session#pageId is a counter that is used to give an id to the next
>> created
>>> page.
>>> It is not the id of the currently used page!
>>> 
>>> You will need to provide the pageId somehow to the class that generates
>> the
>>> url.
>>> 
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>> 
>>> 
>>> On Tue, Sep 9, 2014 at 3:13 PM, Tobias Soloschenko <
>>> tobiassolosche...@googlemail.com> wrote:
>>> 
 The method getPage() is not available at the place where I'm building
>> the
 link - I'm not within a component and I try to get the page by content
>> of
 the session. :-)
 
 I didn't modified the Session - the pageId is stored in
 org.apache.wicket.Session.pageId which is an AtomicInteger
 
 
 2014-09-09 14:06 GMT+02:00 Martin Grigorov :
 
> Pass the pageId as a query string parameter.
> 
> PageParameters params = new PageParameters();
> params.set("pageId", getPage().getPageId());
> theUrlToTheReference = requestCycle.urlFor(yourResRef, params);
> 
> Then in the IResource (better extend AbstractResource) just read it
>>> from
> the request parameters.
> 
> Storing the pageId in the session is not OK because the user may open
>>> two
> different pages in separate tabs/windows and this will break.
> 
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> Thanks again for the fast answer. My code now looks this way:
>> 
>>Field declaredField =
>> WebSession.get().getClass().getSuperclass()
>>.getDeclaredField("pageId");
>> 
>>declaredField.setAccessible(true);
>>AtomicInteger i = (AtomicInteger)
>> declaredField.get(WebSession.get());
>>Page page = (Page) WebSession.get().getPageManager()
>>.getPage(i.get());
>> 
>>AjaxRequestTarget newAjaxRequestTarget =
>>> ((WebApplication)
>> Application.get())
>>.newAjaxRequestTarget(page);
>> 
>>RequestCycle.get().scheduleRequestHandlerAfterCurrent(
>>newAjaxRequestTarget);
>> 
>> I dont know how to get the current pageId but from the Session. The
 page
> at
>> this place is null. :-(
>> 
>> 
>> 
>> 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
>> 
>>> On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
>>> tobiassolosche...@googlemail.com> wrote:
>>> 
 Hi again,
 
 I tried out that code you mentioned here.
 WebSession.get().getPageManager().getPage(int i) returns
>> IManageablePage
 which is not applicable as argument for newAjaxRequestTarget.
>>> 
>>> cast it
>>> it is known that in your environment you don't use any custom
>>> IManageablePage/IRequestablePage impls (see IPageFactory)
>>> 
>>> 
 
 The second thing is how do I get the instance of a page by
>> class
 with
>> the
 last page id not from within a component (this would be simple
>>> getPage())?
>>> 
>>> I didn't get this
>>> Please re-phrase
>>> 
>>> 
 
 2014-09-09 11:51 GMT+02:00 Martin Grigorov <
>> mgrigo...@apache.org
 :
 
> I've re-read the message and I think I got it.
> What you really need is a mounted resource
> (WebApplication#mountResource(someResourceReference))
> To get a url to it use

Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
Thats the point. It is not used within a Component / Behavior - so I cant use 
getPage() ...

> Am 09.09.2014 um 14:50 schrieb Martin Grigorov :
> 
> The UrlGenerator class is used somewhere where the Page is available, no ?
> In SomeComponent/SomeBehavior:
> 
> UrlGenerator generator = new UrlGenerator();
> Url url = generator.generate(getPage().getPageId());
> 
> Session.get().getPageManager().getPage(exisingAndNonExpiredPageId) is the
> way to get a reference to the page.
> Wicket uses this API internally every time you click a link or button.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 3:45 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> And thats the question I was looking for - how do I get the current page id
>> within the class that generates the url which is no component and the
>> second question was how do I get the page to that id, because (Page)
>> WebSession.get().getPageManager().getPage(i.get()) returns null for int i
>> 0-10, event if I cleared the browsers cache / restarted the server.
>> 
>> kind regards and big thanks for all the help!
>> 
>> Tobias
>> 
>> 2014-09-09 14:28 GMT+02:00 Martin Grigorov :
>> 
>>> Session#pageId is a counter that is used to give an id to the next
>> created
>>> page.
>>> It is not the id of the currently used page!
>>> 
>>> You will need to provide the pageId somehow to the class that generates
>> the
>>> url.
>>> 
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>> 
>>> 
>>> On Tue, Sep 9, 2014 at 3:13 PM, Tobias Soloschenko <
>>> tobiassolosche...@googlemail.com> wrote:
>>> 
 The method getPage() is not available at the place where I'm building
>> the
 link - I'm not within a component and I try to get the page by content
>> of
 the session. :-)
 
 I didn't modified the Session - the pageId is stored in
 org.apache.wicket.Session.pageId which is an AtomicInteger
 
 
 2014-09-09 14:06 GMT+02:00 Martin Grigorov :
 
> Pass the pageId as a query string parameter.
> 
> PageParameters params = new PageParameters();
> params.set("pageId", getPage().getPageId());
> theUrlToTheReference = requestCycle.urlFor(yourResRef, params);
> 
> Then in the IResource (better extend AbstractResource) just read it
>>> from
> the request parameters.
> 
> Storing the pageId in the session is not OK because the user may open
>>> two
> different pages in separate tabs/windows and this will break.
> 
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> Thanks again for the fast answer. My code now looks this way:
>> 
>>Field declaredField =
>> WebSession.get().getClass().getSuperclass()
>>.getDeclaredField("pageId");
>> 
>>declaredField.setAccessible(true);
>>AtomicInteger i = (AtomicInteger)
>> declaredField.get(WebSession.get());
>>Page page = (Page) WebSession.get().getPageManager()
>>.getPage(i.get());
>> 
>>AjaxRequestTarget newAjaxRequestTarget =
>>> ((WebApplication)
>> Application.get())
>>.newAjaxRequestTarget(page);
>> 
>>RequestCycle.get().scheduleRequestHandlerAfterCurrent(
>>newAjaxRequestTarget);
>> 
>> I dont know how to get the current pageId but from the Session. The
 page
> at
>> this place is null. :-(
>> 
>> 
>> 
>> 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
>> 
>>> On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
>>> tobiassolosche...@googlemail.com> wrote:
>>> 
 Hi again,
 
 I tried out that code you mentioned here.
 WebSession.get().getPageManager().getPage(int i) returns
>> IManageablePage
 which is not applicable as argument for newAjaxRequestTarget.
>>> 
>>> cast it
>>> it is known that in your environment you don't use any custom
>>> IManageablePage/IRequestablePage impls (see IPageFactory)
>>> 
>>> 
 
 The second thing is how do I get the instance of a page by
>> class
 with
>> the
 last page id not from within a component (this would be simple
>>> getPage())?
>>> 
>>> I didn't get this
>>> Please re-phrase
>>> 
>>> 
 
 2014-09-09 11:51 GMT+02:00 Martin Grigorov <
>> mgrigo...@apache.org
 :
 
> I've re-read the message and I think I got it.
> What you really need is a mounted resource
> (WebApplication#mountResource(someResourceReference))
> To get a url to it use: theUrl =
>>> requestCycle.urlFor(sameResRef,

Re: Global Ajax Event Handler

2014-09-09 Thread Martin Grigorov
The UrlGenerator class is used somewhere where the Page is available, no ?
In SomeComponent/SomeBehavior:

UrlGenerator generator = new UrlGenerator();
Url url = generator.generate(getPage().getPageId());

Session.get().getPageManager().getPage(exisingAndNonExpiredPageId) is the
way to get a reference to the page.
Wicket uses this API internally every time you click a link or button.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 3:45 PM, Tobias Soloschenko <
tobiassolosche...@googlemail.com> wrote:

> And thats the question I was looking for - how do I get the current page id
> within the class that generates the url which is no component and the
> second question was how do I get the page to that id, because (Page)
> WebSession.get().getPageManager().getPage(i.get()) returns null for int i
> 0-10, event if I cleared the browsers cache / restarted the server.
>
> kind regards and big thanks for all the help!
>
> Tobias
>
> 2014-09-09 14:28 GMT+02:00 Martin Grigorov :
>
> > Session#pageId is a counter that is used to give an id to the next
> created
> > page.
> > It is not the id of the currently used page!
> >
> > You will need to provide the pageId somehow to the class that generates
> the
> > url.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> >
> > On Tue, Sep 9, 2014 at 3:13 PM, Tobias Soloschenko <
> > tobiassolosche...@googlemail.com> wrote:
> >
> > > The method getPage() is not available at the place where I'm building
> the
> > > link - I'm not within a component and I try to get the page by content
> of
> > > the session. :-)
> > >
> > > I didn't modified the Session - the pageId is stored in
> > > org.apache.wicket.Session.pageId which is an AtomicInteger
> > >
> > >
> > > 2014-09-09 14:06 GMT+02:00 Martin Grigorov :
> > >
> > > > Pass the pageId as a query string parameter.
> > > >
> > > > PageParameters params = new PageParameters();
> > > > params.set("pageId", getPage().getPageId());
> > > > theUrlToTheReference = requestCycle.urlFor(yourResRef, params);
> > > >
> > > > Then in the IResource (better extend AbstractResource) just read it
> > from
> > > > the request parameters.
> > > >
> > > > Storing the pageId in the session is not OK because the user may open
> > two
> > > > different pages in separate tabs/windows and this will break.
> > > >
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > > https://twitter.com/mtgrigorov
> > > >
> > > >
> > > > On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko <
> > > > tobiassolosche...@googlemail.com> wrote:
> > > >
> > > > > Thanks again for the fast answer. My code now looks this way:
> > > > >
> > > > > Field declaredField =
> > > > > WebSession.get().getClass().getSuperclass()
> > > > > .getDeclaredField("pageId");
> > > > >
> > > > > declaredField.setAccessible(true);
> > > > > AtomicInteger i = (AtomicInteger)
> > > > > declaredField.get(WebSession.get());
> > > > > Page page = (Page) WebSession.get().getPageManager()
> > > > > .getPage(i.get());
> > > > >
> > > > > AjaxRequestTarget newAjaxRequestTarget =
> > ((WebApplication)
> > > > > Application.get())
> > > > > .newAjaxRequestTarget(page);
> > > > >
> > > > > RequestCycle.get().scheduleRequestHandlerAfterCurrent(
> > > > > newAjaxRequestTarget);
> > > > >
> > > > > I dont know how to get the current pageId but from the Session. The
> > > page
> > > > at
> > > > > this place is null. :-(
> > > > >
> > > > >
> > > > >
> > > > > 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
> > > > >
> > > > > > On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
> > > > > > tobiassolosche...@googlemail.com> wrote:
> > > > > >
> > > > > > > Hi again,
> > > > > > >
> > > > > > > I tried out that code you mentioned here.
> > > > > > > WebSession.get().getPageManager().getPage(int i) returns
> > > > > IManageablePage
> > > > > > > which is not applicable as argument for newAjaxRequestTarget.
> > > > > > >
> > > > > >
> > > > > > cast it
> > > > > > it is known that in your environment you don't use any custom
> > > > > > IManageablePage/IRequestablePage impls (see IPageFactory)
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > The second thing is how do I get the instance of a page by
> class
> > > with
> > > > > the
> > > > > > > last page id not from within a component (this would be simple
> > > > > > getPage())?
> > > > > > >
> > > > > >
> > > > > > I didn't get this
> > > > > > Please re-phrase
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > 2014-09-09 11:51 GMT+02:00 Martin Grigorov <
> mgrigo...@apache.org
> > >:
> > > > > > >
> > > > > > > > I've re-read the message and I think I got it.
> > > > > > > > What you really need is a mounted resource
> > > > > > > > (WebApplication#mountResource(someResourceReference))
> > > > > > > >

Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
And thats the question I was looking for - how do I get the current page id
within the class that generates the url which is no component and the
second question was how do I get the page to that id, because (Page)
WebSession.get().getPageManager().getPage(i.get()) returns null for int i
0-10, event if I cleared the browsers cache / restarted the server.

kind regards and big thanks for all the help!

Tobias

2014-09-09 14:28 GMT+02:00 Martin Grigorov :

> Session#pageId is a counter that is used to give an id to the next created
> page.
> It is not the id of the currently used page!
>
> You will need to provide the pageId somehow to the class that generates the
> url.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Tue, Sep 9, 2014 at 3:13 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
>
> > The method getPage() is not available at the place where I'm building the
> > link - I'm not within a component and I try to get the page by content of
> > the session. :-)
> >
> > I didn't modified the Session - the pageId is stored in
> > org.apache.wicket.Session.pageId which is an AtomicInteger
> >
> >
> > 2014-09-09 14:06 GMT+02:00 Martin Grigorov :
> >
> > > Pass the pageId as a query string parameter.
> > >
> > > PageParameters params = new PageParameters();
> > > params.set("pageId", getPage().getPageId());
> > > theUrlToTheReference = requestCycle.urlFor(yourResRef, params);
> > >
> > > Then in the IResource (better extend AbstractResource) just read it
> from
> > > the request parameters.
> > >
> > > Storing the pageId in the session is not OK because the user may open
> two
> > > different pages in separate tabs/windows and this will break.
> > >
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > >
> > > On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko <
> > > tobiassolosche...@googlemail.com> wrote:
> > >
> > > > Thanks again for the fast answer. My code now looks this way:
> > > >
> > > > Field declaredField =
> > > > WebSession.get().getClass().getSuperclass()
> > > > .getDeclaredField("pageId");
> > > >
> > > > declaredField.setAccessible(true);
> > > > AtomicInteger i = (AtomicInteger)
> > > > declaredField.get(WebSession.get());
> > > > Page page = (Page) WebSession.get().getPageManager()
> > > > .getPage(i.get());
> > > >
> > > > AjaxRequestTarget newAjaxRequestTarget =
> ((WebApplication)
> > > > Application.get())
> > > > .newAjaxRequestTarget(page);
> > > >
> > > > RequestCycle.get().scheduleRequestHandlerAfterCurrent(
> > > > newAjaxRequestTarget);
> > > >
> > > > I dont know how to get the current pageId but from the Session. The
> > page
> > > at
> > > > this place is null. :-(
> > > >
> > > >
> > > >
> > > > 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
> > > >
> > > > > On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
> > > > > tobiassolosche...@googlemail.com> wrote:
> > > > >
> > > > > > Hi again,
> > > > > >
> > > > > > I tried out that code you mentioned here.
> > > > > > WebSession.get().getPageManager().getPage(int i) returns
> > > > IManageablePage
> > > > > > which is not applicable as argument for newAjaxRequestTarget.
> > > > > >
> > > > >
> > > > > cast it
> > > > > it is known that in your environment you don't use any custom
> > > > > IManageablePage/IRequestablePage impls (see IPageFactory)
> > > > >
> > > > >
> > > > > >
> > > > > > The second thing is how do I get the instance of a page by class
> > with
> > > > the
> > > > > > last page id not from within a component (this would be simple
> > > > > getPage())?
> > > > > >
> > > > >
> > > > > I didn't get this
> > > > > Please re-phrase
> > > > >
> > > > >
> > > > > >
> > > > > > 2014-09-09 11:51 GMT+02:00 Martin Grigorov  >:
> > > > > >
> > > > > > > I've re-read the message and I think I got it.
> > > > > > > What you really need is a mounted resource
> > > > > > > (WebApplication#mountResource(someResourceReference))
> > > > > > > To get a url to it use: theUrl =
> requestCycle.urlFor(sameResRef,
> > > > > > > parametersWithPageId)
> > > > > > > Wicket.Ajax.get({"u": theUrl, ...})
> > > > > > > In IResource#respond() you can create AjaxRequestTarget with:
> > > > > > >
> > > > > > > Page page =
> > session.getPageManager().get(parameters.get("pageId"))
> > > > > > > target = webApplication.newAjaxRequestTarget(page)
> > > > > > > requestCycle.scheduleRequestHandlerAfterCurrent(target);
> > > > > > > page.send(page, Broadcast.BREADTH, new SomeEvent(target))
> > > > > > >
> > > > > > > in SomeComponent#onEvent() use someEvent.getTarget().add(this)
> to
> > > add
> > > > > the
> > > > > > > component when SomeEvent is broadcasted
> > > > > > >
> > > > > > > Martin Grigorov
> > > > > > > Wicket Training and Consulting
> > > > > > > https://twitter.com/mtgrigorov

AuthenticatedWebSession.authenticate() not being called

2014-09-09 Thread Lucio Crusca
Hi all,

in a webapp that worked until yesterday (and that has worked for the last
2 years), the AuthenticatedWebSession.authenticate() method is not being
called anymore. I have MySession class that extends
AuthenticatedWebSession. The MySession constructor gets called correctly.
I use a standard SignInPanel: when I click "Sign in" the page reloads but
the code execution doesn't reach the breakpoint at the first line of
authenticate() in MySession. The authenticate() method does have the
@Override annotation, so I'm sure it has the correct signature.

Changes I've made since yesterday are only to the css, some HTML, a few
new initParameters in web.xml, but nothing directly related to the login
process... any clue about what could be causing that behavior? What should
I check first?

Btw, no, I didn't commit the code yesterday before those changes, so now I
can't revert, my bad.


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



Re: Global Ajax Event Handler

2014-09-09 Thread Martin Grigorov
Session#pageId is a counter that is used to give an id to the next created
page.
It is not the id of the currently used page!

You will need to provide the pageId somehow to the class that generates the
url.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 3:13 PM, Tobias Soloschenko <
tobiassolosche...@googlemail.com> wrote:

> The method getPage() is not available at the place where I'm building the
> link - I'm not within a component and I try to get the page by content of
> the session. :-)
>
> I didn't modified the Session - the pageId is stored in
> org.apache.wicket.Session.pageId which is an AtomicInteger
>
>
> 2014-09-09 14:06 GMT+02:00 Martin Grigorov :
>
> > Pass the pageId as a query string parameter.
> >
> > PageParameters params = new PageParameters();
> > params.set("pageId", getPage().getPageId());
> > theUrlToTheReference = requestCycle.urlFor(yourResRef, params);
> >
> > Then in the IResource (better extend AbstractResource) just read it from
> > the request parameters.
> >
> > Storing the pageId in the session is not OK because the user may open two
> > different pages in separate tabs/windows and this will break.
> >
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> >
> > On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko <
> > tobiassolosche...@googlemail.com> wrote:
> >
> > > Thanks again for the fast answer. My code now looks this way:
> > >
> > > Field declaredField =
> > > WebSession.get().getClass().getSuperclass()
> > > .getDeclaredField("pageId");
> > >
> > > declaredField.setAccessible(true);
> > > AtomicInteger i = (AtomicInteger)
> > > declaredField.get(WebSession.get());
> > > Page page = (Page) WebSession.get().getPageManager()
> > > .getPage(i.get());
> > >
> > > AjaxRequestTarget newAjaxRequestTarget = ((WebApplication)
> > > Application.get())
> > > .newAjaxRequestTarget(page);
> > >
> > > RequestCycle.get().scheduleRequestHandlerAfterCurrent(
> > > newAjaxRequestTarget);
> > >
> > > I dont know how to get the current pageId but from the Session. The
> page
> > at
> > > this place is null. :-(
> > >
> > >
> > >
> > > 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
> > >
> > > > On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
> > > > tobiassolosche...@googlemail.com> wrote:
> > > >
> > > > > Hi again,
> > > > >
> > > > > I tried out that code you mentioned here.
> > > > > WebSession.get().getPageManager().getPage(int i) returns
> > > IManageablePage
> > > > > which is not applicable as argument for newAjaxRequestTarget.
> > > > >
> > > >
> > > > cast it
> > > > it is known that in your environment you don't use any custom
> > > > IManageablePage/IRequestablePage impls (see IPageFactory)
> > > >
> > > >
> > > > >
> > > > > The second thing is how do I get the instance of a page by class
> with
> > > the
> > > > > last page id not from within a component (this would be simple
> > > > getPage())?
> > > > >
> > > >
> > > > I didn't get this
> > > > Please re-phrase
> > > >
> > > >
> > > > >
> > > > > 2014-09-09 11:51 GMT+02:00 Martin Grigorov :
> > > > >
> > > > > > I've re-read the message and I think I got it.
> > > > > > What you really need is a mounted resource
> > > > > > (WebApplication#mountResource(someResourceReference))
> > > > > > To get a url to it use: theUrl = requestCycle.urlFor(sameResRef,
> > > > > > parametersWithPageId)
> > > > > > Wicket.Ajax.get({"u": theUrl, ...})
> > > > > > In IResource#respond() you can create AjaxRequestTarget with:
> > > > > >
> > > > > > Page page =
> session.getPageManager().get(parameters.get("pageId"))
> > > > > > target = webApplication.newAjaxRequestTarget(page)
> > > > > > requestCycle.scheduleRequestHandlerAfterCurrent(target);
> > > > > > page.send(page, Broadcast.BREADTH, new SomeEvent(target))
> > > > > >
> > > > > > in SomeComponent#onEvent() use someEvent.getTarget().add(this) to
> > add
> > > > the
> > > > > > component when SomeEvent is broadcasted
> > > > > >
> > > > > > Martin Grigorov
> > > > > > Wicket Training and Consulting
> > > > > > https://twitter.com/mtgrigorov
> > > > > >
> > > > > >
> > > > > > On Tue, Sep 9, 2014 at 12:40 PM, Richter, Marvin <
> > > > > > marvin.rich...@freenetdigital.com> wrote:
> > > > > >
> > > > > > > What you are looking for is the Wicket Event mechanism.
> > > > > > >
> > > > > > > This allows you to send a broadcast to a specified Component
> > (e.g.
> > > > the
> > > > > > > current page) and a payload (e.g. your custom event type which
> > > > contains
> > > > > > > information).
> > > > > > >
> > > > > > > In the Components which should react on the event you override
> > the
> > > > > method
> > > > > > > onEvent, check if the event is of your type and if so, do with
> > the
> > > > > event
> > > > > > > payload whatever you want.
> > > 

Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
The method getPage() is not available at the place where I'm building the
link - I'm not within a component and I try to get the page by content of
the session. :-)

I didn't modified the Session - the pageId is stored in
org.apache.wicket.Session.pageId which is an AtomicInteger


2014-09-09 14:06 GMT+02:00 Martin Grigorov :

> Pass the pageId as a query string parameter.
>
> PageParameters params = new PageParameters();
> params.set("pageId", getPage().getPageId());
> theUrlToTheReference = requestCycle.urlFor(yourResRef, params);
>
> Then in the IResource (better extend AbstractResource) just read it from
> the request parameters.
>
> Storing the pageId in the session is not OK because the user may open two
> different pages in separate tabs/windows and this will break.
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
>
> > Thanks again for the fast answer. My code now looks this way:
> >
> > Field declaredField =
> > WebSession.get().getClass().getSuperclass()
> > .getDeclaredField("pageId");
> >
> > declaredField.setAccessible(true);
> > AtomicInteger i = (AtomicInteger)
> > declaredField.get(WebSession.get());
> > Page page = (Page) WebSession.get().getPageManager()
> > .getPage(i.get());
> >
> > AjaxRequestTarget newAjaxRequestTarget = ((WebApplication)
> > Application.get())
> > .newAjaxRequestTarget(page);
> >
> > RequestCycle.get().scheduleRequestHandlerAfterCurrent(
> > newAjaxRequestTarget);
> >
> > I dont know how to get the current pageId but from the Session. The page
> at
> > this place is null. :-(
> >
> >
> >
> > 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
> >
> > > On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
> > > tobiassolosche...@googlemail.com> wrote:
> > >
> > > > Hi again,
> > > >
> > > > I tried out that code you mentioned here.
> > > > WebSession.get().getPageManager().getPage(int i) returns
> > IManageablePage
> > > > which is not applicable as argument for newAjaxRequestTarget.
> > > >
> > >
> > > cast it
> > > it is known that in your environment you don't use any custom
> > > IManageablePage/IRequestablePage impls (see IPageFactory)
> > >
> > >
> > > >
> > > > The second thing is how do I get the instance of a page by class with
> > the
> > > > last page id not from within a component (this would be simple
> > > getPage())?
> > > >
> > >
> > > I didn't get this
> > > Please re-phrase
> > >
> > >
> > > >
> > > > 2014-09-09 11:51 GMT+02:00 Martin Grigorov :
> > > >
> > > > > I've re-read the message and I think I got it.
> > > > > What you really need is a mounted resource
> > > > > (WebApplication#mountResource(someResourceReference))
> > > > > To get a url to it use: theUrl = requestCycle.urlFor(sameResRef,
> > > > > parametersWithPageId)
> > > > > Wicket.Ajax.get({"u": theUrl, ...})
> > > > > In IResource#respond() you can create AjaxRequestTarget with:
> > > > >
> > > > > Page page = session.getPageManager().get(parameters.get("pageId"))
> > > > > target = webApplication.newAjaxRequestTarget(page)
> > > > > requestCycle.scheduleRequestHandlerAfterCurrent(target);
> > > > > page.send(page, Broadcast.BREADTH, new SomeEvent(target))
> > > > >
> > > > > in SomeComponent#onEvent() use someEvent.getTarget().add(this) to
> add
> > > the
> > > > > component when SomeEvent is broadcasted
> > > > >
> > > > > Martin Grigorov
> > > > > Wicket Training and Consulting
> > > > > https://twitter.com/mtgrigorov
> > > > >
> > > > >
> > > > > On Tue, Sep 9, 2014 at 12:40 PM, Richter, Marvin <
> > > > > marvin.rich...@freenetdigital.com> wrote:
> > > > >
> > > > > > What you are looking for is the Wicket Event mechanism.
> > > > > >
> > > > > > This allows you to send a broadcast to a specified Component
> (e.g.
> > > the
> > > > > > current page) and a payload (e.g. your custom event type which
> > > contains
> > > > > > information).
> > > > > >
> > > > > > In the Components which should react on the event you override
> the
> > > > method
> > > > > > onEvent, check if the event is of your type and if so, do with
> the
> > > > event
> > > > > > payload whatever you want.
> > > > > >
> > > > > > Check out
> > > > > >
> > > > >
> > > >
> > >
> >
> http://www.wicket-library.com/wicket-examples/events/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.events.DecoupledAjaxUpdatePage
> > > > > > for a good example.
> > > > > >
> > > > > > Best,
> > > > > > Marvin
> > > > > >
> > > > > > -Original Message-
> > > > > > From: Tobias Soloschenko [mailto:
> tobiassolosche...@googlemail.com]
> > > > > > Sent: Tuesday, September 09, 2014 11:31 AM
> > > > > > To: users@wicket.apache.org
> > > > > > Subject: Re: Global Ajax Event Handler
> > > > > >
> > > >

Re: Global Ajax Event Handler

2014-09-09 Thread Martin Grigorov
Pass the pageId as a query string parameter.

PageParameters params = new PageParameters();
params.set("pageId", getPage().getPageId());
theUrlToTheReference = requestCycle.urlFor(yourResRef, params);

Then in the IResource (better extend AbstractResource) just read it from
the request parameters.

Storing the pageId in the session is not OK because the user may open two
different pages in separate tabs/windows and this will break.


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 3:01 PM, Tobias Soloschenko <
tobiassolosche...@googlemail.com> wrote:

> Thanks again for the fast answer. My code now looks this way:
>
> Field declaredField =
> WebSession.get().getClass().getSuperclass()
> .getDeclaredField("pageId");
>
> declaredField.setAccessible(true);
> AtomicInteger i = (AtomicInteger)
> declaredField.get(WebSession.get());
> Page page = (Page) WebSession.get().getPageManager()
> .getPage(i.get());
>
> AjaxRequestTarget newAjaxRequestTarget = ((WebApplication)
> Application.get())
> .newAjaxRequestTarget(page);
>
> RequestCycle.get().scheduleRequestHandlerAfterCurrent(
> newAjaxRequestTarget);
>
> I dont know how to get the current pageId but from the Session. The page at
> this place is null. :-(
>
>
>
> 2014-09-09 13:53 GMT+02:00 Martin Grigorov :
>
> > On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
> > tobiassolosche...@googlemail.com> wrote:
> >
> > > Hi again,
> > >
> > > I tried out that code you mentioned here.
> > > WebSession.get().getPageManager().getPage(int i) returns
> IManageablePage
> > > which is not applicable as argument for newAjaxRequestTarget.
> > >
> >
> > cast it
> > it is known that in your environment you don't use any custom
> > IManageablePage/IRequestablePage impls (see IPageFactory)
> >
> >
> > >
> > > The second thing is how do I get the instance of a page by class with
> the
> > > last page id not from within a component (this would be simple
> > getPage())?
> > >
> >
> > I didn't get this
> > Please re-phrase
> >
> >
> > >
> > > 2014-09-09 11:51 GMT+02:00 Martin Grigorov :
> > >
> > > > I've re-read the message and I think I got it.
> > > > What you really need is a mounted resource
> > > > (WebApplication#mountResource(someResourceReference))
> > > > To get a url to it use: theUrl = requestCycle.urlFor(sameResRef,
> > > > parametersWithPageId)
> > > > Wicket.Ajax.get({"u": theUrl, ...})
> > > > In IResource#respond() you can create AjaxRequestTarget with:
> > > >
> > > > Page page = session.getPageManager().get(parameters.get("pageId"))
> > > > target = webApplication.newAjaxRequestTarget(page)
> > > > requestCycle.scheduleRequestHandlerAfterCurrent(target);
> > > > page.send(page, Broadcast.BREADTH, new SomeEvent(target))
> > > >
> > > > in SomeComponent#onEvent() use someEvent.getTarget().add(this) to add
> > the
> > > > component when SomeEvent is broadcasted
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > > https://twitter.com/mtgrigorov
> > > >
> > > >
> > > > On Tue, Sep 9, 2014 at 12:40 PM, Richter, Marvin <
> > > > marvin.rich...@freenetdigital.com> wrote:
> > > >
> > > > > What you are looking for is the Wicket Event mechanism.
> > > > >
> > > > > This allows you to send a broadcast to a specified Component (e.g.
> > the
> > > > > current page) and a payload (e.g. your custom event type which
> > contains
> > > > > information).
> > > > >
> > > > > In the Components which should react on the event you override the
> > > method
> > > > > onEvent, check if the event is of your type and if so, do with the
> > > event
> > > > > payload whatever you want.
> > > > >
> > > > > Check out
> > > > >
> > > >
> > >
> >
> http://www.wicket-library.com/wicket-examples/events/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.events.DecoupledAjaxUpdatePage
> > > > > for a good example.
> > > > >
> > > > > Best,
> > > > > Marvin
> > > > >
> > > > > -Original Message-
> > > > > From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com]
> > > > > Sent: Tuesday, September 09, 2014 11:31 AM
> > > > > To: users@wicket.apache.org
> > > > > Subject: Re: Global Ajax Event Handler
> > > > >
> > > > > Hi,
> > > > >
> > > > > thanks for the answer, but this is only a client side event hook
> not
> > > for
> > > > > processing a request to the Server. I added a pseudo code to the
> > > question
> > > > > of martin who asked me what I exactly want to do.
> > > > >
> > > > > Thanks anyway for the fast answer!
> > > > >
> > > > > kind regards,
> > > > >
> > > > > Tobias
> > > > >
> > > > > > Am 09.09.2014 um 11:06 schrieb Tom Götz :
> > > > > >
> > > > > > See
> https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax
> > ,
> > > > > section "Global Ajax call listeners“.
> > > > > >
> > >

Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
Thanks again for the fast answer. My code now looks this way:

Field declaredField =
WebSession.get().getClass().getSuperclass()
.getDeclaredField("pageId");

declaredField.setAccessible(true);
AtomicInteger i = (AtomicInteger)
declaredField.get(WebSession.get());
Page page = (Page) WebSession.get().getPageManager()
.getPage(i.get());

AjaxRequestTarget newAjaxRequestTarget = ((WebApplication)
Application.get())
.newAjaxRequestTarget(page);

RequestCycle.get().scheduleRequestHandlerAfterCurrent(
newAjaxRequestTarget);

I dont know how to get the current pageId but from the Session. The page at
this place is null. :-(



2014-09-09 13:53 GMT+02:00 Martin Grigorov :

> On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
>
> > Hi again,
> >
> > I tried out that code you mentioned here.
> > WebSession.get().getPageManager().getPage(int i) returns IManageablePage
> > which is not applicable as argument for newAjaxRequestTarget.
> >
>
> cast it
> it is known that in your environment you don't use any custom
> IManageablePage/IRequestablePage impls (see IPageFactory)
>
>
> >
> > The second thing is how do I get the instance of a page by class with the
> > last page id not from within a component (this would be simple
> getPage())?
> >
>
> I didn't get this
> Please re-phrase
>
>
> >
> > 2014-09-09 11:51 GMT+02:00 Martin Grigorov :
> >
> > > I've re-read the message and I think I got it.
> > > What you really need is a mounted resource
> > > (WebApplication#mountResource(someResourceReference))
> > > To get a url to it use: theUrl = requestCycle.urlFor(sameResRef,
> > > parametersWithPageId)
> > > Wicket.Ajax.get({"u": theUrl, ...})
> > > In IResource#respond() you can create AjaxRequestTarget with:
> > >
> > > Page page = session.getPageManager().get(parameters.get("pageId"))
> > > target = webApplication.newAjaxRequestTarget(page)
> > > requestCycle.scheduleRequestHandlerAfterCurrent(target);
> > > page.send(page, Broadcast.BREADTH, new SomeEvent(target))
> > >
> > > in SomeComponent#onEvent() use someEvent.getTarget().add(this) to add
> the
> > > component when SomeEvent is broadcasted
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > >
> > > On Tue, Sep 9, 2014 at 12:40 PM, Richter, Marvin <
> > > marvin.rich...@freenetdigital.com> wrote:
> > >
> > > > What you are looking for is the Wicket Event mechanism.
> > > >
> > > > This allows you to send a broadcast to a specified Component (e.g.
> the
> > > > current page) and a payload (e.g. your custom event type which
> contains
> > > > information).
> > > >
> > > > In the Components which should react on the event you override the
> > method
> > > > onEvent, check if the event is of your type and if so, do with the
> > event
> > > > payload whatever you want.
> > > >
> > > > Check out
> > > >
> > >
> >
> http://www.wicket-library.com/wicket-examples/events/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.events.DecoupledAjaxUpdatePage
> > > > for a good example.
> > > >
> > > > Best,
> > > > Marvin
> > > >
> > > > -Original Message-
> > > > From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com]
> > > > Sent: Tuesday, September 09, 2014 11:31 AM
> > > > To: users@wicket.apache.org
> > > > Subject: Re: Global Ajax Event Handler
> > > >
> > > > Hi,
> > > >
> > > > thanks for the answer, but this is only a client side event hook not
> > for
> > > > processing a request to the Server. I added a pseudo code to the
> > question
> > > > of martin who asked me what I exactly want to do.
> > > >
> > > > Thanks anyway for the fast answer!
> > > >
> > > > kind regards,
> > > >
> > > > Tobias
> > > >
> > > > > Am 09.09.2014 um 11:06 schrieb Tom Götz :
> > > > >
> > > > > See https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax
> ,
> > > > section "Global Ajax call listeners“.
> > > > >
> > > > > Cheers,
> > > > >   -Tom
> > > > >
> > > > >
> > > > >> On 09.09.2014, at 10:58, Tobias Soloschenko <
> > > > tobiassolosche...@googlemail.com> wrote:
> > > > >>
> > > > >> Hi all,
> > > > >>
> > > > >> is there a way to register a global ajax event handler within
> > Wicket?
> > > > For normal there is the AbstractDefaultAjaxBehavior which is added
> to a
> > > > component. And then the CallbackScript can be obtained and used
> within
> > a
> > > > OnDomReadyHeaderItem for example.
> > > > >>
> > > > >> Is there a way to do this on application level so that Im able to
> > get
> > > > the CallbackScript from the instantiated Application?
> > > > >>
> > > > >> kind regards
> > > > >>
> > > > >> Tobias
> > > > >>
> > -
> > > > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>

Re: CouldNotLockPageException while trying 'inspect' option of Debug bar

2014-09-09 Thread Martin Grigorov
Can you reproduce this in a simple quickstart app ?

AbstractAjaxTimerBehavior will send a request on the defined timeout, but
the processing of this request should be fast enough. Check what you do in
#onTimer() callback.


On Tue, Sep 9, 2014 at 2:02 PM, Rakesh A  wrote:

> Hi,
> Strange thing is, even if I increase the request timeout to 5mins using
> "org.apache.wicket.settings.IRequestCycleSettings.setTimeout(Duration)", I
> get the same exception.
>
> I use Wicket 6.15.0, pages are unversioned & page uses
> 'AbstractAjaxTimerBehavior'.
> Does 'AbstractAjaxTimerBehavior' cause this lock?
>
> Regards,
> Rakesh.A
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/CouldNotLockPageException-while-trying-inspect-option-of-Debug-bar-tp4667405p4667413.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Global Ajax Event Handler

2014-09-09 Thread Martin Grigorov
On Tue, Sep 9, 2014 at 2:05 PM, Tobias Soloschenko <
tobiassolosche...@googlemail.com> wrote:

> Hi again,
>
> I tried out that code you mentioned here.
> WebSession.get().getPageManager().getPage(int i) returns IManageablePage
> which is not applicable as argument for newAjaxRequestTarget.
>

cast it
it is known that in your environment you don't use any custom
IManageablePage/IRequestablePage impls (see IPageFactory)


>
> The second thing is how do I get the instance of a page by class with the
> last page id not from within a component (this would be simple getPage())?
>

I didn't get this
Please re-phrase


>
> 2014-09-09 11:51 GMT+02:00 Martin Grigorov :
>
> > I've re-read the message and I think I got it.
> > What you really need is a mounted resource
> > (WebApplication#mountResource(someResourceReference))
> > To get a url to it use: theUrl = requestCycle.urlFor(sameResRef,
> > parametersWithPageId)
> > Wicket.Ajax.get({"u": theUrl, ...})
> > In IResource#respond() you can create AjaxRequestTarget with:
> >
> > Page page = session.getPageManager().get(parameters.get("pageId"))
> > target = webApplication.newAjaxRequestTarget(page)
> > requestCycle.scheduleRequestHandlerAfterCurrent(target);
> > page.send(page, Broadcast.BREADTH, new SomeEvent(target))
> >
> > in SomeComponent#onEvent() use someEvent.getTarget().add(this) to add the
> > component when SomeEvent is broadcasted
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> >
> > On Tue, Sep 9, 2014 at 12:40 PM, Richter, Marvin <
> > marvin.rich...@freenetdigital.com> wrote:
> >
> > > What you are looking for is the Wicket Event mechanism.
> > >
> > > This allows you to send a broadcast to a specified Component (e.g. the
> > > current page) and a payload (e.g. your custom event type which contains
> > > information).
> > >
> > > In the Components which should react on the event you override the
> method
> > > onEvent, check if the event is of your type and if so, do with the
> event
> > > payload whatever you want.
> > >
> > > Check out
> > >
> >
> http://www.wicket-library.com/wicket-examples/events/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.events.DecoupledAjaxUpdatePage
> > > for a good example.
> > >
> > > Best,
> > > Marvin
> > >
> > > -Original Message-
> > > From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com]
> > > Sent: Tuesday, September 09, 2014 11:31 AM
> > > To: users@wicket.apache.org
> > > Subject: Re: Global Ajax Event Handler
> > >
> > > Hi,
> > >
> > > thanks for the answer, but this is only a client side event hook not
> for
> > > processing a request to the Server. I added a pseudo code to the
> question
> > > of martin who asked me what I exactly want to do.
> > >
> > > Thanks anyway for the fast answer!
> > >
> > > kind regards,
> > >
> > > Tobias
> > >
> > > > Am 09.09.2014 um 11:06 schrieb Tom Götz :
> > > >
> > > > See https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax,
> > > section "Global Ajax call listeners“.
> > > >
> > > > Cheers,
> > > >   -Tom
> > > >
> > > >
> > > >> On 09.09.2014, at 10:58, Tobias Soloschenko <
> > > tobiassolosche...@googlemail.com> wrote:
> > > >>
> > > >> Hi all,
> > > >>
> > > >> is there a way to register a global ajax event handler within
> Wicket?
> > > For normal there is the AbstractDefaultAjaxBehavior which is added to a
> > > component. And then the CallbackScript can be obtained and used within
> a
> > > OnDomReadyHeaderItem for example.
> > > >>
> > > >> Is there a way to do this on application level so that Im able to
> get
> > > the CallbackScript from the instantiated Application?
> > > >>
> > > >> kind regards
> > > >>
> > > >> Tobias
> > > >>
> -
> > > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > >> For additional commands, e-mail: users-h...@wicket.apache.org
> > > >
> > > >
> > > >
> > > >
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
>


Re: Wicket logs

2014-09-09 Thread Martin Grigorov
Hi,

The provided (none!) logs look fine.
Please provide some more so we can check them too.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 2:16 PM, dharmendra pandey <
dharmendra.pan...@gmail.com> wrote:

> Hi,
>
> My application is deployed on PRODUCTION environment and I set our
> application log level (Wicket Application to deployment mode)
>
> After override/setting the method below we are seeing lots unnecessary
> wicket logs info in file.
>
>
>   public RuntimeConfigurationType getRuntimeConfigurationType() {
>
> return RuntimeConfigurationType.DEPLOYMENT;
>
> }
>
> Please suggest,
>
> Regards
> Dharmendra Pandey
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-logs-tp4667415.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Wicket logs

2014-09-09 Thread dharmendra pandey
Hi,

My application is deployed on PRODUCTION environment and I set our
application log level (Wicket Application to deployment mode)

After override/setting the method below we are seeing lots unnecessary
wicket logs info in file.


  public RuntimeConfigurationType getRuntimeConfigurationType() {

return RuntimeConfigurationType.DEPLOYMENT;

}

Please suggest,

Regards
Dharmendra Pandey

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-logs-tp4667415.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
Hi again,

I tried out that code you mentioned here.
WebSession.get().getPageManager().getPage(int i) returns IManageablePage
which is not applicable as argument for newAjaxRequestTarget.

The second thing is how do I get the instance of a page by class with the
last page id not from within a component (this would be simple getPage())?

2014-09-09 11:51 GMT+02:00 Martin Grigorov :

> I've re-read the message and I think I got it.
> What you really need is a mounted resource
> (WebApplication#mountResource(someResourceReference))
> To get a url to it use: theUrl = requestCycle.urlFor(sameResRef,
> parametersWithPageId)
> Wicket.Ajax.get({"u": theUrl, ...})
> In IResource#respond() you can create AjaxRequestTarget with:
>
> Page page = session.getPageManager().get(parameters.get("pageId"))
> target = webApplication.newAjaxRequestTarget(page)
> requestCycle.scheduleRequestHandlerAfterCurrent(target);
> page.send(page, Broadcast.BREADTH, new SomeEvent(target))
>
> in SomeComponent#onEvent() use someEvent.getTarget().add(this) to add the
> component when SomeEvent is broadcasted
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Tue, Sep 9, 2014 at 12:40 PM, Richter, Marvin <
> marvin.rich...@freenetdigital.com> wrote:
>
> > What you are looking for is the Wicket Event mechanism.
> >
> > This allows you to send a broadcast to a specified Component (e.g. the
> > current page) and a payload (e.g. your custom event type which contains
> > information).
> >
> > In the Components which should react on the event you override the method
> > onEvent, check if the event is of your type and if so, do with the event
> > payload whatever you want.
> >
> > Check out
> >
> http://www.wicket-library.com/wicket-examples/events/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.events.DecoupledAjaxUpdatePage
> > for a good example.
> >
> > Best,
> > Marvin
> >
> > -Original Message-
> > From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com]
> > Sent: Tuesday, September 09, 2014 11:31 AM
> > To: users@wicket.apache.org
> > Subject: Re: Global Ajax Event Handler
> >
> > Hi,
> >
> > thanks for the answer, but this is only a client side event hook not for
> > processing a request to the Server. I added a pseudo code to the question
> > of martin who asked me what I exactly want to do.
> >
> > Thanks anyway for the fast answer!
> >
> > kind regards,
> >
> > Tobias
> >
> > > Am 09.09.2014 um 11:06 schrieb Tom Götz :
> > >
> > > See https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax,
> > section "Global Ajax call listeners“.
> > >
> > > Cheers,
> > >   -Tom
> > >
> > >
> > >> On 09.09.2014, at 10:58, Tobias Soloschenko <
> > tobiassolosche...@googlemail.com> wrote:
> > >>
> > >> Hi all,
> > >>
> > >> is there a way to register a global ajax event handler within Wicket?
> > For normal there is the AbstractDefaultAjaxBehavior which is added to a
> > component. And then the CallbackScript can be obtained and used within a
> > OnDomReadyHeaderItem for example.
> > >>
> > >> Is there a way to do this on application level so that Im able to get
> > the CallbackScript from the instantiated Application?
> > >>
> > >> kind regards
> > >>
> > >> Tobias
> > >> -
> > >> 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: CouldNotLockPageException while trying 'inspect' option of Debug bar

2014-09-09 Thread Rakesh A
Hi,
Strange thing is, even if I increase the request timeout to 5mins using
"org.apache.wicket.settings.IRequestCycleSettings.setTimeout(Duration)", I
get the same exception.

I use Wicket 6.15.0, pages are unversioned & page uses
'AbstractAjaxTimerBehavior'.
Does 'AbstractAjaxTimerBehavior' cause this lock?

Regards,
Rakesh.A

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CouldNotLockPageException-while-trying-inspect-option-of-Debug-bar-tp4667405p4667413.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to register a global resource with dependencies?

2014-09-09 Thread Martin Grigorov
This is OK.
Override Component#renderHead() or Behavior#renderHead() and list all
references that are needed.
You can also
use org.apache.wicket.Application#getHeaderContributorListeners().add(new
IHeaderContributor() { #renderHead() {...} }) to define which header items
should be contributed for every request.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 1:47 PM, brushmate  wrote:

> Okay, then I have another question:
>
> Where do I have to define the references. Until now, I always defined them
> in the component that needs them.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403p4667411.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: How to register a global resource with dependencies?

2014-09-09 Thread brushmate
Okay, then I have another question:

Where do I have to define the references. Until now, I always defined them
in the component that needs them.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403p4667411.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to register a global resource with dependencies?

2014-09-09 Thread Martin Grigorov
On Tue, Sep 9, 2014 at 1:35 PM, brushmate  wrote:

> Thanks for your answer. So everytime I want to reference a resource, I have
> to declare its dependencies?
>
> I want to register it globally, because I can use it on different pages
> then
> and if the path to the resource changes in the future, I only need to
> update
> it at one place.
>

The same is valid for any other (non-shared) resource reference.
Just create a PackageResourceReference (e.g. Css or JS) and define the
scope class and the relative path. Or UrlResourceReference with the Url.
Define the dependencies.
Later if you need to change the scope/relativePath/url just do it. All
users of the reference will have the update for free.


>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403p4667407.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: How to register a global resource with dependencies?

2014-09-09 Thread Tobias Soloschenko
You could use resource bundles, define all ResourceReferences within the
bundle and within each ResourceReference their dependencies. If you would
use any resourcereference within a renderHead method, all dependencies and
resources would placed at the right position and you would save some
requests.

2014-09-09 12:35 GMT+02:00 brushmate :

> Thanks for your answer. So everytime I want to reference a resource, I have
> to declare its dependencies?
>
> I want to register it globally, because I can use it on different pages
> then
> and if the path to the resource changes in the future, I only need to
> update
> it at one place.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403p4667407.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: CouldNotLockPageException while trying 'inspect' option of Debug bar

2014-09-09 Thread Martin Grigorov
The Inspector tries to get a reference to the page by its id to be able to
get a list of its components.
But another thread is already acquired the lock to this page... It seems to
write the page's markup to the browser but I cannot say why it does this
for more than a minute.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 1:27 PM, Rakesh A  wrote:

> Hi,
>
> I was trying to analyze my wicket page, by adding Wicket debug bar. When I
> click on the 'Inspector' option in Wicket debug bar I get a
> CouldNotLockPageException. Thread dump logged is provided below, I couldn't
> understand much from it, can anybody point me towards why I am getting this
> exception.
>
>
> Thanks,
> Rakesh.A
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/CouldNotLockPageException-while-trying-inspect-option-of-Debug-bar-tp4667405.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: How to register a global resource with dependencies?

2014-09-09 Thread brushmate
Thanks for your answer. So everytime I want to reference a resource, I have
to declare its dependencies?

I want to register it globally, because I can use it on different pages then
and if the path to the resource changes in the future, I only need to update
it at one place.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403p4667407.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to register a global resource with dependencies?

2014-09-09 Thread Martin Grigorov
Hi,

You register the IResource with getSharedResources().add(String name,
IResource resource) but later you need to reference it with
SharedResourceReference(name) to be able to use it. You can override
SharedResourceReference's
getDependencies() to declare the JQuery dependency.

Why do you need to use shared resources at all ?
What benefit do you see ?

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 1:20 PM, brushmate  wrote:

> Hi,I want to register a JS file globally, but it depends on jQuery. The
> user
> guide says that rsources can be registered with
> getSharedResources().add(String name, IResource resource). But since it
> takes an IResource, I can not declare the dependencies with overriding
> getDependencies() like I would do with a ResourceReference. So how can I
> register a global JavaScript resource that depends on jQuery?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


CouldNotLockPageException while trying 'inspect' option of Debug bar

2014-09-09 Thread Rakesh A
Hi,

I was trying to analyze my wicket page, by adding Wicket debug bar. When I
click on the 'Inspector' option in Wicket debug bar I get a
CouldNotLockPageException. Thread dump logged is provided below, I couldn't
understand much from it, can anybody point me towards why I am getting this
exception.


Thanks,
Rakesh.A

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CouldNotLockPageException-while-trying-inspect-option-of-Debug-bar-tp4667405.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to register a global resource with dependencies?

2014-09-09 Thread Tobias Soloschenko
You can get the JQueryResourceReference used by Wicket like this:

getJavaScriptLibrarySettings().getJQueryReference()

kind regards

Tobias

2014-09-09 12:20 GMT+02:00 brushmate :

> Hi,I want to register a JS file globally, but it depends on jQuery. The
> user
> guide says that rsources can be registered with
> getSharedResources().add(String name, IResource resource). But since it
> takes an IResource, I can not declare the dependencies with overriding
> getDependencies() like I would do with a ResourceReference. So how can I
> register a global JavaScript resource that depends on jQuery?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


How to register a global resource with dependencies?

2014-09-09 Thread brushmate
Hi,I want to register a JS file globally, but it depends on jQuery. The user
guide says that rsources can be registered with
getSharedResources().add(String name, IResource resource). But since it
takes an IResource, I can not declare the dependencies with overriding
getDependencies() like I would do with a ResourceReference. So how can I
register a global JavaScript resource that depends on jQuery?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-register-a-global-resource-with-dependencies-tp4667403.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
Thats it!!! Thanks!

Kind regards

Tobias 

Von meinem iPhone gesendet

> Am 09.09.2014 um 11:51 schrieb Martin Grigorov :
> 
> I've re-read the message and I think I got it.
> What you really need is a mounted resource
> (WebApplication#mountResource(someResourceReference))
> To get a url to it use: theUrl = requestCycle.urlFor(sameResRef,
> parametersWithPageId)
> Wicket.Ajax.get({"u": theUrl, ...})
> In IResource#respond() you can create AjaxRequestTarget with:
> 
> Page page = session.getPageManager().get(parameters.get("pageId"))
> target = webApplication.newAjaxRequestTarget(page)
> requestCycle.scheduleRequestHandlerAfterCurrent(target);
> page.send(page, Broadcast.BREADTH, new SomeEvent(target))
> 
> in SomeComponent#onEvent() use someEvent.getTarget().add(this) to add the
> component when SomeEvent is broadcasted
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 12:40 PM, Richter, Marvin <
> marvin.rich...@freenetdigital.com> wrote:
> 
>> What you are looking for is the Wicket Event mechanism.
>> 
>> This allows you to send a broadcast to a specified Component (e.g. the
>> current page) and a payload (e.g. your custom event type which contains
>> information).
>> 
>> In the Components which should react on the event you override the method
>> onEvent, check if the event is of your type and if so, do with the event
>> payload whatever you want.
>> 
>> Check out
>> http://www.wicket-library.com/wicket-examples/events/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.events.DecoupledAjaxUpdatePage
>> for a good example.
>> 
>> Best,
>> Marvin
>> 
>> -Original Message-
>> From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com]
>> Sent: Tuesday, September 09, 2014 11:31 AM
>> To: users@wicket.apache.org
>> Subject: Re: Global Ajax Event Handler
>> 
>> Hi,
>> 
>> thanks for the answer, but this is only a client side event hook not for
>> processing a request to the Server. I added a pseudo code to the question
>> of martin who asked me what I exactly want to do.
>> 
>> Thanks anyway for the fast answer!
>> 
>> kind regards,
>> 
>> Tobias
>> 
>>> Am 09.09.2014 um 11:06 schrieb Tom Götz :
>>> 
>>> See https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax,
>> section "Global Ajax call listeners“.
>>> 
>>> Cheers,
>>>  -Tom
>>> 
>>> 
 On 09.09.2014, at 10:58, Tobias Soloschenko <
>> tobiassolosche...@googlemail.com> wrote:
 
 Hi all,
 
 is there a way to register a global ajax event handler within Wicket?
>> For normal there is the AbstractDefaultAjaxBehavior which is added to a
>> component. And then the CallbackScript can be obtained and used within a
>> OnDomReadyHeaderItem for example.
 
 Is there a way to do this on application level so that Im able to get
>> the CallbackScript from the instantiated Application?
 
 kind regards
 
 Tobias
 -
 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: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
Hi,

the example shows up event bubbling which is not what I mean. 

Thanks anyway :-)

Kind regards 

Tobias 
> Am 09.09.2014 um 11:40 schrieb "Richter, Marvin" 
> :
> 
> What you are looking for is the Wicket Event mechanism.
> 
> This allows you to send a broadcast to a specified Component (e.g. the 
> current page) and a payload (e.g. your custom event type which contains 
> information).
> 
> In the Components which should react on the event you override the method 
> onEvent, check if the event is of your type and if so, do with the event 
> payload whatever you want.
> 
> Check out 
> http://www.wicket-library.com/wicket-examples/events/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.events.DecoupledAjaxUpdatePage
>  for a good example.
> 
> Best,
> Marvin
> 
> -Original Message-
> From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com] 
> Sent: Tuesday, September 09, 2014 11:31 AM
> To: users@wicket.apache.org
> Subject: Re: Global Ajax Event Handler
> 
> Hi,
> 
> thanks for the answer, but this is only a client side event hook not for 
> processing a request to the Server. I added a pseudo code to the question of 
> martin who asked me what I exactly want to do.
> 
> Thanks anyway for the fast answer!
> 
> kind regards,
> 
> Tobias 
> 
>> Am 09.09.2014 um 11:06 schrieb Tom Götz :
>> 
>> See https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax, section 
>> "Global Ajax call listeners“.
>> 
>> Cheers,
>>  -Tom
>> 
>> 
>>> On 09.09.2014, at 10:58, Tobias Soloschenko 
>>>  wrote:
>>> 
>>> Hi all, 
>>> 
>>> is there a way to register a global ajax event handler within Wicket? For 
>>> normal there is the AbstractDefaultAjaxBehavior which is added to a 
>>> component. And then the CallbackScript can be obtained and used within a 
>>> OnDomReadyHeaderItem for example.
>>> 
>>> Is there a way to do this on application level so that Im able to get the 
>>> CallbackScript from the instantiated Application? 
>>> 
>>> kind regards 
>>> 
>>> Tobias
>>> -
>>> 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
> 
> ТÐÐ¥FòVç7V'67&–&RÂRÖÖ–âW6W'2×Vç7V'67&–&Tv–6¶WBæ6†Ræ÷&pФf÷"FF—F–öæÂ6öÖÖæG2ÂRÖÖ–âW6W'2Ö†VÇv–6¶WBæ6†Ræ÷&pÐ
>  

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



Re: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
I only wrote some pseudo code to show what I want to do. In simple words:

I want to write javascript code that invokes a method on the server side. The 
method on Server side is going to refresh components. Everything should work 
without Rendering the javascript code within a wicket page / component.

Kind regards

Tobias 

> Am 09.09.2014 um 11:37 schrieb Martin Grigorov :
> 
> I am still confused :-)
> You used class names which are not available in Wicket 6.17.0 so I cannot
> map them to any functionality that is possible with "local" behavior.
> 
> My guess is that you ask
> about 
> org.apache.wicket.ajax.AjaxRequestTarget.IListener#updateAjaxAttributes()
> You can register custom listener like this:
> https://github.com/apache/wicket/blob/master/wicket-core/src/test/java/org/apache/wicket/ajax/GlobalUpdateAjaxAttributesTest.java#L40
> 
> This way you have a global (server side, application-wide) way to
> manipulate the AjaxRequestAttributes for *all* Ajax behaviors/components.
> 
> Does this solve the problem ?
> If NO then please explain how you would do it "the local way".
> 
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 12:26 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> I want to have the possibility to add a listener at application Level like
>> in this pseudo code
>> 
>> Server side
>> getGlobalAjaxBehaviors().add("myid",new GlobalAjaxBehavior(){
>> 
>> public void respond(GlobalRequest request){
>> // here the Event is received
>> // request.getArguments();
>> // request.replace(...)
>> }
>> }
>> 
>> Client side
>> Wicket.Ajax.get({"id","somearguments"});
>> 
>> This would allow me to send ajax request from any applications rendered at
>> the Same page but which aren't able to access the wicket component
>> structure. But within the event I would like to add and replace components
>> based on the given args. Maybe application is Not the right place - Page
>> would also be ok by adding the page class to the listener instead an id and
>> the page class itself could implement an Interface for handling the event.
>> 
>> kind regards
>> 
>> Tobias
>> 
>>> Am 09.09.2014 um 11:06 schrieb Martin Grigorov :
>>> 
>>> What exactly you want to do ?
>>> 
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>> 
>>> 
>>> On Tue, Sep 9, 2014 at 11:58 AM, Tobias Soloschenko <
>>> tobiassolosche...@googlemail.com> wrote:
>>> 
 Hi all,
 
 is there a way to register a global ajax event handler within Wicket?
>> For
 normal there is the AbstractDefaultAjaxBehavior which is added to a
 component. And then the CallbackScript can be obtained and used within a
 OnDomReadyHeaderItem for example.
 
 Is there a way to do this on application level so that Im able to get
>> the
 CallbackScript from the instantiated Application?
 
 kind regards
 
 Tobias
 -
 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: Global Ajax Event Handler

2014-09-09 Thread Martin Grigorov
I've re-read the message and I think I got it.
What you really need is a mounted resource
(WebApplication#mountResource(someResourceReference))
To get a url to it use: theUrl = requestCycle.urlFor(sameResRef,
parametersWithPageId)
Wicket.Ajax.get({"u": theUrl, ...})
In IResource#respond() you can create AjaxRequestTarget with:

Page page = session.getPageManager().get(parameters.get("pageId"))
target = webApplication.newAjaxRequestTarget(page)
requestCycle.scheduleRequestHandlerAfterCurrent(target);
page.send(page, Broadcast.BREADTH, new SomeEvent(target))

in SomeComponent#onEvent() use someEvent.getTarget().add(this) to add the
component when SomeEvent is broadcasted

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 12:40 PM, Richter, Marvin <
marvin.rich...@freenetdigital.com> wrote:

> What you are looking for is the Wicket Event mechanism.
>
> This allows you to send a broadcast to a specified Component (e.g. the
> current page) and a payload (e.g. your custom event type which contains
> information).
>
> In the Components which should react on the event you override the method
> onEvent, check if the event is of your type and if so, do with the event
> payload whatever you want.
>
> Check out
> http://www.wicket-library.com/wicket-examples/events/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.events.DecoupledAjaxUpdatePage
> for a good example.
>
> Best,
> Marvin
>
> -Original Message-
> From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com]
> Sent: Tuesday, September 09, 2014 11:31 AM
> To: users@wicket.apache.org
> Subject: Re: Global Ajax Event Handler
>
> Hi,
>
> thanks for the answer, but this is only a client side event hook not for
> processing a request to the Server. I added a pseudo code to the question
> of martin who asked me what I exactly want to do.
>
> Thanks anyway for the fast answer!
>
> kind regards,
>
> Tobias
>
> > Am 09.09.2014 um 11:06 schrieb Tom Götz :
> >
> > See https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax,
> section "Global Ajax call listeners“.
> >
> > Cheers,
> >   -Tom
> >
> >
> >> On 09.09.2014, at 10:58, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> >>
> >> Hi all,
> >>
> >> is there a way to register a global ajax event handler within Wicket?
> For normal there is the AbstractDefaultAjaxBehavior which is added to a
> component. And then the CallbackScript can be obtained and used within a
> OnDomReadyHeaderItem for example.
> >>
> >> Is there a way to do this on application level so that Im able to get
> the CallbackScript from the instantiated Application?
> >>
> >> kind regards
> >>
> >> Tobias
> >> -
> >> 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: Global Ajax Event Handler

2014-09-09 Thread Richter, Marvin
What you are looking for is the Wicket Event mechanism.

This allows you to send a broadcast to a specified Component (e.g. the current 
page) and a payload (e.g. your custom event type which contains information).

In the Components which should react on the event you override the method 
onEvent, check if the event is of your type and if so, do with the event 
payload whatever you want.

Check out 
http://www.wicket-library.com/wicket-examples/events/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.events.DecoupledAjaxUpdatePage
 for a good example.

Best,
Marvin

-Original Message-
From: Tobias Soloschenko [mailto:tobiassolosche...@googlemail.com] 
Sent: Tuesday, September 09, 2014 11:31 AM
To: users@wicket.apache.org
Subject: Re: Global Ajax Event Handler

Hi,

thanks for the answer, but this is only a client side event hook not for 
processing a request to the Server. I added a pseudo code to the question of 
martin who asked me what I exactly want to do.

Thanks anyway for the fast answer!

kind regards,

Tobias 

> Am 09.09.2014 um 11:06 schrieb Tom Götz :
> 
> See https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax, section 
> "Global Ajax call listeners“.
> 
> Cheers,
>   -Tom
> 
> 
>> On 09.09.2014, at 10:58, Tobias Soloschenko 
>>  wrote:
>> 
>> Hi all, 
>> 
>> is there a way to register a global ajax event handler within Wicket? For 
>> normal there is the AbstractDefaultAjaxBehavior which is added to a 
>> component. And then the CallbackScript can be obtained and used within a 
>> OnDomReadyHeaderItem for example.
>> 
>> Is there a way to do this on application level so that Im able to get the 
>> CallbackScript from the instantiated Application? 
>> 
>> kind regards 
>> 
>> Tobias
>> -
>> 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: Global Ajax Event Handler

2014-09-09 Thread Martin Grigorov
I am still confused :-)
You used class names which are not available in Wicket 6.17.0 so I cannot
map them to any functionality that is possible with "local" behavior.

My guess is that you ask
about org.apache.wicket.ajax.AjaxRequestTarget.IListener#updateAjaxAttributes()
You can register custom listener like this:
https://github.com/apache/wicket/blob/master/wicket-core/src/test/java/org/apache/wicket/ajax/GlobalUpdateAjaxAttributesTest.java#L40

This way you have a global (server side, application-wide) way to
manipulate the AjaxRequestAttributes for *all* Ajax behaviors/components.

Does this solve the problem ?
If NO then please explain how you would do it "the local way".


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 12:26 PM, Tobias Soloschenko <
tobiassolosche...@googlemail.com> wrote:

> I want to have the possibility to add a listener at application Level like
> in this pseudo code
>
> Server side
> getGlobalAjaxBehaviors().add("myid",new GlobalAjaxBehavior(){
>
>  public void respond(GlobalRequest request){
>  // here the Event is received
> // request.getArguments();
>  // request.replace(...)
> }
> }
>
> Client side
> Wicket.Ajax.get({"id","somearguments"});
>
> This would allow me to send ajax request from any applications rendered at
> the Same page but which aren't able to access the wicket component
> structure. But within the event I would like to add and replace components
> based on the given args. Maybe application is Not the right place - Page
> would also be ok by adding the page class to the listener instead an id and
> the page class itself could implement an Interface for handling the event.
>
> kind regards
>
> Tobias
>
> > Am 09.09.2014 um 11:06 schrieb Martin Grigorov :
> >
> > What exactly you want to do ?
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> >
> > On Tue, Sep 9, 2014 at 11:58 AM, Tobias Soloschenko <
> > tobiassolosche...@googlemail.com> wrote:
> >
> >> Hi all,
> >>
> >> is there a way to register a global ajax event handler within Wicket?
> For
> >> normal there is the AbstractDefaultAjaxBehavior which is added to a
> >> component. And then the CallbackScript can be obtained and used within a
> >> OnDomReadyHeaderItem for example.
> >>
> >> Is there a way to do this on application level so that Im able to get
> the
> >> CallbackScript from the instantiated Application?
> >>
> >> kind regards
> >>
> >> Tobias
> >> -
> >> 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: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
Hi,

thanks for the answer, but this is only a client side event hook not for 
processing a request to the Server. I added a pseudo code to the question of 
martin who asked me what I exactly want to do.

Thanks anyway for the fast answer!

kind regards,

Tobias 

> Am 09.09.2014 um 11:06 schrieb Tom Götz :
> 
> See https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax, section 
> "Global Ajax call listeners“.
> 
> Cheers,
>   -Tom
> 
> 
>> On 09.09.2014, at 10:58, Tobias Soloschenko 
>>  wrote:
>> 
>> Hi all, 
>> 
>> is there a way to register a global ajax event handler within Wicket? For 
>> normal there is the AbstractDefaultAjaxBehavior which is added to a 
>> component. And then the CallbackScript can be obtained and used within a 
>> OnDomReadyHeaderItem for example.
>> 
>> Is there a way to do this on application level so that Im able to get the 
>> CallbackScript from the instantiated Application? 
>> 
>> kind regards 
>> 
>> Tobias
>> -
>> 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: Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
I want to have the possibility to add a listener at application Level like in 
this pseudo code 

Server side
getGlobalAjaxBehaviors().add("myid",new GlobalAjaxBehavior(){

 public void respond(GlobalRequest request){
 // here the Event is received 
// request.getArguments();
 // request.replace(...)
}
}

Client side
Wicket.Ajax.get({"id","somearguments"});

This would allow me to send ajax request from any applications rendered at the 
Same page but which aren't able to access the wicket component structure. But 
within the event I would like to add and replace components based on the given 
args. Maybe application is Not the right place - Page would also be ok by 
adding the page class to the listener instead an id and the page class itself 
could implement an Interface for handling the event.

kind regards 

Tobias 

> Am 09.09.2014 um 11:06 schrieb Martin Grigorov :
> 
> What exactly you want to do ?
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> 
> On Tue, Sep 9, 2014 at 11:58 AM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> Hi all,
>> 
>> is there a way to register a global ajax event handler within Wicket? For
>> normal there is the AbstractDefaultAjaxBehavior which is added to a
>> component. And then the CallbackScript can be obtained and used within a
>> OnDomReadyHeaderItem for example.
>> 
>> Is there a way to do this on application level so that Im able to get the
>> CallbackScript from the instantiated Application?
>> 
>> kind regards
>> 
>> Tobias
>> -
>> 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: Global Ajax Event Handler

2014-09-09 Thread Tom Götz
See https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax, section 
"Global Ajax call listeners“.

Cheers,
   -Tom


On 09.09.2014, at 10:58, Tobias Soloschenko  
wrote:

> Hi all, 
> 
> is there a way to register a global ajax event handler within Wicket? For 
> normal there is the AbstractDefaultAjaxBehavior which is added to a 
> component. And then the CallbackScript can be obtained and used within a 
> OnDomReadyHeaderItem for example.
> 
> Is there a way to do this on application level so that Im able to get the 
> CallbackScript from the instantiated Application? 
> 
> kind regards 
> 
> Tobias
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 






Re: Global Ajax Event Handler

2014-09-09 Thread Martin Grigorov
What exactly you want to do ?

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 11:58 AM, Tobias Soloschenko <
tobiassolosche...@googlemail.com> wrote:

> Hi all,
>
> is there a way to register a global ajax event handler within Wicket? For
> normal there is the AbstractDefaultAjaxBehavior which is added to a
> component. And then the CallbackScript can be obtained and used within a
> OnDomReadyHeaderItem for example.
>
> Is there a way to do this on application level so that Im able to get the
> CallbackScript from the instantiated Application?
>
> kind regards
>
> Tobias
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Global Ajax Event Handler

2014-09-09 Thread Tobias Soloschenko
Hi all, 

is there a way to register a global ajax event handler within Wicket? For 
normal there is the AbstractDefaultAjaxBehavior which is added to a component. 
And then the CallbackScript can be obtained and used within a 
OnDomReadyHeaderItem for example.

Is there a way to do this on application level so that Im able to get the 
CallbackScript from the instantiated Application? 

kind regards 

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



Re: Variant Change Behavior

2014-09-09 Thread Thibault Kruse
The API looks good. I don't have time to test it right now.

On Tue, Sep 9, 2014 at 9:44 AM, Martin Grigorov  wrote:
> https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commit;h=702bf45a
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Tue, Sep 9, 2014 at 10:42 AM, Martin Grigorov 
> wrote:
>
>> Please check that the solution provided with
>> https://issues.apache.org/jira/browse/WICKET-5694 will do the job.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>>
>> On Mon, Sep 8, 2014 at 10:45 AM, Thibault Kruse 
>> wrote:
>>
>>> Hm, thinking some more, the general solution would be to fail if a
>>> variant is requested, and it is among a set of whitelisted variants,
>>> and the markup is not found. For other variants, using the default
>>> would probably be fine. This is more general than our current usecase,
>>> but still significant I believe. I trust that Wicket fails at runtime
>>> when the markup has an error, and I want to be able to express in
>>> wicket that for a given component, a set of variants is expected to
>>> exist, and wicket should fail if the markup is missing for any variant
>>> in the set.
>>>
>>> On Mon, Sep 8, 2014 at 9:41 AM, Thibault Kruse 
>>> wrote:
>>> > Both solutions are not ideal, since we do not want our tests to become
>>> > brittle. We want to functionally test components in multiple variants,
>>> > but where the variants vary in mere layout (css classes), we do not
>>> > want to have tests break just because the layout changes (as long as
>>> > the component still functions).
>>> >
>>> > Another solution for us would be to have components without variant
>>> > loading fallback behavior. So in general it is obviously good if a
>>> > component falls back to default markup, because we might have a
>>> > component tree where only a subset of involved components have a
>>> > variant markup. But for those component are supposed to have it, it
>>> > would be good if they fail when it is not found (e.g. due to typos).
>>> > However, I guess we cannot implement that logic inside getVariant(),
>>> > as the child components will invoke it. Is there another hook we could
>>> > use to fail for specific components when their variant was not found?
>>> >
>>> > On Mon, Sep 8, 2014 at 9:12 AM, Martin Grigorov 
>>> wrote:
>>> >> Hi,
>>> >>
>>> >> There is nothing specific for this.
>>> >> But you can use
>>> >> various org.apache.wicket.util.tester.WicketTester#executeTest()
>>> methods to
>>> >> check the response against a valid response pre-saved in a file.
>>> >> Or you can use
>>> org.apache.wicket.util.tester.WicketTester#assertContains()
>>> >> to check that a specific String (actually a Regex) is in the response.
>>> >>
>>> >> Martin Grigorov
>>> >> Wicket Training and Consulting
>>> >> https://twitter.com/mtgrigorov
>>> >>
>>> >>
>>> >> On Fri, Sep 5, 2014 at 4:30 PM, Thibault Kruse <
>>> tibokr...@googlemail.com>
>>> >> wrote:
>>> >>
>>> >>> Thanks Martin,
>>> >>>
>>> >>> that works for us. I missed that Variants are inherited from parents.
>>> >>>
>>> >>> Is there also a good way that I can assure in our unit tests that the
>>> >>> variant markup for certain components exists and was found? Else a
>>> >>> typo would go unnoticed in the unit tests.
>>> >>>
>>> >>> cheers,
>>> >>>   Thibault
>>> >>>
>>> >>> On Wed, Sep 3, 2014 at 12:59 PM, Martin Grigorov <
>>> mgrigo...@apache.org>
>>> >>> wrote:
>>> >>> > Hi,
>>> >>> >
>>> >>> > The behaviors are not used for variations.
>>> >>> > For such use cases you should
>>> >>> > override org.apache.wicket.Component#getVariation() on the (base)
>>> page.
>>> >>> > This way all components will know the correct variation.
>>> >>> >
>>> >>> > Martin Grigorov
>>> >>> > Wicket Training and Consulting
>>> >>> > https://twitter.com/mtgrigorov
>>> >>> >
>>> >>> >
>>> >>> > On Wed, Sep 3, 2014 at 1:09 PM, Thibault Kruse <
>>> tibokr...@googlemail.com
>>> >>> >
>>> >>> > wrote:
>>> >>> >
>>> >>> >> Hi,
>>> >>> >>
>>> >>> >> playing around with Variants for Components, I am wondering whether
>>> >>> >> there is an elegant way to steer Variant markup loading via a
>>> >>> >> Behavior.
>>> >>> >>
>>> >>> >> In our case we want to use a different markup layout based on the
>>> >>> >> width of the container the component is going to be used in,
>>> visually.
>>> >>> >>
>>> >>> >> So if we imagine a Browser window with desktop size, we might want
>>> to
>>> >>> >> use a component on the full width, on a third of the width, or a
>>> >>> >> quarter of the width.
>>> >>> >>
>>> >>> >> For each such container width, we need different responsive design
>>> >>> >> markup. Since this may affect many of our components which inherit
>>> >>> >> from different wicket components, I'd like to just add another html
>>> >>> >> markup file for the variant, and add a Behavior to the component
>>> that
>>> >>> >> decides the Variant.
>>> >>> >>
>>> >>> >> cheers,
>>> >>> >>   Thib

Re: Variant Change Behavior

2014-09-09 Thread Martin Grigorov
https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commit;h=702bf45a

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 10:42 AM, Martin Grigorov 
wrote:

> Please check that the solution provided with
> https://issues.apache.org/jira/browse/WICKET-5694 will do the job.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Mon, Sep 8, 2014 at 10:45 AM, Thibault Kruse 
> wrote:
>
>> Hm, thinking some more, the general solution would be to fail if a
>> variant is requested, and it is among a set of whitelisted variants,
>> and the markup is not found. For other variants, using the default
>> would probably be fine. This is more general than our current usecase,
>> but still significant I believe. I trust that Wicket fails at runtime
>> when the markup has an error, and I want to be able to express in
>> wicket that for a given component, a set of variants is expected to
>> exist, and wicket should fail if the markup is missing for any variant
>> in the set.
>>
>> On Mon, Sep 8, 2014 at 9:41 AM, Thibault Kruse 
>> wrote:
>> > Both solutions are not ideal, since we do not want our tests to become
>> > brittle. We want to functionally test components in multiple variants,
>> > but where the variants vary in mere layout (css classes), we do not
>> > want to have tests break just because the layout changes (as long as
>> > the component still functions).
>> >
>> > Another solution for us would be to have components without variant
>> > loading fallback behavior. So in general it is obviously good if a
>> > component falls back to default markup, because we might have a
>> > component tree where only a subset of involved components have a
>> > variant markup. But for those component are supposed to have it, it
>> > would be good if they fail when it is not found (e.g. due to typos).
>> > However, I guess we cannot implement that logic inside getVariant(),
>> > as the child components will invoke it. Is there another hook we could
>> > use to fail for specific components when their variant was not found?
>> >
>> > On Mon, Sep 8, 2014 at 9:12 AM, Martin Grigorov 
>> wrote:
>> >> Hi,
>> >>
>> >> There is nothing specific for this.
>> >> But you can use
>> >> various org.apache.wicket.util.tester.WicketTester#executeTest()
>> methods to
>> >> check the response against a valid response pre-saved in a file.
>> >> Or you can use
>> org.apache.wicket.util.tester.WicketTester#assertContains()
>> >> to check that a specific String (actually a Regex) is in the response.
>> >>
>> >> Martin Grigorov
>> >> Wicket Training and Consulting
>> >> https://twitter.com/mtgrigorov
>> >>
>> >>
>> >> On Fri, Sep 5, 2014 at 4:30 PM, Thibault Kruse <
>> tibokr...@googlemail.com>
>> >> wrote:
>> >>
>> >>> Thanks Martin,
>> >>>
>> >>> that works for us. I missed that Variants are inherited from parents.
>> >>>
>> >>> Is there also a good way that I can assure in our unit tests that the
>> >>> variant markup for certain components exists and was found? Else a
>> >>> typo would go unnoticed in the unit tests.
>> >>>
>> >>> cheers,
>> >>>   Thibault
>> >>>
>> >>> On Wed, Sep 3, 2014 at 12:59 PM, Martin Grigorov <
>> mgrigo...@apache.org>
>> >>> wrote:
>> >>> > Hi,
>> >>> >
>> >>> > The behaviors are not used for variations.
>> >>> > For such use cases you should
>> >>> > override org.apache.wicket.Component#getVariation() on the (base)
>> page.
>> >>> > This way all components will know the correct variation.
>> >>> >
>> >>> > Martin Grigorov
>> >>> > Wicket Training and Consulting
>> >>> > https://twitter.com/mtgrigorov
>> >>> >
>> >>> >
>> >>> > On Wed, Sep 3, 2014 at 1:09 PM, Thibault Kruse <
>> tibokr...@googlemail.com
>> >>> >
>> >>> > wrote:
>> >>> >
>> >>> >> Hi,
>> >>> >>
>> >>> >> playing around with Variants for Components, I am wondering whether
>> >>> >> there is an elegant way to steer Variant markup loading via a
>> >>> >> Behavior.
>> >>> >>
>> >>> >> In our case we want to use a different markup layout based on the
>> >>> >> width of the container the component is going to be used in,
>> visually.
>> >>> >>
>> >>> >> So if we imagine a Browser window with desktop size, we might want
>> to
>> >>> >> use a component on the full width, on a third of the width, or a
>> >>> >> quarter of the width.
>> >>> >>
>> >>> >> For each such container width, we need different responsive design
>> >>> >> markup. Since this may affect many of our components which inherit
>> >>> >> from different wicket components, I'd like to just add another html
>> >>> >> markup file for the variant, and add a Behavior to the component
>> that
>> >>> >> decides the Variant.
>> >>> >>
>> >>> >> cheers,
>> >>> >>   Thibault
>> >>> >>
>> >>> >>
>> -
>> >>> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >>> >> For additional commands, e-mail: users-h...@wicket.apache.org
>> >>> >>

Re: Variant Change Behavior

2014-09-09 Thread Martin Grigorov
Please check that the solution provided with
https://issues.apache.org/jira/browse/WICKET-5694 will do the job.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Mon, Sep 8, 2014 at 10:45 AM, Thibault Kruse 
wrote:

> Hm, thinking some more, the general solution would be to fail if a
> variant is requested, and it is among a set of whitelisted variants,
> and the markup is not found. For other variants, using the default
> would probably be fine. This is more general than our current usecase,
> but still significant I believe. I trust that Wicket fails at runtime
> when the markup has an error, and I want to be able to express in
> wicket that for a given component, a set of variants is expected to
> exist, and wicket should fail if the markup is missing for any variant
> in the set.
>
> On Mon, Sep 8, 2014 at 9:41 AM, Thibault Kruse 
> wrote:
> > Both solutions are not ideal, since we do not want our tests to become
> > brittle. We want to functionally test components in multiple variants,
> > but where the variants vary in mere layout (css classes), we do not
> > want to have tests break just because the layout changes (as long as
> > the component still functions).
> >
> > Another solution for us would be to have components without variant
> > loading fallback behavior. So in general it is obviously good if a
> > component falls back to default markup, because we might have a
> > component tree where only a subset of involved components have a
> > variant markup. But for those component are supposed to have it, it
> > would be good if they fail when it is not found (e.g. due to typos).
> > However, I guess we cannot implement that logic inside getVariant(),
> > as the child components will invoke it. Is there another hook we could
> > use to fail for specific components when their variant was not found?
> >
> > On Mon, Sep 8, 2014 at 9:12 AM, Martin Grigorov 
> wrote:
> >> Hi,
> >>
> >> There is nothing specific for this.
> >> But you can use
> >> various org.apache.wicket.util.tester.WicketTester#executeTest()
> methods to
> >> check the response against a valid response pre-saved in a file.
> >> Or you can use
> org.apache.wicket.util.tester.WicketTester#assertContains()
> >> to check that a specific String (actually a Regex) is in the response.
> >>
> >> Martin Grigorov
> >> Wicket Training and Consulting
> >> https://twitter.com/mtgrigorov
> >>
> >>
> >> On Fri, Sep 5, 2014 at 4:30 PM, Thibault Kruse <
> tibokr...@googlemail.com>
> >> wrote:
> >>
> >>> Thanks Martin,
> >>>
> >>> that works for us. I missed that Variants are inherited from parents.
> >>>
> >>> Is there also a good way that I can assure in our unit tests that the
> >>> variant markup for certain components exists and was found? Else a
> >>> typo would go unnoticed in the unit tests.
> >>>
> >>> cheers,
> >>>   Thibault
> >>>
> >>> On Wed, Sep 3, 2014 at 12:59 PM, Martin Grigorov  >
> >>> wrote:
> >>> > Hi,
> >>> >
> >>> > The behaviors are not used for variations.
> >>> > For such use cases you should
> >>> > override org.apache.wicket.Component#getVariation() on the (base)
> page.
> >>> > This way all components will know the correct variation.
> >>> >
> >>> > Martin Grigorov
> >>> > Wicket Training and Consulting
> >>> > https://twitter.com/mtgrigorov
> >>> >
> >>> >
> >>> > On Wed, Sep 3, 2014 at 1:09 PM, Thibault Kruse <
> tibokr...@googlemail.com
> >>> >
> >>> > wrote:
> >>> >
> >>> >> Hi,
> >>> >>
> >>> >> playing around with Variants for Components, I am wondering whether
> >>> >> there is an elegant way to steer Variant markup loading via a
> >>> >> Behavior.
> >>> >>
> >>> >> In our case we want to use a different markup layout based on the
> >>> >> width of the container the component is going to be used in,
> visually.
> >>> >>
> >>> >> So if we imagine a Browser window with desktop size, we might want
> to
> >>> >> use a component on the full width, on a third of the width, or a
> >>> >> quarter of the width.
> >>> >>
> >>> >> For each such container width, we need different responsive design
> >>> >> markup. Since this may affect many of our components which inherit
> >>> >> from different wicket components, I'd like to just add another html
> >>> >> markup file for the variant, and add a Behavior to the component
> that
> >>> >> decides the Variant.
> >>> >>
> >>> >> cheers,
> >>> >>   Thibault
> >>> >>
> >>> >>
> -
> >>> >> 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.apa

Re: JavaSerializer - Error serializing object class

2014-09-09 Thread Martin Grigorov
Hi,

This is a well known issue with CDI+EJB. It has been discussed few times
here and other forums.
CDI injects non-Serializable objects for EJB beans.
A workaround is to use a delegate CDI bean to lookup the EJBs. I.e. instead
of @Inject-ing EJBs in Wicket components inject a scoped CDI bean that
injects the EJBs in itself.
So the usage in Wicket would be:

public class MyComponent extends ... {
  @Inject MyCDIBean cdiBean;
  ...

  cdiBean.getEjb().doSomething();
  ...
}

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 9:53 AM, Stefan Lorenz 
wrote:

> Hi,
>
> with Glassfish4 we get a lot of Exceptions when a page gets serialized.
>
> org.apache.wicket.serialize.java.JavaSerializer - Error serializing object
> class
> ..
> org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream$ObjectCheckException:
> The object type is not Serializable!
> A problem occurred while checking object with type:
> com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
> Field hierarchy is:
> ..
> ..
> private final org.jboss.weld.ejb.api.SessionObjectReference
> org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.reference
> [class=org.glassfish.weld.ejb.SessionObjectReferenceImpl]
> private
> java.lang.Object org.glassfish.weld.ejb.SessionObjectReferenceImpl.ejbRef
> [class=com.sun.proxy.$Proxy202]
>
> protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h
> [class=com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate]
> <- field that is causing the problem
>
>
> Any idea where this is coming from or what's causing this?
>
> Regards,
> Stefan
>
>


Re: [ANNOUNCE] Apache Wicket 6.17.0 released

2014-09-09 Thread Guillaume Smet
Hi,

On Tue, Sep 9, 2014 at 8:46 AM, Martin Grigorov  wrote:
> I use this URL to check:
> http://central.maven.org/maven2/org/apache/wicket/wicket-core/6.17.0/
> Most probably the index of search.maven.org is broken ...

I reported it to Sonatype:
https://getsatisfaction.com/sonatype/topics/wicket-6-17-0-in-central-but-not-on-search-maven-org
.

We use search.maven.org at artifact-listener.org so Wicket 6.17.0 is
still unannounced there too...

-- 
Guillaume

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



Re: JavaSerializer - Error serializing object class

2014-09-09 Thread Maxim Solodovnik
you can only have Serializable classes stored in the page
you can have DTO or ID stored if it is impossible

On 9 September 2014 13:53, Stefan Lorenz  wrote:

> Hi,
>
> with Glassfish4 we get a lot of Exceptions when a page gets serialized.
>
> org.apache.wicket.serialize.java.JavaSerializer - Error serializing object
> class
> ..
> org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream$ObjectCheckException:
> The object type is not Serializable!
> A problem occurred while checking object with type:
> com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
> Field hierarchy is:
> ..
> ..
> private final org.jboss.weld.ejb.api.SessionObjectReference
> org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.reference
> [class=org.glassfish.weld.ejb.SessionObjectReferenceImpl]
> private
> java.lang.Object org.glassfish.weld.ejb.SessionObjectReferenceImpl.ejbRef
> [class=com.sun.proxy.$Proxy202]
>
> protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h
> [class=com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate]
> <- field that is causing the problem
>
>
> Any idea where this is coming from or what's causing this?
>
> Regards,
> Stefan
>
>


-- 
WBR
Maxim aka solomax