RE: Conditional validation without overriding isRequired

2012-06-06 Thread Schlärmann , Bob
Thanks for your reply,

 Argh, confused setVisible() with setRequired, my bad ;-)
 But nevertheless: call setRequiered(condition) in onConfigure().

I've tried this but if I am correct isRequired() gets called before 
onConfigure() during the request cycle (at least this is the behaviour I see 
during debugging). 

The problem is that the user is then able to submit the form without filling in 
the required field if validation completely succeeds at once. Also the required 
fields lag behind one request cycle.


 
-Tom
 
 
 Thomas Götz wrote:
 
  Yes, you can also push the state instead of pulling it, which besides is
 preferrable in terms of efficiency (as onConfigure() is only called once per
 request whereas isVisible() is potentially called many time):
 
  TextFieldString textField = new TextFieldString(textField) {
 @Override
 protected void onConfigure() {
 super.onConfigure();
 setVisible(condition);
 }
  };
 
  You can also call textField.setVisible(...) in the Page's or Panel's
 onConfigure(), but then you need a reference to the textField (property of the
 page or panel). Or - if possible - you can group your FormComponents into a
 WebMarkupContainer an set the visibility there.
 
-Tom
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.



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



getLastPage is block third party cookies

2012-06-06 Thread cosmindumy
Hi,
I have problems when trying to retrieve last page if block third party
cookies are set in browser.
All my pages extends a base page that has a method storeCurrentPate().
I try to get last page like :
 final HashMapString, PageIdVersion lastPageMap =
getSession().getMetaData(lastPageIdVersionKey);
final PageIdVersion pageIdVersion =
lastPageMap.get(getPageMap().getName()).last;
...

Anyone an idea?
Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/getLastPage-is-block-third-party-cookies-tp4649750.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Streaming Files back to client with using Wicket Pages

2012-06-06 Thread MattyDE
Hi folks,

iam ill-using a PrintPage to start my Printing progress which delivers a
pdf-File back to the User by writing to the response output Stream.

I have to use a Wicket-Page because in one particular case i want to show
the Paths to the pdfs instead of stream them directly.

Everything works fine. But when i stream the file back to client wicket
throws this error (which is comprehensible). But how can i say to wicket:
Hey I've sended the response before, dont care about!' ?

Iam using wicket 1.4.19



Thanks in Advance for any help.

And excuse my English, its not my mothers tongue.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Streaming-Files-back-to-client-with-using-Wicket-Pages-tp4649751.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Conditional validation without overriding isRequired

2012-06-06 Thread Andrea Del Bene

Hi,

you can consider to override form's process() method. Before calling the 
super version you can check for the radio value and set the other fields 
as required if the specific value was chosen.

Thanks for your reply,


Argh, confused setVisible() with setRequired, my bad ;-)
But nevertheless: call setRequiered(condition) in onConfigure().

I've tried this but if I am correct isRequired() gets called before 
onConfigure() during the request cycle (at least this is the behaviour I see 
during debugging).

The problem is that the user is then able to submit the form without filling in the 
required field if validation completely succeeds at once. Also the required fields 
lag behind one request cycle.



-Tom


Thomas Götz wrote:


Yes, you can also push the state instead of pulling it, which besides is

preferrable in terms of efficiency (as onConfigure() is only called once per
request whereas isVisible() is potentially called many time):

TextFieldString  textField = new TextFieldString(textField) {
@Override
protected void onConfigure() {
super.onConfigure();
setVisible(condition);
}
};

You can also call textField.setVisible(...) in the Page's or Panel's

onConfigure(), but then you need a reference to the textField (property of the
page or panel). Or - if possible - you can group your FormComponents into a
WebMarkupContainer an set the visibility there.

   -Tom


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



Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.



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




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



RE: Conditional validation without overriding isRequired

2012-06-06 Thread Sven Meier
You have to use the input or converted input of the field. See

https://cwiki.apache.org/WICKET/conditional-validation.html

for inspirations.

Sven

Schlärmann, Bob bob.schlarm...@logica.com schrieb:

Thanks for your reply,

 Argh, confused setVisible() with setRequired, my bad ;-)
 But nevertheless: call setRequiered(condition) in onConfigure().

I've tried this but if I am correct isRequired() gets called before 
onConfigure() during the request cycle (at least this is the behaviour I see 
during debugging). 

The problem is that the user is then able to submit the form without filling 
in the required field if validation completely succeeds at once. Also the 
required fields lag behind one request cycle.


 
-Tom
 
 
 Thomas Götz wrote:
 
  Yes, you can also push the state instead of pulling it, which besides is
 preferrable in terms of efficiency (as onConfigure() is only called once per
 request whereas isVisible() is potentially called many time):
 
  TextFieldString textField = new TextFieldString(textField) {
 @Override
 protected void onConfigure() {
 super.onConfigure();
 setVisible(condition);
 }
  };
 
  You can also call textField.setVisible(...) in the Page's or Panel's
 onConfigure(), but then you need a reference to the textField (property of 
 the
 page or panel). Or - if possible - you can group your FormComponents into a
 WebMarkupContainer an set the visibility there.
 
-Tom
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.



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



ModalDialog and returning back

2012-06-06 Thread Alex
Dear All,
I have an application that on renderOnDomReadyJavascript shows Modal Dialog
for 5 seconds and then closes it. It is kind of Logo. Unfortunately if user
goes to another site and returns back then “Page expired” is displayed in
this Modal Dialog and it is not closes. Is it possible to avoid showing
this Modal Dialog after user returns to my application pressing “Back”
Button on the Browser or to show it properly for 5 sec.
Thanks a lot in advance,
Alex

public class LogoStarter {
private static final Logger log =
LoggerFactory.getLogger(LogoStarter.class);

public LogoStarter(final WebPage webPage) {
final ModalWindow modalLogo;
final ModalWindow modalInfo;

webPage.add(modalLogo = new OpenOnLoadModalWindow(modalLogo));
modalLogo.setTitle();
modalLogo.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID =
2674999186672458996L;
public Page createPage() {
return new Logo();
}
});

webPage.add(new AjaxLinkObject(logo) {
public void onClick(AjaxRequestTarget target) {
if (target != null) {
modalLogo.show(target);
} else {
System.out.println(JS off);
setResponsePage(new Logo(JS_OFF_MSG));
}

}
});

webPage.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
protected void onTimer(AjaxRequestTarget target) {
if (modalLogo.isShown())
modalLogo.close(target);
stop();
}
});
}
}

public class OpenOnLoadModalWindow extends ModalWindow implements
IHeaderContributor {

public OpenOnLoadModalWindow(String id) {
super(id);
}

public OpenOnLoadModalWindow(String id, IModel? model) {
super(id, model);
}

public void renderHead(IHeaderResponse response)
{
   response.renderOnDomReadyJavascript(getWindowOpenJavascript());
}

   protected boolean makeContentVisible()
{
return true;
}
}


RE: Conditional validation without overriding isRequired

2012-06-06 Thread Schlärmann , Bob
Thanks for all the comments.

I'm implementing the conditional validation using a custom form processing 
method as suggested by Andrea. 

It's implemented as a form and behavior subclass. The overridden Form#process() 
first visits all form components and executes a special method on the behavior. 
The behavior then calls validate() on the source field and sets the required 
flag of the target component based on the converted input value.

The call to validate() is needed in order to have the converted input value set.

Best regards,

Bob

 You have to use the input or converted input of the field. See
 
 https://cwiki.apache.org/WICKET/conditional-validation.html
 
 for inspirations.
 
 Sven
 
 Schlärmann, Bob bob.schlarm...@logica.com schrieb:
 
 Thanks for your reply,
 
  Argh, confused setVisible() with setRequired, my bad ;-)
  But nevertheless: call setRequiered(condition) in onConfigure().
 
 I've tried this but if I am correct isRequired() gets called before
 onConfigure() during the request cycle (at least this is the behaviour I see
 during debugging).
 
 The problem is that the user is then able to submit the form without filling
 in the required field if validation completely succeeds at once. Also the
 required fields lag behind one request cycle.
 
 
 
 -Tom
 
 
  Thomas Götz wrote:
 
   Yes, you can also push the state instead of pulling it, which besides is
  preferrable in terms of efficiency (as onConfigure() is only called once
 per
  request whereas isVisible() is potentially called many time):
  
   TextFieldString textField = new TextFieldString(textField) {
  @Override
  protected void onConfigure() {
  super.onConfigure();
  setVisible(condition);
  }
   };
  
   You can also call textField.setVisible(...) in the Page's or Panel's
  onConfigure(), but then you need a reference to the textField (property of
 the
  page or panel). Or - if possible - you can group your FormComponents into a
  WebMarkupContainer an set the visibility there.
  
 -Tom
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 Think green - keep it on the screen.
 
 This e-mail and any attachment is for authorised use by the intended
 recipient(s) only. It may contain proprietary material, confidential
 information and/or be subject to legal privilege. It should not be copied,
 disclosed to, retained or used by, any other party. If you are not an intended
 recipient then please promptly delete this e-mail and any attachment and all
 copies and inform the sender. Thank you.
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 

Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.



Re: Page Expiry In IE8

2012-06-06 Thread shashikanth69
Hi Guys,

   I am posting again as i havent get any solution for this problem
yet. Hope this time i may get one.
Just addign somemore tho the description of my earlier post.

Here are the example url i am using from our employers domain in two tabs.

1st tab: http://xdev.comapny.com/externalapp

2nd tab : http://xdev.comapny.com/myapp

when I do any operation in any page in my application the page just expires
and goes to the default page which configured through page expiry method.

-shashi

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Page-Expiry-In-IE8-tp4288969p4649760.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Exception handling and testing

2012-06-06 Thread Alec Swan
Hello,

I am creating a new set of pages that are a part of an old project but
have a different home page. It's kind of like a sub-site within a
site. The user is required to log in on the sub-site's home page to be
able to access any of those pages. If the user tries to access any of
these pages directly he should be redirected to the sub-site's home
page.

What's the best way to implement/configure the home page for this sub-site?
What kind of exception should each sub-site page throw to trigger
redirection to home page?
How can I verify that an exception was thrown in my test? (Currently I
have a test which calls startPanel(..) which logs an exception if the
user is not logged in, but returns with no errors. So, I have to
verify that the rendered page is what it should be.)

I am basically looking for best practices here.

Thanks,

Alec

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