Re: Redirect page via POST method

2012-10-08 Thread Matthias Keller

Hi

AFAIK you can only do that by returning a normal HTTP page with a form 
which is auto-submitted using javascript, for example in an onload handler.


Matt

On 08.10.2012 11:53, cosmindumy wrote:

Hello,
How can I go to a page with a given url with POST method, instead of using a
redirect page which uses GET method.
I want to send some private information from one to another as page
parameters.
Thanks.





smime.p7s
Description: S/MIME Cryptographic Signature


Re: What exactly is IWrapModel used for?

2012-08-09 Thread Matthias Keller

Hi Sven

Thanks for your explanations.
I do now see why there's this wrapper. However, the StringResourceModel 
appears to break its contract since every LoadableDetachableModel should 
be loaded using its load() method which cannot be used here!
I can fix this by just using delegation instead of subclassing but in my 
opinion this is just plain wrong that implementors need to know which 
classes may be overriden and which do not. We have several subclasses of 
StringResourceModel doing some special stuff like reducing all 
unresolved properties to the empty string or even returning a completely 
different String if not all expressions were resolved correctly (for 
cases where the model object itself is null and thus no properties can 
be resolved at all) etc...


This should either be fixed so that load() can be overriden and works as 
expected or then it should be made final with a notice why it's not 
supposed to be overridden.


Shall I open a JIRA for that?

Regards
Matt

On 06.08.2012 21:41, Sven Meier wrote:

Hi Matt,

I don't know about your example but the following makes perfect sense:

new Label(id, new StringResourceModel(foo));

This way the message is resolved relative to the label.

If the StringResourceModel's constructor is given a component 
argument, it doesn't make sense to pass it to other components as 
model, since it will be reassigned anyway.
AFAIK this variant is meant to be used ad-hoc without passing it to a 
component.


Maybe it would be better for your OurStringResourceModel *not* to 
extend StringResourceModel?


Sven


On 08/06/2012 06:38 PM, Matthias Keller wrote:

Hi

I'm having some trouble porting a 1.4 application to 1.5 since we're 
using our own subclass of a StringResourceModel implementing load() 
in a special way.
However, in some cases this does not work as our subclass might get 
wrapped in a AssignmentWrapper and since we do not provide the 
component instance (since it's not relevant for this model), load() 
is never called on our model but instead the load() method of the 
AssignmentWrapper calls the private getString() directly.


I don't see why a model should behave so differently whether it knows 
its component or not, and where's the point to do something like:

label = new Label(id);
model=new OurStringResourceModel(..., label);
label.setDefaultModel(model);

just to have load() called on our own model?

Could someone with some insight shed some light on it?

Thanks

Matt




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



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


What exactly is IWrapModel used for?

2012-08-06 Thread Matthias Keller

Hi

I'm having some trouble porting a 1.4 application to 1.5 since we're 
using our own subclass of a StringResourceModel implementing load() in a 
special way.
However, in some cases this does not work as our subclass might get 
wrapped in a AssignmentWrapper and since we do not provide the component 
instance (since it's not relevant for this model), load() is never 
called on our model but instead the load() method of the 
AssignmentWrapper calls the private getString() directly.


I don't see why a model should behave so differently whether it knows 
its component or not, and where's the point to do something like:

label = new Label(id);
model=new OurStringResourceModel(..., label);
label.setDefaultModel(model);

just to have load() called on our own model?

Could someone with some insight shed some light on it?

Thanks

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to Logout

2012-07-19 Thread Matthias Keller

Hi Paul

Thanks, I was able to fix this using your idea, even though I couldn't 
do this in the link itself since this URL is called from a lot of places.


Thanks again

Matt

On 18.07.2012 19:06, Paul Bors wrote:

There is no need to throw a RestartResponseAtInterceptPageException.
Simply redirect the user to the log-in page:

// Logout
Link logout = new Link(logout) {
 @Override
 public void onClick() {
 Session.session().invalidateNow();
 setResponsePage(LoginPage.class);
 }
};

~ Thank you,
Paul Bors

-Original Message-
From: Sébastien Gautrin [mailto:sgaut...@telemetris.com]
Sent: Wednesday, July 18, 2012 12:43 PM
To: users@wicket.apache.org
Subject: Re: How to Logout

Hi,

The LogoutPage in the application I work on is quite simple:
- first we invalidate the session with session.invalidateNow() like you do
- second we throw a RestartResponseAtInterceptPageException with the Page we 
want the user to go to after the logout process (actually we use it with the 
class of the Page we want, but you can pass it an instance of a Page).

Hope this will help.


 Original Message 
Subject: How to Logout
From: Matthias Keller matthias.kel...@ergon.ch
To: users@wicket.apache.org
Date: 2012-07-18


Hi

I'm trying to implement a simple logout mechanism with the need of
complete session termination.

For this I created a LogoutPage and mounted it using
mountPage(/logout, LogoutPage.class);

Now this page contains multiple components and a link to change
langugage etc, therefore it is stateful.
But when I perform a session.invalidate(Now)() in the page's
constructor, the user gets redirected to /logout?0 with a new session
ID. Probably though the page was stored in the previous session so it
doesn't exist with the new one, then he gets redirected back to
/logout, back to /logout?0 and so on.

What do I have to do to implement this simple logout page?

Thanks

Matt


-
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




--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Wicket 1.5 vs 1.4: StringResourcesModel with properties in the key

2012-07-18 Thread Matthias Keller

Hi

I'm currently migrating a project from 1.4 and am encountering a Problem 
with StringResourcesModel:


I've got one defined as:
new StringResourceModel(details.disabled.${disabled}, this.model)

isDisabled returns a boolean naturally.
In 1.4 this worked as expected and the resource keys 
details.disabled.true or details.disabled.false were taken.


Unfortunately, there's a default IConverter in place for boolean values 
since those usually needs to be displayed as yes and no (or alike in 
the other languages).
In Wicket 1.5, the StringResourceModel now does some heavier processing 
on the key, thus the boolean value is converted first using the 
registered converter and then inserted into the resource key; resulting 
in keys like details.disabled.yes or details.disabled.ja etc which 
are even language dependent!


Is there a possibility to revert to the previous behaviour except for 
overriding the StringResourceModel (and a lot of other classes) and 
except for removing the global boolean converter? The latter isn't 
doable as it would be nearly impossible to find out where those booleans 
are used throughout the pretty huge application


Thanks

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


How to Logout

2012-07-18 Thread Matthias Keller

Hi

I'm trying to implement a simple logout mechanism with the need of 
complete session termination.


For this I created a LogoutPage and mounted it using 
mountPage(/logout, LogoutPage.class);


Now this page contains multiple components and a link to change 
langugage etc, therefore it is stateful.
But when I perform a session.invalidate(Now)() in the page's 
constructor, the user gets redirected to /logout?0 with a new session 
ID. Probably though the page was stored in the previous session so it 
doesn't exist with the new one, then he gets redirected back to /logout, 
back to /logout?0 and so on.


What do I have to do to implement this simple logout page?

Thanks

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: PageParameters in 1.5: a sanity check request

2011-11-23 Thread Matthias Keller

Hi

And you can even leave away the

if(params.getNamedKeys().contains(parameter_name))

and just do:

StringValue param = params.get(param); // or use an index if you wish
if (!param.isEmpty()) {
... param.toString() ...
}

Matt

On 2011-11-23 12:17, vineet semwal wrote:

ListStringValue  liSVs = params.getValues([Param name]);
  if ((liSVs != null)  !liSVs.isEmpty())
  {
StringValue svValue = liSVs.get(0);
String sValue = svValue.toOptionalString();
...
  }

  you can just do
  if(params.getNamedKeys().contains(parameter_name))
{
  String svValue  =  params.get(parameter_name)
   String sValue  = svValue.toOptionalString();
  if(!Strings.isEmpty(sValue)){
--your code--
}
}

On Wed, Nov 23, 2011 at 4:06 PM, Ian Marshallianmarshall...@gmail.com  wrote:

I have ported my app from 1.4.18 to 1.5.1 (I haven't used 1.5.3 yet).

As part of my porting, I had to adjust the use of page parameters. I would
like to mention my changes for parameter extraction and existence
determination below, in case someone can mention a cleaner way to do these
things...

  import org.apache.wicket.util.string.StringValue;

Replace

  if (params.containsKey([Param name]))
  {
String sValue = params.getString([Param name]);
...
  }

with

  ListStringValue  liSVs = params.getValues([Param name]);
  if ((liSVs != null)  !liSVs.isEmpty())
  {
StringValue svValue = liSVs.get(0);
String sValue = svValue.toOptionalString();
...
  }

and replace

  String sUserName = params.getString([Key name], [Empty default string]);
  if (!sUserName.isEmpty())
...

with

  ListStringValue  liSVs = params.getValues([Param name]);
  if ((liSVs != null)  !liSVs.isEmpty())
...





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Difference b/w SetoutputMarkupId(true) and SetOutputMarkupHolderTag(true?)

2011-11-21 Thread Matthias Keller

Hi

setOutputMarkupId sets the id attribute of the HTML tag. This 
generally must be set if the tag shall be updated by AJAX
setOutputMarkupPlaceholderTag has the effect that a *hidden* component 
is still added to the HTML tree but - hidden. This is used, if the 
component is initially not visible (isVisible() == false) and would 
normally not leave a trace in the generated HTML file, thus it cannot be 
set visible by AJAX since it doesn't have a 'handle' to it. So it 
generally must be set to true if the component is to be updated by AJAX 
but is NOT initially visible.


Matt

On 2011-11-21 10:38, raju.ch wrote:

Can anyone tell me the difference b/w SetoutputMarkupId(true) and
SetOutputMarkupHolderTag(true)?




smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to clear PageMap in Wicket 1.5?

2011-11-14 Thread Matthias Keller

Hi Martin

Sorry for the delay, I was busy with other things recently.
Of course you're right, that clearing all pages, including the NextPage 
isn't a smart thing and I don't wanna do that anyway.
But what I need is away to redirect to a new (non-bookmarkable!) 
NextPage while clearing all other stored page instances.
I'll try to illustrate a flow; the user starts on the homepage  
HomePage. All pages are stateful:
HomePage click on a link AnotherPage click on the special Link we're 
talking about NextPage.
Now, when the user is on the NextPage of course all links on THAT page 
do have to work as expected. But all previous page instances (of 
HomePage and AnotherPage) must be cleared from the page store, so that 
if the user clicks BACK in his browser (and would go back to 
AnotherPage), a PageExpiredException must be thrown.
I can achieve that with Session.replaceSession() BEFORE calling 
setResponsePage(new NextPage()) - but this method has additional 
semantics (change the session ID) which I may not want to have.

That's why I came to

getSessionStore().invalidate(RequestCycle.get().getRequest());

which *appears* to do what I want but due to the lack of knowledge of 
the session/pagestore internals I cannot say if it's correct or 
sufficient to do that...


So the important bit is, that when calling a usable  Session.clear(), 
the current page shall not be stored in the session/pagestore anymore...


Thanks

Matt

On 2011-11-03 09:05, Martin Grigorov wrote:

Hi Matthias,

On Thu, Nov 3, 2011 at 9:30 AM, Matthias Keller
matthias.kel...@ergon.ch  wrote:

Hi Martin

I see this is getting in the same direction as it was with Wicket 1.4 - it
just doesn't work as expected.
The method you propose results in the next page shown as expected and going
back is not possible anymore. But so is clicking on anything on the next
page then - those links seem to be invalid then too...

The problem seems to be in the order of events:
1) The flow wishes to invalidate all current pages, so calls Session.clear()
2) Then the user is redirected to a new page with setResponsePage(new
NextPage())
3) Then the request ends and if cleaning up is performed at this stage, it
doesn't know to keep the NextPage and its links but clean everything else

No 3 could be addressed in wicket 1.4 using the internal untouch method to
tell wicket NOT to store that page anymore.

One question: what should happen when the user is redirected to
NextPage (because of setResponsePage(new NextPage())) and
the user clicks on a Link ?
Wicket will try to find the page to execute Link#onClick() but since
the page is not stored Wicket will throw PageExpiredException.
The same will happen if the user refreshes the page with F5.
How do you handle that case ?

Session.clear() removes all pages stored so far. If you use
setResponsePage(anInstance) then a new page will be stored afterwards.
If you really want to clear all pages even the NextPage instance then
you can do:

class MyRequestCycle extends RequestCycle {
   private boolean fullClean;

   public void fullClean() {
 fullClean = true;
   }

   @Override
   public void detach() {
 super.detach();

 if (fullClean) {
fullClean = false;
Session.get().clean();
 }
   }
}


What appears to work is create a public method in my session which calls:
getSessionStore().invalidate(RequestCycle.get().getRequest());

This seems to work (and is part of what replaceSession() does) but I don't
know the internals of the new PageManager et al so I'm not sure if this is
already enough and correct?

Matt

On 2011-11-02 13:27, Martin Grigorov wrote:

On Wed, Nov 2, 2011 at 2:09 PM, Matthias Keller
matthias.kel...@ergon.chwrote:

Hi Martin

Thanks for the quick reply.
The fix doesn't work for me though, I can still go back and press reload



or
do anything I like.
If I use session.replaceSession() it works as expected but as a side
effect
also changes the JSESSIONID which usually isn't what you want...

I'm using it like that in an onClick event of a button (and the session
is
NOT temporary):

if (getSession().isTemporary() == false) {
getSession().getPageManager().sessionExpired(getId());
}

This code does the same as in 1.4 with page maps.
#untouchPage() as internal API in 1.4 and is not ported to 1.5.

Try by override Session#detach() and do:
super.detach();
clear();


setResponsePage(new ConfirmationPage(...));

Maybe it could be some kind of special situation like it was in Wicket
1.4
where I manually had to untouch the current page to avoid it still being
stored at the end of the request...?

Matt


On 2011-11-02 10:40, Martin Grigorov wrote:

I implemented the feature in the ticket Matt created.
Please try it.

On Wed, Nov 2, 2011 at 11:35 AM, Andrea Del Beneadelb...@ciseonweb.it
  wrote:

Have you tried session.invalidate()? If you have an
AuthenticatedWebSession
you can also use signOut()

Hi

Upon logging out we need to keep the current

Re: How to clear PageMap in Wicket 1.5?

2011-11-03 Thread Matthias Keller

Hi Martin

I see this is getting in the same direction as it was with Wicket 1.4 - 
it just doesn't work as expected.
The method you propose results in the next page shown as expected and 
going back is not possible anymore. But so is clicking on anything on 
the next page then - those links seem to be invalid then too...


The problem seems to be in the order of events:
1) The flow wishes to invalidate all current pages, so calls Session.clear()
2) Then the user is redirected to a new page with setResponsePage(new 
NextPage())
3) Then the request ends and if cleaning up is performed at this stage, 
it doesn't know to keep the NextPage and its links but clean everything else


No 3 could be addressed in wicket 1.4 using the internal untouch method 
to tell wicket NOT to store that page anymore.


What appears to work is create a public method in my session which calls:
getSessionStore().invalidate(RequestCycle.get().getRequest());

This seems to work (and is part of what replaceSession() does) but I 
don't know the internals of the new PageManager et al so I'm not sure if 
this is already enough and correct?


Matt

On 2011-11-02 13:27, Martin Grigorov wrote:

On Wed, Nov 2, 2011 at 2:09 PM, Matthias Keller
matthias.kel...@ergon.ch  wrote:

Hi Martin

Thanks for the quick reply.
The fix doesn't work for me though, I can still go back and press reload or
do anything I like.
If I use session.replaceSession() it works as expected but as a side effect
also changes the JSESSIONID which usually isn't what you want...

I'm using it like that in an onClick event of a button (and the session is
NOT temporary):

if (getSession().isTemporary() == false) {
getSession().getPageManager().sessionExpired(getId());
}

This code does the same as in 1.4 with page maps.
#untouchPage() as internal API in 1.4 and is not ported to 1.5.

Try by override Session#detach() and do:
super.detach();
clear();


setResponsePage(new ConfirmationPage(...));

Maybe it could be some kind of special situation like it was in Wicket 1.4
where I manually had to untouch the current page to avoid it still being
stored at the end of the request...?

Matt


On 2011-11-02 10:40, Martin Grigorov wrote:

I implemented the feature in the ticket Matt created.
Please try it.

On Wed, Nov 2, 2011 at 11:35 AM, Andrea Del Beneadelb...@ciseonweb.it
  wrote:

Have you tried session.invalidate()? If you have an
AuthenticatedWebSession
you can also use signOut()

Hi

Upon logging out we need to keep the current user's session to still
display some information but we want to remove all previous pages from
the
PageMap (or however that is solved in Wicket 1.5 now) so that he cannot
go
back and continue on these pages.
In Wicket 1.4 we found a way to achieve that, basically with
  session.clear()  (plus  session.untouch(getPage())  ). In Wicket 1.5.2
the
clear() method ist still there, but only contains an empty TODO
comment

How do we clear the previous pages now so that if he goes back, the user
receives a PageExpiredError ?

Thanks a lot

Matt






smime.p7s
Description: S/MIME Cryptographic Signature


How to clear PageMap in Wicket 1.5?

2011-11-02 Thread Matthias Keller

Hi

Upon logging out we need to keep the current user's session to still 
display some information but we want to remove all previous pages from 
the PageMap (or however that is solved in Wicket 1.5 now) so that he 
cannot go back and continue on these pages.
In Wicket 1.4 we found a way to achieve that, basically with  
session.clear()  (plus  session.untouch(getPage())  ). In Wicket 1.5.2 
the clear() method ist still there, but only contains an empty TODO 
comment


How do we clear the previous pages now so that if he goes back, the user 
receives a PageExpiredError ?


Thanks a lot

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to clear PageMap in Wicket 1.5?

2011-11-02 Thread Matthias Keller

Hi Martin

Thanks for the quick reply.
The fix doesn't work for me though, I can still go back and press reload 
or do anything I like.
If I use session.replaceSession() it works as expected but as a side 
effect also changes the JSESSIONID which usually isn't what you want...


I'm using it like that in an onClick event of a button (and the session 
is NOT temporary):


if (getSession().isTemporary() == false) {
getSession().getPageManager().sessionExpired(getId());
}

setResponsePage(new ConfirmationPage(...));

Maybe it could be some kind of special situation like it was in Wicket 
1.4 where I manually had to untouch the current page to avoid it still 
being stored at the end of the request...?


Matt


On 2011-11-02 10:40, Martin Grigorov wrote:

I implemented the feature in the ticket Matt created.
Please try it.

On Wed, Nov 2, 2011 at 11:35 AM, Andrea Del Beneadelb...@ciseonweb.it  wrote:

Have you tried session.invalidate()? If you have an AuthenticatedWebSession
you can also use signOut()

Hi

Upon logging out we need to keep the current user's session to still
display some information but we want to remove all previous pages from the
PageMap (or however that is solved in Wicket 1.5 now) so that he cannot go
back and continue on these pages.
In Wicket 1.4 we found a way to achieve that, basically with
  session.clear()  (plus  session.untouch(getPage())  ). In Wicket 1.5.2 the
clear() method ist still there, but only contains an empty TODO comment

How do we clear the previous pages now so that if he goes back, the user
receives a PageExpiredError ?

Thanks a lot

Matt





smime.p7s
Description: S/MIME Cryptographic Signature


1.5.2: WebPageRenderer - The Buffered response should be handled by BufferedResponseRequestHandler

2011-10-24 Thread Matthias Keller

Hi

I've just upgraded to 1.5.2 and I'm now seeing a WARN that didn't occur 
with 1.5.1:
WebPageRenderer - The Buffered response should be handled by 
BufferedResponseRequestHandler


I'm seeing it on every page load...?
We're using a Wizard, if that makes a difference...

Thanks

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: 1.5.2: WebPageRenderer - The Buffered response should be handled by BufferedResponseRequestHandler

2011-10-24 Thread Matthias Keller

Hi Martin

Thanks for the quick reply. Is there a drawback with just ignoring the 
WARN message for now compared to your workaround?


Thanks
Matt

On 2011-10-24 10:58, Martin Grigorov wrote:

https://issues.apache.org/jira/browse/WICKET-4163

On Mon, Oct 24, 2011 at 10:46 AM, Matthias Keller
matthias.kel...@ergon.ch  wrote:

Hi

I've just upgraded to 1.5.2 and I'm now seeing a WARN that didn't occur with
1.5.1:
WebPageRenderer - The Buffered response should be handled by
BufferedResponseRequestHandler

I'm seeing it on every page load...?
We're using a Wizard, if that makes a difference...

Thanks

Matt










smime.p7s
Description: S/MIME Cryptographic Signature


Re: autocomplete js error in IE

2011-10-20 Thread Matthias Keller
I also see this error on the specified page with Internet Explorer 8 
(WinXP SP3)

It does not matter if I enable or disable the compatibility feature.

Matt

On 2011-10-20 13:54, Martin Grigorov wrote:

Works OK for me.
No JS errors. Tested with IE9 in different browser modes and document
modes. Including Quirks.
Is it possible that it is some IE setting ?

On Thu, Oct 20, 2011 at 2:49 PM, Ann Baertann.ba...@tvh.be  wrote:

A wicket autocomplete gives errors in Internet Explorer. The error is on
line 42 of wicket-autocomplete.js.
On that line stands the following code: objonkeyup=obj.onkeyup;
I'm using Wicket 1.5.1. And you can reproduce the problem on the wicket
examples: http://www.wicket-library.com/wicket-examples/ajax/autocomplete

I created a jira issue for this:
https://issues.apache.org/jira/browse/WICKET-4150





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Recommended way for wicket:for and markupIDs

2011-10-13 Thread Matthias Keller

On 2011-10-13 17:52, Igor Vaynberg wrote:

On Thu, Oct 13, 2011 at 2:08 AM, Martin Grigorovmgrigo...@apache.org  wrote:

wicket:for works as IComponentResolver, i.e. while rendering the final
markup Wicket will see a ComponentTag with the special 'wicket:for'
attribute and will transform it tolabel for=

Wicket can set automatically the this flag for and actually it does it:

if (!component.getOutputMarkupId())
{
component.setOutputMarkupId(true);  // HERE
if (!component.hasBeenRendered())   // BUG ?!
{
logger.warn(
Component: {} is referenced via a wicket:for attribute 
but does
not have its outputMarkupId property set to true,
component.toString(false));
}
}

But it could be too late if your markup looks like:input id=id1/
label for=id1.../label, i.e. the label will be rendered AFTER
the related form component and setting the flag will be too late.

@Igor: is it a bug the line with 'hasBeenRendered()' ? I think the
negation shouldn't be there.

indeed looks like a bug, fixing
Thanks a lot! That would explain why I'm seeing a lot of those messages 
even though we always have the label before the input field..


Now to my other question: What is the best way to combine wicket:for 
with JS that needs access to certain input fields? Wicket generates an 
ID so the JS somehow needs to know about it - is there an easy way to 
achieve that?


Thanks
Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Recommended way for wicket:for and markupIDs

2011-10-12 Thread Matthias Keller

Hi

I really like the wicket:for feature; makes writing the HTML pages much 
less tedious -- except that it appears I have to use  
setOutputMarkupId() on each and every referenced Component - is this how 
it is expected to work? I expected that those IDs should be set 
automatically without a warning in the log every time?

The wicket XHTML-Page also doesn't mention anything about that.
We're using Wicket 1.5.1

We will also have to access certain input fields by javascript methods, 
what's the recommended way to do this since we cannot determine the IDs 
beforehand?


Thank you very much

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: 1.5.1

2011-10-07 Thread Matthias Keller

Hi

Seems to be right here:

wicket:container wicket:id=entranceNameHeader..
You're missing an opening quote

Matt





smime.p7s
Description: S/MIME Cryptographic Signature


Wicket 1.5: How to stop execution after AbstractResource.respond() ?

2011-05-26 Thread Matthias Keller

We have a dynamically generated PDF we send to the user.
I figured out a way to do it, but while it works, it produces lots of 
stacktraces in wicket:


I created a PdfResource as subclass of ByteArrayResource.
When the user clicks the button, in the onClick() method we do:

PdfResource pdfResource = new PdfResource(data);
Attributes attrs = new Attributes(requestCycle.getRequest(), 
requestCycle.getResponse());

pdfResource.respond(attrs);

This works so far, except that wicket doesn't know the response has 
already been sent and tries to display the same page again - I somehow 
have to stop processing the response, but how do I do that?
In Wicket 1.4 I could just throw an AbortException() which did just 
that. How do I do that in Wicket 1.5 ?


Thanks
Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Wicket 1.5: How to stop execution after AbstractResource.respond() ?

2011-05-26 Thread Matthias Keller

Thanks Martin

Was looking for such an example but couldn't find one right away. Works 
like a charm even though I don't really understand what's going on - is 
there some reading about request handler internals in wicket 1.5 somewhere?

The wiki pages do not seem to reflect any 1.5 behaviour yet...

Thanks
Matt

On 2011-05-26 13:55, Martin Grigorov wrote:

see how org.apache.wicket.markup.html.link.DownloadLink.onClick() does it

On Thu, May 26, 2011 at 2:52 PM, Matthias Keller
matthias.kel...@ergon.ch  wrote:

We have a dynamically generated PDF we send to the user.
I figured out a way to do it, but while it works, it produces lots of
stacktraces in wicket:

I created a PdfResource as subclass of ByteArrayResource.
When the user clicks the button, in the onClick() method we do:

PdfResource pdfResource = new PdfResource(data);
Attributes attrs = new Attributes(requestCycle.getRequest(),
requestCycle.getResponse());
pdfResource.respond(attrs);

This works so far, except that wicket doesn't know the response has already
been sent and tries to display the same page again - I somehow have to stop
processing the response, but how do I do that?
In Wicket 1.4 I could just throw an AbortException() which did just that.
How do I do that in Wicket 1.5 ?

Thanks
Matt






smime.p7s
Description: S/MIME Cryptographic Signature


Wicket 1.5 and Request.getRelativePathPrefixToContextRoot() ?

2011-05-24 Thread Matthias Keller

Hi

I'm trying to migrate to 1.5 RC4.2 and I've just run into a method that 
cannot be resolved anymore:

Request.getRelativePathPrefixToContextRoot() seems to have disappeared?

I used it instead of using the context prefix to circumvent various 
issues with URL rewriting because of a reverse proxy in front of our 
application which changes the context path for the browser.

Relative URLs however work correctly even if it's rewritten.
Has this functionality been moved elsewhere?

Thanks a lot

Matt

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



Re: Wicket 1.5 and Request.getRelativePathPrefixToContextRoot() ?

2011-05-24 Thread Matthias Keller

Hi Martin

Thanks for your reply. I actually need this method in order to avoid 
having to rewrite URLs on the reverse proxy which might even be 
impossible, depending on the proxy being used.

Would be great if that method would come back!

Matt

On 2011-05-24 16:18, Martin Grigorov wrote:

The code is simplified and afaik there is no replacement for this method.
You say it works but do you still need similar functionality or you ask
just out of curiosity ?

On Tue, May 24, 2011 at 5:14 PM, Matthias Keller
matthias.kel...@ergon.chwrote:


Hi

I'm trying to migrate to 1.5 RC4.2 and I've just run into a method that
cannot be resolved anymore:
Request.getRelativePathPrefixToContextRoot() seems to have disappeared?

I used it instead of using the context prefix to circumvent various issues
with URL rewriting because of a reverse proxy in front of our application
which changes the context path for the browser.
Relative URLs however work correctly even if it's rewritten.
Has this functionality been moved elsewhere?

Thanks a lot

Matt

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









smime.p7s
Description: S/MIME Cryptographic Signature


Re: Wicket requests

2011-04-21 Thread Matthias Keller

Hi

Yes, wicket usually handles such things internally, saving you the 
overhead of multiple redirects. However, if you need to modify cookie 
data and you must rely on getting these infos back in the following 
request, you need to force a round trip to the client using 
setRedirect(true).
HOWEVER you might well run into trouble with that too, since the default 
strategy of wicket is to render the next page while still in the context 
of the previous one, then actually send the redirect and if the next 
request comes in, it just streams the cached page back. You can change 
the strategy used somewhere not to use those buffers, but this might 
have even other effects.. So such a situation is very tricky and you 
need to be well aware of that pre-rendering and buffering of the next 
page...


Matt

On 2011-04-21 09:10, Gabriel Teris wrote:

Hi,

I am quite new to wicket, and I am trying to better understand how the requests 
are handled.

My problem is this:
I have a landing page in my application, where I check if the session is a 
correct one(I have a parameter called sessionId which dictates the user's 
session). If the session is null, I create a cookie with the given parameter 
value, and if the session has an unexpected id I invalidate it and create a new 
cookie (as above).
Cookies are activated between requests, but as I see in Firebug there is only 
one request while displaying 3 pages!
Should I use setRedirect(true) on the page to force redirects? For page 
rendering I use the setResponse(Page.class) method, not page instantiation.
I also tried looking for detailed navigation in Wicket in Action and Pro Wicket 
books, but I didn't find anything detailed.





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Firefox 4: Modal windows redirect to invalid page, i.e WICKET-2207 in Firefox 4

2011-04-11 Thread Matthias Keller
I can confirm that an URL http://:/; is tried to be loaded in that 
process, although it does not result in an ugly yahoo page - as I dont 
have any yahoo toolbars installed. So the effect is NIL but that url 
nevertheless is being loaded (verified using firebug, Tab Net, then 
click on the link. You'll see that request as GET :.

I'm not sure where it comes from but it's there and it's definitely wrong.

Matt

On 2011-04-11 17:09, Alec Swan wrote:

Martin,

When I click on Show modal dialog with a page link on
http://wicketstuff.org/wicket14/ajax/modal-window I get redirected to
Yahoo search (probably because I have Yahoo toolbar installed) which
says:
Sorry, the page you were looking for could not be found. Showing
related results for: http://:/ 

I am on Firefox 4.0, Windows 7.

Alec

On Mon, Apr 11, 2011 at 12:57 AM, Martin Grigorovmgrigo...@apache.org  wrote:

http://wicketstuff.org/wicket14/ajax/modal-window works for me with FF4
please create a new ticket with a quickstart

On Sun, Apr 10, 2011 at 8:30 PM, Alec Swanalecs...@gmail.com  wrote:


Hello,

I just updated my Firefox to 4.0 and noticed that all modal windows on
my website no longer work. When I click a link to open a modal window
I get redirected to an invalid page.

This is similar to issue 2207
https://issues.apache.org/jira/browse/WICKET-2207. I don't have
privileges to reopen this issue, could anybody do this for me?

Thanks,





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Regarding WICKET-3321 not solved in Wicket 1.4.6

2011-02-24 Thread Matthias Keller

Hmm
Well the Issue sais it is fixed in 1.4.*16* not .6 ... and 1.4.16 is not 
yet released


Matt

On 2011-02-24 11:38, Muro Copenhagen wrote:

Hi,

I have been waiting for the fix of Wicket-3321.

It should have been solved in Wicket 1.4.6 according to the defect/jira
info: https://issues.apache.org/jira/browse/WICKET-3321

But i can't find it under the list of fixed issues in Wicket 1.4.6:
https://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=truemode=hidesorter/order=DESCsorter/field=prioritypid=12310561fixfor=12314470

And it appears that the problem still exists with Wicket 1.4.6.

Can anyone please explain why the defect has been abandoned in Wicket 1.4.6,
i have been waiting for
it for some time now.

Thanks in advance.

Muro







smime.p7s
Description: S/MIME Cryptographic Signature


Re: onInitialize / onBeforeRender

2011-02-10 Thread Matthias Keller

On 2011-02-10 17:49, Brown, Berlin [GCG-PFS] wrote:

Version: wicket1.4.13

Is there any reason onInitialize would not be called?  And is it always
called before onBeforeRender?  When I look at my logs, it looks like
there are cases where onInitialize wasn't called.  But onBeforeRender
was always called.
  

Just a quick thought:
Do you call super.onInitialize() in every onInitialize() mehod? Failing 
to do this could expose such a behaviour...


Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to remove all previous pages from pagemap

2011-01-26 Thread Matthias Keller

On 2011-01-25 18:20, Jeremy Thomerson wrote:

On Tue, Jan 25, 2011 at 11:14 AM, Matthias Keller wrote

Hi List

We've got the following scenario:
After a user hopped through a wizard, he'll reach a confirmation page in
our workflow. Now the session still needs to remain active but I want to
prohibit going back into the wizard and resend it again.
I experimented with  Session.clear()  and  Session.getPageMaps() and
calling pageMap.remove() on each instance returned, to no avail - after
clicking back, the user may still access the wizard again.

What's the correct way to 'expire' *all* previous pages so that going back
using the back-button is not possible anymore? And, where do I need to put
that specific code (at the end of the wizard after calling
setResponsePage(), in the onInitialize() of the confirmation page, ... ?


  Have you looked at IPageMap#clear()?  I'm not 100% sure where you are able
to put it.  I think you could put it just before calling setResponsePage.
  Not after, though (since setResponsePage throws an exception that stops
processing, your code wouldn't get called after it.)
Session.clear() does just this, it visits all pagemaps and calls clear() 
on them. Though this seems to clear up some things (when I get all 
pagemaps afterwards programmatically, they're gone), I can still go back 
with the back button and reload the pages as often as I like.
BTW, setResponsePage() does not throw any exceptions (at least not for 
1.4.X), it just stores the nexxt page somewhere in the RequestCycle for 
later usage.


It would be great if someone with deeper pagemaps-knowledge could chime 
in to find out the right place and way to clear all old pages...



Is there some cool debugging feature or call I'd could do to see all the

pages in the pagemaps with their versions et al in order to find out what to
call to clear that...

Add a dependency to wicket-devutils and then in your base page (hopefully
you have a base page for all your pages), add a DebugBar.  That will have
some links to the inspector, etc...

Thanks, I'll give it a shot this afternoon

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to remove all previous pages from pagemap

2011-01-26 Thread Matthias Keller

Hi Martijn

Yes I know that, but as I stated, it's still possible to reload that 
page and perform actions on it (they are *all* stateful pages) - I must 
know how I can suppress that. I don't care if the user goes back and 
sees the page from the cache but he mustn't be able to perform any 
actions on it which I could not avoid yet, my knowledge of the page 
store implementation is too shallow; I don't know why the user may still 
access the previous page even thought I issued a Session.clear() which 
will call IPageMap.clear() on all pagemaps... Maybe because it's the 
previous page and it cannot really be removed .. ?


Thanks for your input

Matt

On 2011-01-26 12:10, Martijn Dashorst wrote:

Unless you completely invalidated the browser/client side cache of
markup, people can still use the back button and will be presented
with the markup as it was rendered at that time. It is not until the
user performs an action at that page when wicket will try to retrieve
the page from the page store. And only then will it see that the page
is no longer available (provided the page was stateful, and the action
URL is not targetting a stateless action) and present the user with
page expired (or whatever you configured as the page expired page).

Martijn

On Wed, Jan 26, 2011 at 11:17 AM, Matthias Keller
matthias.kel...@ergon.ch  wrote:

On 2011-01-25 18:20, Jeremy Thomerson wrote:

On Tue, Jan 25, 2011 at 11:14 AM, Matthias Keller wrote

Hi List

We've got the following scenario:
After a user hopped through a wizard, he'll reach a confirmation page in
our workflow. Now the session still needs to remain active but I want to
prohibit going back into the wizard and resend it again.
I experimented with  Session.clear()  and  Session.getPageMaps() and
calling pageMap.remove() on each instance returned, to no avail - after
clicking back, the user may still access the wizard again.

What's the correct way to 'expire' *all* previous pages so that going
back
using the back-button is not possible anymore? And, where do I need to
put
that specific code (at the end of the wizard after calling
setResponsePage(), in the onInitialize() of the confirmation page, ... ?


  Have you looked at IPageMap#clear()?  I'm not 100% sure where you are
able
to put it.  I think you could put it just before calling setResponsePage.
  Not after, though (since setResponsePage throws an exception that stops
processing, your code wouldn't get called after it.)

Session.clear() does just this, it visits all pagemaps and calls clear() on
them. Though this seems to clear up some things (when I get all pagemaps
afterwards programmatically, they're gone), I can still go back with the
back button and reload the pages as often as I like.
BTW, setResponsePage() does not throw any exceptions (at least not for
1.4.X), it just stores the nexxt page somewhere in the RequestCycle for
later usage.

It would be great if someone with deeper pagemaps-knowledge could chime in
to find out the right place and way to clear all old pages...


Is there some cool debugging feature or call I'd could do to see all the

pages in the pagemaps with their versions et al in order to find out what
to
call to clear that...

Add a dependency to wicket-devutils and then in your base page (hopefully
you have a base page for all your pages), add a DebugBar.  That will have
some links to the inspector, etc...

Thanks, I'll give it a shot this afternoon

Matt










smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to remove all previous pages from pagemap

2011-01-26 Thread Matthias Keller

I now found one way to clear all previous pages.
I guess the reason is the REDIRECT_TO_BUFFER strategy (or however it's 
called) which both processes a button's onClick() event AND the next 
page's full initialization+rendering in one request. Thus the previous 
page (where the button was) is marked as 'touched' in the Session as 
well - no matter when I clear all the pagemaps, the previous page will 
just be re-added at the end of the request.
My current solution which solves this problem (although ugly) is the 
following code in the onClick:


// Make sure this page does NOT get stored at the end of the 
request

getSession().untouch(getPage());
// Clear all previous stored pages
getSession().clear();

// display the confirmation page
setResponsePage(new ConfirmationPage(...));

I still hope there's a better solution but this works for now


Does anyone know if there's the possibility to override the 
REDIRECT_TO_BUFFER strategy for a certain redirect? This would also 
solve this problem as then the Session.clear() would be executed in the 
next request after the onClick()


thanks

Matt

On 2011-01-25 18:14, Matthias Keller wrote:

Hi List

We've got the following scenario:
After a user hopped through a wizard, he'll reach a confirmation page 
in our workflow. Now the session still needs to remain active but I 
want to prohibit going back into the wizard and resend it again.
I experimented with  Session.clear()  and  Session.getPageMaps() and 
calling pageMap.remove() on each instance returned, to no avail - 
after clicking back, the user may still access the wizard again.


What's the correct way to 'expire' *all* previous pages so that going 
back using the back-button is not possible anymore? And, where do I 
need to put that specific code (at the end of the wizard after calling 
setResponsePage(), in the onInitialize() of the confirmation page, ... ?


Is there some cool debugging feature or call I'd could do to see all 
the pages in the pagemaps with their versions et al in order to find 
out what to call to clear that...?


Thank you very much

Matt





smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to remove all previous pages from pagemap

2011-01-26 Thread Matthias Keller

On 2011-01-26 15:49, Martijn Dashorst wrote:

On Wed, Jan 26, 2011 at 3:23 PM, Matthias Keller
matthias.kel...@ergon.ch  wrote:

My current solution which solves this problem (although ugly) is the
following code in the onClick:

You could try to see if setRedirect(true); works for you, and not
perform a setResponsePage( new Page()), but rather do a
setResponsePage(Page.class). However, that would make the confirmation
page bookmarkable, something you probably don't want :)

Ugly use case sometimes requires ugly code :-).. I don't think this is
ugly, it performs each step you need explicitly. The use case to
remove pages from the page map is not that common, so the story for
doing that is not as nice.

Perhaps something like a @DontStoreInPageMap annotation could be
used. This would put the page in the session, ensuring you still have
the stateful programming model and are able to work with the page as
if it were a normal wicket page. But the page would not be put in the
pagestore. I guess this would still work across clusters to support
failover: the current page would still be stored in the session,
making it available on all buddy nodes.

Martijn

Hi Marijn

Thanks for your reply

Well, if the code's ugly or not is one side - the time required to get 
to that point is the other side - I spent hours trying to figure out why 
Session.clear() apparently does not work. To understand that, a lot of 
insight into Request Cycles, PageMaps and Render Strategies is necessary.
I'd very much welcome a hook to alter the render strategy just for the 
next page. setRedirect(true) does not change the strategy and is the 
default in the (default) REDIRECT_TO_BUFFER strategy: In this case the 
next page is rendered and stored, then the user is redirected to a new 
url (to solve the Reload-after-POST problem) - the new url only serves 
the previously cached HTML code and does not call any hooks on the page 
itself (because it doesn't even know about it, I guess).
So what I'd need would be a kind of setRedirect() which switches to 
REDIRECT_TO_RENDER.


Matt




smime.p7s
Description: S/MIME Cryptographic Signature


How to remove all previous pages from pagemap

2011-01-25 Thread Matthias Keller

Hi List

We've got the following scenario:
After a user hopped through a wizard, he'll reach a confirmation page in 
our workflow. Now the session still needs to remain active but I want to 
prohibit going back into the wizard and resend it again.
I experimented with  Session.clear()  and  Session.getPageMaps() and 
calling pageMap.remove() on each instance returned, to no avail - after 
clicking back, the user may still access the wizard again.


What's the correct way to 'expire' *all* previous pages so that going 
back using the back-button is not possible anymore? And, where do I need 
to put that specific code (at the end of the wizard after calling 
setResponsePage(), in the onInitialize() of the confirmation page, ... ?


Is there some cool debugging feature or call I'd could do to see all the 
pages in the pagemaps with their versions et al in order to find out 
what to call to clear that...?


Thank you very much

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


wicket:message and property resolving

2010-12-22 Thread Matthias Keller

Hi

I just disovered by chance that it's possible to use property 
expressions in normal wicket:message key=.../ elements which then 
get resolved against the next model found in the hierarchy.
Unfortunately it seems to work a bit different to other automatic 
resolving like in new Label(property).


Example:
I've got a page with a WebMarkupContainer containing both a normal 
(wicket) label and a wicket:message in the HTML.


The page model's object has a method say  String getSomething()

Java:

WebMarkupContainer c = new WebMarkupContainer(container);
add(c);
c.add(new Label(something));

HTML:
div wicket:id=container
span wicket:id=something/
wicket:message key=myKey/
/div

Properties:
myKey = Here it is: ${something}

The Label works as expected and displays the return value of the  
getSomething() call.
The message fails with a big exception since it tries to get the model 
from the WebMarkupContainer and complains, that there's no  
getContainer() method...
Shouldn't this work the same way as with labels, by 'finding' the nex 
model available?
The quick solution is to give the WebMarkupContainer also the default 
model of the page which works but is not very nice...?


Is this a bug? Then I'll file a JIRA

Thanks

Matt




smime.p7s
Description: S/MIME Cryptographic Signature


Re: wicket:message and property resolving

2010-12-22 Thread Matthias Keller

Hi Andra

No no, that label is just to demonstrate my the effect that the Label 
works as expected but the message not. The wicket:message thingie 
works without a label at all.
I just don't know if it's even intended to be used like that and if yes, 
if my observations are correct and this is a bug


Matt

On 2010-12-22 15:01, Andrea Del Bene wrote:

Hi Matthias,

I think that label should go inside wicket:message tag, i. e.


wicket:message key=myKey
span wicket:id=something/
/wicket:message



Hi

I just disovered by chance that it's possible to use property 
expressions in normal wicket:message key=.../ elements which then 
get resolved against the next model found in the hierarchy.
Unfortunately it seems to work a bit different to other automatic 
resolving like in new Label(property).


Example:
I've got a page with a WebMarkupContainer containing both a normal 
(wicket) label and a wicket:message in the HTML.


The page model's object has a method say  String getSomething()

Java:

WebMarkupContainer c = new WebMarkupContainer(container);
add(c);
c.add(new Label(something));

HTML:
div wicket:id=container
span wicket:id=something/
wicket:message key=myKey/
/div

Properties:
myKey = Here it is: ${something}

The Label works as expected and displays the return value of the  
getSomething() call.
The message fails with a big exception since it tries to get the 
model from the WebMarkupContainer and complains, that there's no  
getContainer() method...
Shouldn't this work the same way as with labels, by 'finding' the nex 
model available?
The quick solution is to give the WebMarkupContainer also the default 
model of the page which works but is not very nice...?


Is this a bug? Then I'll file a JIRA

Thanks

Matt







smime.p7s
Description: S/MIME Cryptographic Signature


Re: Initial DropDown Blank Choice (Choose One) Disappearing

2010-12-20 Thread Matthias Keller

Hi eugene

See DropDownChoice#setNullValid(boolean)

Matt

On 2010-12-20 18:57, eugenebalt wrote:

In my DropDown, the initial choice is blank (Choose One), which I want to
keep. My selections allow N/A which means nothing is selected.

Initially on my form, the Choose One blank option is available, but after
I make a selection, it goes away. Do I need to manually add a blank option
to my dropdown so it doesn't go away? Thanks





smime.p7s
Description: S/MIME Cryptographic Signature


How to tackle field labels when using CompoundPropertyModels?

2010-12-16 Thread Matthias Keller

Hi

This is an issue I frequently run into and I haven't found a good 
solution yet:

I've got a Form using a CompoundPropertyModel and having lots of fields.
The easy way to do these fields is:
form.add(new RequiredTextFieldString(name));

The model object has a getter and setter for name, so all works well.
Unfortunately, when the user doesn't enter a valid value, the Required 
error message shows up saying something like Field 'name' is required.
I could have a resource key name in my translations but this has the 
limitation, that all name fields in my whole app are translated the 
same way. Maybe one name is a human name, the other one is a machine 
name which have different translations...
Is there an easy way to tackle this problem? For example have a prefix 
prepended to the field name or something else? One thing I want to avoid 
is to set an explicit label model for every field and if possible I'm 
hoping to avoid having to create different TextField subclasses for all 
my pages just prepending that string


How do you do this for large applications?
Currently, we're reverting to
form.add(new RequiredTextFieldString(somepage.name, new 
PropertyModelString(model, name)));

which kinda defeats the whole CompoundPropertyModel stuff

Thanks a lot

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to tackle field labels when using CompoundPropertyModels?

2010-12-16 Thread Matthias Keller

Hi James

Do you mean page or component scoped message properties files? Like 
MyPage.properties?
Unfortunately I don't see that as a solution because this would produce 
hundreds or properties files which would be a real nightmare to maintain 
(our customer wants *very* frequent text changes which are way easier to 
do if all translations are in one big file and also enables us to just 
send the customer one file for translation instead of hundreds).

Or is there another way to specify a prefix for a given component?

Thanks

Matt

On 2010-12-16 17:51, James Carman wrote:

You can use page or component scoped messages.

On Thu, Dec 16, 2010 at 11:48 AM, Matthias Keller
matthias.kel...@ergon.ch  wrote:

Hi

This is an issue I frequently run into and I haven't found a good solution
yet:
I've got a Form using a CompoundPropertyModel and having lots of fields.
The easy way to do these fields is:
form.add(new RequiredTextFieldString(name));

The model object has a getter and setter for name, so all works well.
Unfortunately, when the user doesn't enter a valid value, the Required error
message shows up saying something like Field 'name' is required.
I could have a resource key name in my translations but this has the
limitation, that all name fields in my whole app are translated the same
way. Maybe one name is a human name, the other one is a machine name which
have different translations...
Is there an easy way to tackle this problem? For example have a prefix
prepended to the field name or something else? One thing I want to avoid is
to set an explicit label model for every field and if possible I'm hoping to
avoid having to create different TextField subclasses for all my pages just
prepending that string

How do you do this for large applications?
Currently, we're reverting to
form.add(new RequiredTextFieldString(somepage.name, new
PropertyModelString(model, name)));
which kinda defeats the whole CompoundPropertyModel stuff

Thanks a lot

Matt







smime.p7s
Description: S/MIME Cryptographic Signature


Re: Logout (Session destroy) on the last (stateful) page?

2010-12-02 Thread Matthias Keller

Hi Randy

Yes it appears to have something to do with that. Our app uses the 
REDIRECT_BUFFER by default (we never actively configured this though) 
which appears to be a sensible option for normal operation. I'm not very 
familiar with the render strategies but you appear to be right: The page 
is actually rendered at the end of the previous request where the 
session is invalidated too. Then a redirect happens to the pre-rendered 
page which fails because the Session is already gone...


Is there any hook that will be called at the end of the second request 
serving the pre-rendered content?
I found a workaround for the moment: In the previous page, I explicitly 
set setRedirect(false); but this has the consequence that if the user 
hits reload on the confirmation page, he will first be asked about 
resending the POST parameters...


Anything we could do to invalidate the session at the end of the serving 
of the prerendered page?


Thanks a lot

Matt

On 2010-12-01 20:44, Randy S. wrote:

Does the redirect to the home page happen because of Wicket's default render
strategy (REDIRECT_TO_BUFFER) that causes two requests?  You invalidate
session on the first which redirects to the buffered response. When the
second request comes in expecting to get the already-rendered response, you
get a new session.


On Wed, Dec 1, 2010 at 11:53 AM, Martin Makundi
martin.maku...@koodaripalvelut.com  wrote:


Hi!

I am curious too. For this reason we had to build our logoutpage so
that it invalidtes session logically but not in httpsession sense.

Only clicking something from login page will do that.

But it's a hack, I would like to know what's the proper way ;)

**
Martin



2010/12/1 Matthias Kellermatthias.kel...@ergon.ch:

Hi

I've got the following problem:
After a user completes a wizard, he sees a last confirmation page

containing

some data, thus it must be a stateful page called by the following code

from

the wizard:

setResponsePage(new ConfirmationPage(myBean));

This ConfirmationPage must only be displayed once, thus if the user does

a

refresh it must not be available anymore.
I expected that I would be able to call  session.invalidate() from

somewhere

within the ConfirmationPage's onAfterRender or onDetach methods.
Unfortunately, whenever I do this, the user is automatically redirected

to

the home page without a trace in the logs
Any idea how to do that?

Thanks

Matt







smime.p7s
Description: S/MIME Cryptographic Signature


Re: Logout (Session destroy) on the last (stateful) page?

2010-12-02 Thread Matthias Keller

Hi Ernesto

No that's not possible because the ConfirmationPage is *stateful* and 
contains lots of information from the session/page state, so it must be 
allowed to display the pre-rendered page once but after that request, 
the session must be invalidated.


Thanks

Matt

On 2010-12-02 10:34, Ernesto Reinaldo Barreiro wrote:

Matt,

Can't you just do some kind of trick so that your ConfirmationPage is
served as the home page? So that you invalidate the session but at
getHomePage() you temporarily return your ConfirmationPage?

Regards,

Ernesto

On Thu, Dec 2, 2010 at 10:06 AM, Matthias Keller
matthias.kel...@ergon.ch  wrote:

Hi Randy

Yes it appears to have something to do with that. Our app uses the
REDIRECT_BUFFER by default (we never actively configured this though) which
appears to be a sensible option for normal operation. I'm not very familiar
with the render strategies but you appear to be right: The page is actually
rendered at the end of the previous request where the session is invalidated
too. Then a redirect happens to the pre-rendered page which fails because
the Session is already gone...

Is there any hook that will be called at the end of the second request
serving the pre-rendered content?
I found a workaround for the moment: In the previous page, I explicitly set
setRedirect(false); but this has the consequence that if the user hits
reload on the confirmation page, he will first be asked about resending the
POST parameters...

Anything we could do to invalidate the session at the end of the serving of
the prerendered page?

Thanks a lot

Matt

On 2010-12-01 20:44, Randy S. wrote:

Does the redirect to the home page happen because of Wicket's default
render
strategy (REDIRECT_TO_BUFFER) that causes two requests?  You invalidate
session on the first which redirects to the buffered response. When the
second request comes in expecting to get the already-rendered response,
you
get a new session.


On Wed, Dec 1, 2010 at 11:53 AM, Martin Makundi
martin.maku...@koodaripalvelut.comwrote:


Hi!

I am curious too. For this reason we had to build our logoutpage so
that it invalidtes session logically but not in httpsession sense.

Only clicking something from login page will do that.

But it's a hack, I would like to know what's the proper way ;)

**
Martin



2010/12/1 Matthias Kellermatthias.kel...@ergon.ch:

Hi

I've got the following problem:
After a user completes a wizard, he sees a last confirmation page

containing

some data, thus it must be a stateful page called by the following code

from

the wizard:

setResponsePage(new ConfirmationPage(myBean));

This ConfirmationPage must only be displayed once, thus if the user does

a

refresh it must not be available anymore.
I expected that I would be able to call  session.invalidate() from

somewhere

within the ConfirmationPage's onAfterRender or onDetach methods.
Unfortunately, whenever I do this, the user is automatically redirected

to

the home page without a trace in the logs
Any idea how to do that?

Thanks

Matt







smime.p7s
Description: S/MIME Cryptographic Signature


Logout (Session destroy) on the last (stateful) page?

2010-12-01 Thread Matthias Keller

Hi

I've got the following problem:
After a user completes a wizard, he sees a last confirmation page 
containing some data, thus it must be a stateful page called by the 
following code from the wizard:

setResponsePage(new ConfirmationPage(myBean));
This ConfirmationPage must only be displayed once, thus if the user does 
a refresh it must not be available anymore.
I expected that I would be able to call  session.invalidate() from 
somewhere within the ConfirmationPage's onAfterRender or onDetach methods.
Unfortunately, whenever I do this, the user is automatically redirected 
to the home page without a trace in the logs

Any idea how to do that?

Thanks

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: component not visible exception

2010-11-29 Thread Matthias Keller
One other thing to check is, do you have a custom isVisible() override 
in the container or do you explicitly set it to visible/invisible using 
setVisible()?
If the former, this logic will usually be re-evaluated upon form 
submission and if that logic depends on some state which might change 
upon submission, you might get exactly that error.


Matt

On 2010-11-29 20:21, Igor Vaynberg wrote:

another possibility, if this page is using hybrid url coding strategy,
is that the session expires and the form is submitted against a new
instance of the page - where the button is not visible.

-igor

On Mon, Nov 29, 2010 at 11:05 AM, Douglas Ferguson
doug...@douglasferguson.us  wrote:

The problem is that I can't recreate this error, but I see it in production 
alot.

So I have no way of looking at the action url.

D/


On Nov 29, 2010, at 12:59 PM, Igor Vaynberg wrote:


easy.

the form's action url points to a version of the page where the button
is not visible. so when the button is clicked and the form is
submitted wicket rolls back the version of the page to one where
button is not visible and you get the error. not sure that is what is
happening in your app, but its one possible explanation. look at
form's url and make sure none of your ajax actions are changing the
page version.

-igor

On Mon, Nov 29, 2010 at 10:41 AM, Douglas Ferguson
doug...@douglasferguson.us  wrote:

We do toggle the visibility of the web markup container that contains the 
button.

Here's how it works.

1) Page loads and the container is hidden
2) An ajax timer is used to watch for state to change
3) When state changes we make the container visible (which then makes the 
submit button visible)

How could they user manage to click on the save button when is it not visible?

The only thing I can think of is that this could be some back button issue.
But then again, I'm not sure how that would manifest...

D/

On Nov 29, 2010, at 11:25 AM, Igor Vaynberg wrote:


in order for component to be visible all of its parents have to be
visible from the page down to the component. same for the enabled
state.

-igor

On Mon, Nov 29, 2010 at 9:21 AM, Douglas Ferguson
doug...@douglasferguson.us  wrote:

Hmm... even if we aren't changing the visibility of the button?

On Nov 29, 2010, at 10:42 AM, Marco Mancini wrote:


try to set

mybutton.setOutputMarkupPlaceholderTag(true);

bye
marco

2010/11/29 Martin Grigorovmgrigo...@apache.org


On Mon, Nov 29, 2010 at 4:46 PM, Douglas Ferguson
doug...@douglasferguson.us  wrote:


We have not overridden isVisible, nor have we do we have a popup modal.
That's why I was asking if this could be a back button issue.

The only thing we do is set the button enabled. Could this be the problem
even thought he message it talking about visibility?


No. There is a separate check for enabled state. It is definitely for
visibility.


D/

On Nov 29, 2010, at 3:15 AM, Martin Grigorov wrote:


Here is another scenario:

Ajax request sets the visibility of the submit button (or its parent)

to

false but forgets to repaint the button so it is still visible for the

user.

Then the user clicks on this button, it fires and then the backend

shows

this message - the button is invisible so it cannot be clicked.

On Mon, Nov 29, 2010 at 9:04 AM, Chris Colman
chr...@stepaheadsoftware.comwrote:


A back button where?

The form is on a page and has a submit button only. If there is an

error

a ModalWindow pops up - it only has an OK button which is meant to

make

the ModalWindow simply disappear and thus re-enable the page beneath -
the one with the form on it.

Chris

-Original Message-
From: Douglas Ferguson [mailto:doug...@douglasferguson.us]
Sent: Monday, 29 November 2010 6:53 PM
To: users@wicket.apache.org
Subject: Re: component not visible exception

Could this be happening because of the back button?

D/

On Nov 28, 2010, at 4:54 AM, Chris Colman wrote:


I had a similar problem. In my scenario it occurred when a

ModalWindow

was brought up when a form failed validation. When they clicked ok

to

close the ModalWindow and then clicked Submit on the form again I

got

a

similar message saying that the Submit button was no longer visible.

It doesn't happen if I use the normal validation 'feedback' panel to
display the validation error messages.

Chris


-Original Message-
From: Douglas Ferguson [mailto:doug...@douglasferguson.us]
Sent: Saturday, 27 November 2010 3:13 AM
To: Wicket Mailing List List
Subject: component not visible exception

I have an error I've been seeing in the production logs for awhile

now

and

haven't been able to to figure it out.

My thought is that it is due to a stale page or the back button,

but

it

seems to me that it is happening alot, so I thought I might

inquire.

Any thoughts on what might be causing this and how to avoid it?

2010-11-26 08:36:36,676 ERROR [TP-Processor34] wicket.RequestCycle

-

Submit

Button add (path=dataPanel:contentCenterBox:addUserForm:add) is 

Re: visural-wicket 0.6.5 released!

2010-11-26 Thread Matthias Keller

Hi

Isn't this exactly the same as a wicket Palette ?

Matt

On 2010-11-26 15:42, Andrea Del Bene wrote:


Hi Richard and thank you for your work!

I've developed a custom multi select widget which is much more user 
friendly then classic HTML multiselect control. This widget looks like 
this: 
http://drupal.org/files/issues/filefield_sources_multiselect_widget_0.jpg. 
It's build upon standard Wicket ListMultipleChoice component and is 
customizable via CSS.
If you think that this kind of component could be useful I can send 
you source code and we can consider to integrate it into visural.


Bye!


Thanks for all the positive comments :)

If anyone has any suggestions / ideas for the next release (0.7) then 
let me

know.

Currently the only things on the RoadMap, are Wicket 1.5 support and 
some
refactoring on the DropDown control (which has become a bit of a 
maintenance

time-sink).

cheers,
RIch

On Fri, Nov 26, 2010 at 6:19 AM, Mark 
Doylemarkjohndo...@googlemail.comwrote:







smime.p7s
Description: S/MIME Cryptographic Signature


Re: visural-wicket 0.6.5 released!

2010-11-26 Thread Matthias Keller

Palette is in wicket-extensions at:
org.apache.wicket.extensions.markup.html.form.palette.Palette

The one listed as wicket.markup is actually extensions too when you 
click on it - it just appears to be misnomed on the index page


Matt


On 2010-11-26 16:20, Andrea Del Bene wrote:
Damn! Didn't know about the existence of this component. BTW, there 
are two examples about Palete (here 
http://wicketstuff.org/wicket14/compref/) and one is about 
wicket.markup.html.form.palette.Palette, but it seems that this class 
doesn't exist in Wicket source. Is this an error?

Hi

Isn't this exactly the same as a wicket Palette ?

Matt






smime.p7s
Description: S/MIME Cryptographic Signature


Re: close tag not found error in markup

2010-11-23 Thread Matthias Keller

Hi Andrea

The error is:

WicketMessage: close tag not found for tag: . Component: [MarkupContainer
[Component id = toolbar]]
I can't see a wicket:id=toolbar in your posted code, so the problem 
appears to be somewhere else on that page including the posted panel.

Try to find that toolbar - there appears to be the problem

Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Re: multilevel markup inheritance

2010-11-23 Thread Matthias Keller

Hi juraj

Absolutely no problem, wicket can handle that just easily.
Let's assume you've got a BasePage (containing for example the HTML 
header and the body tag), a LayoutPage (containing the main layout) 
and a specific page (Page1):


BasePage.html :
html
head.../head
body
wicket:childThis will be replaced by LayoutPage/wicket:child
/body
/html

LayoutPage.html :
wicket:extend
  ..layout stuff..
wicket:childThis will be replaced by Page1/wicket:child
  .. more layout stuff ..
/wicket:extend

Page1.html :
wicket:extend
  .. Page1 stuff ..
/wicket:extend

Matt

On 2010-11-23 14:31, Juraj Petko wrote:

Hello,
  i am starting to explorer this beautifull framework and want to make a
big use of markup inheritance. What i can't do is to make a page3, which
markup inherits from page2 and at the same time page2 markup inherits
from page1. Am i doing something wrong, or there is no support for this?
thanks, juraj 





smime.p7s
Description: S/MIME Cryptographic Signature


Re: close tag not found error in markup

2010-11-23 Thread Matthias Keller

Hi Andrea

Make sure you remove that whitespace in  span - that should be 
span and the same for / span - /span.

Valid HTML must not contain whitespace there.

Matt

On 2010-11-23 11:35, andrea.castello wrote:

I am very sorry, but it seems like a portion of the code I paste is being
stripped when I post it.

This is the code that's nested inside the thead tag

  span wicket:id = topToolbars
   span wicket:id = toolbar  / span


Hope it's readable now (all those whitespaces are not in the original code,
just a trick to make it readable..)

A.





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Free wicket from component hierarchy hell

2010-11-09 Thread Matthias Keller

Hi Martin

Isn't this exactly the reason we've got CSS?
HTML shouldn't really be used for lookfeel and the size and placement 
of components can perfectly be defined using CSS classes.


Matt

On 2010-11-09 13:34, Martin Makundi wrote:

Also making skins for different devices / screen sizes becomes easier.

**
Martin

2010/11/9 Vitaly Tsaplinvitaly.tsap...@gmail.com:

In simple cases it makes no difference. It makes real difference with
some complex widgets (for example search components) that must be
reused on many pages and they should render differently on each page
depending on how much space and what context they are in. I don't like
duplicating code even if it is gui code.

Sounds like the first appealing argument slowly comming out of
surrounding fuzz =)





smime.p7s
Description: S/MIME Cryptographic Signature


Re: StringResourceModel - On the Fly

2010-09-07 Thread Matthias Keller

Hi

Why not use one of the various methods on the localizer?
getLocalizer().getString(...)
Or if not in a component
Application.get().getResourceSettings().getLocalizer().getString(...)

Matt

On 2010-09-06 19:26, msantos wrote:

Thats solve the problem. I already have a resource bundle on the application,
but i was trying to eliminate it and just use the wicket StringResourceModel
witch is more easy to maintain all the pages of the application.

If there is no way to get the string from the .properties file of the page
on that moment, a i guess i will use the Java ResourceBundle.

Thank you all
   






smime.p7s
Description: S/MIME Cryptographic Signature


Re: AutoCompleteTextField

2010-08-19 Thread Matthias Keller

On 2010-08-19 15:00, Patrick Petermair wrote:

armandoxxx schrieb:
You need to be able to select multiple items from autocomplete 
dropdown list
with just DOWN key ??? 


No, I want to select a single item - but out of a list of all the items.
Take the example at:
www.wicket-library.com/wicket-examples/ajax/autocomplete

The user starts typing a and the AutoCompleteTextField suggests the 
values Algeria, Austria, Australia, etc.
In my usecase, the user wants to press the down key and be presented 
with a list of all the countries so that he can navigate through them 
with the up  down keys.


Let's say a user has 100 possible choices .. then it makes sense to 
type in the first few letters until he is down to probably 5 choices 
or so. But another user may have only 3 possible choices. For him it 
would be better to just use the down key right away and select the 
value he wants instead of having him type a letter first.. 

Wouldn't it be enough to just let the list show on focus and on empty input?

Use:
AutoCompleteSettings settings = new AutoCompleteSettings();
settings.setShowListOnEmptyInput(true);
settings.setShowListOnFocusGain(true);
// and possibly other settings as needed

And then specify those settings in the constructor..

Matt




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Session.replaceSession() behavior

2010-06-25 Thread Matthias Keller

Hi Doug

As described in the javadoc, the replaceSession() only replaces the 
(underlying) HTTP Session to help against session fixation attacks.
What is your goal exactly? If the user logs in and still has an earlier 
session, that that one will be destroyed?
In that case consider to use  session.invalidateNow()  to immediately 
destroy the (old) session and then create a new one.
Notice: When using invalidateNow() and creating a new one, the static 
method  Session.get() will still get you the previous (destroyed) 
session while being in the same call...


Matt

On 2010-06-24 20:13, Doug Leeper wrote:

I was under the impression that when I call Session.replaceSession() a new 
session would be created.

I am seeing a new HttpServletSession being created but not my wicket application session. 
 I have placed a System.out.println( new AppSession()... ) in the constructor 
and I am not seeing that.

Can anyone confirm this behavior as well?  Is this a bug?  Is there a work 
around?

I am using Wicket 1.4.9

BTW...my use case is someone goes to the LoginPage and logs in, the previous 
session will be cleared.

Multi-window support is also on (however...changing this doesn't affect the 
outcome)

Thanks
- Doug
   





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Help me speed up my Wicket

2010-05-20 Thread Matthias Keller
And it would not speed up page loading at all since in the end, the same 
data would have to be transferred but splitted into multiple requests 
which adds the request overhead to the total loading time compared to 
the prepared complete page.


On 2010-05-20 10:25, Martin Makundi wrote:

Would this not flicker a lot?

**
Martin

2010/5/20 nino martinez waelnino.martinez.w...@gmail.com:
   

ok the idea are this:

First render the page with out the grid.
Then add the empty grid
Then add row 1 to grid
Adding row 1 triggers a new request adding row 2 and so on until all
rows are loaded..

All done with ajax.

It's just an idea, but I think it should help. However it causes more
load on the server I think.

2010/5/20 Martin Makundimartin.maku...@koodaripalvelut.com:
 





smime.p7s
Description: S/MIME Cryptographic Signature


AutoCompleteTextField uses wrong encoding?

2010-05-10 Thread Matthias Keller

Hi

I'm using an autocompletefield and it works fine so far. Except that 
when entering special characters, they don't get encoded correctly.
The query String is correct and sends the special character in encoded 
UTF-8:

GET http://localhost:9080/.../...q=%C3%B6random=...
%C3%B6 is UTF8 for ö

But in:
org.apache.wicket.extensions.ajax.markup.html.autocomplete.AbstractAutoCompleteBehavior.respond(AjaxRequestTarget)
The following line
final String val = requestCycle.getRequest().getParameter(q);
returns an incorrect string: ö which would be the %C3%B6 in 
ISO-8859-1 (which happens to be my platform encoding)...
Thus the input parameter to my getChoices() call contains strange 
characters in this case...


It appears that the request isn't read out as UTF-8 somehow.. Since I 
don't know the AJAX internals, it's hard to find the culprit for me


I'm using Wicket 1.4.8

Matt




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Choose One Text Without Property File?

2010-03-24 Thread Matthias Keller

Hi Brad

You'd probably have to subclass DropDownChoice and override the method 
getDefaultChoice() to return whatever value you'd like.


Matt

On 2010-03-24 16:45, Brad Grier wrote:

I'd like to be able to change the Choose One text for a DropDownChoice 
without using a property file. I have a dynamic form generator and I need the user to be 
able to designate the verbiage. Is this possible?

Thanks,
Brad
   






smime.p7s
Description: S/MIME Cryptographic Signature


Re: V1.4 Decision

2010-03-18 Thread Matthias Keller

Hi Karmien

Wicket 1.3.X is not supported anymore as far as I know, so there will 
most probably be no more updates for it.
Go for 1.4, it's been around for very long and most components are 
updated to 1.4 in a breeze (given that you have access to their source 
code). If no models are involved, they might even continue to work 
without changes


Matt

On 2010-03-18 10:50, karmi...@absa.co.za wrote:

Hi

I have a general question, we are at the verge of starting a big, newish
project, with potentially many developers on Wicket and we need to
decide which version to base it on. The obvious choice is to choose
v1.4.x (latest) but we need Enterprise type components (like Security)
in the development, which many still are 1.3 based. What would you
recommend?

Thanks
Karmien





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Select the Choose one of a required DropDownChoice

2010-03-18 Thread Matthias Keller

Hi

Have a look at DropDownChoice.setNullValid() and .setRequired()

Matt

On 2010-03-18 14:26, David Chang wrote:

Hi, I am new in Wicket and am playing with different components.

I have a two dropdown lists. One is a list of countries, required field, 
controlling another list of states/provinces via 
AjaxFormComponentUpdatingBehavior.

The country list always has a blank (equivalent of Choose one) as the first 
option in the list. When I select different countries, the state/province list changes 
accordingly. However, when I change to the blank in the country list, the state list 
stops updating. I looked into it and found out that in this situation (required droopdown 
list) selecting blank makes Wicket issue a feedback message instead of calling 
AjaxFormComponentUpdatingBehavior#onUpdate, which is what I want.

What can I do to make Wicket the way I want?

Thanks!





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Make FeedbackPanel occupy zero space when having no messages?

2010-03-18 Thread Matthias Keller

Hi

Just create your own FeedbackPanel subclass and add:

public boolean isVisible () {
return anyMessage();
}

Matt

On 2010-03-18 14:32, David Chang wrote:

Hello, I am playing with FeedbackPanel. I put it in a page like this:

div wicket:id=feedbackHolder /

I notice that when having no messages, it always take up some space.

How can I make FeedbackPanel occupy zero space when having no messages?

Wicket way? or CSS?

Any help is really appreciated.





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Select the Choose one of a required DropDownChoice

2010-03-18 Thread Matthias Keller

Hi

Yes, exactly, but why do you have it set to required at all in first 
place if you want to allow the empty selection too?
I dont think a DropDownChoice is required by default but if it is, try  
setRequired(false) ...


Matt

On 2010-03-18 14:36, David Chang wrote:

Matt, I already did that.

DropDownChoice.setNullValid() makes Choose one always stay there.
I notice that DropDownChoice.setRequired() is the reason to generate the 
message and not get onUpdate called.

Thanks.


--- On Thu, 3/18/10, Matthias Kellermatthias.kel...@ergon.ch  wrote:

   

From: Matthias Kellermatthias.kel...@ergon.ch
Subject: Re: Select the Choose one of a required DropDownChoice
To: users@wicket.apache.org
Date: Thursday, March 18, 2010, 9:30 AM
Hi

Have a look at DropDownChoice.setNullValid() and
.setRequired()

Matt

On 2010-03-18 14:26, David Chang wrote:
 

Hi, I am new in Wicket and am playing with different
   

components.
 

I have a two dropdown lists. One is a list of
   

countries, required field, controlling another list of
states/provinces via AjaxFormComponentUpdatingBehavior.
 

The country list always has a blank (equivalent of
   

Choose one) as the first option in the list. When I select
different countries, the state/province list changes
accordingly. However, when I change to the blank in the
country list, the state list stops updating. I looked into
it and found out that in this situation (required droopdown
list) selecting blank makes Wicket issue a feedback message
instead of calling
AjaxFormComponentUpdatingBehavior#onUpdate, which is what I
want.
 






smime.p7s
Description: S/MIME Cryptographic Signature


Re: A question about using Spring in Wicket 1.4

2010-03-11 Thread Matthias Keller

Hi David

addComponentInstantiationListener(new SpringComponentInjector(this));

is correct, as there is no add() method in Application.

Matt

On 2010-03-11 15:14, David Chang wrote:

James, thanks for quick reply. I guess I am a little confused is that in the 
init method, I use

addComponentInstantiationListener(new SpringComponentInjector(this));

instead of

add(new SpringComponentInjector(this));

as Migrating guide specified. The Guide-specified approach actually generates 
compiler error.

Regards.


--- On Thu, 3/11/10, James Carmanjcar...@carmanconsulting.com  wrote:

   

From: James Carmanjcar...@carmanconsulting.com
Subject: Re: A question about using Spring in Wicket 1.4
To: users@wicket.apache.org
Date: Thursday, March 11, 2010, 9:09 AM
yes

On Thu, Mar 11, 2010 at 8:56 AM, David Changdavid_q_zh...@yahoo.com
wrote:
 

Yesterday I was looking at the page Migrating to
   

Wicket 1.4
 

http://cwiki.apache.org/WICKET/migrating-to-wicket-14.html

Regarding SpringWebApplication, it says:

SpringWebApplication has been deprecated in favor of
   

SpringBean annotation. See SpringWebApplication javadoc for
how to setup SpringBean based injection.
 

I went to Wicket API about SpringWebApplication and it
   

says:
 

Deprecated. when using java5 it is preferrable to use
   

SpringBean annotations for injection rather then this
spring-specific application subclass with its helpers. To
setup SpringBean add the following line to your
WebApplication subclass init method add(new
SpringComponentInjector(this));
 

Here is my way of using Spring in my wicket app.

1. In the init method:

addComponentInstantiationListener(new
   

SpringComponentInjector(this));
 

Please note that it is not: add(new
   

SpringComponentInjector(this));
 

2. In wicket components that access Spring beans:

@SpringBean
private SupportService supportService;


Am I doing Spring in Wicket right way?

Thanks for input!





   





smime.p7s
Description: S/MIME Cryptographic Signature


Re: modal window problem

2010-03-08 Thread Matthias Keller

On 2010-03-08 17:07, Martin Asenov wrote:

It's me again. I just noticed some very strange error that I have no 
explanation about. When I open a wicket modal window then it appears for a 
while and closes and the entire page gets redirected to some browser related 
pages, for instance ask.com, or some thing like this:

http://www.mybrowserbar.com/cgi/errors.cgi?q=http%3A%2F%2F%3A%2Ftype=dnsISN=29A2367D3BED40D7A5BA3349E8CAA9FDccv=130cnid=374563cco=USct=12

This is a modal window issue. Any help regarding the question will be highly 
appreciated!
   

Hi

It appears that something on your page/modal window is referencing an 
URL http://:/; (or maybe just :/) so your browser bar takes over 
control since that host cannot be found. Maybe check the source of that 
page for such an URL...


Matt



smime.p7s
Description: S/MIME Cryptographic Signature


Wicket Multi-Threading with access to the session

2010-02-10 Thread Matthias Keller

Hi

We have a complex application which needs to calculate some very 
expensive things. Those could easily be parallelized so we thought about 
having a thread pool to do that.
Unfortunately, that code needs access to the localizer and the 
application (for some configuration values) so we're setting the Session 
and the Application explicitly in that thread using  Application.set() 
and  Session.set().
But this always leads to a strange error - I suspect it has something to 
do with the 'duplicated' session or application?


Any hints about how to do this correctly? Do we need to do something 
special with the session or application at the end of the thread?


Thanks!

Matt


Here's the stacktrace:

WicketMessage: Method onFormSubmitted of interface 
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component 
[MarkupContainer [Component id = SignupForm]] threw an exception

Root cause:

ExceptionConverter: java.io.IOException: No message found for 
the.document.has.no.pages

Complete stack:

org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of interface 
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component 
[MarkupContainer [Component id = SignupForm]] threw an exception
at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:194)
at 
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355)

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:183)
at 
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355)





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Wicket Multi-Threading with access to the session

2010-02-10 Thread Matthias Keller

Hi Ernesto

Thanks for your reply. This would basically be possible but very 
complicated because the threads need dozens to hundreds of values, so it 
would be a very tedious and complicated task to collect everything in 
advance just to pass it to those threads.


Matt

On 2010-02-10 12:18, Ernesto Reinaldo Barreiro wrote:

Why not just collect the information you need and pass it to the thread?
Can't you know in advance which localized values you are going to need?

Best,

Ernesto


On Wed, Feb 10, 2010 at 12:08 PM, Matthias Keller
matthias.kel...@ergon.chwrote:

   

Hi

We have a complex application which needs to calculate some very expensive
things. Those could easily be parallelized so we thought about having a
thread pool to do that.
Unfortunately, that code needs access to the localizer and the application
(for some configuration values) so we're setting the Session and the
Application explicitly in that thread using  Application.set() and
  Session.set().
But this always leads to a strange error - I suspect it has something to do
with the 'duplicated' session or application?

Any hints about how to do this correctly? Do we need to do something
special with the session or application at the end of the thread?

Thanks!

Matt


Here's the stacktrace:

WicketMessage: Method onFormSubmitted of interface
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component
[MarkupContainer [Component id = SignupForm]] threw an exception

Root cause:

ExceptionConverter: java.io.IOException: No message found for
the.document.has.no.pages

Complete stack:

org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
component [MarkupContainer [Component id = SignupForm]] threw an exception
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:194)
at
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355)

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:183)
at
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355)




 
   



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to use DateTimeField with java.sql.Timestamp

2009-12-17 Thread Matthias Keller
DateTimeField internally uses a DateTextField which is a normal 
TextField initialized as type java.util.Date


You could create a class:

public class TimestampField extends DateTimeField {
   protected DateTextField newDateTextField(String id, PropertyModel 
dateFieldModel)

   {
   return new DateTextField(id, dateFieldModel, new 
StyleTimestampConverter(false));

   }
}

This allows you to create your own converter which results in a 
Timestamp object.
you could for example just extend StyleDateConverter to take advantage 
of its implementation and in your override of convertToObject() you 
could convert the super.convertToObject() Date to Timestamp


Matt

chinedu efoagui wrote:

Hello,
I am very new to Wicket
I am building an application that requires a Datetimefield

The field in my database 'timein' is datetime.

The pojo object accepts a java.sql.Timestamp
  /**
* Returns the value of the codetimein/code property.
*
*/
   @Column(name = timein  )
   public java.sql.Timestamp getTimein() {
  return timein;
   }

   /**
* Sets the value of the codetimein/code property.
*
* @param timein the value for the codetimein/code property
*/
   public void setTimein(java.sql.Timestamp timein) {
  this.timein = timein;
   }
but the DateTimefield uses java.util.get

when i save the form to the database i get this error below

org.apache.wicket.WicketRuntimeException: Error calling method: public
void 
org.apache.wicket.extensions.yui.calendar.DateTimeField.setDate(java.util.Date)
on object: [MarkupContainer [Component id = timein]]
at 
org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(PropertyResolver.java:1133)
at 
org.apache.wicket.util.lang.PropertyResolver$ObjectAndGetSetter.setValue(PropertyResolver.java:588)
at 
org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.java:136)
at 
org.apache.wicket.model.AbstractPropertyModel.setObject(AbstractPropertyModel.java:169)
at 
org.apache.wicket.Component.setDefaultModelObject(Component.java:3052)
at 
org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
at 
org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:225)
at 
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514)
at 
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
at 
org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493)
Caused by: org.apache.wicket.WicketRuntimeException: Error calling
method: public void
com.mw.hr.entity.personnelrecordsattendance.PersonnelrecordsAttendance.setTimein(java.sql.Timestamp)
on object: 
com.mw.hr.entity.personnelrecordsattendance.personnelrecordsattenda...@1f0c408
at 
org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(PropertyResolver.java:1138)
at 
org.apache.wicket.util.lang.PropertyResolver$ObjectAndGetSetter.setValue(PropertyResolver.java:588)
at 
org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.java:136)
at 
org.apache.wicket.model.AbstractPropertyModel.setObject(AbstractPropertyModel.java:169)
at 
org.apache.wicket.Component.setDefaultModelObject(Component.java:3052)
at 
org.apache.wicket.extensions.yui.calendar.DateTimeField.setDate(DateTimeField.java:239)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(PropertyResolver.java:1129)
... 51 more

please can i get an idea or sample code to convert the input from the
datetimefiled to java.sql.timestamp??

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

  



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


AutocompleteTextField in wicket 1.3.6 ?

2009-12-02 Thread Matthias Keller

Hi

I just tried to add a AutocompleteTextField to a 1.3.6 application but 
it doesn't seem to work.
I copied the exact example from 
http://www.wicket-library.com/wicket-examples/ajax/autocomplete and 
removed the generics for 1.3.6
Yet still no matter if I enter anything or not, no autocomplete shows up 
and the ajax debug stays completely empty...


Is there anything else to try or is there something more required to get 
it to work in 1.3.6 as opposed to 1.4.x ?


Thanks a lot

Matt

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Re: EntityModel

2009-11-12 Thread Matthias Keller

Injection is easy

Just call:
InjectorHolder.getInjector().inject(this);
in your EntityModel constructor.

That's it.
While developing if you hot-redeploy often, you might also want to do a 
check in load() like:

if (this.whateverService == null)
   InjectorHolder.getInjector().inject(this);

Matt

Sam Barrow wrote:

Yes that shouldn't be a problem I just need to figure out the injection,
how do you do this? I use wicket-spring also.

On Thu, 2009-11-12 at 08:53 +0100, Matthias Keller wrote:
  

Hi Sam

We use Spring to inject them.
Well, somewhere you'll need that logic what class is loaded by which 
repo - you could of course do it in a more generic way using factories 
or a kind of a mapper or whatever...

Since we only have around 10 classes, this is easy.

If you use hibernate, you can have it for free since you can instruct 
hibernate to load the instance given the class and the id, for example:

T entity =  entityManager.find(entityClass, id);

Matt

Sam Barrow wrote:


We have close to a hundred repositories, this wouldn't work. How do you
inject the services into the EntityModel anyway?

On Thu, 2009-11-12 at 08:34 +0100, Matthias Keller wrote:
  
  

Hi Sam

What exactly do you mean by repository? Do you have to load every entity 
from another place?
in load(), we have the code to load every possible entity in our 
implementation, for example:


T entity;
if (this.clazz == User.class) {
entity = userService.load(...);
} else if (this.clazz == Company.class) {
entity = companyService.load(...);
} else .

And so on. In the end, the entity is loaded from wherever it is defined 
for this class...


Matt

Sam Barrow wrote:



Does anybody how to pass a smart EntityModel (link below) to another
page? We use a different repository for each entity type. I can't get it
to work. I have tried storing the repository as a field on the
EntityModel and using an abstract method on EntityModel to retrieve it.

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/
  
  
  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: EntityModel

2009-11-11 Thread Matthias Keller

Hi Sam

What exactly do you mean by repository? Do you have to load every entity 
from another place?
in load(), we have the code to load every possible entity in our 
implementation, for example:


T entity;
if (this.clazz == User.class) {
   entity = userService.load(...);
} else if (this.clazz == Company.class) {
   entity = companyService.load(...);
} else .

And so on. In the end, the entity is loaded from wherever it is defined 
for this class...


Matt

Sam Barrow wrote:

Does anybody how to pass a smart EntityModel (link below) to another
page? We use a different repository for each entity type. I can't get it
to work. I have tried storing the repository as a field on the
EntityModel and using an abstract method on EntityModel to retrieve it.

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/
  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: EntityModel

2009-11-11 Thread Matthias Keller

Hi Sam

We use Spring to inject them.
Well, somewhere you'll need that logic what class is loaded by which 
repo - you could of course do it in a more generic way using factories 
or a kind of a mapper or whatever...

Since we only have around 10 classes, this is easy.

If you use hibernate, you can have it for free since you can instruct 
hibernate to load the instance given the class and the id, for example:

T entity =  entityManager.find(entityClass, id);

Matt

Sam Barrow wrote:

We have close to a hundred repositories, this wouldn't work. How do you
inject the services into the EntityModel anyway?

On Thu, 2009-11-12 at 08:34 +0100, Matthias Keller wrote:
  

Hi Sam

What exactly do you mean by repository? Do you have to load every entity 
from another place?
in load(), we have the code to load every possible entity in our 
implementation, for example:


T entity;
if (this.clazz == User.class) {
entity = userService.load(...);
} else if (this.clazz == Company.class) {
entity = companyService.load(...);
} else .

And so on. In the end, the entity is loaded from wherever it is defined 
for this class...


Matt

Sam Barrow wrote:


Does anybody how to pass a smart EntityModel (link below) to another
page? We use a different repository for each entity type. I can't get it
to work. I have tried storing the repository as a field on the
EntityModel and using an abstract method on EntityModel to retrieve it.

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/
  
  



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

  



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Force page reload/re-render

2009-11-10 Thread Matthias Keller

Hi Pieter

Due to the Java-Nature of Wicket, things done in the constructor are 
only executed once for this instance. Since F5 only re-renders the 
instance, the expression   setVisible(whatever())  is only executed once.
The most dynamic implementation would be to override  isVisible()  for 
every component that changes its visibility dynamically or if that would 
lead to lots of code duplication, you could write a behaviour doing 
exactly that and add it to every component (or container) as needed.
isVisible()  is evaluated during each and every rendering phase, meaning 
upon every F5 reload as well.


This is the way we do it for dynamic content.

Matt

pieter claassen wrote:

Hi Ernesto,

To recap, I have a control panel visible on each and every page and in
that control panel, you can select the appropriate role you want to
use. Based on that role some menu items will be visible or not
(example below is correct). I am sure this problem has been solved
before :-0 as this is a very normal usecase for context sensitive
navigation.

It seems that there is no way to force the page to re-render using getPage()?

Thanks for the feedback so far. I keep on coming up against this issue
and have not found a reasonable solution to the problem. The
javascript option seems to be best so far.

Pieter

On Tue, Nov 10, 2009 at 1:41 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
  

Even if you re-render your page components that are not dynamic will not
change their state: unless you create a new instance of the page, I guess.
By this I mean.

class MyPanel  {
  public MyPanel(id) {
  PanelB panelB = new Panel(B);
  panelB.setVisible(getSomeCondition());
  
  }
}

Even if condition getSomeCondition() change, and you re-render  MyPanel, or
the whole page, panelB will still be not visible. So, if you want something
to be dynamic you have to program it to be dynamic.

Best,

Ernesto


On Tue, Nov 10, 2009 at 1:20 PM, pieter claassen pieter.claas...@gmail.com
wrote:


Both of the suggestions I think requires me to modify the logic of the
controls (either to keep track of which ones need to be updated or by
placing the rendering logic in onBeforeRender()). I think this is a
lot of work for something relative straight forward and also any
changes to permission structures and I have to modify controls.

Is there no way that I can mark a page obtained via getPage() as
requiring re-rendering? I tried getPage().dirty() before the
setResponsePage() but that didn't do anything.

Thanks for the feedback though.
P

On Tue, Nov 10, 2009 at 1:10 PM, Pedro Santos pedros...@gmail.com wrote:
  

I tried setResponsePage(getPage()) but the problem is it does not
re-render controls on the page.

Where do you implement your control ( update logic )? Consider do it
overriding Component.onBeforeRender method

On Tue, Nov 10, 2009 at 10:03 AM, pieter claassen
pieter.claas...@gmail.com wrote:


Hi Pedro,

I tried setResponsePage(getPage()) but the problem is it does not
re-render controls on the page.

setResponsePage(getPage().getClass()) only works for stateless pages
and on most of my pages, I pass params via the constructor.

The javascript option will be a last resort, but it seems to be not
the most elegant solution.

Rgds,

On Tue, Nov 10, 2009 at 11:45 AM, Pedro Santos pedros...@gmail.com
wrote:
  

if(userSetWasChanged){
target.appendJavascript(window.location.reload());
or
setResponsePage(getPage());
or
setResponsePage(getPage().getClass());
}


On Tue, Nov 10, 2009 at 5:19 AM, pieter claassen
pieter.claas...@gmail.com
wrote:


I have a link on a panel that is included in many pages. When the
user
clicks on the link, I change something in the user settings that
will
affect what gets displayed on the page. However, for that to work, I
need to reload the page after the user clicked on the link as by
default the other components that now need to be checked for
conditional visibility don't re-render (why not?). setResponsePage()
requires me to pass into the panel a target page and this becomes
complex when you have a mix of statefull and stateless pages as
targets (and it just doesn't feel right).

I am sure there must be an easier way to just re-render a page?

Any tips?

Thanks,
pieter
  




smime.p7s
Description: S/MIME Cryptographic Signature


Check(box) loses checked state after error

2009-10-27 Thread Matthias Keller

Hi

I'm using a CheckGroup together with a few Check in a repeater because 
the number of boxes displayed is dynamic.
This works fine and the data gets stored in the model correctly when 
submitting.
However, if another form component fails in the validation, all 
checkboxes are getting unchecked.
It seems the uuid increased after the error and does not match the 
submitted data anymore.
In Check.onComponentTag(), the  group.hasRawInput() returns true and 
contains for example  check60, check61  but the uuid variable is much 
higher then, vor example 120, resulting in no checkbox being checked. It 
appears that the Check's already got a new uuid and cannot be 
repopulated from the submitted values as those values were different...?


I'm using Wicket 1.3.5

Thanks for your help

Matt


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Release 1.4.3

2009-10-27 Thread Matthias Keller

Corbin, James wrote:

James,

Do you know when the official release of 1.4.3 is happening?  By official I mean the Apache Wicket Website updated with the release announcement and links to the official package downloads.  


J.D.
  
Well, it is as official as can be, they just have some troubles updating 
the webpage itself.

Here's the announcement from earlier on:


release tag: https://svn.apache.org/repos/asf/wicket/releases/wicket-1.4.3

download: http://www.apache.org/dyn/closer.cgi/wicket/1.4.3

changelog: https://issues.apache.org/jira/browse/WICKET/fixforversion/12314250
( full release notes below )

maven:

dependency
  groupIdorg.apache.wicket/groupId
  artifactIdwicket/artifactId
  version1.4.3/version
/dependency

thank you.

-igor

ps. our website has not yet been updated with the release
announcement, something is broken with the confluence publishing
plugin.

---

Release Notes - Wicket - Version 1.4.3

** Bug
   * [WICKET-2348] - always insert encoding in http response header
   * [WICKET-2436] - invalid DataTable markup breaks table layout
   * [WICKET-2497] - AutoComplete textfield ignores visible
property within hierarchy.
   * [WICKET-2501] - BaseWicketTester clickLink calls onBeginRequest two times.
   * [WICKET-2505] - Button.onSubmit javadoc is misleading
   * [WICKET-2506] - Regression: Could not find child with id: ID
in the wicket:enclosure for non-component tag
   * [WICKET-2507] - Inconsistent resource path using wicket:link
and HeaderContributor after second request
   * [WICKET-2508] - NullPointerException in
BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:96)
   * [WICKET-2513] - wicket:enclosure does not work if child is a
container and not a component (regression from 1.4.1)
   * [WICKET-2516] - Javadoc for Component.getMarkupId is incorrect
   * [WICKET-2518] - Application_bg.properties property file is
incorrectly encoded
   * [WICKET-2520] - Use of Object instead of generic T in
StringAutoCompleteRenderer
   * [WICKET-2522] - Easy fix suggestion: In BaseWicketTester
'IFormSubmitting' component should be the submitting component, not
just a 'Button'
   * [WICKET-2525] - DatePicker consume too much memory
   * [WICKET-2527] - wicket:enclosure child attribute search path has changed
   * [WICKET-2528] - CheckBoxMultipleChoice ignores isDisabled() checks
   * [WICKET-2530] - Class not found when using OSGI class loader

** Improvement
   * [WICKET-2344] - Performance improvement: more efficient
AnnotProxyFieldValueFactory cache
   * [WICKET-2459] - Add new German Wicket Book
   * [WICKET-2511] - Upgrade to SLF4J version 1.5.8
   * [WICKET-2524] - Configurable Throttle delay for AutoCompleteBehavior

** Wish
   * [WICKET-2468] - AjaxLazyLoadPanel do not respect especific
projects components configuration
   * [WICKET-2515] - ModalWindow javadoc improvent




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Check(box) loses checked state after error

2009-10-27 Thread Matthias Keller

Hi Pedro

Thanks, that worked for me!

Matt

Pedro Santos wrote:

call ListView.setReuseItems(true)

On Tue, Oct 27, 2009 at 1:24 PM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

  

I'm using a CheckGroup together with a few Check in a repeater because
  

the


number of boxes displayed is dynamic.
  

If you have a repeater  the redraw event instantiates NEW checkboxes..
so ofcourse you lose the staete.

I have built a reusemanager that copies the old state. Usage sould be
quite straight forward, ask if you need help.

Here is a simple example of usage:

add(reuseManager.rememberOrReuse(rowIndex, custom_id, hoursField));

:::


public class FormComponentReuseManager implements Serializable {
 private final MapObject, MapString, Component idMapRow = new
HashMapObject, MapString, Component();


 /**
  * @param S
  * @param T
  * @param rowId
  * @param componentId
  * @param newComponent
  * @return FormComponent
  */
 @SuppressWarnings(unchecked)
 public S, T extends FormComponentS T rememberOrReuse(Object
rowId, String componentId, T newComponent) {
   return (T) rememberOrReuse(rowId, componentId, (Component)
newComponent);
 }

 /**
  * @param T
  * @param rowId
  * @param componentId
  * @param newComponent
  * @return FormComponent
  */
 public T extends Component T rememberOrReuse(Object rowId, String
componentId, T newComponent) {
   MapString, Component rowMap = createOrReuse(rowId);

   @SuppressWarnings(unchecked)
   T existingComponent = (T) rowMap.get(componentId);

   if (newComponent instanceof FormComponent) {
 // Never reuse the component itself, just reuse the
 rowMap.put(componentId, newComponent);

 if (existingComponent != null) {
   MarkupUtils.fakeRawInput((FormComponent?)newComponent,
(FormComponent?)existingComponent);
   // Transfer also the error messages
   for (FeedbackMessage feedbackMessage :
TakpSession.get().getFeedbackMessages().messages(new
ComponentFeedbackMessageFilter(existingComponent))) {
 MarkupUtils.replaceReporter(feedbackMessage,
(FormComponent?) newComponent);
   }
 }

 return newComponent;
   }

   // else
   if (existingComponent == null) {
 rowMap.put(componentId, newComponent);
 return newComponent;
   }

   // else
   return existingComponent;
 }

 /**
  * @param rowId
  * @return MapString, FormComponent
  */
 private MapString, Component createOrReuse(Object rowId) {
   MapString, Component rowMap = idMapRow.get(rowId);

   if ((rowMap == null)  (rowId instanceof AbstractDTO) 
(((AbstractDTO) rowId).getId() != null)) {
 rowId = ((AbstractDTO) rowId).getId();
 rowMap = idMapRow.get(rowId);
   }

   if (rowMap == null) {
 rowMap = new HashMapString, Component();
 idMapRow.put(rowId, rowMap);
   }

   return rowMap;
 }

 /**
  *
  */
 public void clear() {
   idMapRow.clear();
 }

 /**
  * @param S
  * @param T
  * @param key
  * @param formComponent
  * @param behaviors
  * @return T
  */
 public S, T extends FormComponentS T
rememberOrReuseAndProvideFeedback(
 Object key, T formComponent, IBehavior... behaviors) {
   formComponent.add(behaviors);
   formComponent.setOutputMarkupId(true);
   return rememberOrReuse(key, formComponent.getId(),
FeedbackStyler.add(formComponent));
  }
}




This works fine and the data gets stored in the model correctly when
submitting.
However, if another form component fails in the validation, all
  

checkboxes


are getting unchecked.
It seems the uuid increased after the error and does not match the
  

submitted


data anymore.
In Check.onComponentTag(), the  group.hasRawInput() returns true and
contains for example  check60, check61  but the uuid variable is much
  

higher


then, vor example 120, resulting in no checkbox being checked. It appears
that the Check's already got a new uuid and cannot be repopulated from
  

the


submitted values as those values were different...?

I'm using Wicket 1.3.5

Thanks for your help

Matt
  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: [wicket-1.4] parameterizing ResourceModel for wicket:message

2009-10-06 Thread Matthias Keller

Hi Bernhard

Have a look at StringResourceModel, though I think it's not possible to 
use it directly with wicket:message but you can use it easily in a label.

It supports both MessageFormat style and model-style replacements.

Matt

Bernhard Grünewaldt wrote:

Hello,

I am using a properties.xml file for my wicket:message tags.
And soon I wondered if there is a way to parameterize these messages,
like it worked for apache struts.

With wicket I can just say
  entry key=testfoo/entry
and use
  wicket:message key=test /


In Struts something like
  mymessage = foo {0}
- and -
  bean:message key=mymessage  arg0=bar/
was possible, which produced foo bar

Is there already a way to do this?
And if not, do you think it is worth being implemented?

I searched the mailing lists and the wiki fo a solution but didn't 
find something similar.



thx,

Bernhard Grünewaldt



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






smime.p7s
Description: S/MIME Cryptographic Signature


Re: wicket default locale

2009-10-05 Thread Matthias Keller

Hi

The default implementation pulls the used locale from the servlet 
request (meaning the requested locale by the browser).

If you want to override that, we do it exactly as you do it.

Matt

Gatos wrote:

Hello,

How to set a default locale for the application?


It works for me, but I guess it should be more common:
@Override
 public Session newSession(Request request, Response response)
 {
  Session session = super.newSession(request, response);
  session.setLocale(new Locale(et));
  return session;
 }



Thank you

  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: wicket default locale

2009-10-05 Thread Matthias Keller

Hi Adrian

You could do that but what he wants is to set a default locale, not a 
fixed-forever locale.
When you set it in newSession, you get exactly that - a default locale 
which might get changed any time by the application.


Matt

Adrian Merrall wrote:

I think the more common method is to override newSession in your application
class to return your own session (that extends WebSession) and then in your
own session class override getLocale().

Very happy to be corrected though.

HTH,

Adrian

On Mon, Oct 5, 2009 at 10:59 PM, Gatos ega...@gmail.com wrote:

  

Hello,

How to set a default locale for the application?


It works for me, but I guess it should be more common:
@Override
 public Session newSession(Request request, Response response)
 {
 Session session = super.newSession(request, response);
 session.setLocale(new Locale(et));
 return session;
 }



Thank you




  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Show Validation Errors

2009-09-30 Thread Matthias Keller

Hi Peter

Try adding a FeedbackPanel to your page Without that, wicket doesn't 
even know where and how to display the messages.


Matt

Peter Arnulf Lustig wrote:

Hi,

I am trying to show validation errors on a page. Somehow it won't function! But 
I don't understand why?

I mean I am using the right Validation class... Why don't wicket show any error 
when the user does a wrong input?


Thanks!


import java.util.Date;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.markup.html.form.RequiredTextField;
import org.apache.wicket.markup.html.form.TextField;
import 
org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.util.value.ValueMap;
import org.omikron.test.data.Administrator;
import org.omikron.test.data.AdministratorDataProvider;

/**
 *
 * @author sven.dzepina
 */
public class CreateAdministratorForm extends Form {
private ValueMap properties = new ValueMap();
TextFieldString username;
TextFieldString email;
TextFieldString firstname;
TextFieldString lastname;
PasswordTextField password;
PasswordTextField password2;
Boolean isUpdate = false;
Administrator a;

public CreateAdministratorForm(String id) {

super(id);
username = new RequiredTextFieldString(username, new 
PropertyModelString(properties, username));
password = new PasswordTextField(password, new 
PropertyModelString(properties, password));
password2 = new PasswordTextField(password2, new 
PropertyModelString(properties, password2));
email = new RequiredTextField(email, new PropertyModel(properties, 
email));
firstname = new RequiredTextField(firstname, new PropertyModel(properties, 
firstname));
lastname = new RequiredTextField(lastname, new PropertyModel(properties, 
lastname));
add(email);
add(password2);
add(firstname);
add(lastname);
add(username);
add(password);
add(new EqualPasswordInputValidator(password, password2));
}

public void setUpdate(Administrator a) {
this.a = a;
isUpdate = true;
IModelString usernameModel = Model.of(a.getUsername());
IModelString emailModel = Model.of(a.getEmail());
IModelString firstnameModel = Model.of(a.getFirstname());
IModelString lastnameModel = Model.of(a.getLastname());
username.setModel(usernameModel);
email.setModel(emailModel);
firstname.setModel(firstnameModel);
lastname.setModel(lastnameModel);
}

@Override
public void onSubmit() {

if ( !isUpdate ) {
Administrator a = new Administrator();
a.setEmail(email.getModel().getObject());
a.setFirstname(firstname.getModel().getObject());
a.setLastname(lastname.getModel().getObject());
a.setPassword(password.getModel().getObject());
a.setUsername(username.getModel().getObject());
a.setSysTimestamp(new Date());
AdministratorDataProvider administratorDataProvider = new 
AdministratorDataProvider();
administratorDataProvider.save(a);
} else {
a.setEmail(email.getModel().getObject());
a.setFirstname(firstname.getModel().getObject());
a.setLastname(lastname.getModel().getObject());
a.setPassword(password.getModel().getObject());
a.setUsername(username.getModel().getObject());
a.setSysTimestamp(new Date());
AdministratorDataProvider administratorDataProvider = new 
AdministratorDataProvider();
administratorDataProvider.save(a);
}
}
}


  


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

  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: How would you realize a delete-Link in a datagrid row?

2009-09-30 Thread Matthias Keller

Hi Peter

For that we usually add an AttributeModifier which adds something like 
that to the onclick javascript event:

if (!confirm('Do you really want to delete this entry')) return false;

Matt

Peter Arnulf Lustig wrote:

Hi,

I'd like to create a delete link where you can delete a row in a datagrid. But when you 
click on the delete link, the delete label should change and a warning occurs: Do 
you really want to delete xyz.
After the second click it finally deletes the content.

How can I achieve that? Could you verbalize the procedure?

Thanks!!



  


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

  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: What is preferred/recommended way to localize texts of non-visual components

2009-09-30 Thread Matthias Keller

Hi Petr

We use a custom EnumConverter for that. It can be added to the 
application like so:

   @Override
   protected IConverterLocator newConverterLocator () {
   ConverterLocator converterLocator = (ConverterLocator) 
super.newConverterLocator();

   converterLocator.set(MyEnum.class, new EnumConverter());
   }

EnumConverter:
...
public String convertToString (Object value, Locale locale) {
   return EnumUtils.getEnumFromResources((Enum?) value, 
value.toString());

   }
...


Then the following helper method looks the enum up in the string 
resources...

   /**
* Tries to resolve a given Enum instance against the resources.
* The following keys are searched for in the resources:br/
* biIf the enum is defined as a top-level enum:/i/b
* ul
*  lipackage.EnumClassName.ENUMNAME/li
*  liEnumClassName.ENUMNAME/li
* /ul
* biIf the enum is defined inside another class:/i/b
* ul
*  lipackage.SomeClass$EnumClassName.ENUMNAME/li
*  lipackage.SomeClass.EnumClassName.ENUMNAME/li
*  liSomeClass.EnumClassName.ENUMNAME/li
*  liEnumClassName.ENUMNAME/li
* /ul
* If no resource could be found, the specified defaultValue is 
returned.

*
* @param enu The Enum instance
* @param defaultValue The default value in case no resource string 
was found
* @return The matching resource string or ttdefaultValue/tt if 
there was no match

*/
   public static String getEnumFromResources (Enum? enu, String 
defaultValue) {


   final Localizer loc = 
WebApplication.get().getResourceSettings().getLocalizer();

   ListString keyList = new ArrayListString();
   keyList.add(enu.getClass().getName());
   keyList.add(enu.getClass().getCanonicalName());
   if (enu.getClass().getDeclaringClass() != null) {
   
keyList.add(enu.getClass().getDeclaringClass().getSimpleName()+.+enu.getClass().getSimpleName());

   }
   keyList.add(enu.getClass().getSimpleName());

   for (String key : keyList) {
   // The empty string needs to be used here because null is 
being treated as 'not found',

   // thus might result in a warning string being returned.
   String res = loc.getString(key+.+enu.name(), null, );
   if (!.equals(res)) {
   return res;
   }
   }
   return defaultValue;
   }

Petr Fejfar wrote:

Hi all,

I have an enum type e.g.

public enum MapType
UNDEFINED,ROADMAP,MOBILE,SATELITE,TERRAIN,HYBRID;

public static String toKeyword(MapType mapType) {
switch (mapType) {
  case ROADMAP:
  return roadmap;
  ...

public static MapType fromKeyword(final String keyword) {
final String kw = keyword.toLowerCase();
if (kw.equals(roadmap))
return ROADMAP;
else if ...



and I'd like to localize a verbal representation of particular elements
which I could share throughout Wicket application in many places.
i.e. I need something like this:

public static String verbose(MapType mapType) {
switch (mapType) {
  case ROADMAP:
  return getString(verbROADMAP);
  ...


What is a preferred/recommended way to localize it?


Thanks, Petr

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

  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: How can we display by example the format to be used to input Date in DateTextField ?

2009-09-28 Thread Matthias Keller

Hi Charles

About Question 1: The validation message seems to have its origin in 
FormComponent#convertInput():
It will try either  IConverter.date class simple name  or  
IConverter  and the used pattern will be available as the variable 
format  (or  ${format}  as used in the string resources).


About Question 2: You'll have to subclass the DateTextField and override 
getConverter().


You could then just check if the returned  super.getConverter() is of 
type  DateConverter and if yes, call the setLenient() method on it.


Matt

Charles Moulliard wrote:

I use a DateTextField to check if a user encode date according to the
Date pattern format defined.

DateTextField textfieldFromDate = new DateTextField(fromDate, MMdd );

Question 1 : Is it possible in the message displayed by Wicket after
the validation in the feedbackPanel to show the correct format to be
used ?

Question 2 . Can we define the format to be used (in the case of a
date) as setLenient() to verify if the date encoded is correct unlike
as the following date 20090230 ?

Regards,

Charles Moulliard
  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread Matthias Keller
Sure, just create it (including the onClick which might be invalid), but 
afterwards set the  setEnabled()  as needed.
As long as the link is disabled, it can never be clicked thus the 
onClick() will never be executed anyway, so it's irrelevant if the 
requestFormModel is valid or not...
I dont think you want the setEnabled(false) inside the onClick - do you? 
That would deactivate the link after the first click which doesn't make 
that much sense?


Matt

Charles Moulliard wrote:

Hi,

I would like to know if there is a better way to code this case : What
I would like to do is to enable/disable a link depending on a
condition. If the condition is true, than we create the link otherwise
we disable it. In both case, a label must be defined for the Link.

I mean, is it possible to avoid to double the creation of the link =
new Link() 

Here is my code

1) HTML

   a href=# wicket:id=linkRequestspan
wicket:id=linkRequestTxt//a


2) JAVA

// Set link for requestId
Link link;

if (audit.getRequest() != null) {

final RequestFormModel requestFormModel = new
RequestFormModel();
requestFormModel.setRequestId( (int)
audit.getRequest().getId() );

link = new Link(linkRequest) {

@Override
public void onClick() {
setResponsePage(new RequestPage(requestFormModel));
}

};

link.add(new
Label(linkRequestTxt,String.valueOf(audit.getRequest().getId(;
item.add(link);

} else {
link = new Link(linkRequest) {

@Override
public void onClick() {
this.setEnabled(false);
}

};
Label label = new Label(linkRequestTxt,);
link.add(label);
item.add(link);


Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*
blog : http://cmoulliard.blogspot.com

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

  



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread Matthias Keller

Hi

As I said in my previous mail, just initialize the link once using the 
upper variant.
Use an if before to create the requestFormModel, in case 2, the 
requestFormModel can be null - as the onClick is never executed this 
will not matter.

Have something like:

final Model requestFormModel;
if (case1)
   requestFormModel = new MyModel(...);
else
   requestFormModel = null;

// Creating the one and only Link instance.
link = new Link(linkRequest) {
   public void onClick() {
  setResponsePage(new RequestPage(requestFormModel));
   }
}
item.add(link);

if (case1) {
   link.add(whatever);
   ...
} else {
   link.add(whatever for case 2);
   link.setEnabled(false);
}


cmoulliard wrote:

You are right. I don't need the setEnabled(false) in the onClick method

I have changed my code :

link = new Link(linkRequest) {

@Override
public void onClick() {
setResponsePage(new 
RequestPage(requestFormModel));
}

};

link.add(new
Label(linkRequestTxt,String.valueOf(audit.getRequest().getId(;
item.add(link);

} else {
link = new Link(linkRequest) {

@Override
public void onClick() { }

};
Label label = new 
Label(linkRequestTxt,);
link.add(label);
link.setEnabled(false);
item.add(link);
}

Remark : 


It should be interesting to be able to create an instance of the Link class
without having to override the onclick() method. Otherwise the code becomes
very verbose and requires as here that we instantiate two times the class
Link


Matthias Keller wrote:
  
Sure, just create it (including the onClick which might be invalid), but 
afterwards set the  setEnabled()  as needed.
As long as the link is disabled, it can never be clicked thus the 
onClick() will never be executed anyway, so it's irrelevant if the 
requestFormModel is valid or not...
I dont think you want the setEnabled(false) inside the onClick - do you? 
That would deactivate the link after the first click which doesn't make 
that much sense?


Matt

Charles Moulliard wrote:


Hi,

I would like to know if there is a better way to code this case : What
I would like to do is to enable/disable a link depending on a
condition. If the condition is true, than we create the link otherwise
we disable it. In both case, a label must be defined for the Link.

I mean, is it possible to avoid to double the creation of the link =
new Link() 

Here is my code

1) HTML

#  wicket:id=linkRequestTxt/ 



2) JAVA

// Set link for requestId
Link link;

if (audit.getRequest() != null) {

final RequestFormModel requestFormModel = new
RequestFormModel();
requestFormModel.setRequestId( (int)
audit.getRequest().getId() );

link = new Link(linkRequest) {

@Override
public void onClick() {
setResponsePage(new
RequestPage(requestFormModel));
}

};

link.add(new
Label(linkRequestTxt,String.valueOf(audit.getRequest().getId(;
item.add(link);

} else {
link = new Link(linkRequest) {

@Override
public void onClick() {
this.setEnabled(false);
}

};
Label label = new Label(linkRequestTxt,);
link.add(label);
item.add(link);





Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*
blog : http://cmoulliard.blogspot.com

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

  
  

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread Matthias Keller

Hi

Yes there'll always be some repetition. Depending on your logic you 
might also stuff the first block in the onClick event to generate the 
model if it's not used anywhere else. That could eliminate the first block.


The problem about reusable components in wicket is that probably you 
might end up with some problems when using the same component instance 
on two pages unless you re-instantiate your Commons class in every call 
which might in turn produce a lot of overhead if you only need a few of 
those labels and stuff.
What you could also du is writing a kind of factory method in a base 
page class (I always have a BasePage class all my pages extend from with 
some common functionality). There you could have a method like

protected Label getIdLabel(String value) { return new Label(id, value); }

Matt

cmoulliard wrote:

Mattias,

OK about what you propose but we repeat the test a second time so the code
still remains very verbose.
Thanks for the suggestion.

I think that this is a general remark that some users make about Wicket. It
is very difficult to reuse part of the code.

Here is another example :

I have a label called id which is used in different page. The way proposes
by Wicket to code it is 


Page Request

item.add(new Label(id, String.valueOf(request.getId(;

Page Notification

item.add(new Label(id, String.valueOf(notification.getId(;

When we compare page request and page notification, we see that we repeat
the same code two times.

It could be interesting to set the value of the label in the page and to
declare it separately

e.g

public class Commons {

public static Label labelId = new Label(id);
...
}


Page Request

item.add( labelId.setValue( String.valueOf(request.getId()) );

Page Notification

item.add( labelId.setValue( String.valueOf(notification.getId()) );

Regards,

Charles
  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Handling Hibernate session (LazyInitializationException)

2009-09-17 Thread Matthias Keller

Hi Anton

The Problem you encounter is probably because you're holding on to a 
hibernate object between requests, thus the references are not valid 
anymore.


Have a look at
http://wicketinaction.com/2008/09/building-a-smart-entitymodel/

This works for us with hibernate.

Matt

Anton Komratov wrote:

Hi, I'm using Wicket + Hibernate (without Spring).
In my application I open Hibernate *session* in WebRequestCycle.*
onBeginRequest*() and close it in WebRequestCycle.*onEndRequest*().

But having association (many-to-one mappings between classes) I've got
LazyInitializationException (no Session). I've just set parameter
*lazy*=false
in hibernate mapping file to many-to-one mappings. And it worked fine -
amount of data stored in memory in this case was not critical.

Since the system is growing furhter, the method with no lazy initialization
is no more suitable. Could you, please, advise me a way to handle hibernate
session to have lazy initialization. (Solution with no Spring is
preferable).

// Best regards, Anton

  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Update Tree Model on Ajax timer. What's wrong ?

2009-09-16 Thread Matthias Keller

Hi Eric

I've never used a Tree before and I don't know the 
AjaxSelfUpdatingTimerBehaviour, but shouldn't you add all changed 
elements to 'target' like in all other AJAX calls I've ever encountered 
before? Wicket usually updates those things that are added to the 
AjaxRequestTarget.


Matt

Eric Bouer wrote:

Hello.
Preface: Wicket Tree is very confusing since it's some kind of hybrid between 
swing Tree model and wicket tree so please forgive me for any 
stupid/irrelevant questions.


I created a tree with a model based on database schema.I'm trying to refresh  
the tree so that it will change node names after some DB update.
I added AJAX timer to self update the tree , the ajax stuff work but it doesn't 
even try to update the model.

To create my tree I have this on my page:
tree = new TreeTable(treeTable, createTreeModel(), columns);
tree.getTreeState().setAllowSelectMultiple(true); 
tree.setOutputMarkupId(true);

add(tree);
tree.add(new AjaxSelfUpdatingTimerBehavior(Duration.ONE_SECOND) {
@Override
protected void onPostProcessTarget(AjaxRequestTarget target) {
super.onPostProcessTarget(target);
VectorObject p = new VectorObject();
//To keep it simple. I'm only trying to update the root.
p.add(tree.getModel().getObject().getRoot()); 
TreeModelEvent event = new TreeModelEvent(tree,p.toArray());

tree.treeNodesChanged(event);
});
}
Nothing get updates.
I tried adding customized TreeModelListener however it doesn't get called at 
all.

Any idea or reference to documentation that explain this?
Thanks.



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

  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Selectively ignoring required fields

2009-09-15 Thread Matthias Keller

Hi

You could also write your own FormValidator which does the 'required' 
validation on its own by checking whether the field's input string is 
empty/null.


Matt

Phil Housley wrote:

2009/9/15 Martin Makundi martin.maku...@koodaripalvelut.com:
  

You can override isRequired for any component.

**
Martin




Thanks, but I really don't want to have to make the individual fields
context aware unless I have to.  We have quite a few custom form
controls, which are used both in searching and various other places,
so it would be a lot of work to make them all respond to this
particular use.  A way to just prevent the required check/validation
from the top would fit the bill better.

  

2009/9/15 Phil Housley undeconstruc...@gmail.com:


Hello,

I'm currently working on a search interface, where the required-ness
of some fields depends on the value of some other.  In particular, the
form looks something like

(+) search by X
a: [_]
b: [_]

() search by Y
...

() search by Z
...

So the radio button selects a group of fields, in which any number may
be required.  Each group of options is its own panel, and basically
independent.  Is it possible for me to ignore protests from the fields
in sections Y and Z, after reading the input from the radio button?
Ideally I'd like to record the values from every field, and keep it
around as raw input, but I don't want to know if it is missing or
fails to convert/validate.

Thanks for any help.

--
Phil Housley

-
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





  



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


How to redirect from a ModalWindow

2009-09-10 Thread Matthias Keller

Hi

I've got a ModalWindow which lets the user select some choices.
Now I need a button in that ModalWindow allowing the user to enter some 
new choices.
I don't want that target to be another ModalWindow (as it's referenced 
from other places too), so I need to redirect the user to that new page 
if he wishes to add a new choice.


Basically that works, using a Button or an AjaxButton both works, but 
since the ModalWindow is still open, I get the ugly browser warning 
about navigating away from the current page.

What can I do to solve that?
I tried an AjaxButton using

window.close(target);
setResponsePage(OtherPage.class);

But that doesn't work. Any ideas?

Thanks

Matt


smime.p7s
Description: S/MIME Cryptographic Signature


Re: DropDownChoice with Java Enum

2009-09-10 Thread Matthias Keller

Hi Charles

No problem. Just make an IChoiceRenderer which calls getDescription for 
the display value and getValue for the id.


Matt

Charles Moulliard wrote:

Hi,

I would like to know if I can create a DropDownChoice where the value to be
displayed in the drop down list corresponds to the description of my
enumeration (e.g. Accepted) while the value to be returned is the value
defined in the enumeration (e.g: ACCPT) ?

public enum ProcessingStatusType {
NEW (NEW, New),
ACCEPTED (ACCPT, Accepted),
VALIDATED (VALID, Validated),
TRANSFORMED(TRFRM, Transformed),
TRANSFERRED(TRFRD, Transferred),
REJECTED(REJEC, Rejected),
FAILED(FAIL, Failed);

private final String value;
private final String description;

ProcessingStatusType( String value, String description ) {
this.value = value;
this.description = description;
}

  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: DropDownChoice with Java Enum

2009-09-10 Thread Matthias Keller

Hi

Close but not quite. getDisplayValue gets the catual ELEMENT of the list 
- so objDispl is of type ProcessingStatusType already.

So in your case it would be something like:


public Object getDisplayValue(Object objDispl) {
return ((ProcessingStatusType) objDispl).getDescription();
}

public String getIdValue(Object obj, int index) {
return obj.toString();
// or if you prefer to have the value of your enum in the HTML code:
// return ((ProcessingStatusType) objDispl).getValue()
}
Which one of the getIdValue implementations you chose doesn't matter for 
wicket, it just needs an ID for every entry which is unique.
In your case you could even   return String.valueOf(index)   as your 
backing List of the Enums will not ever change while deployed.


Be careful though with using index, there are circumstances where no 
useful index will be provided (always -1) - That happens when you 
externally change the selected value of the DropDownChoice.


you could also just use or extend ChoiceRenderer which might already do 
what you want...

For example
new ChoiceRenderer(description, value)

Matt

cmoulliard wrote:

You mean create something like this :

add(new DropDownChoice(requestStatus,
Arrays.asList(ProcessingStatusType.values()), new IChoiceRenderer() {

public Object getDisplayValue(Object objDispl) {
return ProcessingStatusType.valueOf((String) 
objDispl).getDescription();
}

public String getIdValue(Object obj, int index) {
return obj.toString(); 
			}}));

I have an error during initialisation :


WicketMessage: Exception in rendering component: [MarkupContainer [Component
id = requestStatus]]

Root cause:

java.lang.ClassCastException:
com.xpectis.x3s.model.usertype.ProcessingStatusType
at
com.xpectis.x3s.fundbox.web.form.RequestForm$1.getDisplayValue(RequestForm.java:38)

I suppose that what I defined in getDisplayValue is not correct ?

Matthias Keller wrote:
  

Hi Charles

No problem. Just make an IChoiceRenderer which calls getDescription for 
the display value and getValue for the id.


Matt

Charles Moulliard wrote:


Hi,

I would like to know if I can create a DropDownChoice where the value to
be
displayed in the drop down list corresponds to the description of my
enumeration (e.g. Accepted) while the value to be returned is the value
defined in the enumeration (e.g: ACCPT) ?

public enum ProcessingStatusType {
NEW (NEW, New),
ACCEPTED (ACCPT, Accepted),
VALIDATED (VALID, Validated),
TRANSFORMED(TRFRM, Transformed),
TRANSFERRED(TRFRD, Transferred),
REJECTED(REJEC, Rejected),
FAILED(FAIL, Failed);

private final String value;
private final String description;

ProcessingStatusType( String value, String description ) {
this.value = value;
this.description = description;
}

  
  


smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to redirect from a ModalWindow

2009-09-10 Thread Matthias Keller

Hi Peter

You would be right as long as it wasn't for a ModalWindow.
When having an open ModalWindow, wicket seems to register an unload 
javascript event which - when trying to navigate away from the page (be 
it by following a link, closing the window etc), displays a confirmation 
message which you have to accept. I need to avoid that message, but the 
only way to do that probably is by closing that window first so that the 
javascript event gets unloaded.


Matt

Peter Ertl wrote:



throw new RestartResponseException(OtherPage.class)

window.close() is not needed!


Am 10.09.2009 um 12:50 schrieb Matthias Keller:


OtherPage.class



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





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Help on wizard solution...

2009-09-09 Thread Matthias Keller

Hi

Well, if you know of all the steps but there's only some small 
difference (like you said, Step 6 might be D or F), you might also 
consider a normal Wizard, but use the conditional step functionality.
That way you would add ALL pages, but hide those that are not relevant. 
Hiding can also be done dynamically, for example if on the first step, 
option A is selected, step 6 is visible, else not.
This is done in each step by overriding the evaluate() method. If it 
returns true, the step is displayed, if false, not.


Matt

John Armstrong wrote:

I've done this in both DynamicWizards as well as regular wizards and
can pass some code along if you need it.

My rule of thumb is If you can gather all of the content together for
your wizard use a regular wizard (eg: non-dependent configuration
directives), if future wizard steps can change based on a specific
wizard step then use a DynamicWizard (eg: If you pick A on Step 5 then
Step 6 shows D, otherwise Step 6 shows F

I have found that controlling backwards and forwards navigation in a
dynamic wizard very difficult since you are responsible for all of the
logic.

John-

On Tue, Sep 8, 2009 at 8:30 AM, Eyal Golanegola...@gmail.com wrote:
  

I had some experience with what you need so i hope I could help you if you
need something.
I implemented the dynamic wizard and it was actually lots of fun :)


Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Tue, Sep 8, 2009 at 5:51 PM, Muro Copenhagen copenha...@gmail.comwrote:



Thanks Pedro and Peter,

I'll try the DynamicWizardModel, it seems as the right choice.

But a quick google search didn't provide any example, so i must try making
it work.

Hopefully it will...

Best Regards
Muro

On Tue, Sep 8, 2009 at 4:35 PM, Pedro Santos pedros...@gmail.com wrote:

  

I think the wizard is the correct approach... You can try use
DynamicWizardModel on your wizard.

javadoc:
 * Wizard model that is specialized on dynamic wizards. Unlike the


default,
  

static
 * {...@link WizardModel wizard model}, this model isn't very intelligent,


but
  

rather delegates much
 * of the work and knowledge to the {...@link IDynamicWizardStep dynamic
wizard
steps} it uses.

on IDynamicWizardStep you can implement the ordering and navegation rules
based on database and page params.

On Tue, Sep 8, 2009 at 11:20 AM, Muro Copenhagen copenha...@gmail.com


wrote:
  
Hi,


I could use some input on how to solve a problem i have.

In my web-app i have some cases, and each cases have several questions.

And i want the user to flow between the pages in a wizard manner like
  

the
  

example in:
http://www.wicket-library.com/wicket-examples/wizard/

The only problem i have is that all the questions are database driven,
  

and


is not a fixed set of pages.

But the wizard example is in the link is fixed.

How would i make a dynamic database driven wizard, where the content of
  

the


wizard pages are database driven?

Or is the wizard approach not the right way of doing it...?

What i want to achieve is a user browsing through several question in
  

case,


with the option of moving backwards between the question.

Any input from anyone ...?

Best Regards
Muro

  


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

  




smime.p7s
Description: S/MIME Cryptographic Signature


Re: @SpringBean and IDataProvider

2009-09-09 Thread Matthias Keller

Hi Charles

@SpringBean only seems to work in some wicket base classes. In your own 
separate classes, noone will actively inject your content.
What I do (maybe there's a better possibility) is to add this line to 
that classes constructor to force injection:


InjectorHolder.getInjector().inject(this);

That way, all @SpringBean fields will be injected correctly.

Matt

Charles Moulliard wrote:

Hi,

I have a strange problem that I can't explain. I don't know if this is a bug
or a limitation.

When I inject Spring dependency of a service inside a Wicket web page,
everything works fine but when I inject this dependency in a separate class
(in the following code example, the class RequestProvider is not longer
defined as internal class and moved to another package), I have a null
pointer exception at the following line :


09:48:07,432 | ERROR | 3811...@qtp1-1   | RequestCycle |
org.apache.wicket.RequestCycle   1521 | Error attaching this container for
rendering: [Page class = com.xpectis.x3s.fundbox.web.RequestPage, id = 0,
version = 0]
org.apache.wicket.WicketRuntimeException: Error attaching this container for
rendering: [Page class = com.xpectis.x3s.fundbox.web.RequestPage, id = 0,
version = 0]
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1763)
at org.apache.wicket.Component.onBeforeRender(Component.java:3863)
at org.apache.wicket.Page.onBeforeRender(Page.java:1501)
at org.apache.wicket.Component.internalBeforeRender(Component.java:1061)

...
Caused by: java.lang.NullPointerException
at
com.xpectis.x3s.fundbox.web.data.RequestProvider.size(RequestProvider.java:63)
at
org.apache.wicket.markup.repeater.data.DataViewBase.internalGetItemCount(DataViewBase.java:140)
at
org.apache.wicket.markup.repeater.AbstractPageableView.getItemCount(AbstractPageableView.java:252)

Line 63 corresponds to : size = requestService.findRequest().size();

It seems that the requestService is not longer available when size method is
called


Code which is working :

public class RequestPage extends WebPage {

@SpringBean
private RequestService requestService;



private class RequestProvider implements IDataProvider {

private ListRequest result = new ArrayListRequest();
private RequestFormModel requestFormModel;
private Request request;

public RequestProvider() {}

public RequestProvider(RequestFormModel requestFormModel) {
this.requestFormModel = requestFormModel;
}

public Iterator iterator(int first, int count) {
if (requestFormModel != null) {
if (requestFormModel.getRequestId() != null) {
request =
requestService.getRequest(requestFormModel.getRequestId());
result.add(request);
} else if (requestFormModel.getFileName() != null) {
result =
requestService.findRequestByFileName(requestFormModel.getFileName());
} else {
result = requestService.findRequest(first, count);
}
} else {
result = requestService.findRequest(first, count);
}

return result.iterator();

}

public int size() {
int size = 0 ;
if (requestFormModel != null) {
if (requestFormModel.getRequestId() != null) {
request =
requestService.getRequest(requestFormModel.getRequestId());
result.add(request);
size = result.size();
} else if (requestFormModel.getFileName() != null) {
size =
requestService.findRequestByFileName(requestFormModel.getFileName()).size();

} else {
size = requestService.findRequest().size();
}
} else {
size = requestService.findRequest().size();
}
return size;
}

public IModel model(Object object) {
return new Model((Request) object);
}


Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*
blog : http://cmoulliard.blogspot.com

  





smime.p7s
Description: S/MIME Cryptographic Signature


Column which orders by display value

2009-09-07 Thread Matthias Keller

Hi

We have a DataTable with some sortable columns. Unfortunately, they 
often don't match a simple property but are assembled using multiple 
properties.

Unfortunately, a column seems only sortable by a single property :-(
Is there a possibility to sort a DataTable using the effectively 
displayed values instead of a fixed property?


Thanks

Matt


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Choose one

2009-08-27 Thread Matthias Keller

Hi
The implementation tries these keys:
getId() + .nullValid
nullValid

So you could also have a global 'nullValid' entry somewhere in your 
resources which would be the default for ALL AbstractSingleSelectChoices 
such as DropDownChoice and RadioChoice


Matt

Gatos wrote:

Is it possible to reuse existing translation - I like 'Choose one'?

If my app has 32 languages, then I should create 32 records in each file?


On Thu, Aug 27, 2009 at 3:58 PM, Dipu dipu@googlemail.com wrote:

  

add this in your .properties file

yourForm.yourDropDownId.nullValid = Choose One (or what ever you want
to appear)

regards


On Thu, Aug 27, 2009 at 1:45 PM, Gatosega...@gmail.com wrote:


After I choose something in DropDownChoice then 'Choose one' item is
  

removed


from the list.

If I will try to use setNullValid(true) then 'Choose one' string is
replaced with '' (emptry string).

How is it possible to display 'Choose one' if another item has been
selected?

  

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





  




smime.p7s
Description: S/MIME Cryptographic Signature


StringResourceModel ignores Converters?

2009-08-13 Thread Matthias Keller

Hi

I need to use a StringResourceModel to compile a string with multiple 
parameter substitutions.
I have a lot of converters active which should take care of all these 
values and which do work when using for example a PropertyModel elsewhere.
Unfortunately it seems the converters are completely ignored for 
StringResourceModels when doing the parameter substitution? I always get 
the data in its raw (.toString) form instead of the converted?!


Is this a bug or a feature?

Thanks

Matt


smime.p7s
Description: S/MIME Cryptographic Signature


How to use Session.replaceSession() ??

2009-07-29 Thread Matthias Keller

Hi

I'm writing our custom internal error handler which is supposed to 
terminate the current session and create a new one (in order to pass 
over the locale to the new session).


I've stumbled upon the  Session.replaceSession()  method which, 
according to the javadoc, should just exactly do that.
But when I call this method, nothing happens. The same session continues 
to be used and no new session is being created at all?!


I've got it to work by using:

   Session newSession = getApplication().newSession(getRequest(), 
getResponse());

   newSession.setLocale(getSession().getLocale());
   getSession().invalidateNow();
   Session.unset();
   newSession.replaceSession();

But I think there must be something easier... ???!

Thanks

Matt

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Generic Navigation Panel

2009-07-22 Thread Matthias Keller

Hi

I'm creating a new website with wicket which should have a normal 
navigation bar. I'd like to be able to detect whether a link points to 
the current page to give the surrounding div a special class.

For example on page1:
div class=activeLink
   a href=page1page1/a
/div
div
   a href=page2page2/a
/div

I thought about autolinking which does that automatically, except it 
adds very ugly spanem tags. I also don't want to change this 
globally just to have a nicer navigation autolinking going. In addition 
this would be tricky as I need the divs around the links, but with 
different CSS classes.


I'm thinking about creating a panel (representing the div with the 
link) which then adds the link and which has to be created by giving the 
current page via the constructor in order for it to find out if the link 
represents the current page. But this seems to be very complicated so I 
think there must be a more elegant solution for that, as this 
requirement surely isn't anything new?!


Thanks for your hints

Matt

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Wicket Date Field Validation

2009-06-18 Thread Matthias Keller


Rao Archana (HCTM/ETA) wrote:

Hi,

I am working on date fields and have problems with the validation. I
have referred to the link below which helped me.

http://www.nabble.com/Strict-4-digit-year-for-DateTextField--td18656889.
html


So I have subclassed the PatternDateConverter and have set the pattern
as,
dateFormat = ^(\\d{1,2})/(\\d{1,2})/(\\d{4})$;

I have 2 date fields, start_date and end_date. The start_date is a
required field and the end_date is not.
(...)
This works fine ie it does not allow entry of 03/03/09 or
03/03/-2009

BUT, the end_date becomes a required field. I have to enter the end_date
to click 'Save'. Else it complains that an invalid date has been
entered.
But my end_date is not a required field.
(...)
  
Possibly the simplest approach would be to use a regular expression that 
allows an empty string like making the whole expression optional by 
surrounding it with paranthesis and adding the optional operator '?' 
after it. This allows the empty string OR a valid date but nothing else:

dateFormat = ^((\\d{1,2})/(\\d{1,2})/(\\d{4}))?$;

Matt

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Problems using wicket with web.xml security

2009-05-26 Thread Matthias Keller

Hi

We have a wicket application which should be completely secured by FORM 
authentication by the webserver.

For that, we have the following in web.xml:

   security-constraint
   display-nameSecured pages/display-name
   web-resource-collection
   web-resource-nameAll Pages/web-resource-name
   url-pattern/*/url-pattern
   http-methodGET/http-method
   http-methodPOST/http-method
   /web-resource-collection
   auth-constraint
   role-namesomeRole/role-name
   /auth-constraint
   /security-constraint

   login-config
   auth-methodFORM/auth-method
   realm-nameSecure Everything/realm-name
   form-login-config
   form-login-page/login/form-login-page
   form-error-page/login/login-error.jsp/form-error-page
   /form-login-config
   /login-config

   security-role
   descriptionUser security role/description
   role-namesomeRole/role-name
   /security-role
   security-role
   descriptionUser security role/description
   role-namesomeOtherRole/role-name
   /security-role

Unfortunately, it seems that every user having ANY role gets access to 
the wicket pages.
For example a user with role  someOtherRole  will get access to the main 
page, as its url is for example:

http://localhost:7001/app/?wicket:interface=:2
When he tries to access a mounted page though, he gets the Error 
403--Forbidden as expected.
But he should also get this error when trying to access the home page of 
the wicket app.
I suspect it has something to do with the /* url-pattern not catching 
the /?wicket:interface=:2  ???


Thanks for your help!!

Matt

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Add a ui lock page over the page while waiting for response

2009-05-07 Thread Matthias Keller

Hi

Thanks for the input. I now used wicketstuff-jquery and wrote a custom 
behaviour which adds the code to my form.

For later reference:
public class UIBlockerBehaviour extends JQueryBehavior {
   private static final ResourceReference BLOCKUI_JS =
   new CompressedResourceReference(UIBlockerBehaviour.class, 
jquery.blockUI.js);


   public void renderHead (IHeaderResponse response) {
   super.renderHead(response);
   response.renderJavascriptReference(BLOCKUI_JS);
   }

   protected void onBind () {
 super.onBind();
 getComponent().add(
 new AttributeAppender(this.attributeName, new 
ResourceModel(JQuery.blockUI.code), ;));

   }
}

Where the string resource contains:

JQuery.blockUI.code = \
   $.blockUI({\
   message: 'h1Please wait.../h1',\
   css:{\
   border: 'none',\
   padding: '15px',\
   backgroundColor: '#000',\
   '-webkit-border-radius': '10px',\
   '-moz-border-radius': '10px',\
   opacity: '.5',\
   color: '#fff'\
   }\
   });

Thanks for your help

The Veil component didn't work for me at all - I saw no difference 
wether I had added it to the button or not at all


Matt

Serkan Camurcuoglu wrote:

you could use the jquery blockui plugin..

http://malsup.com/jquery/block/#demos



James Carman wrote:
There is a veil component in wicketstuff-minis, I believe.  That 
might help.


On Wed, May 6, 2009 at 10:30 AM, Linda van der Pal
lvd...@heritageagenturen.nl wrote:
 
Back when I was programming in jsp I solved this by disabling the 
button
after clicking it (because it would redirect after processing the 
data). Not

sure how I'd do such a thing with Wicket.

Linda.


Matthias Keller wrote:
   

Hi

We have a web form which does some very extensive backend 
communication

requiring a lot of time. So usually after pressing 'submit', the UI is
locked for 10-30 seconds. To avoid re-submission, we'd like to put 
some kind
of ui-lock-page over the current page, stating 'Please wait' or 
something.
So I'd need something to add to the onclick of the submit button 
(which is
NOT an ajax button but a normal input type=submit button) which 
blocks the

UI until the response is ready.
I've tried the wicket-stuff veil thingy, but it doesn't work. 
Here's what

I tried:
WebMarkupContainer submit = new WebMarkupContainer(submit);
submit.add(new Veil());
add(submit);

But even though I see some JS files added to the page, nothing happens
when I click my button?

Is there something else that I can just add to a button?
Thanks a lot

Matt

  

-
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




--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software




smime.p7s
Description: S/MIME Cryptographic Signature


Add a ui lock page over the page while waiting for response

2009-05-06 Thread Matthias Keller

Hi

We have a web form which does some very extensive backend communication 
requiring a lot of time. So usually after pressing 'submit', the UI is 
locked for 10-30 seconds. To avoid re-submission, we'd like to put some 
kind of ui-lock-page over the current page, stating 'Please wait' or 
something.
So I'd need something to add to the onclick of the submit button (which 
is NOT an ajax button but a normal input type=submit button) which 
blocks the UI until the response is ready.
I've tried the wicket-stuff veil thingy, but it doesn't work. Here's 
what I tried:

WebMarkupContainer submit = new WebMarkupContainer(submit);
submit.add(new Veil());
add(submit);

But even though I see some JS files added to the page, nothing happens 
when I click my button?


Is there something else that I can just add to a button?
Thanks a lot

Matt

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6. Mai 2009 unter www.fairnesspreis.ch 





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Validate, Navigate Wizards

2009-05-04 Thread Matthias Keller

wolfgang.sch...@dachser.com wrote:

Hi,

when I validate the data of a WizardStep after pressing Next, I
navigate within the validate method to the WizardStep.previous()
step in the false case.

Works fine! But calling the method WizardStep.previous() works
not for the first Wizard step. That's ok, there is no previous
one.
But how can I do it right?
  

Hi

Not sure why you even want to call next or previous at all manually?
I'm using 1.3.5 so that may make a difference but we're just adding 
validators to the WizardStep which takes care of everything. We never 
have to manually call previous() or next() ?


We're just doing:

   add(new FormValidator() {
   public FormComponent[] getDependentFormComponents() {
   return new FormComponent[] { radioGroup, checkbox };
   }
   public void validate (Form form) {
   if (isSelected(radioGroup, radio1)) {
   if (isChecked(checkbox)) {
   error(checkbox, our.error);
   }
   }
   }
   });

Note that FormValidator is our implementation of AbstractFormValidator 
which is just there to provide some helper methods like the isSelected() 
and isChecked() plus some optimizations.

Now when the error() is called, the wizard won't go to the next step.

Matt

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6. Mai 2009 unter www.fairnesspreis.ch 





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Validate, Navigate Wizards

2009-05-04 Thread Matthias Keller

Hi

Just one note - I just had another look at our FormValidator class - you 
might wonder why you won't find the method  error (FormComponent fc, 
String resourceKey)  provided in my example. The reason is, we wrapped 
this to provide a direct access to localized error messages in our 
custom FormValidator:


   /**
* Reports an error against the validatable using the given literal 
resource key. This means, no

* class prefix is prepended to the resource key.
*
* @param fc form component against which the error is reported
* @param resourceKey The resource key to use
*/
   @Override
   public void error (FormComponent fc, String resourceKey) {
   fc.error(fc.getLocalizer().getString(resourceKey, fc));
   }


Just calling   error (Serializable message)  inside your form validator 
implementation will of course report the error against the FormValidator 
and not the failing component.
So make sure you callmyTextFieldThatFailed.error(...)   instead of   
error(...)


The Wizard will later test, if all contained components were successful 
and only advance if none of them had its  FormComponent.error() method 
invoked.


Good luck

Matt

jackkilian wrote:

Hi Matthias,

thanks! I used error(), but the wizard didn't stop. I will check it, maybe I
use a ref-Object to call error().

regards
- jk


Matthias Keller wrote:
  

wolfgang.sch...@dachser.com wrote:


Hi,

when I validate the data of a WizardStep after pressing Next, I
navigate within the validate method to the WizardStep.previous()
step in the false case.

Works fine! But calling the method WizardStep.previous() works
not for the first Wizard step. That's ok, there is no previous
one.
But how can I do it right?
  
  

Hi

Not sure why you even want to call next or previous at all manually?
I'm using 1.3.5 so that may make a difference but we're just adding 
validators to the WizardStep which takes care of everything. We never 
have to manually call previous() or next() ?


We're just doing:

add(new FormValidator() {
public FormComponent[] getDependentFormComponents() {
return new FormComponent[] { radioGroup, checkbox };
}
public void validate (Form form) {
if (isSelected(radioGroup, radio1)) {
if (isChecked(checkbox)) {
error(checkbox, our.error);
}
}
}
});

Note that FormValidator is our implementation of AbstractFormValidator 
which is just there to provide some helper methods like the isSelected() 
and isChecked() plus some optimizations.

Now when the error() is called, the wizard won't go to the next step.

Matt

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6.
Mai 2009 unter www.fairnesspreis.ch 




 




  



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6. Mai 2009 unter www.fairnesspreis.ch 





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Validate, Navigate Wizards

2009-05-04 Thread Matthias Keller

Hi

If you only want to require that a radio button is selected, then  
myRadioGroup.setRequired(true)  already does that job. No need to 
implement a custom form validator then.
BTW: RequiredTextField is nothing other than a TextField which calls  
setRequired(true)  in the constructor.. It's only here for convenience 
since it is used very often.
so,  .setRequired(true)  is your friend as long as you only want to 
check if a radio button has been selected.


Matt

jackkilian wrote:

Hi,

my intention is to check if special mandatory fields are filled.
What I found in the examples is the RequiredTextField... within the Wicket
lib.

I use a RadioBtnGroup with RadioBtn's, the user has to select one!
Thats all what I validate.

But no matter, with your hint I can solve that problem. Maybe I implement an
own RadioBtnGroup-Komponent who can check this in general, like the
RequiredTextField... :-)

regards
- jk



Matthias Keller wrote:
  

Hi

Just one note - I just had another look at our FormValidator class - you 
might wonder why you won't find the method  error (FormComponent fc, 
String resourceKey)  provided in my example. The reason is, we wrapped 
this to provide a direct access to localized error messages in our 
custom FormValidator:


/**
 * Reports an error against the validatable using the given literal 
resource key. This means, no

 * class prefix is prepended to the resource key.
 *
 * @param fc form component against which the error is reported
 * @param resourceKey The resource key to use
 */
@Override
public void error (FormComponent fc, String resourceKey) {
fc.error(fc.getLocalizer().getString(resourceKey, fc));
}


Just calling   error (Serializable message)  inside your form validator 
implementation will of course report the error against the FormValidator 
and not the failing component.
So make sure you callmyTextFieldThatFailed.error(...)   instead of   
error(...)


The Wizard will later test, if all contained components were successful 
and only advance if none of them had its  FormComponent.error() method 
invoked.


Good luck

Matt

jackkilian wrote:


Hi Matthias,

thanks! I used error(), but the wizard didn't stop. I will check it,
maybe I
use a ref-Object to call error().

regards
- jk


Matthias Keller wrote:
  
  

wolfgang.sch...@dachser.com wrote:



Hi,

when I validate the data of a WizardStep after pressing Next, I
navigate within the validate method to the WizardStep.previous()
step in the false case.

Works fine! But calling the method WizardStep.previous() works
not for the first Wizard step. That's ok, there is no previous
one.
But how can I do it right?
  
  
  

Hi

Not sure why you even want to call next or previous at all manually?
I'm using 1.3.5 so that may make a difference but we're just adding 
validators to the WizardStep which takes care of everything. We never 
have to manually call previous() or next() ?


We're just doing:

add(new FormValidator() {
public FormComponent[] getDependentFormComponents() {
return new FormComponent[] { radioGroup, checkbox };
}
public void validate (Form form) {
if (isSelected(radioGroup, radio1)) {
if (isChecked(checkbox)) {
error(checkbox, our.error);
}
}
}
});

Note that FormValidator is our implementation of AbstractFormValidator 
which is just there to provide some helper methods like the isSelected() 
and isChecked() plus some optimizations.

Now when the error() is called, the wizard won't go to the next step.

Matt

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6.
Mai 2009 unter www.fairnesspreis.ch 




 



  
  

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6.
Mai 2009 unter www.fairnesspreis.ch 




 




  



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6. Mai 2009 unter www.fairnesspreis.ch 





smime.p7s
Description: S/MIME Cryptographic Signature


  1   2   >