Adding Ajax Validation to Individual Form components- Distinguishing error from multiple validators

2012-08-17 Thread lucast
Dear Forum,
I apologize if this question has come up before.

I have an email field and I want to check two things: one: that the email
address is well formed. And two: that the email address isn't already
registered.

For the first one I use EmailAddressValidator and for the second one I
create my own validator.

I then add AjaxFormComponentUpdatingBehavior to the email address field as
explained in the Apache Wicket Cookbook, Chapter 7: Adding Ajax Validation
to Individual Form components.

The problem I have is that, inside
AjaxFormComponentUpdatingBehavior.onError(AjaxRequestTarget target,
RuntimeException e) I don't know whether the error came from
EmailAddressValidator or my own validator. The error message should be
different depending which Validator is complaining.

Is there a way to find out which validator the error is coming from? that
would make things more efficient.

Thanks in advance.
Lucas





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Adding-Ajax-Validation-to-Individual-Form-components-Distinguishing-error-from-multiple-validators-tp4651319.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: Adding Ajax Validation to Individual Form components- Distinguishing error from multiple validators

2012-08-17 Thread Sven Meier
The two different validators will already have different resource keys for 
display of the feedback, why do you need to differentiate in #onError() ?

Sven

lucast  schrieb:

>Dear Forum,
>I apologize if this question has come up before.
>
>I have an email field and I want to check two things: one: that the email
>address is well formed. And two: that the email address isn't already
>registered.
>
>For the first one I use EmailAddressValidator and for the second one I
>create my own validator.
>
>I then add AjaxFormComponentUpdatingBehavior to the email address field as
>explained in the Apache Wicket Cookbook, Chapter 7: Adding Ajax Validation
>to Individual Form components.
>
>The problem I have is that, inside
>AjaxFormComponentUpdatingBehavior.onError(AjaxRequestTarget target,
>RuntimeException e) I don't know whether the error came from
>EmailAddressValidator or my own validator. The error message should be
>different depending which Validator is complaining.
>
>Is there a way to find out which validator the error is coming from? that
>would make things more efficient.
>
>Thanks in advance.
>Lucas
>
>
>
>
>
>--
>View this message in context: 
>http://apache-wicket.1842946.n4.nabble.com/Adding-Ajax-Validation-to-Individual-Form-components-Distinguishing-error-from-multiple-validators-tp4651319.html
>Sent from the Users forum mailing list archive at Nabble.com.
>
>-
>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>For additional commands, e-mail: users-h...@wicket.apache.org
>

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



Re: Adding Ajax Validation to Individual Form components- Distinguishing error from multiple validators

2012-08-17 Thread lucast
Hi Sven,
Sorry, I should have explained on the first post.
The reason I want to differentiate in #onError()  is because if the address
is already registered then I want to have a modal window popping up with
further options such as retrieving the person's details and so on.
Where as if the email address is not well formed, I don't want to have the
modal window being displayed.

Thanks once more.

Lucas





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Adding-Ajax-Validation-to-Individual-Form-components-Distinguishing-error-from-multiple-validators-tp4651319p4651321.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: Adding Ajax Validation to Individual Form components- Distinguishing error from multiple validators

2012-08-17 Thread Sven Meier
Hi,

there is nothing preventing you to open a modal window from you validator.

If you don't want to see its validation feedback anyway, you should just move 
the address registered checking into your #onSubmit().

Sven

lucast  schrieb:

>Hi Sven,
>Sorry, I should have explained on the first post.
>The reason I want to differentiate in #onError()  is because if the address
>is already registered then I want to have a modal window popping up with
>further options such as retrieving the person's details and so on.
>Where as if the email address is not well formed, I don't want to have the
>modal window being displayed.
>
>Thanks once more.
>
>Lucas
>
>
>
>
>
>--
>View this message in context: 
>http://apache-wicket.1842946.n4.nabble.com/Adding-Ajax-Validation-to-Individual-Form-components-Distinguishing-error-from-multiple-validators-tp4651319p4651321.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: Re: Basic JUnit Test

2012-08-17 Thread vineet semwal
 why are you attaching a new ajaxformsubmitbehavior to an ajaxbutton
,it already has it's own ?
 if you want to pass some request parameter  ,you can set it to the
request by tester.getRequest().setParameter(key,value)

On Fri, Aug 17, 2012 at 12:09 PM, JCoder  wrote:
> Hi Vineet,
>
> "wickettester#ajaxEvent(button,"onclick") " is what I already tried. And it 
> worked better but not finally finsihed.
> The cause of the next problem is that I need to provide some request 
> parameter for this request since my application reads request and throws an 
> exception if it can't find special parameters.
> Then I changed my code to provide some ajax request parameter because the 
> button click is an instance of AjaxButton:
>
> "
> Component comp = tester
> 
> .getComponentFromLastRenderedPage("myForm:myAjaxButton");
> AjaxEventBehavior behavior = new 
> AjaxFormSubmitBehavior("onclick") {
>
> @Override
> protected void onSubmit(AjaxRequestTarget target) {
> System.out.println("hh");
> }
>
> @Override
> protected void onError(AjaxRequestTarget target) {
> // TODO Auto-generated method stub
>
> }
> };
>
> comp.add(behavior);
> tester.executeAjaxEvent(comp, "onclick");
> "
>
> Is this the correct to provide ajax request parameter?
> If so, I guess I need to chance something in "onSubmit(AjaxRequestTarget)", 
> true ?
>
> Regards,
> Y
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
regards,

Vineet Semwal

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



Re: Regarding "WARN - (WebPageRenderer.java:162)" v1.5.7

2012-08-17 Thread yesotaso
Will do, at the moment trying to isolate the incident.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Regarding-WARN-WebPageRenderer-java-162-v1-5-7-tp4651245p4651325.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



Close ModalWindow on keypress (ESC)

2012-08-17 Thread Marco Di Sabatino Di Diodoro
Hi, 

I need close the ModalWindows of my application when I press ESC on the 
keyboard.

Suggestions?

Regards
M

--

Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PPMC Member
http://people.apache.org/~mdisabatino






Re: Close ModalWindow on keypress (ESC)

2012-08-17 Thread Cedric Gatay
Hi,
I actually use this in my project :


/**
 * Behavior allowing to close the window on esc, requires jQuery
 * Slighlty modified from
http://stackoverflow.com/questions/5042426/wicket-close-modalwindow-on-keypress
 */
private class CloseOnESCBehavior extends AbstractDefaultAjaxBehavior {

@NonNls
private static final String PRE_JS = "$(document).ready(function()
{\n" +
 "  $(document).bind('keyup',
function(evt) {\n" +
 "if (evt.keyCode == 27)
{\n";
@NonNls
private static final String POST_JS = "\n evt.preventDefault();\n" +
  "}\n" +
  "  });\n" +
  "});";

/**
 * {@inheritDoc}
 */
@Override
protected void respond(AjaxRequestTarget target) {
close(target);
}

/**
 * {@inheritDoc}
 *
 * @return always null to hide the indicator (it does not flicker)
 */
@Override
protected String findIndicatorId() {
return null;
}

/**
 * {@inheritDoc}
 */
@Override
public void renderHead(Component component, IHeaderResponse
response) {
response.renderJavaScript(new
StringBuilder(PRE_JS).append(getCallbackScript())
  .append(POST_JS).toString(),
"closeModalOnEsc");
}
}

You'll need to adapt it if you're not using JQuery in your project. All you
have to do is add this behavior on your modal window.

Regards,
__
Cedric Gatay
http://www.bloggure.info | http://cedric.gatay.fr |
@Cedric_Gatay


On Fri, Aug 17, 2012 at 12:05 PM, Marco Di Sabatino Di Diodoro <
marco.disabat...@tirasa.net> wrote:

> Hi,
>
> I need close the ModalWindows of my application when I press ESC on the
> keyboard.
>
> Suggestions?
>
> Regards
> M
>
> --
>
> Dott. Marco Di Sabatino Di Diodoro
> Tel. +39 3939065570
>
> Tirasa S.r.l.
> Viale D'Annunzio 267 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 085973
> http://www.tirasa.net
>
> Apache Syncope PPMC Member
> http://people.apache.org/~mdisabatino
>
>
>
>
>


Re: [6.0] resource management

2012-08-17 Thread Pierre Goupil
Excellent! Thanks Martin, I'll try it ASAP.
Le 17 août 2012 07:43, "Martin Grigorov"  a écrit :

> Hi,
>
> You can set your JQueryResRef with
>
> application.getJavaScriptLibrarySettings().setJQueryResourceReference(MyJQueryResRef);
>
> Wicket 6 uses and is tested for JQuery 1.7.2. It also works fine with
> 1.8.0 (i.e. all available tests pass). It wont work with JQuery 1.6
> and older.
>
> On Thu, Aug 16, 2012 at 4:24 PM, Pierre Goupil 
> wrote:
> > Good afternoon,
> >
> > I'm currently playing with Wicket 6.0 resource management, as found here:
> > http://wicketinaction.com/2012/07/wicket-6-resource-management/
> >
> > Martin's website introduces us to the concept of resource dependencies.
> It
> > works great for my own provided JS, but there is still one problem:
> > wicket-core 6.0.0-beta3 contributes its own JSs and I'd like Wicket not
> to
> > contribute jquery.js, because I'll provide it myself.
> >
> > Is there any way of doing this? I have some JQuery-related JS that I
> > contribute myself to the (beginning of the) , so Wicket's
> > contribution of jquery.js (at the end of the ) is undesirable
> because
> > the JS file is then duplicated, which breaks my dependency graph.
> >
> > As an additional request, is there any way to tell Wicket to contribute
> its
> > JS files, but at the very beginning of the  tag?
> >
> > Lastly, which JQuery version should I use if I must contribute the
> > jquery.js myself? Is 1.6.0 up to 1.8.0 all OK?
> >
> > Thanks in advance & best regards,
> >
> > Pierre
> >
> >
> >
> > --
> > Le bonheur n'est pas une destination, mais une façon de voyager.
> >
> > Papa d'une petite Lou-Ann depuis le 30 juin.
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Adding Ajax Validation to Individual Form components- Distinguishing error from multiple validators

2012-08-17 Thread lucast
Thanks Sven, 
I'm afraid I don't know how to open a modal window from IValidator.validate
since as it stands it does not handle ajax (as far as my limited knowledge
goes).

I have moved email address validation to form.onValidate() and implemented
it in the following manner: 

if ( ! EmailAddressValidator.getInstance().getPattern().matcher( email
).find() ){ ...

I just thought one could perhaps, within
AjaxFormComponentUpdatingBehavior.onError  determine which validator is
complaining out of a group that have been assigned to a field.


Thanks,
Lucas



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Adding-Ajax-Validation-to-Individual-Form-components-Distinguishing-error-from-multiple-validators-tp4651319p4651329.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: Close ModalWindow on keypress (ESC)

2012-08-17 Thread Marco Di Sabatino Di Diodoro
Hi, 

thanks for the help.
I integrate your code in my application, but the Modal Window closes only when 
I clicked on it with the mouse first.

How can I set the focus when the ModalWindow opens?

M

On Aug 17, 2012, at 12:31 PM, Cedric Gatay wrote:

> Hi,
> I actually use this in my project :
> 
> 
>/**
> * Behavior allowing to close the window on esc, requires jQuery
> * Slighlty modified from
> http://stackoverflow.com/questions/5042426/wicket-close-modalwindow-on-keypress
> */
>private class CloseOnESCBehavior extends AbstractDefaultAjaxBehavior {
> 
>@NonNls
>private static final String PRE_JS = "$(document).ready(function()
> {\n" +
> "  $(document).bind('keyup',
> function(evt) {\n" +
> "if (evt.keyCode == 27)
> {\n";
>@NonNls
>private static final String POST_JS = "\n evt.preventDefault();\n" +
>  "}\n" +
>  "  });\n" +
>  "});";
> 
>/**
> * {@inheritDoc}
> */
>@Override
>protected void respond(AjaxRequestTarget target) {
>close(target);
>}
> 
>/**
> * {@inheritDoc}
> *
> * @return always null to hide the indicator (it does not flicker)
> */
>@Override
>protected String findIndicatorId() {
>return null;
>}
> 
>/**
> * {@inheritDoc}
> */
>@Override
>public void renderHead(Component component, IHeaderResponse
> response) {
>response.renderJavaScript(new
> StringBuilder(PRE_JS).append(getCallbackScript())
>  .append(POST_JS).toString(),
> "closeModalOnEsc");
>}
>}
> 
> You'll need to adapt it if you're not using JQuery in your project. All you
> have to do is add this behavior on your modal window.
> 
> Regards,
> __
> Cedric Gatay
> http://www.bloggure.info | http://cedric.gatay.fr |
> @Cedric_Gatay
> 
> 
> On Fri, Aug 17, 2012 at 12:05 PM, Marco Di Sabatino Di Diodoro <
> marco.disabat...@tirasa.net> wrote:
> 
>> Hi,
>> 
>> I need close the ModalWindows of my application when I press ESC on the
>> keyboard.
>> 
>> Suggestions?
>> 
>> Regards
>> M
>> 
>> --
>> 
>> Dott. Marco Di Sabatino Di Diodoro
>> Tel. +39 3939065570
>> 
>> Tirasa S.r.l.
>> Viale D'Annunzio 267 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 085973
>> http://www.tirasa.net
>> 
>> Apache Syncope PPMC Member
>> http://people.apache.org/~mdisabatino
>> 
>> 
>> 
>> 
>> 

--

Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PPMC Member
http://people.apache.org/~mdisabatino






Re: Regarding "WARN - (WebPageRenderer.java:162)" v1.5.7

2012-08-17 Thread yesotaso
Please  disregard above comment... I was trying to reproduce mentioned
warning with a staless page... with a straight 16 hours caffeinless brain...
still no caffein I'll try to open JIRA ticket if I can ever remember I did
all this...

Anyway, I created a  https://github.com/yeso112860/Wicket-Test1 Github Repo 
if that counts 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Regarding-WARN-WebPageRenderer-java-162-v1-5-7-tp4651245p4651335.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



Dataview: need message nothing found

2012-08-17 Thread Delange
Hi, when my dataview (with selections) does not return any result, it doesn't
say anything.

How can i return a message that there are no results found. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dataview-need-message-nothing-found-tp4651337.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: Dataview: need message nothing found

2012-08-17 Thread Igor Vaynberg
add a webmarkup container that is only visible when the dataview has no records.

public class NoRecordsContainer extends WebMarkupContainer {
private final AbstractRepeater repeater;

public NoRecordsContainer(String id, AbstractRepeater repeater) {
super(id);
this.repeater = repeater;
setOutputMarkupPlaceholderTag(true);
}

@Override
protected void onConfigure() {
super.onConfigure();
setVisible(repeater.size() == 0);
}
}

-igor

On Fri, Aug 17, 2012 at 8:00 AM, Delange  wrote:
> Hi, when my dataview (with selections) does not return any result, it doesn't
> say anything.
>
> How can i return a message that there are no results found.
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Dataview-need-message-nothing-found-tp4651337.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

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



Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Sven Meier
Without looking to deep into this you should create the InputStream in 
CouchDbResourceStream#getInputStream() instead of the constructor.


Sven

On 08/17/2012 04:25 PM, Michael M wrote:

Hi, short question this time: I have several ResourceLinks to
ResourceStreamResources on a page. When I click on one of those links, the
resource streams attachments dynamically out of my database.

That's working quite well now, however the stream (and whatever happens in
the method returning the streams) is called 2-4 times. E.g. opening an
image results in 4 queries to the CouchDB database. I don't really see that
happening when I'm playing an mp3 file with a flash-player pointing to the
URL of the resource.

Does anyone have an idea why? I'm only instantiating the resource once, for
any link I only use that one resource.

Here's my custom ResourceStreamResource: http://pastebin.com/9BB7LEiV

And here my custom IResouceStream: http://pastebin.com/Z7GvzGja

Thanks!




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



Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Michael M
Hi,

I wanted to, but I can't because then I don't have the stream to close it.
If I don't close the stream returned by the Ektorp getAttachment() method I
will have memory leaks.

2012/8/17 Sven Meier 

> Without looking to deep into this you should create the InputStream in
> CouchDbResourceStream#**getInputStream() instead of the constructor.
>
> Sven
>
>
> On 08/17/2012 04:25 PM, Michael M wrote:
>
>> Hi, short question this time: I have several ResourceLinks to
>> ResourceStreamResources on a page. When I click on one of those links, the
>> resource streams attachments dynamically out of my database.
>>
>> That's working quite well now, however the stream (and whatever happens in
>> the method returning the streams) is called 2-4 times. E.g. opening an
>> image results in 4 queries to the CouchDB database. I don't really see
>> that
>> happening when I'm playing an mp3 file with a flash-player pointing to the
>> URL of the resource.
>>
>> Does anyone have an idea why? I'm only instantiating the resource once,
>> for
>> any link I only use that one resource.
>>
>> Here's my custom ResourceStreamResource: http://pastebin.com/9BB7LEiV
>>
>> And here my custom IResouceStream: http://pastebin.com/Z7GvzGja
>>
>> Thanks!
>>
>>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Sven Meier
Beware that ResourceStreamResource#getResourceStream() is called 
multiple times.


Probably easiest is to create the resource stream in 
CouchDbAttachmentStreamResource's constructor and pass it to super.


Sven

On 08/17/2012 05:28 PM, Michael M wrote:

Hi,

I wanted to, but I can't because then I don't have the stream to close it.
If I don't close the stream returned by the Ektorp getAttachment() method I
will have memory leaks.

2012/8/17 Sven Meier 


Without looking to deep into this you should create the InputStream in
CouchDbResourceStream#**getInputStream() instead of the constructor.

Sven


On 08/17/2012 04:25 PM, Michael M wrote:


Hi, short question this time: I have several ResourceLinks to
ResourceStreamResources on a page. When I click on one of those links, the
resource streams attachments dynamically out of my database.

That's working quite well now, however the stream (and whatever happens in
the method returning the streams) is called 2-4 times. E.g. opening an
image results in 4 queries to the CouchDB database. I don't really see
that
happening when I'm playing an mp3 file with a flash-player pointing to the
URL of the resource.

Does anyone have an idea why? I'm only instantiating the resource once,
for
any link I only use that one resource.

Here's my custom ResourceStreamResource: http://pastebin.com/9BB7LEiV

And here my custom IResouceStream: http://pastebin.com/Z7GvzGja

Thanks!



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





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



Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Michael M
Thanks for the idea, but I can't do that. That would make my resources
static and all attachments would be loaded at page load. I did that at the
beginning, and of course that's a very flawed concept because I would run
into huge performance and memory-problems even with just one user.

So I need the ResourceStreamResource to be dynamic. I don't get why the *
getResourceStream()* is called multiple times.. the javadoc for that method
says

Lazy or dynamic initialization (...)


How can I get proper dynamic resource then?

2012/8/17 Sven Meier 

> Beware that ResourceStreamResource#**getResourceStream() is called
> multiple times.
>
> Probably easiest is to create the resource stream in
> CouchDbAttachmentStreamResourc**e's constructor and pass it to super.
>
> Sven
>
>
> On 08/17/2012 05:28 PM, Michael M wrote:
>
>> Hi,
>>
>> I wanted to, but I can't because then I don't have the stream to close it.
>> If I don't close the stream returned by the Ektorp getAttachment() method
>> I
>> will have memory leaks.
>>
>> 2012/8/17 Sven Meier 
>>
>>  Without looking to deep into this you should create the InputStream in
>>> CouchDbResourceStream#getInputStream() instead of the constructor.
>>>
>>>
>>> Sven
>>>
>>>
>>> On 08/17/2012 04:25 PM, Michael M wrote:
>>>
>>>  Hi, short question this time: I have several ResourceLinks to
 ResourceStreamResources on a page. When I click on one of those links,
 the
 resource streams attachments dynamically out of my database.

 That's working quite well now, however the stream (and whatever happens
 in
 the method returning the streams) is called 2-4 times. E.g. opening an
 image results in 4 queries to the CouchDB database. I don't really see
 that
 happening when I'm playing an mp3 file with a flash-player pointing to
 the
 URL of the resource.

 Does anyone have an idea why? I'm only instantiating the resource once,
 for
 any link I only use that one resource.

 Here's my custom ResourceStreamResource: http://pastebin.com/9BB7LEiV

 And here my custom IResouceStream: http://pastebin.com/Z7GvzGja

 Thanks!


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


Re: Adding Ajax Validation to Individual Form components- Distinguishing error from multiple validators

2012-08-17 Thread Sven Meier

how to open a modal window from IValidator.validate since as it stands it does 
not handle
ajax (as far as my limited knowledge goes).


With AjaxRequestTarget.get() your validator can get hold of the current ART (if 
present).

Or leave the EmailAddressValidator on the TextField and do the rest in 
AjaxSubmitButton#onSubmit():

onSubmit(AjaxRequestTarget target) {
  // address is already valid, else this method wouldn't be called

  if (isAddressUsed()) {
openModalDialog();
  } else {
goOn();
  }
}

Sven



On 08/17/2012 01:44 PM, lucast wrote:

Thanks Sven,
I'm afraid I don't know how to open a modal window from IValidator.validate
since as it stands it does not handle ajax (as far as my limited knowledge
goes).

I have moved email address validation to form.onValidate() and implemented
it in the following manner:

if ( ! EmailAddressValidator.getInstance().getPattern().matcher( email
).find() ){ ...

I just thought one could perhaps, within
AjaxFormComponentUpdatingBehavior.onError  determine which validator is
complaining out of a group that have been assigned to a field.


Thanks,
Lucas



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Adding-Ajax-Validation-to-Individual-Form-components-Distinguishing-error-from-multiple-validators-tp4651319p4651329.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Michael M
Is it possible that it's a bug that the stream gets requested multiple
times? Or if it is by design, why? I can't see a reason for it.

I also cannot only return a new IResourceStream when it's not instantiated
yet in my ResourceStreamResource, because the AttachmentInputStream from
Ektorp is not serializable, I get errors if I try that. As far as my
knowledge goes I see myself with no option left..

2012/8/17 Michael M 

> Thanks for the idea, but I can't do that. That would make my resources
> static and all attachments would be loaded at page load. I did that at the
> beginning, and of course that's a very flawed concept because I would run
> into huge performance and memory-problems even with just one user.
>
> So I need the ResourceStreamResource to be dynamic. I don't get why the *
> getResourceStream()* is called multiple times.. the javadoc for that
> method says
>
> Lazy or dynamic initialization (...)
>
>
> How can I get proper dynamic resource then?
>
> 2012/8/17 Sven Meier 
>
>> Beware that ResourceStreamResource#**getResourceStream() is called
>> multiple times.
>>
>> Probably easiest is to create the resource stream in
>> CouchDbAttachmentStreamResourc**e's constructor and pass it to super.
>>
>> Sven
>>
>>
>> On 08/17/2012 05:28 PM, Michael M wrote:
>>
>>> Hi,
>>>
>>> I wanted to, but I can't because then I don't have the stream to close
>>> it.
>>> If I don't close the stream returned by the Ektorp getAttachment()
>>> method I
>>> will have memory leaks.
>>>
>>> 2012/8/17 Sven Meier 
>>>
>>>  Without looking to deep into this you should create the InputStream in
 CouchDbResourceStream#getInputStream() instead of the constructor.


 Sven


 On 08/17/2012 04:25 PM, Michael M wrote:

  Hi, short question this time: I have several ResourceLinks to
> ResourceStreamResources on a page. When I click on one of those links,
> the
> resource streams attachments dynamically out of my database.
>
> That's working quite well now, however the stream (and whatever
> happens in
> the method returning the streams) is called 2-4 times. E.g. opening an
> image results in 4 queries to the CouchDB database. I don't really see
> that
> happening when I'm playing an mp3 file with a flash-player pointing to
> the
> URL of the resource.
>
> Does anyone have an idea why? I'm only instantiating the resource once,
> for
> any link I only use that one resource.
>
> Here's my custom ResourceStreamResource: http://pastebin.com/9BB7LEiV
>
> And here my custom IResouceStream: http://pastebin.com/Z7GvzGja
>
> Thanks!
>
>
>  --**
 --**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apa**che.org
 
 >

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



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


Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Sven Meier
Hm, possibly easiest would be to create the resource when it is 
requested only.

What component are you using to integrate the resource in your page?

>Is it possible that it's a bug that the stream gets requested multiple 
times? Or if it is by design, why?


IMHO ResourceStreamResource#internalGetResourceStream() should check for 
an already created stream and return that one. The way it is implemented 
now looks like a bug.


Sven


On 08/17/2012 06:19 PM, Michael M wrote:

Is it possible that it's a bug that the stream gets requested multiple
times? Or if it is by design, why? I can't see a reason for it.

I also cannot only return a new IResourceStream when it's not instantiated
yet in my ResourceStreamResource, because the AttachmentInputStream from
Ektorp is not serializable, I get errors if I try that. As far as my
knowledge goes I see myself with no option left..

2012/8/17 Michael M 


Thanks for the idea, but I can't do that. That would make my resources
static and all attachments would be loaded at page load. I did that at the
beginning, and of course that's a very flawed concept because I would run
into huge performance and memory-problems even with just one user.

So I need the ResourceStreamResource to be dynamic. I don't get why the *
getResourceStream()* is called multiple times.. the javadoc for that
method says

Lazy or dynamic initialization (...)


How can I get proper dynamic resource then?

2012/8/17 Sven Meier 


Beware that ResourceStreamResource#**getResourceStream() is called
multiple times.

Probably easiest is to create the resource stream in
CouchDbAttachmentStreamResourc**e's constructor and pass it to super.

Sven


On 08/17/2012 05:28 PM, Michael M wrote:


Hi,

I wanted to, but I can't because then I don't have the stream to close
it.
If I don't close the stream returned by the Ektorp getAttachment()
method I
will have memory leaks.

2012/8/17 Sven Meier 

  Without looking to deep into this you should create the InputStream in

CouchDbResourceStream#getInputStream() instead of the constructor.


Sven


On 08/17/2012 04:25 PM, Michael M wrote:

  Hi, short question this time: I have several ResourceLinks to

ResourceStreamResources on a page. When I click on one of those links,
the
resource streams attachments dynamically out of my database.

That's working quite well now, however the stream (and whatever
happens in
the method returning the streams) is called 2-4 times. E.g. opening an
image results in 4 queries to the CouchDB database. I don't really see
that
happening when I'm playing an mp3 file with a flash-player pointing to
the
URL of the resource.

Does anyone have an idea why? I'm only instantiating the resource once,
for
any link I only use that one resource.

Here's my custom ResourceStreamResource: http://pastebin.com/9BB7LEiV

And here my custom IResouceStream: http://pastebin.com/Z7GvzGja

Thanks!


  --**

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

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




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





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



Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Michael M
Hmm, that would require quite a rewrite, unfortunately I can't afford that
time-effort right now (I chose Wicket for my thesis project). I'm not even
sure if I could do that, because in some cases I also need the URL from the
ResourceLink (e.g. to pass it to JW Player JavaScript for playing an
'audio' content-type attachment from the DB).

IMHO, making this possible is also the whole point of having dynamic
resources.

I'll see if I can file that as a bug. Until then I think I just have to
ignore the stream-resource behavior, since it's not really noticeable in
the prototype yet.

Thanks for your help up to this point! If anyone has more suggestions, feel
free please. :)

2012/8/17 Sven Meier 

> Hm, possibly easiest would be to create the resource when it is requested
> only.
> What component are you using to integrate the resource in your page?
>
>
> >Is it possible that it's a bug that the stream gets requested multiple
> times? Or if it is by design, why?
>
> IMHO ResourceStreamResource#**internalGetResourceStream() should check
> for an already created stream and return that one. The way it is
> implemented now looks like a bug.
>
> Sven
>
>
>
> On 08/17/2012 06:19 PM, Michael M wrote:
>
>> Is it possible that it's a bug that the stream gets requested multiple
>> times? Or if it is by design, why? I can't see a reason for it.
>>
>> I also cannot only return a new IResourceStream when it's not instantiated
>> yet in my ResourceStreamResource, because the AttachmentInputStream from
>> Ektorp is not serializable, I get errors if I try that. As far as my
>> knowledge goes I see myself with no option left..
>>
>> 2012/8/17 Michael M 
>>
>>  Thanks for the idea, but I can't do that. That would make my resources
>>> static and all attachments would be loaded at page load. I did that at
>>> the
>>> beginning, and of course that's a very flawed concept because I would run
>>> into huge performance and memory-problems even with just one user.
>>>
>>> So I need the ResourceStreamResource to be dynamic. I don't get why the *
>>> getResourceStream()* is called multiple times.. the javadoc for that
>>>
>>> method says
>>>
>>> Lazy or dynamic initialization (...)
>>>
>>>
>>> How can I get proper dynamic resource then?
>>>
>>> 2012/8/17 Sven Meier 
>>>
>>>  Beware that ResourceStreamResource#getResourceStream() is called

 multiple times.

 Probably easiest is to create the resource stream in
 CouchDbAttachmentStreamResource's constructor and pass it to super.


 Sven


 On 08/17/2012 05:28 PM, Michael M wrote:

  Hi,
>
> I wanted to, but I can't because then I don't have the stream to close
> it.
> If I don't close the stream returned by the Ektorp getAttachment()
> method I
> will have memory leaks.
>
> 2012/8/17 Sven Meier 
>
>   Without looking to deep into this you should create the InputStream
> in
>
>> CouchDbResourceStream#**getInputStream() instead of the
>> constructor.
>>
>>
>>
>> Sven
>>
>>
>> On 08/17/2012 04:25 PM, Michael M wrote:
>>
>>   Hi, short question this time: I have several ResourceLinks to
>>
>>> ResourceStreamResources on a page. When I click on one of those
>>> links,
>>> the
>>> resource streams attachments dynamically out of my database.
>>>
>>> That's working quite well now, however the stream (and whatever
>>> happens in
>>> the method returning the streams) is called 2-4 times. E.g. opening
>>> an
>>> image results in 4 queries to the CouchDB database. I don't really
>>> see
>>> that
>>> happening when I'm playing an mp3 file with a flash-player pointing
>>> to
>>> the
>>> URL of the resource.
>>>
>>> Does anyone have an idea why? I'm only instantiating the resource
>>> once,
>>> for
>>> any link I only use that one resource.
>>>
>>> Here's my custom ResourceStreamResource:
>>> http://pastebin.com/9BB7LEiV
>>>
>>> And here my custom IResouceStream: http://pastebin.com/Z7GvzGja
>>>
>>> Thanks!
>>>
>>>
>>>   --**--**
>>> --**
>>>
>> --**-
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apa**che.org<
>> http://apache.org**>
>> http://wicket.apache.org><
>> users-unsubscribe@**wicket.apache.org
>> >
>>
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>>  --**
 --**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apa**che.org
 
 >
 For additional commands, e-mail: users-h...@wicket.apache.org



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

Re: Add page feedback to every AjaxRequestTarget

2012-08-17 Thread Alec Swan
Hello,

Thank you for the link. I used your code to register an
ART.addListener(new AjaxFeedbackPanelUpdater()) when the page is
created, but it does not get called when the form is submitted and
hence it never adds the FeedbackPanel to ART of form submission.

Where should I add this listener?

Thanks,

Alec

On Wed, Aug 15, 2012 at 4:14 PM, procrastinative.developer
 wrote:
> Hello Alec,
> Could you take a look on this:
>
> https://github.com/procrastinativedeveloper/ToolsClasses/blob/master/src/main/java/com/utils/wicket/ajax/AjaxFeedbackPanelUpdater.java
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Add-page-feedback-to-every-AjaxRequestTarget-tp4651257p4651262.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

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



Re: JGrowlBehavior

2012-08-17 Thread Tom Norton

onEvent worked wonders.

Thanks,
Tom

On Fri 17 Aug 2012 01:15:39 AM EDT, Martin Grigorov wrote:

Hi,

At 
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/jquery-parent/jquery/src/main/java/org/wicketstuff/jquery/jgrowl
you may find JGrowl based implementation of FeedbackPanel.

On Fri, Aug 17, 2012 at 12:18 AM, Tom Norton
 wrote:

We use JGrowl on our website, and now that we've moved to wicket, I've been
trying to create a JGrowlBehavior.  The only time we want this behavior to
run is AFTER the ajax events of other behaviors and components.  Because of
this, I cannot use AbstractAjaxBehavior or AbstractDefaultAjaxBehavior,
since they require round trips.  Does anyone have any ideas?  We use wicket
1.5.4.

Thanks,
Tom








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



wicket multi-window app

2012-08-17 Thread Chuck Brinkman
Hi,

I have a desktop application that I need to move to the web.  The desktop app 
supports multiple windows.  I'm told it wouldn't be unusual to have as many as 
30 windows open.  All of the windows can be moved, resized, expanded to full 
screen (fill the original app window) and minimize.  The user community doesn't 
want to lose any look and feel of the desktop app.  

Here are the hurdles that I see

-)  keeping the child windows on top of the parent window.
-)  expanding a child window to fill the parent window
-)  can I create a modal window?  A few of the desktop windows are modal.
-)  is there a limit to the number of child windows
-)  concerns about multi-window support in wicket

So,
-)  Will wicket support any of this without me having to resort to writing 
javascript?
-)  What issues have I overlooked that will preclude the use of wicket

Thanks for your input

I looked at wicket a few years ago.  I'm a fan of the just java and just html 
aspect not to mention reusable components.  I would really like to hear that 
wicket will support this multi-window environment.  If not it looks like jquery 
which means lots of javascript and I think large amounts of javascript are 
unmanageable.



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