Re: Slow rendering

2012-02-16 Thread Christian Huber

Hi Jürgen,

I just had a quick glance at the Component and MarkupContainer classes 
and if I am not mistaken you should be able to override onRender() and 
onComponentTag() which would give you a few more measuring points and 
maybe more pointers on where to look further.


HTH, Christian


The Sanity Resort http://sanityresort.blogspot.com/

Am 16.02.2012 19:50, schrieb Jürgen Lind:

Hi there,

I am currently encountering a problem that I don't know how to 
attack... We have
developed an application that uses the Tree-Component to show 
hierarchical data
to the user. In some cases, the tree degenerates to a plain list that 
can be quite
large. Now, if the list has around 1000 entries, the rendering phase 
for the tree
takes approx. 1 second, which seems to be ok. For 2500 entries, the 
rendering time
goes up to around 11 seconds and with 5000 entries, we're looking at 
approx. 30

seconds.

Now, I would like to find out, which part of the component tree causes 
these huge
numbers, but I have run out of ideas on how to track down these 
numbers. The last
point I was able to measure was between onBeforeRender and 
onAfterRender of my

subclassed LabelTree component.

Any suggestions on how to instrument my application without building a 
custom wicket

package?

Kind Regards,

J.



Re: Could not locate error message for component: ..

2011-12-29 Thread Christian Huber

Hi,

i assume the string isim 3 karakterden büyük olmalı is the error 
message you want to display.


You have two options here, first use ValidationError#setMessage instead 
of addMessageKey. The later considers it's argument being a message key 
to be looked up from a properties file.


The alternative would be to put the message into a properties file and 
the pass the corresponding key to addMessageKey instead of the error 
message itself.


I would also recommend having a look at the wicket javadoc api.

The Sanity Resort http://sanityresort.blogspot.com/

Am 29.12.2011 21:39, schrieb Rahman USTA:

Hi, im new in Wicket. im trying out an external validation , my validation
class is here http://chopapp.com/#htmnirs3 ,
  i get a message like this

Could not locate error message for component: TextField@form:ad and error:
[ValidationError message=[null], keys=[isim 3 karakterden büyük olmalı],
variables=[null]]. Tried keys: ad.isim 3 karakterden büyük olmalı, isim 3
karakterden büyük olmalı.

how can i handle this issue.



Re: Using JNDI from Jetty/Start.java

2011-12-27 Thread Christian Huber
The server complains about a missing value for jndi context factory. 
Where do you define that value?



The Sanity Resort http://sanityresort.blogspot.com/

Am 27.12.2011 19:41, schrieb armhold:

Has anyone got a JNDI config that works with Start.java under Wicket 1.5 (and
therefore Jetty 7.5)?

I've got JNDI working fine for my production Tomcat deployment, but can't
seem to figure out which incantations are needed to get it working with
Jetty for development/testing (I use Start.java to launch directly inside my
IDE, rather than mvn jetty-run).

I've created a datasource in WEB-INF/jetty-env.xml, but I suspect the file
is not being read at all. I get:

INFO  - NamingHelper   - JNDI InitialContext properties:{}
ERROR - tasourceConnectionProvider - Could not find datasource:
java:/comp/env/jdbc/mydatasource
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-JNDI-from-Jetty-Start-java-tp4237903p4237903.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to handle errors in RequestCycle.onEndRequest

2011-10-16 Thread Christian Huber
Sorry, took a while until I got time to test the changes. WIth the 
current trunk revision I now can use restart exceptons within 
onRequestHandlerExecuted to force a redirect to an error page and even 
adding feedback messages seems to work properly.


Thank you very much for this fix! :-)


The Sanity Resort http://sanityresort.blogspot.com/

Am 12.10.2011 08:31, schrieb Igor Vaynberg:

ive just checked in a couple of tweaks, give it a go...

-igor

On Sat, Oct 1, 2011 at 10:38 AM, Christian Huberhub...@butterbrot.org  wrote:

Hi Igor,

I just saw you answered to my JIRA issue. I had tried your suggestion about
throwing an exception before but to no avail (see also my comment on the
issue):

I had tried adding

throw new RestartResponseException(ErrorPage.class);

to the onrequesthandlerexecuted() callback while ErrorPage is just an empty
page with empty markup and mounted at error (calling that page did work
when the exception was not thrown) but that caused the following error:

ERROR - DefaultExceptionMapper - Unexpected error occurred
org.apache.wicket.RestartResponseException
ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to response!

throwing the exception directly in the homepage constuctor got me redirected
to the error page as expected.

would you need a new quickstart for this?


The Sanity Resorthttp://sanityresort.blogspot.com/

Am 01.10.2011 17:54, schrieb Christian Huber:

quickstart created and added to
https://issues.apache.org/jira/browse/WICKET-4103

this quickstart does not behave exactly like my application but the
primary problem about messages not being displayed is reproducable. please
let me know if i can provide any further information and thank you for your
assitance.


The Sanity Resorthttp://sanityresort.blogspot.com/

Am 01.10.2011 16:47, schrieb Igor Vaynberg:

that sounds like a bug, please create a quickstart and attach it to jira.

-igor

On Sat, Oct 1, 2011 at 7:29 AM, Christian Huberhub...@butterbrot.org
  wrote:

Hi again,

unfortunately my problem still persists. After migrating to 1.5.1 and
putting my commit code into  onRequestHandlerExecuted() the error
messages
generated there are still not propagated to the rendered response page.

But instead I now get the following error message:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to response!

So it seems that at this it is still to late to anything to the current
response.

As before the error messages do get displayed after the following
request.

At the moment I am totally stumped. Does anyone have a clue what I am
doing
wrong here?

Thanks, Chris


The Sanity Resorthttp://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian
Huberhub...@butterbrot.org
  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a
RequestCycle
somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus commit
my
database changes in onEndRequest, now if an exception occurs here I do
get a
log entry but I cannot get my application to display the corresponding
error
to the user.

Adding a message to the feedback panel does not help as the message
gets
displayed on the following request but not the current one. I also
tried
using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did
improve
the situation as far as the request did get aborted but there is still
no
visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true did
not
change anything.

This sounds like a common problem and so I guess there is an easy
solution
to it, but I just don't get it right now, so any pointers are welcome.

Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.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


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



Re: What is the right way to identify the second login for the same user?

2011-10-03 Thread Christian Huber

I might be wrong, but this does not seem like a Wicket related problem.

Here a spontaneous idea what I would try:

To track sessions of a user I would try to use a database table that 
associates sessions with users and a boolean flag isvalid.
A new session would have to create an entry in that table with isvalid 
set to true and in the same transaction find all existing entries for 
the same entries to set isvalid in those records to false.
For every request a session would have to check in that table if it is 
still valid and if not invalidate itself and delete the record (probably 
best done in onBeginRequest of IRequestCycleHandler). Also when a 
session times out the corresponding record has to be deleted (probably 
best done in sessionUnbound in WebApplication).


Not sure if that is the best way, but at the moment that is the only way 
that comes to my mind. Hopefully this gives you an idea where to start.


Cheers, Chris


The Sanity Resort http://sanityresort.blogspot.com/

Am 03.10.2011 16:00, schrieb donx...@yahoo.com:

Please provide your advice about what is the easiest way to identify the
second time user login for same user.

User login in one machine and one session is created.
User go to another machine and login again. The system create a another
session for the same user and there are two sessions associated with the
user.

What is the best way to identify the second time login for this user and
kill the first session?  The application has Wicket Page and Ajax page or
link also.


Thanks in advance.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/What-is-the-right-way-to-identify-the-second-login-for-the-same-user-tp3867590p3867590.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Crossreferencing wicket internationalization

2011-10-02 Thread Christian Huber
You can use a MapVariableInterpolator  to replace the variable with it's 
label value programmatically, e.g. resolve all nested variables using a 
resolver (or Component#getString) put them as values into a map with the 
variable name as key.


String label = getString(link_label);

MapString,String map = new HashMapString,String();
map.put(link_label, label);

String result = 
MapVariableInterpolator.interpolate(getString(link_instructions),map);



When you use wicket:message tags you can use nested child components 
(see the documentation on the message tag for further information).


In both cases you have to specify all nested variables explicitly.


The Sanity Resort http://sanityresort.blogspot.com/

Am 02.10.2011 10:09, schrieb Martin Makundi:

Hi!

Is it possible to crossreference in xx.properties files for label
keys, in Wicket?

For example:

link_label=Mouse button
link_instructions=Click '${link_label}' to start sequence

Or something similar?

**
Martin

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



Re: How to handle errors in RequestCycle.onEndRequest

2011-10-01 Thread Christian Huber

Hi again,

unfortunately my problem still persists. After migrating to 1.5.1 and 
putting my commit code into  onRequestHandlerExecuted() the error 
messages generated there are still not propagated to the rendered 
response page.


But instead I now get the following error message:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to response!

So it seems that at this it is still to late to anything to the current 
response.


As before the error messages do get displayed after the following request.

At the moment I am totally stumped. Does anyone have a clue what I am 
doing wrong here?


Thanks, Chris


The Sanity Resort http://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian Huberhub...@butterbrot.org  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a RequestCycle
somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus commit my
database changes in onEndRequest, now if an exception occurs here I do get a
log entry but I cannot get my application to display the corresponding error
to the user.

Adding a message to the feedback panel does not help as the message gets
displayed on the following request but not the current one. I also tried
using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did improve
the situation as far as the request did get aborted but there is still no
visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true did not
change anything.

This sounds like a common problem and so I guess there is an easy solution
to it, but I just don't get it right now, so any pointers are welcome.

Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.com/


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



Re: How to handle errors in RequestCycle.onEndRequest

2011-10-01 Thread Christian Huber
quickstart created and added to 
https://issues.apache.org/jira/browse/WICKET-4103


this quickstart does not behave exactly like my application but the 
primary problem about messages not being displayed is reproducable. 
please let me know if i can provide any further information and thank 
you for your assitance.



The Sanity Resort http://sanityresort.blogspot.com/

Am 01.10.2011 16:47, schrieb Igor Vaynberg:

that sounds like a bug, please create a quickstart and attach it to jira.

-igor

On Sat, Oct 1, 2011 at 7:29 AM, Christian Huberhub...@butterbrot.org  wrote:

Hi again,

unfortunately my problem still persists. After migrating to 1.5.1 and
putting my commit code into  onRequestHandlerExecuted() the error messages
generated there are still not propagated to the rendered response page.

But instead I now get the following error message:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to response!

So it seems that at this it is still to late to anything to the current
response.

As before the error messages do get displayed after the following request.

At the moment I am totally stumped. Does anyone have a clue what I am doing
wrong here?

Thanks, Chris


The Sanity Resorthttp://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian Huberhub...@butterbrot.org
  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a RequestCycle
somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus commit my
database changes in onEndRequest, now if an exception occurs here I do
get a
log entry but I cannot get my application to display the corresponding
error
to the user.

Adding a message to the feedback panel does not help as the message gets
displayed on the following request but not the current one. I also tried
using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did
improve
the situation as far as the request did get aborted but there is still no
visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true did not
change anything.

This sounds like a common problem and so I guess there is an easy
solution
to it, but I just don't get it right now, so any pointers are welcome.

Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.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: How to handle errors in RequestCycle.onEndRequest

2011-10-01 Thread Christian Huber

Hi Igor,

I just saw you answered to my JIRA issue. I had tried your suggestion 
about throwing an exception before but to no avail (see also my comment 
on the issue):


I had tried adding

throw new RestartResponseException(ErrorPage.class);

to the onrequesthandlerexecuted() callback while ErrorPage is just an 
empty page with empty markup and mounted at error (calling that page 
did work when the exception was not thrown) but that caused the 
following error:


ERROR - DefaultExceptionMapper - Unexpected error occurred
org.apache.wicket.RestartResponseException
ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to response!

throwing the exception directly in the homepage constuctor got me 
redirected to the error page as expected.


would you need a new quickstart for this?


The Sanity Resort http://sanityresort.blogspot.com/

Am 01.10.2011 17:54, schrieb Christian Huber:
quickstart created and added to 
https://issues.apache.org/jira/browse/WICKET-4103


this quickstart does not behave exactly like my application but the 
primary problem about messages not being displayed is reproducable. 
please let me know if i can provide any further information and thank 
you for your assitance.



The Sanity Resort http://sanityresort.blogspot.com/

Am 01.10.2011 16:47, schrieb Igor Vaynberg:
that sounds like a bug, please create a quickstart and attach it to 
jira.


-igor

On Sat, Oct 1, 2011 at 7:29 AM, Christian 
Huberhub...@butterbrot.org  wrote:

Hi again,

unfortunately my problem still persists. After migrating to 1.5.1 and
putting my commit code into  onRequestHandlerExecuted() the error 
messages

generated there are still not propagated to the rendered response page.

But instead I now get the following error message:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to 
response!


So it seems that at this it is still to late to anything to the current
response.

As before the error messages do get displayed after the following 
request.


At the moment I am totally stumped. Does anyone have a clue what I 
am doing

wrong here?

Thanks, Chris


The Sanity Resorthttp://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian 
Huberhub...@butterbrot.org

  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a 
RequestCycle

somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus 
commit my
database changes in onEndRequest, now if an exception occurs here 
I do

get a
log entry but I cannot get my application to display the 
corresponding

error
to the user.

Adding a message to the feedback panel does not help as the 
message gets
displayed on the following request but not the current one. I also 
tried

using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did
improve
the situation as far as the request did get aborted but there is 
still no

visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true 
did not

change anything.

This sounds like a common problem and so I guess there is an easy
solution
to it, but I just don't get it right now, so any pointers are 
welcome.


Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.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: How to handle errors in RequestCycle.onEndRequest

2011-09-27 Thread Christian Huber
I was thinking about something like that too, but this does look like a 
dangerous task. And I think in the long run migrating to 1.5.0 is a 
better solution.


The Sanity Resort http://sanityresort.blogspot.com/

Am 27.09.2011 07:50, schrieb Hans Lesmeister 2:

Hi,

maybe you can override WebRequestCycleProcessor.respond:

but I did not try if that's too late as well


-


Re: How to handle errors in RequestCycle.onEndRequest

2011-09-26 Thread Christian Huber
as i suspected ;-) i have been using onRuntimeException already but 
without onRequestHandlerExecuted this is not enough.


well, off to migration it is then :-)


The Sanity Resort http://sanityresort.blogspot.com/

Am 26.09.2011 18:28, schrieb Igor Vaynberg:

1.4.x has onRuntimeException() but it has no callback for when the
request handler has executed...

-igor

On Sun, Sep 25, 2011 at 2:20 PM, Christian Huberhub...@butterbrot.org  wrote:

Sorry for bugging again, but I just saw that IRequestCycleListener is not
available in wicket 1.4.x. Is there an alternative other than switching to
1.5.x?

The Sanity Resorthttp://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian Huberhub...@butterbrot.org
  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a RequestCycle
somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus commit my
database changes in onEndRequest, now if an exception occurs here I do
get a
log entry but I cannot get my application to display the corresponding
error
to the user.

Adding a message to the feedback panel does not help as the message gets
displayed on the following request but not the current one. I also tried
using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did
improve
the situation as far as the request did get aborted but there is still no
visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true did not
change anything.

This sounds like a common problem and so I guess there is an easy
solution
to it, but I just don't get it right now, so any pointers are welcome.

Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.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: How to handle errors in RequestCycle.onEndRequest

2011-09-25 Thread Christian Huber

Hi Igor,

once more thanks for your help. I 'll try that and see how it works out :-)

Cheers, Chris


The Sanity Resort http://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian Huberhub...@butterbrot.org  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a RequestCycle
somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus commit my
database changes in onEndRequest, now if an exception occurs here I do get a
log entry but I cannot get my application to display the corresponding error
to the user.

Adding a message to the feedback panel does not help as the message gets
displayed on the following request but not the current one. I also tried
using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did improve
the situation as far as the request did get aborted but there is still no
visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true did not
change anything.

This sounds like a common problem and so I guess there is an easy solution
to it, but I just don't get it right now, so any pointers are welcome.

Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.com/


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



Re: How to handle errors in RequestCycle.onEndRequest

2011-09-25 Thread Christian Huber
Sorry for bugging again, but I just saw that IRequestCycleListener is 
not available in wicket 1.4.x. Is there an alternative other than 
switching to 1.5.x?


The Sanity Resort http://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian Huberhub...@butterbrot.org  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a RequestCycle
somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus commit my
database changes in onEndRequest, now if an exception occurs here I do get a
log entry but I cannot get my application to display the corresponding error
to the user.

Adding a message to the feedback panel does not help as the message gets
displayed on the following request but not the current one. I also tried
using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did improve
the situation as far as the request did get aborted but there is still no
visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true did not
change anything.

This sounds like a common problem and so I guess there is an easy solution
to it, but I just don't get it right now, so any pointers are welcome.

Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.com/


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



Re: How to handle errors in RequestCycle.onEndRequest

2011-09-24 Thread Christian Huber

Hi again,

sorry for reposting, but as I am still struggling with this I thought I 
try bumping this thread.


Any hints would be very welcome.

Cheers, Chris

The Sanity Resort http://sanityresort.blogspot.com/

Am 19.09.2011 19:50, schrieb Christian Huber:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a 
RequestCycle somehow do not reflect on the respone page.


I am using an AjaxFallbackButton and the OSIV pattern and thus commit 
my database changes in onEndRequest, now if an exception occurs here I 
do get a log entry but I cannot get my application to display the 
corresponding error to the user.


Adding a message to the feedback panel does not help as the message 
gets displayed on the following request but not the current one. I 
also tried using various AbortExceptions like RedirectToUrlException, 
RestartResponseException or AbortWithWebErrorCodeException. This did 
improve the situation as far as the request did get aborted but there 
is still no visual display of the error.


Setting the ResponsePage directly and/or setting redirect to true did 
not change anything.


This sounds like a common problem and so I guess there is an easy 
solution to it, but I just don't get it right now, so any pointers are 
welcome.


Thanks, Chris



Re: How to handle errors in RequestCycle.onEndRequest

2011-09-24 Thread Christian Huber

Thanks for your reply Dan.

My application is rather simplistic from a persistence point of view, 
meaning that I want all persistence actions from a request to be atomic. 
Of course I could move the commit calls out of the RequestCycle class 
which would solve this particular problem.


But does that mean there is no way to properly handle an exception 
occuring in RequestCycle#endOfRequest to redirect to an error page or 
add error messages to the current page?


I figured this should be doable, or could it mean that I broke something 
with my architecture?



The Sanity Resort http://sanityresort.blogspot.com/

Am 24.09.2011 12:46, schrieb Dan Retzlaff:

So you open both a session and a transaction at the beginning of a request,
and commit/close them at the end? I think it's more common to only have the
session last through the request, and to have transactions started/committed
around DAO or controller methods. This gives your app more control over
transaction boundaries and exceptions. Since this can mean lots of
begin/try/commit/finally/rollback stuff, it's also common to use AOP (e.g.
from Guice or Spring) to do that stuff without code for each instance.

Dan

On Sat, Sep 24, 2011 at 1:47 AM, Christian Huberhub...@butterbrot.orgwrote:


Hi again,

sorry for reposting, but as I am still struggling with this I thought I try
bumping this thread.

Any hints would be very welcome.

Cheers, Chris


The Sanity 
Resorthttp://sanityresort.blogspot.**com/http://sanityresort.blogspot.com/
Am 19.09.2011 19:50, schrieb Christian Huber:

  Hi all,

I just noticed that exceptions occuring in onEndRequest of a RequestCycle
somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus commit my
database changes in onEndRequest, now if an exception occurs here I do get a
log entry but I cannot get my application to display the corresponding error
to the user.

Adding a message to the feedback panel does not help as the message gets
displayed on the following request but not the current one. I also tried
using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException**. This did
improve the situation as far as the request did get aborted but there is
still no visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true did not
change anything.

This sounds like a common problem and so I guess there is an easy solution
to it, but I just don't get it right now, so any pointers are welcome.

Thanks, Chris




Re: Footnote-Support

2011-09-23 Thread Christian Huber

Hi again,

for those who might be interessted I just wanted to let you know that I 
now have a working footnote support implementation. The details can be 
found here 
http://sanityresort.blogspot.com/2011/09/adding-footnote-support-to-wicket.html 
(another chance for shameless blog advertising ;-)).


Thanks to Dan for his suggestions, though I decided to stick with my 
initial behavior approach. Mainly because I did not want to create a 
component subclass but instead enable all components with a string model 
object to use footnotes.


I'm not sure if what I did is very wickety but at least for me it 
works pretty well and seems rather flexibel.


Here a short summary of the features:

- programmatically add a footnote to a component
- programmatically process the descriptions for programmatically added 
components

- declaratively add labels with footnotes to a markup container
- declaratively add label with footnote descriptions for declaratively 
added footnotes
- declaratively add label with footnote descriptions for 
programmatically added footnotes

- use text or images as footnotes
- use separate style definitions for each footnote and description
- use freely defined wrapping tags for declaratively added footnote 
descriptions


Any kind of feedback is as always very welcome :-)

Cheers, Chris

The Sanity Resort http://sanityresort.blogspot.com/

Am 19.09.2011 16:41, schrieb Dan Retzlaff:

I see now. Forget the behavior approach. :)

How about keeping a ListString  of footnotes in the page's metadata (i.e.
getPage().setMetaData(FOOTNOTES))? Create (1) a Label-like component which,
in its onInitialize(), adds its contents to the list and saves the new index
to be rendered as the footnote annotation, and (2) a FeedbackPanel-like
component which renders the footnote content as an ordered list.

You may also be able to put the footnotes into the Session's feedback data
as Martin suggests, but I'm not sure how the footnote annotation and
footnote content would be differentiated.

On Mon, Sep 19, 2011 at 1:15 AM, Christian Huberhub...@butterbrot.orgwrote:


Hi Dan,

thanks for your answer.

To be a bit more clear about what I want, I would like (spoken simplified)
to add a footenote to a label like Some textsup1/sup and
automatically have the footbnote text appear at the bottom of the
corresponding page.

Right now I have a Label subclass to do this (and a bit more) but am moving
he code to a behavior and will also try to create an appropriate resolver to
allow the usage of a wicket:footnote tag. But I thougth I'd ask if there
isn't already something like it out there.


Cheers, Chris

The Sanity 
Resorthttp://sanityresort.blogspot.**com/http://sanityresort.blogspot.com/
Am 18.09.2011 22:57, schrieb Dan Retzlaff:


Hi Christian,

I don't understand the particular hierarchy placement you have in mind,
but
I'd guess that you could write a Behavior that does it. Behaviors get
callbacks for component tags, rendering events, etc.

Dan

On Sun, Sep 18, 2011 at 12:12 PM, Christian Huberhub...@butterbrot.org*
*wrote:

  Hi all,

I was wondering if there is something like a footnote component/behavior
or
similar. A mechanism that allows you to easily add a footnote to a label
and
the corresponding footnote text to one of it's parents in a generic way.

I know I could just add a footnote to a label and another label
containing
the footnote text but that does not work in a generic way.

Cheers,
Chris

--
The Sanity Resorthttp://sanityresort.**blogspot.http://sanityresort.blogspot.
**com/http://**sanityresort.blogspot.com/http://sanityresort.blogspot.com/


Re: Arabic characters not appearing correctly from .properties file

2011-09-20 Thread Christian Huber
Just a short addition, the resource bundle editor plugin for eclipse is 
great for handling .properties files with UTF-8 characters. The files 
are stored with ISO encoding and UTF-8 characters are escaped correctly 
while you can use the unescaped in the editor.


The Sanity Resort http://sanityresort.blogspot.com/

Am 20.09.2011 13:50, schrieb aabfattah:

Well , the xml file didn't load and it loaded the default .properties files
from wicket
But the first trick worked :)

On 20 September 2011 13:41, Martin A [via Apache Wicket]
ml-node+s1842946n3826499...@n4.nabble.com  wrote:


Hi, Ahmed,

As the Java specification defines, the .properties file contains only
characters in ISO-8859-1, also known as Latin-1. Therefore you cannot enter

arabic characters in a properties file.

You have two options here:

1. Unicode escape your arabic characters, using converters, like this
one
here  http://www.rishida.net/tools/conversion/ (what works for you
appears under JavaScript escapes) or
2. Use an xml file for language properties.

Regards,
Martin

On Tue, Sep 20, 2011 at 1:53 PM, aabfattah
[hidden email]http://user/SendEmail.jtp?type=nodenode=3826499i=0
wrote:


Hello ,
I have written many .properties pages to show error messages in Arabic

and

saved them in UTF-8 format and they display like that :
يجب ادخال اسم الدخول
*Although I wrote all HTML in Arabic and it displays correctly
*
I am using Eclipse Helios and I set workspace encoding to UTF-8

--
View this message in context:


http://apache-wicket.1842946.n4.nabble.com/Arabic-characters-not-appearing-correctly-from-properties-file-tp3826406p3826406.html

Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: [hidden 
email]http://user/SendEmail.jtp?type=nodenode=3826499i=1
For additional commands, e-mail: [hidden 
email]http://user/SendEmail.jtp?type=nodenode=3826499i=2




--
  If you reply to this email, your message will be added to the discussion
below:

http://apache-wicket.1842946.n4.nabble.com/Arabic-characters-not-appearing-correctly-from-properties-file-tp3826406p3826499.html
  To unsubscribe from Arabic characters not appearing correctly from
.properties file, click 
herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=3826406code=YWhtZWQuYWJkZWxmYXR0YWguZWxzaGVtaXN5QGdtYWlsLmNvbXwzODI2NDA2fDI4MjAxMzAzNQ==.







Re: Arabic characters not appearing correctly from .properties file

2011-09-20 Thread Christian Huber

Am 20.09.2011 14:31, schrieb Martin Grigorov:

On Tue, Sep 20, 2011 at 3:26 PM, Christian Huberhub...@butterbrot.org  wrote:

Just a short addition, the resource bundle editor plugin for eclipse is
great for handling .properties files with UTF-8 characters. The files are
stored with ISO encoding and UTF-8 characters are escaped correctly while
you can use the unescaped in the editor.

This is an option but not a good one. In my experience the developers
support only the English version of the bundle and the people who
translate to the other languages are not Eclipse (or any other IDE)
users.
The XML is the most convenient, I think.
In such situations you are right, an eclipse plugin is not suitable if 
resources should be created by non-developers. But in my experience that 
means such resources are created by members of the business departement 
and most xml files that we receive from those have issues like binary 
garbage in prolog (apart from BOM) or invalid use of xml entities etc. 
In such a scenario I would recommend the use a proper CMS if possible. 
But I guess that is another topic ;-)



The Sanity Resorthttp://sanityresort.blogspot.com/

Am 20.09.2011 13:50, schrieb aabfattah:

Well , the xml file didn't load and it loaded the default .properties
files
from wicket
But the first trick worked :)

On 20 September 2011 13:41, Martin A [via Apache Wicket]
ml-node+s1842946n3826499...@n4.nabble.comwrote:


Hi, Ahmed,

As the Java specification defines, the .properties file contains only
characters in ISO-8859-1, also known as Latin-1. Therefore you cannot
enter

arabic characters in a properties file.

You have two options here:

1. Unicode escape your arabic characters, using converters, like this
one
herehttp://www.rishida.net/tools/conversion/ (what works for you
appears under JavaScript escapes) or
2. Use an xml file for language properties.

Regards,
Martin

On Tue, Sep 20, 2011 at 1:53 PM, aabfattah
[hidden email]http://user/SendEmail.jtp?type=nodenode=3826499i=0
wrote:


Hello ,
I have written many .properties pages to show error messages in Arabic

and

saved them in UTF-8 format and they display like that :
يجب ادخال اسم الدخول
*Although I wrote all HTML in Arabic and it displays correctly
*
I am using Eclipse Helios and I set workspace encoding to UTF-8

--
View this message in context:


http://apache-wicket.1842946.n4.nabble.com/Arabic-characters-not-appearing-correctly-from-properties-file-tp3826406p3826406.html

Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: [hidden
email]http://user/SendEmail.jtp?type=nodenode=3826499i=1
For additional commands, e-mail: [hidden
email]http://user/SendEmail.jtp?type=nodenode=3826499i=2



--
  If you reply to this email, your message will be added to the discussion
below:


http://apache-wicket.1842946.n4.nabble.com/Arabic-characters-not-appearing-correctly-from-properties-file-tp3826406p3826499.html
  To unsubscribe from Arabic characters not appearing correctly from
.properties file, click
herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=3826406code=YWhtZWQuYWJkZWxmYXR0YWguZWxzaGVtaXN5QGdtYWlsLmNvbXwzODI2NDA2fDI4MjAxMzAzNQ==.









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



Re: Footnote-Support

2011-09-20 Thread Christian Huber
Well, after about two days I finally got it working ;-) I'll try to 
scratch together a blog post in the next days with the details :-)


The Sanity Resort http://sanityresort.blogspot.com/

Am 19.09.2011 16:41, schrieb Dan Retzlaff:

I see now. Forget the behavior approach. :)

How about keeping a ListString  of footnotes in the page's metadata (i.e.
getPage().setMetaData(FOOTNOTES))? Create (1) a Label-like component which,
in its onInitialize(), adds its contents to the list and saves the new index
to be rendered as the footnote annotation, and (2) a FeedbackPanel-like
component which renders the footnote content as an ordered list.

You may also be able to put the footnotes into the Session's feedback data
as Martin suggests, but I'm not sure how the footnote annotation and
footnote content would be differentiated.

On Mon, Sep 19, 2011 at 1:15 AM, Christian Huberhub...@butterbrot.orgwrote:


Hi Dan,

thanks for your answer.

To be a bit more clear about what I want, I would like (spoken simplified)
to add a footenote to a label like Some textsup1/sup and
automatically have the footbnote text appear at the bottom of the
corresponding page.

Right now I have a Label subclass to do this (and a bit more) but am moving
he code to a behavior and will also try to create an appropriate resolver to
allow the usage of a wicket:footnote tag. But I thougth I'd ask if there
isn't already something like it out there.


Cheers, Chris

The Sanity 
Resorthttp://sanityresort.blogspot.**com/http://sanityresort.blogspot.com/
Am 18.09.2011 22:57, schrieb Dan Retzlaff:


Hi Christian,

I don't understand the particular hierarchy placement you have in mind,
but
I'd guess that you could write a Behavior that does it. Behaviors get
callbacks for component tags, rendering events, etc.

Dan

On Sun, Sep 18, 2011 at 12:12 PM, Christian Huberhub...@butterbrot.org*
*wrote:

  Hi all,

I was wondering if there is something like a footnote component/behavior
or
similar. A mechanism that allows you to easily add a footnote to a label
and
the corresponding footnote text to one of it's parents in a generic way.

I know I could just add a footnote to a label and another label
containing
the footnote text but that does not work in a generic way.

Cheers,
Chris

--
The Sanity Resorthttp://sanityresort.**blogspot.http://sanityresort.blogspot.
**com/http://**sanityresort.blogspot.com/http://sanityresort.blogspot.com/


Re: Footnote-Support

2011-09-19 Thread Christian Huber

Hi Dan,

thanks for your answer.

To be a bit more clear about what I want, I would like (spoken 
simplified) to add a footenote to a label like Some text sup1/sup 
and automatically have the footbnote text appear at the bottom of the 
corresponding page.


Right now I have a Label subclass to do this (and a bit more) but am 
moving he code to a behavior and will also try to create an appropriate 
resolver to allow the usage of a wicket:footnote tag. But I thougth I'd 
ask if there isn't already something like it out there.


Cheers, Chris

The Sanity Resort http://sanityresort.blogspot.com/

Am 18.09.2011 22:57, schrieb Dan Retzlaff:

Hi Christian,

I don't understand the particular hierarchy placement you have in mind, but
I'd guess that you could write a Behavior that does it. Behaviors get
callbacks for component tags, rendering events, etc.

Dan

On Sun, Sep 18, 2011 at 12:12 PM, Christian Huberhub...@butterbrot.orgwrote:


Hi all,

I was wondering if there is something like a footnote component/behavior or
similar. A mechanism that allows you to easily add a footnote to a label and
the corresponding footnote text to one of it's parents in a generic way.

I know I could just add a footnote to a label and another label containing
the footnote text but that does not work in a generic way.

Cheers,
Chris

--
The Sanity 
Resorthttp://sanityresort.blogspot.**com/http://sanityresort.blogspot.com/


How to handle errors in RequestCycle.onEndRequest

2011-09-19 Thread Christian Huber

Hi all,

I just noticed that exceptions occuring in onEndRequest of a 
RequestCycle somehow do not reflect on the respone page.


I am using an AjaxFallbackButton and the OSIV pattern and thus commit my 
database changes in onEndRequest, now if an exception occurs here I do 
get a log entry but I cannot get my application to display the 
corresponding error to the user.


Adding a message to the feedback panel does not help as the message gets 
displayed on the following request but not the current one. I also tried 
using various AbortExceptions like RedirectToUrlException, 
RestartResponseException or AbortWithWebErrorCodeException. This did 
improve the situation as far as the request did get aborted but there is 
still no visual display of the error.


Setting the ResponsePage directly and/or setting redirect to true did 
not change anything.


This sounds like a common problem and so I guess there is an easy 
solution to it, but I just don't get it right now, so any pointers are 
welcome.


Thanks, Chris

--
The Sanity Resort http://sanityresort.blogspot.com/


Footnote-Support

2011-09-18 Thread Christian Huber

Hi all,

I was wondering if there is something like a footnote component/behavior 
or similar. A mechanism that allows you to easily add a footnote to a 
label and the corresponding footnote text to one of it's parents in a 
generic way.


I know I could just add a footnote to a label and another label 
containing the footnote text but that does not work in a generic way.


Cheers,
Chris

--
The Sanity Resort http://sanityresort.blogspot.com/


Re: Know if FileUploadField has value set before its parent form is submitted and file gets uploaded

2011-09-04 Thread Christian Huber
Not sure if I completely understand what you want to do but as far as I 
do I guess the only way to do that is using java script.


You could add a java script validation routine to the submit buttons 
onclick handler that aborts submission when the input field has no value.


Another approach could be to add a onchange handler for the input field. 
If the field has a value set after a change the submit button gets 
enabled otherwise it can be disabled.


hth, Chris


The Sanity Resort http://sanityresort.blogspot.com/

Am 04.09.2011 15:47, schrieb martin.ase...@mail.bg:



Hello, guys,


I've got a FileUploadField as so:


  image1UploadField = new FileUploadField(image1_upload, new Model());


I aim to know if the field has value set even before the form gets
processed and the item gets uploaded. I want to minimize traffic and memory
usage of my application. Therefore I don't want the file get uploaded
before I know if there really was file specified.


What's the most proper way to do this in Wicket code?


Thank you in advance,
Martin

-
Mail.bg: Безплатен e-mail адрес. Най-добрите характеристики на българския пазар 
- 10 GB пощенска кутия, 20 MB прикрепен файл, безплатен POP3, мобилна версия, 
SMS известяване и други.


Create Url for Application Homepage

2011-08-24 Thread Christian Huber

Hi,

the method Component#urlFor(Class pageClass, PageParameters parameters) 
allows you to create an application relative link that could be used as 
dynamic links or stored in a database to be accessed later. Now I 
noticed that links created for the page set as the applications HomePage 
the result does not contain the wicket:bookmarkablePage portion. I 
figure this is an optimization.


Those links work fine as long as the HomePage class does not change. But 
what if due to some refactoring you want to set another page as 
application HomePage? Since those links usually contain page dependent 
parameters the chance old bookmark links won't work or even cause an 
application error are pretty high.


So I would like to avoid this optimization to kick in and have all links 
created in the same way. Does anyone know if this can be done?


Thanks, Chris

--
The Sanity Resort http://sanityresort.blogspot.com/


Re: Create Url for Application Homepage

2011-08-24 Thread Christian Huber

Aaaahh.. cool. Works great. Thanks :-)

The Sanity Resort http://sanityresort.blogspot.com/

Am 24.08.2011 21:44, schrieb Martin Grigorov:

mount your home page
for HomePage1: /home1
for HomePage2: /home2

voila!

On Wed, Aug 24, 2011 at 10:28 PM, Christian Huberhub...@butterbrot.org  wrote:

Hi,

the method Component#urlFor(Class pageClass, PageParameters parameters)
allows you to create an application relative link that could be used as
dynamic links or stored in a database to be accessed later. Now I noticed
that links created for the page set as the applications HomePage the result
does not contain the wicket:bookmarkablePage portion. I figure this is an
optimization.

Those links work fine as long as the HomePage class does not change. But
what if due to some refactoring you want to set another page as application
HomePage? Since those links usually contain page dependent parameters the
chance old bookmark links won't work or even cause an application error are
pretty high.

So I would like to avoid this optimization to kick in and have all links
created in the same way. Does anyone know if this can be done?

Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.com/






Sorting Feedback Messages

2011-08-23 Thread Christian Huber

Hi,

I was wondering if there is a way to have feedback messages show up in 
certain order. Like, when you have multiple messages for the user you 
might want to have the most general one (e.g. success/failure) at the 
top and other detail messages shown below.


From what I have seen so far it looks like this is not possible (at 
least not with 1.4.18)


As a default messages are rendered in the order they have been provided, 
so usually you can just collect the messages you want to display and 
then add them at the end of your request in the desired order. But there 
can be circumstances where this is not feasible or at least pretty anoying.


I have seen that a FeedbackPanel can be given a comparator to sort the 
messages but the feedback messages only provide a level field to 
distinguish between info, debug, errror etc. To impose a proper priority 
order one would need a metric orthogonal to message levels preferrably 
represented by a primitive (double would give the biggest freedom here).


The Component class could be extended to provide additional methods like 
Component#info(String message, double priority) and messages which do 
not have a priority get assigned a default value specified in the 
Application class (could be 0 in the standard implementation).


Would this be a useful/sensible addition? Is such a thing planned for 
future releases or maybe already available and I just did not see it?


One workaround/hack to implement this with the current version could be 
to prefix all messages with a numeric string and use a Comparator to 
parse this string and sort accordingly.


Cheers, Chris

--
The Sanity Resort http://sanityresort.blogspot.com/


Re: Sorting Feedback Messages

2011-08-23 Thread Christian Huber
Yes, as i wrote this would be the way to impose a custom sorting on 
messages but at the moment the FilterMessage class does not provide 
dedicated fields that could be used for a sorting metric. So i was 
wondering if there are plans to provide such a thing or if we will be 
bound to incooperate this kind of information into the messages themselves.


The Sanity Resort http://sanityresort.blogspot.com/

Am 23.08.2011 19:21, schrieb Martin Grigorov:

I think 
org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(ComparatorFeedbackMessage)
is for that

On Tue, Aug 23, 2011 at 8:10 PM, Christian Huberhub...@butterbrot.org  wrote:

Hi,

I was wondering if there is a way to have feedback messages show up in
certain order. Like, when you have multiple messages for the user you might
want to have the most general one (e.g. success/failure) at the top and
other detail messages shown below.

 From what I have seen so far it looks like this is not possible (at least
not with 1.4.18)

As a default messages are rendered in the order they have been provided, so
usually you can just collect the messages you want to display and then add
them at the end of your request in the desired order. But there can be
circumstances where this is not feasible or at least pretty anoying.

I have seen that a FeedbackPanel can be given a comparator to sort the
messages but the feedback messages only provide a level field to distinguish
between info, debug, errror etc. To impose a proper priority order one would
need a metric orthogonal to message levels preferrably represented by a
primitive (double would give the biggest freedom here).

The Component class could be extended to provide additional methods like
Component#info(String message, double priority) and messages which do not
have a priority get assigned a default value specified in the Application
class (could be 0 in the standard implementation).

Would this be a useful/sensible addition? Is such a thing planned for future
releases or maybe already available and I just did not see it?

One workaround/hack to implement this with the current version could be to
prefix all messages with a numeric string and use a Comparator to parse this
string and sort accordingly.

Cheers, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.com/






Include Tag Resolver

2011-08-10 Thread Christian Huber

Hi all,

maybe someone might find this useful. I created a tag resolver to allow 
include components to be used in the same way as label components with 
the wicket:message tag. With this resolver you can use a tag like e.g. 
wicket:include file=path/to/file/ to include a file into a page. It 
is also able to look up the file name with a property value and to 
interpolate variables in the included file.


The complete source can be found here 
http://sanityresort.blogspot.com/2011/08/creating-custom-wicket-tag-resolver.html. 
Any comments or suggestions would be very welcome.


Cheers, Chris

--
The Sanity Resort http://sanityresort.blogspot.com/


Re: on the fly components

2011-07-31 Thread Christian Huber

Hi,

this is just a wild guess but in your code you have line that calls 
item.remove(listChoice); under certain conditions and the listChoice 
instance is bound to the category identifier which does not seem right 
to me.


As far as I understand ListViews the associated markup block is created 
for each item. If you remove the listChoice from an item then Wicket has 
no object to associate the markup with. So I think you cannot remove the 
choice that way.


I have a similar use case where I also add and remove objects to and 
from ListViews via Ajax and it was sufficient to just remove the object 
from the collection that the ListView relies on and add the wrappign 
container to the ajax target.


Since the listChoice is the only thing you add to an item I figure that 
could also be feasible for your case but as said before this is just a 
hunch.


HTH, Chris

--
The Sanity Resort http://sanityresort.blogspot.com/

Am 31.07.2011 21:06, schrieb ramazan pekin:

Hi to everyone,

I am trying to generate dynamic form elements. I need to add and
remove some components dynamically. I have added listChoice component
succesfuly whenever user select a listChoice item, but when I tried to
remove listChoice component, I received an error like that:

org.apache.wicket.DefaultExceptionMapper.internalMap(DefaultExceptionMapper.java:102)
- Unexpected error occurred
org.apache.wicket.markup.MarkupException: Unable to find component
with id 'category' in [ListItem [Component id = 1]]. This means that
you declared wicket:id=category in your markup, but that you either
did not add the component to your page at all, or that the hierarchy
does not match.
.Page.html
td wicket:id=categoryList

select wicket:id=category/select
/td, index = 2, current =  'select
wicket:id=category' (line 16, column 18)]
at 
org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:536)


This is form code:

public class DynamicForm extends Form {

   private static final long serialVersionUID = 1L;

   final ListViewCategoryModel  listView;

   private ListCategoryModel  categories;

   public DynamicForm(String id) {
 super(id);

 categories = new ArrayListCategoryModel();
 categories.add(new CategoryModel(masterCategories));

 final WebMarkupContainer listContainer = new
WebMarkupContainer(categoryContainer);
 listView = new ListViewCategoryModel(categoryList, categories) {

   private static final long serialVersionUID = 1L;

   @Override
   protected void populateItem(final ListItemCategoryModel  item) {
 final CategoryModel category = item.getModelObject();
 ListChoiceOmCategory  listChoice = new ListChoiceOmCategory(
 category,
 new PropertyModelOmCategory(category, selectedCategory),
 masterCategories,
 new IChoiceRendererOmCategory() {
   private static final long serialVersionUID = 1L;

   public Object getDisplayValue(OmCategory omCategory) {
 return omCategory.getCategoryCode().getLocalized();
   }

   public String getIdValue(OmCategory omCategory, int index) {
 return omCategory.getRowId();
   }
 }
 );
 listChoice.add(new AjaxFormComponentUpdatingBehavior(onchange) {
   private static final long serialVersionUID = 5417882427051940952L;

   @Override
   protected void onUpdate(AjaxRequestTarget target) {
 if(categories.size()  1  (categories.indexOf(category)
+ 1) != categories.size()) {
   categories = new
ArrayListCategoryModel(categories.subList(0,
(categories.indexOf(category) + 1)));
 }
 categories.add(new CategoryModel(masterCategories));
 target.add(listContainer);
   }
 });
 if(categories.indexOf(item.getModelObject()) != -1) {
   item.add(listChoice);
 } else {
   item.remove(listChoice);
 }
   }
 };
 listView.setOutputMarkupId(true);
 listContainer.add(listView);
 listContainer.setOutputMarkupId(true);
 add(listContainer);
   }
}


First time I am developing with wicket, and maybe I use wrongly. I'm
new and any feedback is appreciated... Sorry for my english :)

Br.
Ramazan

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



Re: Non-Submit Button Not Getting Called from Form

2011-07-30 Thread Christian Huber

Hi!

Try setting the cancel button's type to submit instead of button, 
then the onSubmit method should be called. Though you might have to 
disable default form processing for the cancel button, depending on your 
form.


HTH, Chris

--
The Sanity Resort http://sanityresort.blogspot.com/

Am 30.07.2011 02:45, schrieb eugenebalt:

It's something simple that I'm forgetting, but my non-Submit button (e.g.
Cancel) is not getting called from my Form.

The button is a simple Button, not Ajax.


My HTML (using [] to avoid rendering here):

[form wicket:id=.. ]
   [input wicket:id=btnReturn type=button value=Return to Home Page
style=width: 300px /]
[/form]

My Java:

 add(new Button(btnReturn) {

 @Override
 public void onSubmit() {
 System.out.println(Clicked);
}

 });


Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Non-Submit-Button-Not-Getting-Called-from-Form-tp3705651p3705651.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




http://sanityresort.blogspot.com/


Re: Non-Submit Button Not Getting Called from Form

2011-07-30 Thread Christian Huber
If you check the link sent by hariharansrc 
https://cwiki.apache.org/WICKET/multiple-submit-buttons.html you see an 
example with two submit buttons. The difference to your example, as far 
as i can see, is that your second button has not the submit type. To my 
understanding a button that is not of the submit type does not fire it's 
onSubmit method when clicked. Instead those usually have an onClick-Script.


Do you get an error when you try to add two submit buttons?
--
The Sanity Resort http://sanityresort.blogspot.com/

Am 30.07.2011 14:39, schrieb eugenebalt:

I can't make it Submit, I already have another Submit button. This is button
#2. I need to override its click behavior, and for some reason I'm not
catching it.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Non-Submit-Button-Not-Getting-Called-from-Form-tp3705651p3706227.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: can we do standalone projects in wicket

2011-07-30 Thread Christian Huber
What do you mean by standalone? Do you mean a framework for desktop 
applications? If so, then Swing or Eclipse RCP might be what you are 
looking for.

--
The Sanity Resort http://sanityresort.blogspot.com/

Am 30.07.2011 16:46, schrieb hariharansrc:

I actually don't understand what standalone project clearly. Can i use wicket
for standalone projects. I am asking this because wicket is the first
framework i have first learned. If not which framework i can learn similar
like wicket.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/can-we-do-standalone-projects-in-wicket-tp3706382p3706382.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Skip validation on nested form's form level validators

2011-07-11 Thread Christian Huber

Hi,

well i _could_ decouple the two forms but that would kinda break my 
usecase and also the layout due to the changed component hierarchy.


Removing and readding the validators does not strike me as a good idea 
though, that would mean that the outer form would have knowledge about 
the internals of the inner form, which would break not only cohesion but 
also the law of demeter.


I was thinking that since there is a defined way to let a form decide 
for itself if it's component's validators should be executed that there 
might also be a similar way to do this for form level validators. But it 
seems that this is not the case. So I guess I will try disabling the 
default form processing on the outer form and call it's component's 
validators manually in the onsubmit method of the corresponding button.


Anyway thanks for your time.

Am 11.07.2011 15:01, schrieb Andrea Del Bene:

Hi,

why don't simply put the inner form out of the outer one? Anyway, you 
could remove inner form's validators before the outer form is 
submitted and add them again when submit process is over 
(onFormSubmitted() )

Hi all,

I have two forms nested within each other (wicket 1.4.17). The inner 
form adds data to the model of the outer form via ajax when it's 
button is pressed while the outer form saves the data to the database 
when the outer form's submit button is pressed.


Both forms have validators attacehd to them and their components. and 
of course the inner form's validators must not be executed when the 
outer form is submitted. Having the inner form implement 
IFormVisitorParticipant and then check if the submitting button was 
it's own avoids the inner form's component's validators to be 
executed. But validators applied to the inner form directly (e.g. 
EqualInputValidators etc.) are still executed and in my case causing 
the request to die horribly because the requred data just is not there.


I was looking for an elegant way to solve this but since all validate 
methods in the hierarchy are final I cannot hook any code into the 
form's on validation cycle. The method onValidate is not called (I 
guess that is because the form is validated as the outer form's 
child). All other methods that allow me to achieve the deisred 
behavior (like isEnabled) are too general cause side effects like 
disabling the form. At the moment the only way I can think of is to 
disable default form processing and then call the validators manually 
which is not very appealing to me.


Is there another way how this can be done?

Cheers,
Chris




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



--
The Sanity Resort http://sanityresort.blogspot.com/


Skip validation on nested form's form level validators

2011-07-10 Thread Christian Huber

Hi all,

I have two forms nested within each other (wicket 1.4.17). The inner 
form adds data to the model of the outer form via ajax when it's button 
is pressed while the outer form saves the data to the database when the 
outer form's submit button is pressed.


Both forms have validators attacehd to them and their components. and of 
course the inner form's validators must not be executed when the outer 
form is submitted. Having the inner form implement 
IFormVisitorParticipant and then check if the submitting button was it's 
own avoids the inner form's component's validators to be executed. But 
validators applied to the inner form directly (e.g. EqualInputValidators 
etc.) are still executed and in my case causing the request to die 
horribly because the requred data just is not there.


I was looking for an elegant way to solve this but since all validate 
methods in the hierarchy are final I cannot hook any code into the 
form's on validation cycle. The method onValidate is not called (I guess 
that is because the form is validated as the outer form's child). All 
other methods that allow me to achieve the deisred behavior (like 
isEnabled) are too general cause side effects like disabling the form. 
At the moment the only way I can think of is to disable default form 
processing and then call the validators manually which is not very 
appealing to me.


Is there another way how this can be done?

Cheers,
Chris

--
The Sanity Resort http://sanityresort.blogspot.com/


Re: Autocomplete - get model object

2011-07-06 Thread Christian Huber

Not sure if am understanding your problem correctly but how about this:

The main problem is that those objects do not have ids associated with 
them because your service just does not use ids for the objects. But as 
far as i understood you have the chance to store the objects you need 
somewhere after you retreived them from your service, right?


So can't you just assign some arbitrary ids to your objects when storing 
them and then use those ids within the autocomplete component?


Of course this would mean that you might end up storing a lot of objects 
in your page/component/etc which might not be feasible..


Am 06.07.2011 23:38, schrieb armandoxxx:

not working ..

here's the situation .. I have an Object with address data(street, house
number, city, etc) .. so I use Autocomplete to search for streets meanin ..
user writes in street name and dropdown shows .. street name and city in
wich street is in (meaning same streets can exists in different cities) ..
so when choice is selected only street is written to the text box .. and
when I wanted to use a converter same street names occur on many choices so
equals method is not appropriate for checking .. cause user might have
selected the 3rd choice and converter would get me an object with the first
one it finds .. and ... NO I cant pust city beside street in text field,
cause city is in it's own field ;) .. that's why I'm trying to get the
object autocomplete field and not this text autocomplete field ..

but hey .. thank you for your help ;)

regards

Armando
PS: cant believe nobody ever needed anything like this :D


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Autocomplete-get-model-object-tp3649960p3650048.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



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



Custom Validator Code

2011-07-05 Thread Christian Huber

Hi all,

just in case this is of interest for anyone, I posted some code for 
custom validators that I consider useful for web applications here: 
http://sanityresort.blogspot.com/2011/07/some-of-my-custom-validatiors-for.html


Feel free to let me know of any improvements or suggestions you have :-)

Cheers,
Chris

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



Re: Behaviors beforeRender broken

2011-07-01 Thread Christian Huber

Hi again.

Igor, thanks for your clarification, after changing isEnabled to return 
true the other callbacks do indeed get called.


But to be honest I am still a bit confused by this fact and would be 
grateful for further information. The javadoc of isEnabled says that it 
is called when a component _is_ rendering which gave me the impression 
that isEnabled should be called _after_ onConfigure and beforeRender.


Furthermore a component can be disabled but is still rendered (like a 
disabled checkbox) which in my opinion should still cause the rendering 
callbacks to be invoked. To my understanding that is not the case.


And last but not least, even though the behavior did return false in 
isEnabled the links it was attached to where fully functional which a 
disabled component should not be as far as I know.


All this leads me to the believe that my understanding of an enabled 
component in wicket terms s not correct. Any pointers would be greatly 
appreciated.


Cheers,
Chris

Am 30.06.2011 22:20, schrieb Christian Huber:

I just created a quick start with 1.4.17 where I added my behavior to
the single label created in the template page. This time in addition to
the methods mentioned below also getStatelessHint gets called but still
beforeRender etc are not called.

The label is still fully rendered. As Martin requested I created a JIRA
issue for this with my quickstart attached. The issue can be found here
https://issues.apache.org/jira/browse/WICKET-3854

Please let me know if that is sufficient or how I can provide more
information.

Am 30.06.2011 19:04, schrieb Igor Vaynberg:

just a hunch, but if the component to which the behavior is attached
to is not visible then none of the methods like before/after render
will be called since component is not rendering.

-igor

On Thu, Jun 30, 2011 at 9:48 AM, Christian
Huberhub...@butterbrot.org wrote:

I tried adding a dummy implementation of that interface that logs every
method call to custom subclass of link. While the links get rendered
regularly the only methods that get invoked are isTemporary, bind,
isEnabled
and detach. All other methods are never called, am I missing
something here?


Am 30.06.2011 17:35, schrieb Igor Vaynberg:


mixin IComponentConfigurationBehavior (1.4.17+ i believe) and
implement visibility toggling in onconfigure(component) of your
behavior.

-igor

On Thu, Jun 30, 2011 at 7:03 AM, Christian Huberhub...@butterbrot.org
wrote:


Hi all,

I wanted to use a Behavior to customize the components in my
application
(Wicket 1.4.2) by modifying some properties in the behaviors
beforeRender
method.

But I had to find that this method is never called, neither is
afterRender.
The other methods of the behavior are invoked but those are not
suitable
for
my needs (can't modify visibilty e.g. because that yields an
exception).

I found an bug entry about this problem and acording to the
comments this
seems to be a conecptual problem and won't be fixed.

So I was wondering if there is a suitable alternative to be used
instead
of
a behavior. For example I would like a component to decide for
itself if
it
should be visible in the current context by evaluating stuff like
login
status of the user or it's content.

Would be great if I could get some pointers on how to do this in a
sensible
way with wicket.

Cheers,
Chris

-
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




-
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



Behaviors beforeRender broken

2011-06-30 Thread Christian Huber

Hi all,

I wanted to use a Behavior to customize the components in my application 
(Wicket 1.4.2) by modifying some properties in the behaviors 
beforeRender method.


But I had to find that this method is never called, neither is 
afterRender. The other methods of the behavior are invoked but those are 
not suitable for my needs (can't modify visibilty e.g. because that 
yields an exception).


I found an bug entry about this problem and acording to the comments 
this seems to be a conecptual problem and won't be fixed.


So I was wondering if there is a suitable alternative to be used instead 
of a behavior. For example I would like a component to decide for itself 
if it should be visible in the current context by evaluating stuff like 
login status of the user or it's content.


Would be great if I could get some pointers on how to do this in a 
sensible way with wicket.


Cheers,
Chris

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



Re: Behaviors beforeRender broken

2011-06-30 Thread Christian Huber
I tried adding a dummy implementation of that interface that logs every 
method call to custom subclass of link. While the links get rendered 
regularly the only methods that get invoked are isTemporary, bind, 
isEnabled and detach. All other methods are never called, am I missing 
something here?



Am 30.06.2011 17:35, schrieb Igor Vaynberg:

mixin IComponentConfigurationBehavior (1.4.17+ i believe) and
implement visibility toggling in onconfigure(component) of your
behavior.

-igor

On Thu, Jun 30, 2011 at 7:03 AM, Christian Huberhub...@butterbrot.org  wrote:

Hi all,

I wanted to use a Behavior to customize the components in my application
(Wicket 1.4.2) by modifying some properties in the behaviors beforeRender
method.

But I had to find that this method is never called, neither is afterRender.
The other methods of the behavior are invoked but those are not suitable for
my needs (can't modify visibilty e.g. because that yields an exception).

I found an bug entry about this problem and acording to the comments this
seems to be a conecptual problem and won't be fixed.

So I was wondering if there is a suitable alternative to be used instead of
a behavior. For example I would like a component to decide for itself if it
should be visible in the current context by evaluating stuff like login
status of the user or it's content.

Would be great if I could get some pointers on how to do this in a sensible
way with wicket.

Cheers,
Chris

-
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: Behaviors beforeRender broken

2011-06-30 Thread Christian Huber
I just created a quick start with 1.4.17 where I added my behavior to 
the single label created in the template page. This time in addition to 
the methods mentioned below also getStatelessHint gets called but still 
beforeRender etc are not called.


The label is still fully rendered. As Martin requested I created a JIRA 
issue for this with my quickstart attached. The issue can be found here 
https://issues.apache.org/jira/browse/WICKET-3854


Please let me know if that is sufficient or how I can provide more 
information.


Am 30.06.2011 19:04, schrieb Igor Vaynberg:

just a hunch, but if the component to which the behavior is attached
to is not visible then none of the methods like before/after render
will be called since component is not rendering.

-igor

On Thu, Jun 30, 2011 at 9:48 AM, Christian Huberhub...@butterbrot.org  wrote:

I tried adding a dummy implementation of that interface that logs every
method call to custom subclass of link. While the links get rendered
regularly the only methods that get invoked are isTemporary, bind, isEnabled
and detach. All other methods are never called, am I missing something here?


Am 30.06.2011 17:35, schrieb Igor Vaynberg:


mixin IComponentConfigurationBehavior (1.4.17+ i believe) and
implement visibility toggling in onconfigure(component) of your
behavior.

-igor

On Thu, Jun 30, 2011 at 7:03 AM, Christian Huberhub...@butterbrot.org
  wrote:


Hi all,

I wanted to use a Behavior to customize the components in my application
(Wicket 1.4.2) by modifying some properties in the behaviors beforeRender
method.

But I had to find that this method is never called, neither is
afterRender.
The other methods of the behavior are invoked but those are not suitable
for
my needs (can't modify visibilty e.g. because that yields an exception).

I found an bug entry about this problem and acording to the comments this
seems to be a conecptual problem and won't be fixed.

So I was wondering if there is a suitable alternative to be used instead
of
a behavior. For example I would like a component to decide for itself if
it
should be visible in the current context by evaluating stuff like login
status of the user or it's content.

Would be great if I could get some pointers on how to do this in a
sensible
way with wicket.

Cheers,
Chris

-
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




-
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