Re: ListItemModel is not detaching List-model

2024-07-11 Thread Tobias Gierke



On 11.07.24 15:31, Emond Papegaaij wrote:

Op do 11 jul 2024 om 15:09 schreef Sven Meier :


the ListItemModel does not hold a reference to the model of the
ListView, so it's not its responsibility to detach it.


IMHO, the implementation of ListItemModel is strange. It does not hold a
direct reference to the model of the ListView, but it holds a reference to
the ListView instead. It also has a dependency on the model object (and
hence the model of) the ListView. I don't think models should hold
references to components, it should be the other way around. I think
ListItemModel should be reworked to take a reference to the model of the
ListView.

Rule of thumb: if you hold a reference to a model, you have to detach it.


I would say: if reading the object of model X requires reading the objects
of other models, the detach of model X should also detach those other
models.
FWIW, I second this - I also recently came across this somewhat 
surprising behavior.


Regards,
Tobias


Best regards,
Emond


--
Tobias Gierke
Software Developer

Voipfuture GmbH   Wendenstr. 4   20097 Hamburg   Germany
Phone +49 40 688 9001 64   Fax +49 40 688 9001 99
Managing Directors   Jan Bastian   Eyal Ullert
Commercial Court AG Hamburg   HRB 109896   VAT ID DE263738086



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



ComponentNotFoundException during concurrent requests to the same page ?

2021-07-22 Thread Tobias Gierke

Hi,

I'm currently investigating the root cause of a 
ComponentNotFoundException in our application (Wicket 8.12) that IMHO 
should not happen in the first place (assuming I understood Wicket page 
versioning correctly, that is).


1. The offending page displays search results using a DataTable with 
non-AJAX links on items in each of the rows plus one "page backwards" 
and one "page forwards" AJAX link outside of the DataTable to switch to 
the next/previous page of results


  

+-- data table --+
| item1    |
++
| item2    |
++
|  etc...    |
++

The crash is happening 100% of the time when doing the following:

1.) Artifically increasing the round-trip time to the server by a lot 
using NetEM (I'm on Linux), for example to a 400ms RTT:


|tc qdisc add dev lo root handle ||1||:||0| |netem delay 200msec|

2.) Clicking the "previous" or "next" AJAX link on the page
3.) Immediately afterwards clicking any of the regular links inside the 
data table rows without waiting for the AJAX request to complete


This gets me a ComponentNotFoundException

org.apache.wicket.core.request.handler.ComponentNotFoundException: 
Component 
'resultList:streamList:streamListTable:body:rows:3:cells:3:cell:link' 
has been removed from page.
at 
org.apache.wicket.core.request.handler.ListenerRequestHandler.respond(ListenerRequestHandler.java:166)
at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:907)
at 
org.apache.wicket.request.RequestHandlerExecutor.execute(RequestHandlerExecutor.java:65)
at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:293)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:254)
at 
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:276)
at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:207)


every time after the AJAX request completes and releases the page lock 
so the second HTTP request is getting processed. IMHO this should not 
happen because the link URL (from the regular link inside the data 
table) includes the page version number and in that version of the page 
object graph the Link component should still exist (we've configured the 
PageStore to keep 20 versions).


What am I missing here ? Is this somehow related to mixing AJAX and 
non-AJAX requests here ? FWIW, the DataTable is using the default 
ItemReuseStrategy.


Cheers,
Tobias





Re: Displaying a Jenkins like "Getting ready to work" message in a web page when application is starting up

2018-12-12 Thread Tobias Gierke



On 10/5/18 11:13 AM, James Selvakumar wrote:

Hi Martin,

Thank you very much for the response.
I'll check that out.

On Fri, Oct 5, 2018 at 3:02 PM Martin Grigorov  wrote:


Hi,

You are very welcome!

Since you use Spring I'd recommend you to check this article+demo app:
https://github.com/nurkiewicz/spring-startup-progress
It should give you an idea how to do it.


Since I recently implemented the same for our application, here's two 
things I remember spending quite a lot of time on that were missing from 
the article:


1.) Valve operational way too late in the startup cycle

If you want the Valve to work from the very beginning of Tomcat startup 
you need to configure "deployOnStartup" and "backgroundProcessorDelay" 
inside server.xml like so:


  backgroundProcessorDelay="1"

    unpackWARs="true" autoDeploy="true">

2.) At least with Tomcat 9.0.5, requests to unmapped endpoints will flag 
the response OutputBuffer as 'suspended' and this will silently ignore 
whatever you're writing to it so the progress page will not work



To fix this, you need to check for a suspended response and call 
setSuspended(false) like this:


    @Override
    public void invoke(Request request, Response response) throws 
IOException, ServletException

    {
    final String requestURI = request.getRequestURI();
    if ( "/progress".equals( requestURI ) )
    {

    if ( response.isSuspended() )
    {
    // Dirty hack to work around the fact that if Tomcat 
decided the request endpoint
    // doesn't exist it already prepares sending a 404 and 
this in turn

    // invokes OutputBuffer#setSuspended(true) which would
    // silently drop the bytes we're about to write to the 
output stream

    response.setSuspended( false );
    }

    // do your thing

   }
   }


Cheers,
Tobias



On Fri, Oct 5, 2018 at 5:09 AM James Selvakumar 
wrote:


Hi all,

First of all I would like to thank the community for all the help offered
in the past. Thank you very much.

My application (Wicket + Spring + Hibernate) takes around 60 to 90

seconds

to startup and all the user has to see is an empty browser tab when the
application is starting up.
I've observed Jenkins displaying a familiar "Getting ready to work"

message

when it starts up.
I've seen some Atlassian products even displaying what's happening behind
the hood during startup.
Can someone explain how to do something similar with Wicket?


--
Tobias Gierke
Software Developer

Voipfuture GmbH   Wendenstr. 4   20097 Hamburg   Germany
Phone +49 40 688 9001 64   Fax +49 40 688 9001 99   www.voipfuture.com
Managing Directors   Jan Bastian   Eyal Ullert
Commercial Court AG Hamburg   HRB 109896   VAT ID DE263738086



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



Re: Repeaters, dynamic data & detaching models

2018-08-28 Thread Tobias Gierke
I've accidently sent my follow-up mail directly to Sven, here it is (and 
his reply) for the sake of completeness, just in case someone else 
stumbles across this as well.


Cheers,
Tobias



Hi Tobias,

>As we're already using a LoadableDetachableModel for the repeater 
itself, you probably meant I should override 
ListView#getListItemModel() and return a LoadableDetachableModel 
there, right ?


+1 exactly.

Sven


Am 28.08.2018 um 09:44 schrieb Tobias Gierke:
Hi Sven,

Thanks for your reply !

Hi,

your first solution was inefficient anyways, because every click 
reloaded all Datas first, before acting on a single one only.
Inefficient in terms of database hits - yes. Inefficient in terms of 
serialization cost/memory usage - no. As the table is fairly small 
(way less than one million rows) and our application has a very low 
number of concurrent users, I'm not too concerned with database query 
performance.


You should use a detachable model instead, see JpaLoadableModel here 
https://ci.apache.org/projects/wicket/guide/8.x/single.html#_detachable_models 



As we're already using a LoadableDetachableModel for the repeater 
itself, you probably meant I should override 
ListView#getListItemModel() and return a LoadableDetachableModel 
there, right ?


Cheers,
Tobi 






Repeaters, dynamic data & detaching models

2018-08-27 Thread Tobias Gierke

Hi,

A collegue of mine just came across a rather interesting bug in our 
Wicket application.


1. We have a simple page with a repeater (ListView) that displays a 
table and on each row, some buttons to perform actions on the item shown 
on this row  (edit/delete/etc.)
2. The underlying data source (a database table) gets updated 
concurrently by another process running on another machine
3. The table is supposed to always show the latest data at the very top, 
so the page uses a LoadableDetachableModel to always hit the database on 
every request


The bug:

Users complained that performing actions on the data items would 
actually affect an item different from what they clicked.


The explanation:

Since the list model got detached at the end of the previous request, 
clicking any of the action buttons would re-populate the data model, 
fetching previously unseen rows from the database. Since (according to 
my collegue,didn't double-check) the ListView associates the item models 
only based on their list index, the action button on the very first row 
now all of a sudden referred to a database row the user didn't even know 
about.


His fix:

Instead of

view = new ListView("listView" , dataProvider )
{
   @Override
   protected void populateItem(ListItem item)
   {
   add(new AjaxButton( "delete , item.getModel() ) // use model from 
ListItem (model gets detached after request)
   {
    public void onClick(AjaxRequestTarget target) {
    delete( getModelObject() );
    }
   });
   // ... more stuff
   }
}

he changed the code to read:

view = new ListView("listView" , dataProvider )
{
   @Override
   protected void populateItem(ListItem item)
   {
   add(new AjaxButton( "delete , item.getModelObject() ) // capture model 
object when constructing the button
   {
    public void onClick(AjaxRequestTarget target) {
    delete( getModelObject() );
    }
   });
   // ... more stuff
   }
}

This obviously is a rather subtle issue and - depending on the size of 
your model objects - also comes with a certain performance/memory cost 
because of the additional serialization for the model items the repeater 
components are now holding onto.


Is this the recommended approach for dealing with dynamically changing 
data or is there a better way to do it ?


Thanks,
Tobias




Re: Curated list of Wicket Libraries and Solutions

2018-07-09 Thread Tobias Gierke

Hey Ilia,

Great work !

Maybe the list should be mentioned on the official Wicket homepage or 
even maintained there ? It's probably easier to update by just 
submitting a pull request on GitHub though...


Cheers,
Tobias


Dear, Wicket users,

Exactly as you are, I love Wicket! It's great framework and even modern JS
frameworks as AngularJS, React and so on - pretty behind Wicket from
architecture perspective.

Most of us has his/her own set of wicket libs, own wicket-ecosystem.
Lets share our experience, lets share what we are using with each other!

I started this curated list of Wicket Libs 2 years ago: https://github.com/
PhantomYdn/awesome-wicket
Please, if you don't find your beloved library: email me or create a PR.

Thanks,
Ilia

-
Orienteer(http://orienteer.org) - open source Business Application Platform



--
Tobias Gierke
Software Developer

Voipfuture GmbH   Wendenstr. 4   20097 Hamburg   Germany
Phone +49 40 688 9001 64   Fax +49 40 688 9001 99   www.voipfuture.com
Managing Directors   Jan Bastian   Eyal Ullert
Commercial Court AG Hamburg   HRB 109896   VAT ID DE263738086



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



Re: AJAX & IllegalStateException: Components can no longer be added

2018-05-25 Thread Tobias Gierke

Hi Sven,

Hi,

actually it is even more strict:

Once the ART has started generating the response - including 
preparation of components - you can now longer add other components.


This hasn't changed from 7.x to 8.x

We were discussing on lifting this restriction, but this would come 
with some difficulties: what if a component in beforeRender() adds one 
of its ancestors to be updated?

Thanks for the clarification!

Cheers,
Tobias


Have fun
Sven


Am 25.05.2018 um 10:44 schrieb Tobias Gierke:

Hi,

Can someone please explain to me what's causing this exception (see 
end of this mail) when trying to add a component to an ART ?


In 
http://apache-wicket.1842946.n4.nabble.com/Components-can-no-longer-be-added-td4662838.html 
Sven Meier said



once rendering of components via Ajax has started, you cannot update
components. 
but as can be seen from the stacktrace I'm still in the 
beforeRender() phase ... or is anything inside the beforeRender() 
code path already considered to be part of the rendering phase ?


Thanks,
Tobias



 java.lang.IllegalStateException: Components can no  longer be added
    at 
org.apache.wicket.page.PartialPageUpdate.assertNotFrozen(PartialPageUpdate.java:858) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.assertComponentsNotFrozen(PartialPageUpdate.java:851) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.add(PartialPageUpdate.java:448) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.ajax.AjaxRequestHandler.add(AjaxRequestHandler.java:263) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.ajax.AjaxRequestHandler.add(AjaxRequestHandler.java:239) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
com.vodecc.voipmng.boundary.wicket.xdrsearch.XDRListPanel$1.lambda$0(XDRListPanel.java:73) 
~[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.behaviors.AjaxTooltipManager.doOnAjaxRequest(AjaxTooltipManager.java:411) 
~[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.xdrsearch.XDRListPanel$1.queryFinished(XDRListPanel.java:73) 
~[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.streamsearch.AbstractSearchResultsDataProvider.invokeCallbacks(AbstractSearchResultsDataProvider.java:241) 
[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.streamsearch.AbstractSearchResultsDataProvider.getSearchResults(AbstractSearchResultsDataProvider.java:230) 
[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.streamsearch.AbstractSearchResultsDataProvider.getSearchResults(AbstractSearchResultsDataProvider.java:252) 
[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.xdrsearch.XDRDataTable.onConfigure(XDRDataTable.java:436) 
[classes/:?]
    at org.apache.wicket.Component.configure(Component.java:984) 
[wicket-core-8.0.0.jar:8.0.0]
    at org.apache.wicket.Component.beforeRender(Component.java:926) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.Component.onBeforeRender(Component.java:3796) 
[wicket-core-8.0.0.jar:8.0.0]
    at org.apache.wicket.Component.beforeRender(Component.java:937) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.prepareComponent(PartialPageUpdate.java:322) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.writeComponents(PartialPageUpdate.java:250) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.writeTo(PartialPageUpdate.java:162) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.ajax.AjaxRequestHandler.respond(AjaxRequestHandler.java:383) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:912) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.RequestHandlerExecutor.execute(RequestHandlerExecutor.java:65) 
[wicket-request-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:283) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:253) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:221) 
[wicket-core-8.0.0.jar:8.0.0]



-
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



AJAX & IllegalStateException: Components can no longer be added

2018-05-25 Thread Tobias Gierke

Hi,

Can someone please explain to me what's causing this exception (see end 
of this mail) when trying to add a component to an ART ?


In 
http://apache-wicket.1842946.n4.nabble.com/Components-can-no-longer-be-added-td4662838.html 
Sven Meier said



once rendering of components via Ajax has started, you cannot update
components. 
but as can be seen from the stacktrace I'm still in the beforeRender() 
phase ... or is anything inside the beforeRender() code path already 
considered to be part of the rendering phase ?


Thanks,
Tobias



 java.lang.IllegalStateException: Components can no  longer be added
    at 
org.apache.wicket.page.PartialPageUpdate.assertNotFrozen(PartialPageUpdate.java:858) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.assertComponentsNotFrozen(PartialPageUpdate.java:851) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.add(PartialPageUpdate.java:448) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.ajax.AjaxRequestHandler.add(AjaxRequestHandler.java:263) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.ajax.AjaxRequestHandler.add(AjaxRequestHandler.java:239) 
~[wicket-core-8.0.0.jar:8.0.0]
    at 
com.vodecc.voipmng.boundary.wicket.xdrsearch.XDRListPanel$1.lambda$0(XDRListPanel.java:73) 
~[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.behaviors.AjaxTooltipManager.doOnAjaxRequest(AjaxTooltipManager.java:411) 
~[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.xdrsearch.XDRListPanel$1.queryFinished(XDRListPanel.java:73) 
~[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.streamsearch.AbstractSearchResultsDataProvider.invokeCallbacks(AbstractSearchResultsDataProvider.java:241) 
[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.streamsearch.AbstractSearchResultsDataProvider.getSearchResults(AbstractSearchResultsDataProvider.java:230) 
[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.streamsearch.AbstractSearchResultsDataProvider.getSearchResults(AbstractSearchResultsDataProvider.java:252) 
[classes/:?]
    at 
com.vodecc.voipmng.boundary.wicket.xdrsearch.XDRDataTable.onConfigure(XDRDataTable.java:436) 
[classes/:?]
    at org.apache.wicket.Component.configure(Component.java:984) 
[wicket-core-8.0.0.jar:8.0.0]
    at org.apache.wicket.Component.beforeRender(Component.java:926) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753) 
[wicket-core-8.0.0.jar:8.0.0]
    at org.apache.wicket.Component.onBeforeRender(Component.java:3796) 
[wicket-core-8.0.0.jar:8.0.0]
    at org.apache.wicket.Component.beforeRender(Component.java:937) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.prepareComponent(PartialPageUpdate.java:322) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.writeComponents(PartialPageUpdate.java:250) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.page.PartialPageUpdate.writeTo(PartialPageUpdate.java:162) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.ajax.AjaxRequestHandler.respond(AjaxRequestHandler.java:383) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:912) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.RequestHandlerExecutor.execute(RequestHandlerExecutor.java:65) 
[wicket-request-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:283) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:253) 
[wicket-core-8.0.0.jar:8.0.0]
    at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:221) 
[wicket-core-8.0.0.jar:8.0.0]



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



Re: Wicket 8 migration / header contributions question

2018-05-25 Thread Tobias Gierke

Hi,

Hi,

this should be caused by WICKET-6498. This issue has changed the 
behavior for HeaderResponseDecorator. You can find how to adapt your 
code in the migration guide or in the release note of Milestone 9:


Btw, could you maybe enhance the migration guide to include a warning 
about JS event names like "onclick","onblur" etc. no longer working ?


I know that Wicket 7.x used to printed lots of warnings about this but 
somehow we (and probably others as well) were too lazy to fix them when 
upgrading to 7.x and now the warnings are gone but AJAX behaviors using 
the old event names stopped working completely.


Thanks,
Tobias


https://wicket.apache.org/news/2018/02/17/wicket-8.0.0-M9-released.html




On 23/05/2018 17:55, Tobias Gierke wrote:

Hi,

I'm in the process of migrating our application from Wicket 7.10 to 
Wicket 8 and encountered some weirdness with regards to header 
contributions.


Our application has a top-level WebPage that defines a 
HeaderResponseContainerat the very end of the page markup and all 
other application pages inherit from it. We have a few header items 
that need to be rendered in their own section at the bottom of the 
page so I basically took the approach outlined in 
http://tomaszdziurko.com/2017/02/forcing-wicket-place-javascript-files-bottom/ 
and adopted it to our needs.


Our Application#init() method does this:

---final IHeaderResponseDecorator 
headerResponseDecorator =new IHeaderResponseDecorator()

   {
  @Override public IHeaderResponse decorate(IHeaderResponse 
response)

  {
 return new FilteringHeaderResponse(response);
  }
   };
   setHeaderResponseDecorator(headerResponseDecorator);
---

And from inside Behavior#renderHead() we're doing

---final OnDomReadyHeaderItem toWrap 
= OnDomReadyHeaderItem.forScript(script);

response.render(new FilteredHeaderItem(toWrap, "our-bucket" );
---

This was working fine in Wicket 7.10 but with Wicket 8 the Wicket 
defeault Javascript files (wicket-event-jquery,wicket-ajax-jquery 
etc.) are no longer being included in the page so AJAX buttons etc. 
fail with "TypeError: Wicket.Event is undefined" etc.


Wrapping the FilteringHeaderResponse inside a ResourceAggregator 
like|| shown in the migration guide had no effect.



Thanks,
Tobias





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



--
Tobias Gierke
Software Developer

Voipfuture GmbH   Wendenstr. 4   20097 Hamburg   Germany
Phone +49 40 688 9001 64   Fax +49 40 688 9001 99   www.voipfuture.com
Managing Directors   Jan Bastian   Eyal Ullert
Commercial Court AG Hamburg   HRB 109896   VAT ID DE263738086



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



Re: Wicket 8 migration / header contributions question

2018-05-25 Thread Tobias Gierke

Hi,

Hi Thomas,

that should work.

Could you please compare your setup with the one in 
https://github.com/apache/wicket/tree/master/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration
My code is identical except I'm using FilteringHeaderResponse with a 
custom "bucket" name instead of JavaScriptFilteredIntoFooterHeaderResponse.


Anyway, for the time being I solved my issue by fixing my HeaderItem 
dependencies and just deleting my custom header decoration stuff (as it 
turned out I was basically abusing this feature to work around my broken 
HeaderItem dependencies :-)


I still feel that the WICKET-6498 change somehow interacts with 
FilteringHeaderResponse in a not-too-obvious way (our code used to work 
in 7.10 but fails in 8.0.0).


Cheers,
Tobi


Thanks
Sven

Am 24. Mai 2018 08:43:47 MESZ schrieb Tobias Gierke 
:

Hi,

Hi,

this should be caused by WICKET-6498. This issue has changed the
behavior for HeaderResponseDecorator. You can find how to adapt your
code in the migration guide or in the release note of Milestone 9:



https://wicket.apache.org/news/2018/02/17/wicket-8.0.0-M9-released.html

Thanks for the quick response! I already tried this and it didn't have
any effect :/

My Application#init() method is doing:

setHeaderResponseDecorator( response ->new ResourceAggregator(new
FilteringHeaderResponse(response) ) );



Cheers,
Tobias


--
Tobias Gierke
Software Developer

Voipfuture GmbH   Wendenstr. 4   20097 Hamburg   Germany
Phone +49 40 688 9001 64   Fax +49 40 688 9001 99   www.voipfuture.com
Managing Directors   Jan Bastian   Eyal Ullert
Commercial Court AG Hamburg   HRB 109896   VAT ID DE263738086



Re: Wicket 8 migration / header contributions question

2018-05-23 Thread Tobias Gierke

Hi,

Hi,

this should be caused by WICKET-6498. This issue has changed the 
behavior for HeaderResponseDecorator. You can find how to adapt your 
code in the migration guide or in the release note of Milestone 9:


https://wicket.apache.org/news/2018/02/17/wicket-8.0.0-M9-released.html


Thanks for the quick response! I already tried this and it didn't have 
any effect :/


My Application#init() method is doing:

setHeaderResponseDecorator( response ->new ResourceAggregator(new 
FilteringHeaderResponse(response) ) );



Cheers,
Tobias






Wicket 8 migration / header contributions question

2018-05-23 Thread Tobias Gierke

Hi,

I'm in the process of migrating our application from Wicket 7.10 to 
Wicket 8 and encountered some weirdness with regards to header 
contributions.


Our application has a top-level WebPage that defines a 
HeaderResponseContainerat the very end of the page markup and all other 
application pages inherit from it. We have a few header items that need 
to be rendered in their own section at the bottom of the page so I 
basically took the approach outlined in 
http://tomaszdziurko.com/2017/02/forcing-wicket-place-javascript-files-bottom/ 
and adopted it to our needs.


Our Application#init() method does this:

---final IHeaderResponseDecorator 
headerResponseDecorator =new IHeaderResponseDecorator()
   {
  @Override public IHeaderResponse decorate(IHeaderResponse response)
  {
 return new FilteringHeaderResponse(response);
  }
   };
   setHeaderResponseDecorator(headerResponseDecorator);
---

And from inside Behavior#renderHead() we're doing

---final OnDomReadyHeaderItem toWrap = 
OnDomReadyHeaderItem.forScript(script);
response.render(new FilteredHeaderItem(toWrap, "our-bucket" );
---

This was working fine in Wicket 7.10 but with Wicket 8 the Wicket 
defeault Javascript files (wicket-event-jquery,wicket-ajax-jquery etc.) 
are no longer being included in the page so AJAX buttons etc. fail with 
"TypeError: Wicket.Event is undefined" etc.


Wrapping the FilteringHeaderResponse inside a ResourceAggregator like|| 
shown in the migration guide had no effect.



Thanks,
Tobias



Yes :-) [ Re: Any usable IntelliJ plugin ?]

2018-04-11 Thread Tobias Gierke

Hey Lukas,

Hi Tobias,

WicketForge 5.0.2 works for me with IntelliJ 2018.1.
Make sure that you configure your wicket resources in „Project Structure >
Facets“.

This was the step I missed!

Thanks a lot,
Tobias



Regards

Lukas

On Wed, Apr 11, 2018 at 3:07 PM Tobias Gierke <
tobias.gie...@code-sourcery.de> wrote:


Hi,

I'm in the process of migrating from Eclipse to IntelliJ and just found
out that the IntelliJ WicketForge plugin is not working for the current
release of IntelliJ (Ultimate 2018.1). I really miss the QWickie plugin
I was using in Eclipse. Does anyone know of a good way to get at least
HTML -> Java code navigation using the wicket:id attributes working ? Or
do I really have to use full-text search again?

Thanks,
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



Any usable IntelliJ plugin ?

2018-04-11 Thread Tobias Gierke

Hi,

I'm in the process of migrating from Eclipse to IntelliJ and just found 
out that the IntelliJ WicketForge plugin is not working for the current 
release of IntelliJ (Ultimate 2018.1). I really miss the QWickie plugin 
I was using in Eclipse. Does anyone know of a good way to get at least 
HTML -> Java code navigation using the wicket:id attributes working ? Or 
do I really have to use full-text search again?


Thanks,
Tobias


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



Re: The day Wicket became Apache Wicket 10 years ago!

2017-06-20 Thread Tobias Gierke
Thank you all for the great work you're doing and the quick replies to 
user questions :-)


To the next 10 years !


Today marks the date 10 years ago that the Wicket project graduated from
the Incubator to a fully fledged Apache project.

The time flies when you're having fun!

I would like to thank all our community members for their continued support
and usage of Apache Wicket and pour one out for you!

Here's a big Thank You for everyone reading this message, asking and
answering questions, using Wicket in their projects and a special :beer:
for all contributors to Wicket, past and present! Here's to another 10
years!

Martijn Dashorst




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



Re: Weird ListView behaviour on AJAX updates

2017-06-13 Thread Tobias Gierke

Hi Sven,

Thanks for clearing this up !

Cheers,
Tobias


Hi Tobias,

this is a well-known idiosyncrasy of a combination of ListView and 
LoadableDetachableModel:


Your delete button accesses the list item's model, thus loading the 
underlying list. Upon rendering the *old* list is rendered. When the 
next request comes in, the underlying list represents the actual 
contents after deleting an item.


Calling #detach() is ok, using an 'EntityModel' is an alternative - 
see ListView#getListItemModel() javadoc.


Have fun
Sven


Am 13.06.2017 um 13:35 schrieb Tobias Gierke:

Hi,

While trying to debug an AIOOBE that happens when a user opened the 
same page in multiple tabs (the page renders a repeater where users 
can remove items by clicking a button), I came across some 
interesting behaviour.


I created a tiny example project to show it: 
https://github.com/toby1984/wicket-ajaxtest


Observations:

1.) When you click on the very first button you notice that the AJAX 
response contains exactly the same same markup that is already 
present (so the page doesn't change)
2.) When you continue clicking on the buttons you will get an AIOOBE 
(caused by ListItemModel.java:61) while trying to delete the last item


These issues go away when I explicitly call detach() on the 
repeater's model after removing an item from the underlying list like 
so:


->8-->8-->8-->8-->8-->8-->8- 

final AjaxButton delete = new 
AjaxButton("deleteButton",item.getModel())

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

{
final String obj = getModelObject();
db.remove( obj );
listModel.detach();
target.add( container );
}
};
->8-->8-->8-->8-->8-->8-->8- 



Is there a way to have this working properly without having to 
manually detach() after mutating the repeater model's list or is this 
the recommended approach ?


Thanks,
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



Weird ListView behaviour on AJAX updates

2017-06-13 Thread Tobias Gierke

Hi,

While trying to debug an AIOOBE that happens when a user opened the same 
page in multiple tabs (the page renders a repeater where users can 
remove items by clicking a button), I came across some interesting 
behaviour.


I created a tiny example project to show it: 
https://github.com/toby1984/wicket-ajaxtest


Observations:

1.) When you click on the very first button you notice that the AJAX 
response contains exactly the same same markup that is already present 
(so the page doesn't change)
2.) When you continue clicking on the buttons you will get an AIOOBE 
(caused by ListItemModel.java:61) while trying to delete the last item


These issues go away when I explicitly call detach() on the repeater's 
model after removing an item from the underlying list like so:


->8-->8-->8-->8-->8-->8-->8-
final AjaxButton delete = new 
AjaxButton("deleteButton",item.getModel())

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

{
final String obj = getModelObject();
db.remove( obj );
listModel.detach();
target.add( container );
}
};
->8-->8-->8-->8-->8-->8-->8-

Is there a way to have this working properly without having to manually 
detach() after mutating the repeater model's list or is this the 
recommended approach ?


Thanks,
Tobias




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



Re: Difficulty with related, mutually updating fields

2015-12-03 Thread Tobias Gierke

Hi,

Hello,

I have a form with the following fields : start date, duration (in days) &
end date. I want the user to be able to enter EITHER a duration OR an end
date and the other field will be automatically calculated according to this
and the start date. Each field has an associated feedback label. However,
simple as this seems, I’m having trouble pulling it off. Here’s what I’m
going for in terms of behaviour:

+ If the start date is missing, the others are blanked and disabled.

+ Changing either field results in an ajax update of both and the other
field is calculated.

+ When the form is submitted, the “calculated” field must be null (even
though it displays the calculated value). The underlying domain object
should have either a duration or an end date but not both.
Just curious... why does your domain object need to have both end date 
and duration (either of which can be derived from the other assuming the 
start date is set) ? IMHO this makes things more complicated/error prone 
than necessary (since you have to make sure duration & end date fields 
stay in sync while deriving one from the other would take care of this 
automagically).


Cheers,
Tobias



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



Re: Wicket 6: Generic solution for generating "nicer-looking" URLs ?

2015-09-08 Thread Tobias Gierke

Hi Martin,

Hi,

Yes.
Although "?x.y-ILinkListener" is the url for a Link, if you rework it
you may break your application.
The parameter says: click the link in page with id X and render count Y, at
component path Z.
What less frightening scheme for encoding this you have in mind?
Nothing in particular, maybe something shorter (like a hash value). But 
doing such a mapping obviously comes with its own set of problems 
(memory requirements, performance impact of having to do the mapping on 
each request etc.)...


One of my colleague raised the URL "beautification" issue since a quick 
google search didn't turn up many useful results (apart from explicitly 
mounting pages to certain URLs) so I thought maybe there's a more 
generic (less manual) way to achieve this.


Thanks,
Tobias


This url should be visible only in the HTML sources. Usually the address
bar should have only "?x", where "x" is the page id.
Usually only developers look in the HTML source. Users do not do this.

On Mon, Sep 7, 2015 at 12:54 PM, Tobias Gierke 
wrote:
Hi,

Is there a generic way to rewrite Wicket-generated URLs to something less
frightening than "?x.y-ILinkListener" ? Looks like one would need to
implement their own IRequestMapper for this, right ?

Thanks,
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



Wicket 6: Generic solution for generating "nicer-looking" URLs ?

2015-09-07 Thread Tobias Gierke

Hi,

Is there a generic way to rewrite Wicket-generated URLs to something 
less frightening than "?x.y-ILinkListener" ? Looks like one would 
need to implement their own IRequestMapper for this, right ?


Thanks,
Tobias


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



Re: Wicket 6 + string resource caching

2015-06-19 Thread Tobias Gierke

Thanks Martin & Sven, works like a charm :)

Cheers,
Tobias


Also see Localizer#clearCache() [1]
When changing the theme use getApplication().getLocalizer().clearCache()

1.
https://github.com/apache/wicket/blob/edcbd4e849378a5aba9ee2d5e4f954bce904af52/wicket-core/src/main/java/org/apache/wicket/Localizer.java#L90

Martin Grigorov
Freelancer. Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Jun 18, 2015 at 9:14 PM, Sven Meier  wrote:


Hi,

Wicket includes the session's style when generating the cache key*. Why
don't you use this to identify your current 'theme'? Then theme-specific
string resources should work out-of-the-box.

Have fun
Sven

*See Localizer#getCacheKey()



On 18.06.2015 16:39, Tobias Gierke wrote:


Hi,

I'm working on a 'themeable' (does this word exist ?) application were
some string resources differ based on the currently active user's theme.
Since (at least during development) each user can freely switch between
different themes, I need Wicket to not cache these string resources.

I implemented a custom IStringResourceLoader to locate the .properties
file associated with the current user's UI theme but it seems Wicket is
caching the String property values and only calls my IStringResourceLoader
once for every String property.

How can I disable this caching for my IStringResourceLoader ? I suspect
Wicket thinks of .properties files as static resources so maybe I'm
stretching the design a bit ;)

Cheers,
Tobias


Currently my WicketApplication class looks like this:

--->8-->8-->8-->8-->8-->8---
 getResourceSettings().getStringResourceLoaders().add( new
UIThemeStringResourceLoader() );
--->8-->8-->8-->8-->8-->8---

...and the the IStringResourceLoader looks like this

--->8-->8-->8-->8-->8-->8---
 protected final class UIThemeStringResourceLoader implements
IStringResourceLoader
 {
 // cache to avoid reloading properties over and over when not in
debug mode
 private final Map properties = new
HashMap<>(); // Key is UI theme name, value is properties file

 @Override
 public String loadStringResource(Class clazz, String key,
Locale locale, String style, String variation)
 {
 return loadStringResource( (Component) null , key  , locale
,style , variation );
 }

 @Override
 public String loadStringResource(Component component, String key,
Locale locale, String style, String variation)
 {
 synchronized( properties )
 {
 CacheEntry props = properties.get( getUITheme().getName()
);
 if ( props == null || ( isDebugModeEnabled() &&
props.isOlderThan( java.time.Duration.ofSeconds( 2 ) ) ) ) // discard stale
properties when running in debug mode
 {
 final UserSession session = (UserSession)
Session.get();
 final Locale locale = session.isUserLoggedIn() ?
session.getCurrentUser().getLocale() :
applicationSettings.getDefaultLocale();
 final String path =
getUITheme().getStringPropertiesPath( locale );

 try ( final InputStream stream =
getServletContext().getResourceAsStream( path ) )
 {
 if ( stream == null ) {
 return null;
 }

 final Properties tmp = new Properties();
 tmp.load( stream );

 props = new CacheEntry( tmp );
 properties.put( getUITheme().getName() , props );
 }
 catch (IOException e) {
 LOG.warn("getString(): Failed to load string
properties for UI theme '"+getUITheme().getName()+"' from '"+path+"'",e);
 }
 }
 return props.properties.getProperty( key );
 }
 }
 }



-
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



Wicket 6 + string resource caching

2015-06-18 Thread Tobias Gierke

Hi,

I'm working on a 'themeable' (does this word exist ?) application were 
some string resources differ based on the currently active user's theme. 
Since (at least during development) each user can freely switch between 
different themes, I need Wicket to not cache these string resources.


I implemented a custom IStringResourceLoader to locate the .properties 
file associated with the current user's UI theme but it seems Wicket is 
caching the String property values and only calls my 
IStringResourceLoader once for every String property.


How can I disable this caching for my IStringResourceLoader ? I suspect 
Wicket thinks of .properties files as static resources so maybe I'm 
stretching the design a bit ;)


Cheers,
Tobias


Currently my WicketApplication class looks like this:

--->8-->8-->8-->8-->8-->8---
getResourceSettings().getStringResourceLoaders().add( new 
UIThemeStringResourceLoader() );

--->8-->8-->8-->8-->8-->8---

...and the the IStringResourceLoader looks like this

--->8-->8-->8-->8-->8-->8---
protected final class UIThemeStringResourceLoader implements 
IStringResourceLoader

{
// cache to avoid reloading properties over and over when not 
in debug mode
private final Map properties = new 
HashMap<>(); // Key is UI theme name, value is properties file


@Override
public String loadStringResource(Class clazz, String key, 
Locale locale, String style, String variation)

{
return loadStringResource( (Component) null , key  , locale 
,style , variation );

}

@Override
public String loadStringResource(Component component, String 
key, Locale locale, String style, String variation)

{
synchronized( properties )
{
CacheEntry props = properties.get( 
getUITheme().getName() );
if ( props == null || ( isDebugModeEnabled() && 
props.isOlderThan( java.time.Duration.ofSeconds( 2 ) ) ) ) // discard 
stale properties when running in debug mode

{
final UserSession session = (UserSession) 
Session.get();
final Locale locale = session.isUserLoggedIn() ? 
session.getCurrentUser().getLocale() : 
applicationSettings.getDefaultLocale();
final String path = 
getUITheme().getStringPropertiesPath( locale );


try ( final InputStream stream = 
getServletContext().getResourceAsStream( path ) )

{
if ( stream == null ) {
return null;
}

final Properties tmp = new Properties();
tmp.load( stream );

props = new CacheEntry( tmp );
properties.put( getUITheme().getName() , props );
}
catch (IOException e) {
LOG.warn("getString(): Failed to load string 
properties for UI theme '"+getUITheme().getName()+"' from '"+path+"'",e);

}
}
return props.properties.getProperty( key );
}
}
}

--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 164 Fax +49 40 688 900 199
Email tobias.gie...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



Re: Possible to add a new component to a page using IComponentResolver ?

2015-05-10 Thread Tobias Gierke

On 09.05.2015 15:21, Andrea Del Bene wrote:
You are right. I'm afraid you can not do what you want in Wicket 6 
because up to this version autocomponents (i.e those who are added 
during markup parsing) are removed after rendering phase. That's why 
your link doesn't find its component. With Wicket 7 autocomponents are 
no more removed and your code works fine. Here I've created a 
quickstart with your code for Wicket 7:


Ok, that's what I already suspected... guess I'll wait for the Wicket 7 
release then :)


Thanks,
Tobias



https://www.dropbox.com/s/2pua1utz5r35nde/TagWithLink.zip?dl=0

Hi Andrea,

Hi,

A nice example of a custom IComponentResolver can be found in 
WicketStuff with module JEE-Web-Integration: 
https://github.com/wicketstuff/core/wiki/JEE-Web-Integration. The 
code is here: 
https://github.com/wicketstuff/core/tree/master/jdk-1.7-parent/jee-web-parent/jee-web. 
Look at class JEEWebResolver to learn more about component 
resolvers. A chapter on this topic is in my TODO list :).


Thanks for your reply but looking at the JEEWebResolver it seems that 
you're just writing out some markup but not trying to register a link 
/ ILinkListener like I'm trying to do. Or did I miss something ?


Cheers,
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: Possible to add a new component to a page using IComponentResolver ?

2015-05-08 Thread Tobias Gierke

Hi Andrea,

Hi,

A nice example of a custom IComponentResolver can be found in 
WicketStuff with module JEE-Web-Integration: 
https://github.com/wicketstuff/core/wiki/JEE-Web-Integration. The code 
is here: 
https://github.com/wicketstuff/core/tree/master/jdk-1.7-parent/jee-web-parent/jee-web. 
Look at class JEEWebResolver to learn more about component resolvers. 
A chapter on this topic is in my TODO list :).


Thanks for your reply but looking at the JEEWebResolver it seems that 
you're just writing out some markup but not trying to register a link / 
ILinkListener like I'm trying to do. Or did I miss something ?


Cheers,
Tobias




On 08/05/2015 10:41, Tobias Gierke wrote:

Hi,

I'm trying to use IComponentResolver to implement a custom tag that 
will render a panel with a link that when clicked will display some 
help text. I want to use a custom tag for this because I need to be 
able to programmatically validate up-front (during the build process) 
that there are no missing help texts (=unknown help text IDs) in the 
code base. Parsing XHTML to do so is obviously way easier than 
parsing the application's java sources so that's why I opted for the 
IComponentResolver approach.


My component resolver:

--->8-->8-->8-->8-->8-->8-->8---
@Override
public Component resolve(MarkupContainer container, MarkupStream 
markupStream, ComponentTag tag)

{
if ( markupStream.getWicketNamespace().equalsIgnoreCase( 
tag.getNamespace() ) && TAG_NAME.equalsIgnoreCase( tag.getName() ) )

{
final String tagValue = tag.getAttribute("helpTextId");
return new HelpTextTag( 
"helpText."+container.getPage().getAutoIndex() , new HelpTextId( 
tagValue.trim() )  );

}
return null;
}
--->8-->8-->8-->8-->8-->8-->8---


HelpTextTag is a very simple panel:

--->8-->8-->8-->8-->8-->8---

http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org/";>

  


   width="16" height="16" />Help



  


--->8-->8-->8-->8-->8-->8---
public class HelpTextTag extends Panel
{
private final HelpTextId helpTextId;

public HelpTextTag(String id,HelpTextId helpTextId)
{
super(id);
this.helpTextId = helpTextId;
}

@Override
protected void onInitialize()
{
super.onInitialize();
final Link l = new Link("helpTextLink")
{
@Override
public void onClick() { setResponsePage( new 
HelpPage(helpTextId) ); }

};
l.add( new Image("helpTextImg" , new 
PackageResourceReference("img/help.png") ) );

add(l);
}
}
--->8-->8-->8-->8-->8-->8-->8---

Most likely due to my lack of understanding how IComponentResolver 
really fits into the grand scheme of things :) , trying to click the 
link always fails with a "Could not find component ... on page" 
Exception ... which kind of makes sense since the HelpTextTag is not 
add()ed to the component hierarchy (at least not by me).


Here's the markup generated by Wicket:

--->8-->8-->8-->8-->8-->8-->8---

  wicketsource="com.voipfuture.voipmng.onlinehelp:HelpTextTagResolver.java:36" 
helptextid="test.page">

  
 wicketsource="com.voipfuture.voipmng.onlinehelp:HelpTextTag.java:23" 
href="../page?2-1.ILinkListener-_wicket_child11-_wicket_extend12-_wicket_child67-_wicket_extend68-helpText.69-helpTextLink" 
wicket:id="helpTextLink">
   wicketsource="com.voipfuture.voipmng.onlinehelp:HelpTextTag.java:31" 
src="../resource/org.apache.wicket.Application/img/help-ver-1375187674000.png" 
wicket:id="helpTextImg">

 
 Help
  
  
  wicketsource="com.vodecc.voipmng.boundary.wicket.onlinehelp:HelpTextsOverviewPage.java:20" 
href="../page?2-1.ILinkListener-someOtherLink" 
wicket:id="someOtherLink">Some link

  
--->8-->8-->8-->8-->8-->8-->8---

Is it even possible to add a new Panel/component without it already 
being present in the component hierarchy ? I looked at the 
IComponentResolver implementations that ship with Wicket and they 
either just generate/rewrite existing markup or replace a component 
that has already been added to the page.


Thanks,
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



Possible to add a new component to a page using IComponentResolver ?

2015-05-08 Thread Tobias Gierke

Hi,

I'm trying to use IComponentResolver to implement a custom tag that will 
render a panel with a link that when clicked will display some help 
text. I want to use a custom tag for this because I need to be able to 
programmatically validate up-front (during the build process) that there 
are no missing help texts (=unknown help text IDs) in the code base. 
Parsing XHTML to do so is obviously way easier than parsing the 
application's java sources so that's why I opted for the 
IComponentResolver approach.


My component resolver:

--->8-->8-->8-->8-->8-->8-->8---
@Override
public Component resolve(MarkupContainer container, MarkupStream 
markupStream, ComponentTag tag)

{
if ( markupStream.getWicketNamespace().equalsIgnoreCase( 
tag.getNamespace() ) && TAG_NAME.equalsIgnoreCase( tag.getName() ) )

{
final String tagValue = tag.getAttribute("helpTextId");
return new HelpTextTag( 
"helpText."+container.getPage().getAutoIndex() , new HelpTextId( 
tagValue.trim() )  );

}
return null;
}
--->8-->8-->8-->8-->8-->8-->8---


HelpTextTag is a very simple panel:

--->8-->8-->8-->8-->8-->8---

http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org/";>

  


   width="16" height="16" />Help



  


--->8-->8-->8-->8-->8-->8---
public class HelpTextTag extends Panel
{
private final HelpTextId helpTextId;

public HelpTextTag(String id,HelpTextId helpTextId)
{
super(id);
this.helpTextId = helpTextId;
}

@Override
protected void onInitialize()
{
super.onInitialize();
final Link l = new Link("helpTextLink")
{
@Override
public void onClick() { setResponsePage( new 
HelpPage(helpTextId) ); }

};
l.add( new Image("helpTextImg" , new 
PackageResourceReference("img/help.png") ) );

add(l);
}
}
--->8-->8-->8-->8-->8-->8-->8---

Most likely due to my lack of understanding how IComponentResolver 
really fits into the grand scheme of things :) , trying to click the 
link always fails with a "Could not find component ... on page" 
Exception ... which kind of makes sense since the HelpTextTag is not 
add()ed to the component hierarchy (at least not by me).


Here's the markup generated by Wicket:

--->8-->8-->8-->8-->8-->8-->8---

  wicketsource="com.voipfuture.voipmng.onlinehelp:HelpTextTagResolver.java:36" 
helptextid="test.page">

  
 wicketsource="com.voipfuture.voipmng.onlinehelp:HelpTextTag.java:23" 
href="../page?2-1.ILinkListener-_wicket_child11-_wicket_extend12-_wicket_child67-_wicket_extend68-helpText.69-helpTextLink" 
wicket:id="helpTextLink">
   wicketsource="com.voipfuture.voipmng.onlinehelp:HelpTextTag.java:31" 
src="../resource/org.apache.wicket.Application/img/help-ver-1375187674000.png" 
wicket:id="helpTextImg">

 
 Help
  
  
  wicketsource="com.vodecc.voipmng.boundary.wicket.onlinehelp:HelpTextsOverviewPage.java:20" 
href="../page?2-1.ILinkListener-someOtherLink" 
wicket:id="someOtherLink">Some link

  
--->8-->8-->8-->8-->8-->8-->8---

Is it even possible to add a new Panel/component without it already 
being present in the component hierarchy ? I looked at the 
IComponentResolver implementations that ship with Wicket and they either 
just generate/rewrite existing markup or replace a component that has 
already been added to the page.


Thanks,
Tobias


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



Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

2014-10-14 Thread Tobias Gierke

Hi,

I've just come to the same conclusion. And I don't really like the fact 
that every component that needs to be rendered in a 'fail-safe' way also 
has to override onRender() with an empty implementation. To me this 
'fail-safe rendering' looks more like a cross-cutting concern that 
wicket-core should provide a hook for (maybe exposed through a new 
method in IRequestCycleListener).


Cheers,
Tobias


Hi,

isVisible() is called at many places in Wicket.
It is not easy to try/catch it.

I've updated (locally) the demo app and with 6.x it breaks with:

java.lang.RuntimeException: Problem in #isVisible
at com.mycompany.HomePage$2.isVisible(HomePage.java:35)
at org.apache.wicket.Component.determineVisibility(Component.java:4340)
at org.apache.wicket.Component.isVisibleInHierarchy(Component.java:2131)
at org.apache.wicket.Component.isStateless(Component.java:2048)
at org.apache.wicket.Page$2.component(Page.java:479)
at org.apache.wicket.Page$2.component(Page.java:475)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:144)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:123)
at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:860)
at org.apache.wicket.Page.isPageStateless(Page.java:473)
at
org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.getPageInfo(AbstractBookmarkableMapper.java:465)
at
org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.mapHandler(AbstractBookmarkableMapper.java:409)
at
org.apache.wicket.core.request.mapper.MountedMapper.mapHandler(MountedMapper.java:395)
at
org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:215)
at
org.apache.wicket.request.cycle.RequestCycle.mapUrlFor(RequestCycle.java:429)
at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:281)

This is even before starting rendering the page itself.

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

On Tue, Oct 14, 2014 at 2:50 PM, Tobias Gierke 
wrote:
Sorry for the noise, I should've read your e-mail more thorougly :(

"But as you can see the default rendering of a component should be
suppressed (PortletLike#onRender() {}) so it is not enough just to have the
behavior. "

I'll fix my implementation and try again.

Cheers,
Tobias



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





--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 164 Fax +49 40 688 900 199
Email tobias.gie...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

2014-10-14 Thread Tobias Gierke

Sorry for the noise, I should've read your e-mail more thorougly :(

"But as you can see the default rendering of a component should be 
suppressed (PortletLike#onRender() {}) so it is not enough just to have 
the behavior. "


I'll fix my implementation and try again.

Cheers,
Tobias


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



Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

2014-10-14 Thread Tobias Gierke
/twitter.com/mtgrigorov

On Tue, Oct 14, 2014 at 1:10 PM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:


Thanks! Whose PortletLike on



https://github.com/martin-g/component-rendering-default/blob/master/src/main/java/com/mycompany/HomePage.java

?
PanelA?

On Tue, Oct 14, 2014 at 9:03 AM, Martin Grigorov 
Hi,

Here is a demo app with Wicket 6.x:
https://github.com/martin-g/component-rendering-default

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

On Mon, Oct 13, 2014 at 6:13 PM, Martin Grigorov <

mgrigo...@apache.org

wrote:


Here is a possible solution *now*:

portletLike.add(new AbstractTransformerBehavior() {
   @Override public CharSequence transform(Component c, CharSequence
output) {
  try {
c.internalRenderComponent();
  } catch (Exception x) {
return "default result";
  }
}
});

Something like this should do it.

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

On Mon, Oct 13, 2014 at 5:39 PM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:


I see... you may have already streamed content --> Maybe same

interface

serves to mark a component as "do not stream anything till the

end",

or

stream the contents to an intermediate buffer... but what I way

above

might
not make sense as well.


On Mon, Oct 13, 2014 at 4:33 PM, Martin Grigorov <

mgrigo...@apache.org>

wrote:


On Mon, Oct 13, 2014 at 5:09 PM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:


@Martin,

Just a (maybe stupid) idea:

1- Mark some component as ISafeFail
2- If rendering fails take Component_onfail.html and render it


As I said earlier this is not so trivial.
The failure may happen in the middle of the rendering and the

content

collected so far in RequestCycle#getResponse() could be invalid

HTML.

Appending anything (loaded from a file or generated on the fly)

is

not

really a solution.



On Mon, Oct 13, 2014 at 4:02 PM, Martin Grigorov <

mgrigo...@apache.org>

wrote:


https://issues.apache.org/jira/browse/WICKET-4321
this is the ticker I meant
it suggests to restart the rendering completely for the

whole

page

and

this

is not enough
I'll see what kind of changes would be needed to accomplish

this.

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

On Fri, Oct 10, 2014 at 2:29 PM, Martin Grigorov <

mgrigo...@apache.org

wrote:


Hi,

There is no support for this, even in 7.x.
I remember Carl-Eric Menzel asking for the same

functionality

before

...

Behavior#onException() sounds like something similar but

there

is

no

way

to suppress the bubbling of the exception at the moment.
The bigger problem is that the rendering can fail in the

middle,

i.e.

the

component can have written some response already and then

fail.

If

the

written response is proper HTML then it is OKish. But if

some

tag

is

not

closed then the rendering of the complete page may fail.
So if we try to add this functionality we will have to use

temporary

Response objects for the rendering of each component to be

able

to

throw

away whatever it has produced before failing.

Usually the problem is related to the component's model. A

workaround

for

you could be to use a wrapper Model that returns "empty

data"

when

the

underlying model throws an exception.

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

On Fri, Oct 10, 2014 at 12:59 PM, Ernesto Reinaldo

Barreiro

<

reier...@gmail.com> wrote:


Hi,

On Fri, Oct 10, 2014 at 11:50 AM, Tobias Gierke <
tobias.gie...@voipfuture.com> wrote:


Hi,


Wouldn't it be possible to "embed"  the failing prone

porlets

inside

iframes so that each one is a Wicket page?


I already thought about this but the page uses quite a

lot

of

fancy

CSS/Ajax/Javascript (portlets are rendered in a grid

with

configurable

row/column count, drag'n'drop to move them around etc.)

and

I'd

rather

not

touch the existing code if there's a Java-side only

solution

;-)

I do not know of any :-(

Another possibility is build each client entirely on

JavaScript

and

use

Wicket just as a service layer... not very Wicket like

but

you

would

not

have this problem.



Cheers,
Tobias



On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
tobias.gie...@voipfuture.com> wrote:

  Hi,

In our web application we have a dashboard-like

homepage

that

displays a

number of user-configurable 'portlets' (which are

really

just

ordinary

Wicket components and have nothing to do with the

Portlet

spec).

I'm

looking for a way of preventing the application from

becoming

unusable in

case one or more of these portlets continuously fail

to

render

because of

some internal error/bug.

We're currently using a custom RequestCycleListener

with

the

onException()
method redirecting 

Re: Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

2014-10-10 Thread Tobias Gierke

Hi,

Wouldn't it be possible to "embed"  the failing prone porlets inside
iframes so that each one is a Wicket page?
I already thought about this but the page uses quite a lot of fancy 
CSS/Ajax/Javascript (portlets are rendered in a grid with configurable 
row/column count, drag'n'drop to move them around etc.) and I'd rather 
not touch the existing code if there's a Java-side only solution ;-)


Cheers,
Tobias


On Fri, Oct 10, 2014 at 11:12 AM, Tobias Gierke <
tobias.gie...@voipfuture.com> wrote:


Hi,

In our web application we have a dashboard-like homepage that displays a
number of user-configurable 'portlets' (which are really just ordinary
Wicket components and have nothing to do with the Portlet spec). I'm
looking for a way of preventing the application from becoming unusable in
case one or more of these portlets continuously fail to render because of
some internal error/bug.

We're currently using a custom RequestCycleListener with the onException()
method redirecting to a generic error page, thus when rendering of a
'portlet' fails the user will never get to see the homepage and always end
up on the error page - which is obviously not really desirable.

Is there a way to to hook into Wicket's rendering cycle so that I can
provide some default markup in case rendering of a component (subtree)
fails with a RuntimeException ?

I understand that this maybe be very tricky since the component subtree
might've rendered partially and thus internal state will be inconsistent.
It would probably require serializing the initial state of the component
(subtree) before rendering starts and reverting the wholle subtree to its
initial state once a RuntimeException is thrown.

We're running Wicket 1.5.12.

Thanks in advance,
Tobias

--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 164 Fax +49 40 688 900 199
Email tobias.gie...@voipfuture.com   Web http://www.voipfuture.com
  CEO Jan Bastian

Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



-
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



Returning some default markup when rendering of a component (subtree) fails with a RuntimeException ?

2014-10-10 Thread Tobias Gierke

Hi,

In our web application we have a dashboard-like homepage that displays a 
number of user-configurable 'portlets' (which are really just ordinary 
Wicket components and have nothing to do with the Portlet spec). I'm 
looking for a way of preventing the application from becoming unusable 
in case one or more of these portlets continuously fail to render 
because of some internal error/bug.


We're currently using a custom RequestCycleListener with the 
onException() method redirecting to a generic error page, thus when 
rendering of a 'portlet' fails the user will never get to see the 
homepage and always end up on the error page - which is obviously not 
really desirable.


Is there a way to to hook into Wicket's rendering cycle so that I can 
provide some default markup in case rendering of a component (subtree) 
fails with a RuntimeException ?


I understand that this maybe be very tricky since the component subtree 
might've rendered partially and thus internal state will be 
inconsistent. It would probably require serializing the initial state of 
the component (subtree) before rendering starts and reverting the wholle 
subtree to its initial state once a RuntimeException is thrown.


We're running Wicket 1.5.12.

Thanks in advance,
Tobias

--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 164 Fax +49 40 688 900 199
Email tobias.gie...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



Re: Wicket AJAX & Google Chrome: Strange DOMException in Wicket.Ajax.Request.doGet

2014-05-16 Thread Tobias Gierke

Hi,

Considering the mess with the Apache foundation's mailserver outage, I'm 
not sure my message got through ... anyway , I found out what was 
causing me trouble:


Seems like Chrome's handling of synchronous AJAX requests is broken, 
switching to asynchronous mode fixed it.


Cheers,
Tobias


Hi,

I'm stumped by an error (DOMException #19, "A network error occurred") 
that seems to have started with Chrome version >=31. In our Wicket 
1.5.11 application I have some Javascript that issues an synchronous 
AJAX call like this:


>8>8>8>8>8>8
var successHandler = null;
var failureHandler = null;
var channel = null; // use default channel
var call = new Wicket.Ajax.Call(url, successHandler, 
failureHandler, channel);

call.request.async = false;
call.call();
>8>8>8>8>8>8

The URL I'm passing is a callback URL returned from 
AbstractAjaxBehavior#getCallbackUrl(). The code works perfectly fine 
with Firefox, Opera and IE but fails at least in Chrome 31 and Chrome 
34.0.1847.137


Here are some (hopefully helpful) screenshots:

AJAX request: http://www.tiikoni.com/tis/view/?id=cd02752
AJAX response: http://www.tiikoni.com/tis/view/?id=525a2c2
Exception: http://www.tiikoni.com/tis/view/?id=4e5e42b
Wicket AJAX debug panel: http://www.tiikoni.com/tis/view/?id=ce33a01

What's really making me scratch my head is the fact that the Wicket 
debug panel clearly shows the server's response/seems to have parsed 
it correctly ... maybe the exception is not the actual root cause but 
triggered by some error in a JS callback function ?


Cheers,
Tobias

P.S. I'm a Javascript novice so please have mercy if I did/overlooked 
something stupid ;)





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



Wicket AJAX & Google Chrome: Strange DOMException in Wicket.Ajax.Request.doGet

2014-05-14 Thread Tobias Gierke

Hi,

I'm stumped by an error (DOMException #19, "A network error occurred") 
that seems to have started with Chrome version >=31. In our Wicket 
1.5.11 application I have some Javascript that issues an synchronous 
AJAX call like this:


>8>8>8>8>8>8
var successHandler = null;
var failureHandler = null;
var channel = null; // use default channel
var call = new Wicket.Ajax.Call(url, successHandler, 
failureHandler, channel);

call.request.async = false;
call.call();
>8>8>8>8>8>8

The URL I'm passing is a callback URL returned from 
AbstractAjaxBehavior#getCallbackUrl(). The code works perfectly fine 
with Firefox, Opera and IE but fails at least in Chrome 31 and Chrome 
34.0.1847.137


Here are some (hopefully helpful) screenshots:

AJAX request: http://www.tiikoni.com/tis/view/?id=cd02752
AJAX response: http://www.tiikoni.com/tis/view/?id=525a2c2
Exception: http://www.tiikoni.com/tis/view/?id=4e5e42b
Wicket AJAX debug panel: http://www.tiikoni.com/tis/view/?id=ce33a01

What's really making me scratch my head is the fact that the Wicket 
debug panel clearly shows the server's response/seems to have parsed it 
correctly ... maybe the exception is not the actual root cause but 
triggered by some error in a JS callback function ?


Cheers,
Tobias

P.S. I'm a Javascript novice so please have mercy if I did/overlooked 
something stupid ;)


Re: Two Questions

2014-04-15 Thread Tobias Gierke

Hi,

1) I have a feedback panel and when i add messages under info(), they do not
show up.  When I add the message via error(), it shows as expected.  Why
might this be?
Hm, IMHO both should work. Are you maybe using AJAX and not adding the 
FeedbackPanel to the AjaxRequestTarget when using info() ? In this case 
you should see a warning in your log output (something along the lines 
of "component-targeted feedback message was not rendered").


2) I am using the @SpringBean annotation, works fine.  But I want to inject
a string property value that came from the properties file my spring reads.
How would I get that?  I tried ${myProp} in the @SpringBean, but that
doesn't work...and I kinda thought it would be a longshot.
There are probably more elegant solutions but I would go with an ugly & 
simple one here and use an intermediate bean to hold just the value (and 
then use PropertyPlaceholderConfigurer+property expression to inject the 
value into this intermediary). You could ofc roll your own bean Injector 
but I'm not sure it's worth the effort.


Cheers,
Tobias


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



Re: Strange issue with AJAX update + file download

2014-04-10 Thread Tobias Gierke


On Thu, Apr 10, 2014 at 1:13 PM, Tobias Gierke 

wrote:
Hi,

  What do you exactly mean by the rendering of the page after download
completed? You repaint a part of the screen via AJAX? And this is 
the one

giving problem with images?

Good point. I just investigated the AJAX response returned by the 
server
when clicking the 'Start download' button on the modal dialog and I 
noticed

that along with the JavaScript snippet that does the "setTimeout(...)"
there are also a lot of AJAX component updates that are obviously 
generated
by components with overridden onEvent() methods. I didn't write the 
code so

I wasn't aware of this :/

I suspect that the issue I'm seeing is caused by the Wicket AJAX 
library
being interrupted by the "setTimeout()" call while processing the 
component
updates... proving this will unfortunately take some time since the 
page

has a lot of different components that all override onEvent() ...


JavaScript is single-threaded. There is no way to interrupt it.
By using setTimeout/setInterval functions you just add tasks to the 
queue

that this single thread processes.
I stand corrected ;) But how come - given that  setTimeout() just adds 
a task to some "queue" - the actual magnitude of the timeout has an 
effect ? My queues are usually processed first-to-last ;)


Forgive my ignorance, I just read 
http://ejohn.org/blog/how-javascript-timers-work and was enlightened ;)


Cheers,
Tobias


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



Re: Strange issue with AJAX update + file download

2014-04-10 Thread Tobias Gierke

Hi,

Hi,



On Thu, Apr 10, 2014 at 1:13 PM, Tobias Gierke 
wrote:
Hi,

  What do you exactly mean by the rendering of the page after download

completed? You repaint a part of the screen via AJAX? And this is the one
giving problem with images?


Good point. I just investigated the AJAX response returned by the server
when clicking the 'Start download' button on the modal dialog and I noticed
that along with the JavaScript snippet that does the "setTimeout(...)"
there are also a lot of AJAX component updates that are obviously generated
by components with overridden onEvent() methods. I didn't write the code so
I wasn't aware of this :/

I suspect that the issue I'm seeing is caused by the Wicket AJAX library
being interrupted by the "setTimeout()" call while processing the component
updates... proving this will unfortunately take some time since the page
has a lot of different components that all override onEvent() ...


JavaScript is single-threaded. There is no way to interrupt it.
By using setTimeout/setInterval functions you just add tasks to the queue
that this single thread processes.
I stand corrected ;) But how come - given that  setTimeout() just adds a 
task to some "queue" - the actual magnitude of the timeout has an effect 
? My queues are usually processed first-to-last ;)


Cheers,
Tobias




Thanks,
Tobias





  The page contains some dynamic images/icons that are included via

Image/DynamicImageResource (all have a 'antiCache' parameter in their URL
as well as a "last-modified" date that equals "now()" ). Both chrome and
firefox re-request these images after the download has completed and
looking at the network traffic/PCAP file I captured , I can see that
Wicket
is in fact delivering the PNGs to the browser.

But:  Chrome still renders these icons using the  'image is broken'
placeholder icon and Firefox/firebug shows the image downloads as 'never
completed' / 0 bytes downloaded (see attached screenshots). Firebug also
shows a pending GET request for a JavaScript file along with the image
download requests so the issue may be related to either caching or the
Wicket request processing in general.

Any ideas ?

Thanks in advance,
Tobias



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





--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 111 Fax +49 40 688 900 199
Email tobias.gie...@voipfuture.com   Web http://www.voipfuture.com
  CEO Jan Bastian

Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086




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





--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 111 Fax +49 40 688 900 199
Email tobias.gie...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



Solved [ Re: Strange issue with AJAX update + file download ]

2014-04-10 Thread Tobias Gierke
Sorry for the noise, I just tried to validate my assumption by (again) 
setting the timeout to some really large value (20 seconds) and noticed 
that I screwed up while testing your initial suggestion , the changed 
timeout value was never in effect ...


Raising the timeout value does in fact solve the issue (although I don't 
like the solution since the required timeout value depends on the speed 
of the connection/request processing so this is bound to break sooner 
than later).


Thank you very much,
Tobias


Hi,

What do you exactly mean by the rendering of the page after download
completed? You repaint a part of the screen via AJAX? And this is the 
one

giving problem with images?
Good point. I just investigated the AJAX response returned by the 
server when clicking the 'Start download' button on the modal dialog 
and I noticed that along with the JavaScript snippet that does the 
"setTimeout(...)" there are also a lot of AJAX component updates that 
are obviously generated by components with overridden onEvent() 
methods. I didn't write the code so I wasn't aware of this :/


I suspect that the issue I'm seeing is caused by the Wicket AJAX 
library being interrupted by the "setTimeout()" call while processing 
the component updates... proving this will unfortunately take some 
time since the page has a lot of different components that all 
override onEvent() ...


Thanks,
Tobias






The page contains some dynamic images/icons that are included via
Image/DynamicImageResource (all have a 'antiCache' parameter in 
their URL
as well as a "last-modified" date that equals "now()" ). Both chrome 
and

firefox re-request these images after the download has completed and
looking at the network traffic/PCAP file I captured , I can see that 
Wicket

is in fact delivering the PNGs to the browser.

But:  Chrome still renders these icons using the  'image is broken'
placeholder icon and Firefox/firebug shows the image downloads as 
'never
completed' / 0 bytes downloaded (see attached screenshots). Firebug 
also

shows a pending GET request for a JavaScript file along with the image
download requests so the issue may be related to either caching or the
Wicket request processing in general.

Any ideas ?

Thanks in advance,
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: Strange issue with AJAX update + file download

2014-04-10 Thread Tobias Gierke

Hi,

What do you exactly mean by the rendering of the page after download
completed? You repaint a part of the screen via AJAX? And this is the one
giving problem with images?
Good point. I just investigated the AJAX response returned by the server 
when clicking the 'Start download' button on the modal dialog and I 
noticed that along with the JavaScript snippet that does the 
"setTimeout(...)" there are also a lot of AJAX component updates that 
are obviously generated by components with overridden onEvent() methods. 
I didn't write the code so I wasn't aware of this :/


I suspect that the issue I'm seeing is caused by the Wicket AJAX library 
being interrupted by the "setTimeout()" call while processing the 
component updates... proving this will unfortunately take some time 
since the page has a lot of different components that all override 
onEvent() ...


Thanks,
Tobias






The page contains some dynamic images/icons that are included via
Image/DynamicImageResource (all have a 'antiCache' parameter in their URL
as well as a "last-modified" date that equals "now()" ). Both chrome and
firefox re-request these images after the download has completed and
looking at the network traffic/PCAP file I captured , I can see that Wicket
is in fact delivering the PNGs to the browser.

But:  Chrome still renders these icons using the  'image is broken'
placeholder icon and Firefox/firebug shows the image downloads as 'never
completed' / 0 bytes downloaded (see attached screenshots). Firebug also
shows a pending GET request for a JavaScript file along with the image
download requests so the issue may be related to either caching or the
Wicket request processing in general.

Any ideas ?

Thanks in advance,
Tobias



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







--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 111 Fax +49 40 688 900 199
Email tobias.gie...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



Re: Strange issue with AJAX update + file download

2014-04-10 Thread Tobias Gierke

Hi,

Tried both your suggestions, unfortunately none of them worked :(

Thanks anyway,
Tobias


Hi,

I have no idea but something you can try is replacing

target.appendJavaScript("setTimeout(\"window.location.href='" + url + "'\",
100);");

with a bigger timeout... or maybe $(function() { window}); so that
download is triggered once DOM is ready.



On Thu, Apr 10, 2014 at 11:02 AM, Tobias Gierke <
tobias.gie...@voipfuture.com> wrote:


...sorry, forgot that sending attachments to mailing-lists does not
generally work...

http://picpaste.com/firebug.png
http://picpaste.com/chrome_after_download.png


  Hi,

We're using Wicket 1.5.11 with the approach described in
https://cwiki.apache.org/confluence/display/WICKET/
AJAX+update+and+file+download+in+one+blow to trigger a file download
from within a modal dialog. This all works fine, our problem is with the
rendering of the page after the download is complete.

The page contains some dynamic images/icons that are included via
Image/DynamicImageResource (all have a 'antiCache' parameter in their URL
as well as a "last-modified" date that equals "now()" ). Both chrome and
firefox re-request these images after the download has completed and
looking at the network traffic/PCAP file I captured , I can see that Wicket
is in fact delivering the PNGs to the browser.

But:  Chrome still renders these icons using the  'image is broken'
placeholder icon and Firefox/firebug shows the image downloads as 'never
completed' / 0 bytes downloaded (see attached screenshots). Firebug also
shows a pending GET request for a JavaScript file along with the image
download requests so the issue may be related to either caching or the
Wicket request processing in general.

Any ideas ?

Thanks in advance,
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: Strange issue with AJAX update + file download

2014-04-10 Thread Tobias Gierke
...sorry, forgot that sending attachments to mailing-lists does not 
generally work...


http://picpaste.com/firebug.png
http://picpaste.com/chrome_after_download.png


Hi,

We're using Wicket 1.5.11 with the approach described in 
https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow 
to trigger a file download from within a modal dialog. This all works 
fine, our problem is with the rendering of the page after the download 
is complete.


The page contains some dynamic images/icons that are included via 
Image/DynamicImageResource (all have a 'antiCache' parameter in their 
URL as well as a "last-modified" date that equals "now()" ). Both 
chrome and firefox re-request these images after the download has 
completed and looking at the network traffic/PCAP file I captured , I 
can see that Wicket is in fact delivering the PNGs to the browser.


But:  Chrome still renders these icons using the  'image is broken' 
placeholder icon and Firefox/firebug shows the image downloads as 
'never completed' / 0 bytes downloaded (see attached screenshots). 
Firebug also shows a pending GET request for a JavaScript file along 
with the image download requests so the issue may be related to either 
caching or the Wicket request processing in general.


Any ideas ?

Thanks in advance,
Tobias





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



Strange issue with AJAX update + file download

2014-04-10 Thread Tobias Gierke

Hi,

We're using Wicket 1.5.11 with the approach described in 
https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow 
to trigger a file download from within a modal dialog. This all works 
fine, our problem is with the rendering of the page after the download 
is complete.


The page contains some dynamic images/icons that are included via 
Image/DynamicImageResource (all have a 'antiCache' parameter in their 
URL as well as a "last-modified" date that equals "now()" ). Both chrome 
and firefox re-request these images after the download has completed and 
looking at the network traffic/PCAP file I captured , I can see that 
Wicket is in fact delivering the PNGs to the browser.


But:  Chrome still renders these icons using the  'image is broken' 
placeholder icon and Firefox/firebug shows the image downloads as 'never 
completed' / 0 bytes downloaded (see attached screenshots). Firebug also 
shows a pending GET request for a JavaScript file along with the image 
download requests so the issue may be related to either caching or the 
Wicket request processing in general.


Any ideas ?

Thanks in advance,
Tobias


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

Re: wicket:enclosure not finding child nested in border ? (Wicket 1.5.8)

2013-10-08 Thread Tobias Gierke

Hi Sven,

Hi,

the Border will add your input into its body, so its effective path 
will be "loginNameBorder:body:loginName".


Almost :-) Maybe this was changed in more recent versions but for 1.5.8 
it's  "loginNameBorder:loginNameBorder_body:loginName"


Thanks for the hint, much appreciated !

Cheers,
Tobias



Sven


On 10/08/2013 12:29 PM, Tobias Gierke wrote:

Hi,

In one of my pages I have a textfield (whose visibility is changed 
through AJAX) that is wrapped with a border like so:


>8->8->8-
  

  :
  wicket:id="loginName"/>


  
>8->8->8-

The border is defined as

>8->8->8-
http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org/";>




   style="display:inline-block"/>





>8->8->8-

For some odd reason accessing this page immediately fails with a 
"Could not find child with id: loginNameBorder:loginName in the 
wicket:enclosure" . I also tried to use child="loginName" but this 
gives me the same error (and according to 
https://cwiki.apache.org/confluence/display/WICKET/Wicket%27s+XHTML+tags#Wicket%27sXHTMLtags-Elementwicket%3Aenclosure 
a nested child needs to be referenced by the full path).


What did I do wrong ?

Cheers,
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



wicket:enclosure not finding child nested in border ? (Wicket 1.5.8)

2013-10-08 Thread Tobias Gierke

Hi,

In one of my pages I have a textfield (whose visibility is changed 
through AJAX) that is wrapped with a border like so:


>8->8->8-
  

  :
  wicket:id="loginName"/>


  
>8->8->8-

The border is defined as

>8->8->8-
http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org/";>




   style="display:inline-block"/>





>8->8->8-

For some odd reason accessing this page immediately fails with a "Could 
not find child with id: loginNameBorder:loginName in the 
wicket:enclosure" . I also tried to use child="loginName" but this gives 
me the same error (and according to 
https://cwiki.apache.org/confluence/display/WICKET/Wicket%27s+XHTML+tags#Wicket%27sXHTMLtags-Elementwicket%3Aenclosure 
a nested child needs to be referenced by the full path).


What did I do wrong ?

Cheers,
Tobias


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



Re: Generic in-app bookmarking mechanism

2013-09-24 Thread Tobias Gierke


So you agree that serializing a page instance while the request is still 
being processed (my current approach) is likely the cause of the 
glitches I'm seeing with some (put not all) of the pages , right ?




>> hook into DefaultPageStore#**storePageData()
> custom IPageStore will be needed

That's what I meant.

Sven


On 09/24/2013 01:15 PM, Martin Grigorov wrote:

On Tue, Sep 24, 2013 at 12:51 PM, Sven Meier  wrote:

You could just mark the page to be "bookmarked" (e.g. via MetaData 
on the

RequestCycle) and hook into DefaultPageStore#**storePageData() to store
the page alongside in the database.


I don't think this will help much.
The page can be requested from the DB much later when the disk store 
has no

info about this page or even the http session that the page belongs to.
Any interaction with the rendered page will lead to PageExpiredException
because the following request will search in the disk store, not in 
the DB.


I think a custom IPageStore will be needed ..




Sven


On 09/24/2013 12:06 PM, Tobias Gierke wrote:


Hi,

I'm currently investigating a bug in our application that is most 
likely

caused by the very "brute-force" way I implemented a generic in-app
bookmarking feature.

The basic requirement is something along the lines of "Users should be
able to create an (internal) bookmark for virtually any Wicket page 
that
can subsequently be shared with other users". Keep in mind that 
everything
is happening inside our application, so no browser bookmarks/URLs 
involved.


I implemented this by serializing the current WebPage instance using
XStream and storing it as a BLOB in the database. Users then basically
share the DB primary key of this BLOB and whenever a user navigates 
to such
a bookmark, I just de-serialize the WebPage instance and use "throw 
new

RestartResponseException( deserializedPage )" to render it.

To create a new bookmark, the user clicks on an AJAX link that does

 final AjaxLink link = new AjaxLink("link") {
 @Override
 public void onClick(AjaxRequestTarget target)
 {
 final long bookmarkId = serializeCurrentPage();
 ...
 }
};

It seems that my approach is quite fragile for certain constructs, for
example when the page involves components that register AJAX 
behaviors /

resource listeners in general. Since Wicket itself successfully uses
serialization for page versioning, I suspect the issues I'm having are
caused by serializing the page instance while the request 
processing is

still in-transit.

Is there some way to safely hook into the processing of the current 
HTTP
request and get hold of a serialized WebPage instance for my 
use-case ?


Thanks in advance,
Tobias


--**--**- 

To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org

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


--**--**- 

To unsubscribe, e-mail: 
users-unsubscribe@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.or 



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



Generic in-app bookmarking mechanism

2013-09-24 Thread Tobias Gierke

Hi,

I'm currently investigating a bug in our application that is most likely 
caused by the very "brute-force" way I implemented a generic in-app 
bookmarking feature.


The basic requirement is something along the lines of "Users should be 
able to create an (internal) bookmark for virtually any Wicket page that 
can subsequently be shared with other users". Keep in mind that 
everything is happening inside our application, so no browser 
bookmarks/URLs involved.


I implemented this by serializing the current WebPage instance using 
XStream and storing it as a BLOB in the database. Users then basically 
share the DB primary key of this BLOB and whenever a user navigates to 
such a bookmark, I just de-serialize the WebPage instance and use "throw 
new RestartResponseException( deserializedPage )" to render it.


To create a new bookmark, the user clicks on an AJAX link that does

final AjaxLink link = new AjaxLink("link") {
@Override
public void onClick(AjaxRequestTarget target)
{
final long bookmarkId = serializeCurrentPage();
...
}
   };

It seems that my approach is quite fragile for certain constructs, for 
example when the page involves components that register AJAX behaviors / 
resource listeners in general. Since Wicket itself successfully uses 
serialization for page versioning, I suspect the issues I'm having are 
caused by serializing the page instance while the request processing is 
still in-transit.


Is there some way to safely hook into the processing of the current HTTP 
request and get hold of a serialized WebPage instance for my use-case ?


Thanks in advance,
Tobias


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



How to include the JQuery version bundled with WiQuery in a page ?

2013-08-13 Thread Tobias Gierke

Hi,

We're using WiQuery + Wicket (both are version 1.5.x so JQuery is not a 
part of Wicket) and I have a page without any WiQuery components where I 
want to use JQuery functions in some custom JavaScript.


What's the correct (=most upwards compatible/cleanest) way to reference 
the JQuery version that comes with WiQuery ?


Thanks,
Tobias

--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 111 Mobile +49 172 323 06 11 Fax +49 40 688 900 199
Email jan.bast...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



Re: Scheduled IRequestHandler never executed ?

2013-07-04 Thread Tobias Gierke

Hi Sven,

Hi,

when your behavior is triggered, an AjaxRequestHandler is already 
scheduled to generate the Ajax response for Wicket's JavaScript.
It doesn't make sense to replace scheduled handler with a fileDownload 
then. Whatever you'll send back to the browser, Wicket's JavaScript 
won't understand it.


You misunderstood me, closing the modal window is ofc an AJAX request 
and the response to this request contains



ajaxTarget.appendJavaScript("setTimeout(\"window.location.href='" + url 
+ "'\", 100);");


where URL is the actual 'download' behaviour's callback URL.  After 100 
ms the browser initiates a regular HTTP GET request and this is where I 
schedule my file download request handler (just like described in the 
link I posted).


Cheers,
Tobias



Sven

On 07/04/2013 11:04 AM, Tobias Gierke wrote:

Hi,

I have a modal dialog window that - after closing - should start a 
file download.


Basically I'm doing everything like in 
http://mail-archives.apache.org/mod_mbox/wicket-users/201304.mbox/%3c1364779681800-4657667.p...@n4.nabble.com%3E 
(AJAX response with setTimeout() call that redirects the browser to 
an AJAX behaviour which in turn invokes 
IRequestCycle#scheduleRequestHandlerAfterCurrent() to send the actual 
file data).


---
@Override
protected void respond(AjaxRequestTarget target)
{
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( 
fileDownloadRequestHandler );

}
---

I've set a debugger breakpoint inside my respond() method and it's 
being correctly called after the modal dialog is closed - but for 
some reason the scheduled request handler never gets invoked by Wicket.


Cheers,
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



[SOLVED] Re: Scheduled IRequestHandler never executed ?

2013-07-04 Thread Tobias Gierke
Sorry for the noise, I just found out that 
scheduleRequestHandlerAfterCurrent() silently accepts NULL handlers and 
I was passing a NULL value...



Sorry, forgot to mention that I'm using Wicket 1.5.8


Hi,

I have a modal dialog window that - after closing - should start a 
file download.


Basically I'm doing everything like in 
http://mail-archives.apache.org/mod_mbox/wicket-users/201304.mbox/%3c1364779681800-4657667.p...@n4.nabble.com%3E 
(AJAX response with setTimeout() call that redirects the browser to 
an AJAX behaviour which in turn invokes 
IRequestCycle#scheduleRequestHandlerAfterCurrent() to send the actual 
file data).


---
@Override
protected void respond(AjaxRequestTarget target)
{

getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( 
fileDownloadRequestHandler );

}
---

I've set a debugger breakpoint inside my respond() method and it's 
being correctly called after the modal dialog is closed - but for 
some reason the scheduled request handler never gets invoked by Wicket.


Cheers,
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: Scheduled IRequestHandler never executed ?

2013-07-04 Thread Tobias Gierke

Sorry, forgot to mention that I'm using Wicket 1.5.8


Hi,

I have a modal dialog window that - after closing - should start a 
file download.


Basically I'm doing everything like in 
http://mail-archives.apache.org/mod_mbox/wicket-users/201304.mbox/%3c1364779681800-4657667.p...@n4.nabble.com%3E 
(AJAX response with setTimeout() call that redirects the browser to an 
AJAX behaviour which in turn invokes 
IRequestCycle#scheduleRequestHandlerAfterCurrent() to send the actual 
file data).


---
@Override
protected void respond(AjaxRequestTarget target)
{

getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( 
fileDownloadRequestHandler );

}
---

I've set a debugger breakpoint inside my respond() method and it's 
being correctly called after the modal dialog is closed - but for some 
reason the scheduled request handler never gets invoked by Wicket.


Cheers,
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



Scheduled IRequestHandler never executed ?

2013-07-04 Thread Tobias Gierke

Hi,

I have a modal dialog window that - after closing - should start a file 
download.


Basically I'm doing everything like in 
http://mail-archives.apache.org/mod_mbox/wicket-users/201304.mbox/%3c1364779681800-4657667.p...@n4.nabble.com%3E 
(AJAX response with setTimeout() call that redirects the browser to an 
AJAX behaviour which in turn invokes 
IRequestCycle#scheduleRequestHandlerAfterCurrent() to send the actual 
file data).


---
@Override
protected void respond(AjaxRequestTarget target)
{

getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent( 
fileDownloadRequestHandler );

}
---

I've set a debugger breakpoint inside my respond() method and it's being 
correctly called after the modal dialog is closed - but for some reason 
the scheduled request handler never gets invoked by Wicket.


Cheers,
Tobias

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



Re: Model is null after submit, using FormComponentPanel

2012-12-06 Thread Tobias Gierke

Hi,

I think you need to override FormComponentPanel#convertInput().

Cheers,
Tobias

Thanks for the reply, I tried to use the component on the form with the
object
CompoundPropertyModel. As follows,

ccc = new CustomerAccountCode("ccc",
new CompoundPropertyModel(new Account(config.getCcc(;
form.add(ccc);

But this does the same as before, ie load correctly displayed data, but when
you throw the "onSubmit" form, the model
the "ccc.getModelObject()" still returns null.

//New implementation
public class CustomerAccountCode extends
FormComponentPanel {

private FormComponent entity;
private FormComponent office;
private FormComponent dc;
private FormComponent number;

public CustomerAccountCode(String id, CompoundPropertyModel 
model)
{
super(id, model);

entity = new TextField("entity");
office = new TextField("office");
dc = new TextField("dc");
number = new TextField("number");

AttributeModifier attEntity = new AttributeModifier("name", 
"entity");
AttributeModifier attOffice = new AttributeModifier("name", 
"office");
AttributeModifier attDc = new AttributeModifier("name", "dc");
AttributeModifier attNumber = new AttributeModifier("name", 
"number");
add(entity.add(attEntity));
add(office.add(attOffice));
add(dc.add(attDc));
add(number.add(attNumber));
//  add(CustomerAccountCodeValidator.getInstance());

}

@Override
public Component add(final Behavior... behaviors) {
entity.add(behaviors);
office.add(behaviors);
dc.add(behaviors);
number.add(behaviors);
return this;
}
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Model-is-null-after-submit-using-FormComponentPanel-tp4654441p4654545.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




--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 111 Mobile +49 172 323 06 11 Fax +49 40 688 900 199
Email jan.bast...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



WiQuery: Having trouble getting dynamically added AutocompleteAjaxComponent to work

2012-10-05 Thread Tobias Gierke

Hi all,

I'm building a generic 'Search' form where the user dynamically 
constructs the search criteria by picking a constraint type and then 
filling out the fields associated with the selected constraint type. 
Depending on the select constraint type, one or more form fields are 
dynamically added to the form (or replaced, if the user changes the 
constraint type on an existing criteria) .


I'm having trouble with a dynamically added AutocompleteAjaxComponent 
field ; the markup looks ok and I can see no javascript/markup errors in 
the brower's error console but for some reason the generated callback URL


?0-1.IBehaviorListener.0-form-filterEditingPanel-constraintList-0-constraintEditor-autocompleter&term=someUserInput

always yields a "302 Moved Temporarily" response instead of returning 
JSON data ...and thus the autocompleter obviously displays no choices.


I'm fairly sure this has something to do with the fact that the 
AutocompleteAjaxComponent is added dynamically to the form but how do I 
fix this ?


Thanks in advance,
Tobias

P.S. I'm using Wicket 1.5.7 / WiQuery 1.5.7

--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 111 Mobile +49 172 323 06 11 Fax +49 40 688 900 199
Email jan.bast...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



Re: Subclassing FormComponentPanel / propagating setRequired() to child components ?

2012-10-01 Thread Tobias Gierke

Hi,

I decided to just override isRequired() on the child components and let 
it delegate to FormComponentPanel.this#isRequired() ... didn't test it 
yet but I suppose it should work.


Thanks for your reply!

Tobias


Hi,

Don't think you have to propagate #setRequired() to child components
because the whole formcomponent is required. But I think you could overrive
#checkRequired() - which is not final - to fit best your use case (which is
called underneath by #validate())

Hope this helps,
Sebastien.

On Mon, Oct 1, 2012 at 1:48 PM, Tobias Gierke
wrote:


Hi,

With setRequired() being final, I'm not sure how to propagate a
setRequired() call to my child components ... I found some discussion about
the pro's and con's of having a final setRequired() method () (
http://apache-wicket.1842946.**n4.nabble.com/VOTE-**
setRequired-final-or-not-**td1903843.html<http://apache-wicket.1842946.n4.nabble.com/VOTE-setRequired-final-or-not-td1903843.html>)
 but I'm still not sure how to actually apply this knowledge.

Any pointers ?

Thanks in advance,
Tobias

P.S. I'm using Wicket 1.5



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





--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 111 Mobile +49 172 323 06 11 Fax +49 40 688 900 199
Email jan.bast...@voipfuture.com   Web http://www.voipfuture.com
 
CEO Jan Bastian


Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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



Subclassing FormComponentPanel / propagating setRequired() to child components ?

2012-10-01 Thread Tobias Gierke

Hi,

With setRequired() being final, I'm not sure how to propagate a 
setRequired() call to my child components ... I found some discussion 
about the pro's and con's of having a final setRequired() method () ( 
http://apache-wicket.1842946.n4.nabble.com/VOTE-setRequired-final-or-not-td1903843.html 
) but I'm still not sure how to actually apply this knowledge.


Any pointers ?

Thanks in advance,
Tobias

P.S. I'm using Wicket 1.5



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



Re: wicket session statistics

2011-05-26 Thread Tobias Gierke
Hi,

Implement a
http://download.oracle.com/javaee/5/api/javax/servlet/http/HttpSessionListener.html
and put it in your web.xml.

Regards,
Tobias

> Hello,
>
> Maybe I found it,LiveSessionsPage.java ,it can count peak session,but not
> what i want.
>
> I want to count the online users,
>
> for example there a three users here, if somtime a user had closed his(or
> her) web browser this session number is two now
>
>
> How can I do it ?
>
> Thanks!
>
>
> 2011/5/26 Martin Grigorov 
>
>> Look deeper. This info is also provided.
>>
>> 2011/5/26 KingFee Dong :
>>> I found that DebugBar panel in wicket-devutils.jar is also talk about
>> size
>>> of one session.
>>>
>>> What I want to count  is unexpired sessions in the wicket application.
>>>
>>> just like a forum,count the online users
>>>
>>> Thanks !
>>>
>>>
>>> 2011/5/26 Martin Grigorov 
>>>
 Also Tomcat comes with ManagerApplication which provides such kind of
 information for all deployed apps

 On Thu, May 26, 2011 at 12:05 PM, Martin Grigorov >>> wrote:
> see DebugBar panel in wicket-devutils.jar
>
> 2011/5/26 KingFee Dong :
>> hello,
>>
>> Maybe my question is not very clear.
>>
>>
>>  I want to Statistics  Session Numbers, I mean the sessions in the
>> application.
>>
>> for example there are two users online the session should be 2.
>>
>> Can anyone give me some solutions ?
>>
>> Thank you all the same,Martin Grigorov!
>>
>> Good Luck !
>>
>> 2011/5/26 Martin Grigorov 
>>
>>> org.apache.wicket.Session.getSizeInBytes()
>>>
>>> 2011/5/26 KingFee Dong 
>>>
 Hi,EVERYONE

 I am a newer  to wicket ,now i  want to statistics session,how can
>> i
 do
>>> it?
 Can anyone give me some suggestion ?


 Thanks!

>>>
>>>
>>> --
>>> Martin Grigorov
>>> jWeekend
>>> Training, Consulting, Development
>>> http://jWeekend.com  
>>>
>>
>>
>> --
>>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com 
>


 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com 

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


>>
>>
>> --
>>  Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com 
>>
>> -
>> 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: Problem with Link,PopupSettings and dynamic window names

2009-05-03 Thread Tobias Gierke

Hi,
The class you want to edit must implement Serializable. 
  
It is serializable. My actual code uses domain objects wrapped in 
LoadableDetachableModels that only hold the (serializable) primary key 
and fetch the domain object using a Spring-injected DAO. I just sketched 
a rough outline of the code to illustrate what I'm trying to do. I don't 
really see any connection between serialization and my use of 
"PopupSettings#setWindowName()" here (or is the window title used to 
associate the window with server-side state ?).


Anyway, thanks for your reply !

Cheers,
Tobias

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



Problem with Link,PopupSettings and dynamic window names

2009-05-02 Thread Tobias Gierke

Hi,

In my application I have a "edit " link that opens a 
popup-window where the user can actually edit "". Giving the 
window a generic title (like just "Edit" ) would be confusing when 
multiple pop-ups are open so I tried to make the popup-window title read 
"Edit " instead.


My problem: The generated JavaScript looks ok but whenever I click on 
the edit link the popup window that opens just shows the "Page expired" 
page.



Thanks in advance,

Tobias


P.S. Here's what I (conceptually) try to do ( Wicket 1.3.5 ). The actual 
code is slightly different and more complex but DOES work when I omit 
the PopupSettings#setWindowName() call.


public class EditComponent extends Panel {

  private final class EditForm extends Form {

 private ThingToEdit thingToEdit;
 private Link editLink;

 protected EditForm(ThingToEdit someThing) {

super("form");

setThingToEdit( someThing );

   // link that opens a new pop-up window
   // where more complex properties
   // of  be edited
editLink = new Link("editLink") {

public void onClick() {
setResponsePage( new EditSomethingPage( 
thingToEdit ) );
}  
 };


 editLink.setPopupSettings( createPopupSettings( someThing ) );
 add( "link" , editLink);
 /* more TextFields etc. for performing simple updates */
 }

 private static PopupSettings createPopupSettings(ThingToEdit 
thing) {

return new PopupSettings().setWindowName("Edit "+thing);
 }

 protected void setThingToEdit(ThingToEdit aThing) {
   this.thingToEdit = aThing;
   if ( editLink != null ) {
   editLink.setPopupSettings( createPopupSettings( aThing ) 
);
   }

 }

  }
 
  public EditComponent(String id,List thingsToEdit) {

super( id );
   
final EditForm editForm =  new EditForm  );
   
/* render  list of thingsToEdit where clicking on an item 
will call editForm.setThingToEdit(  ) */

  }
}
  


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