Re: usage of JavascriptFilteredIntoFooterHeaderResponse

2011-05-19 Thread robert.mcguinness
Jeremy,


Great work on this BTW.  Quick question, any reason why
JavaScriptFilteredIntoFooterHeaderResponse is final?  Would like to:



JavaScriptFilteredIntoFooterHeaderResponse javaScriptFooterResponse = new
JavaScriptFilteredIntoFooterHeaderResponse(response, "footerBucket") {

@Override
protected 
JavaScriptAcceptingHeaderResponseFilter createFooterFilter(
String 
footerBucketName) {
return new 
JavaScriptAcceptingHeaderResponseFilter(footerBucketName) {
@Override
public boolean 
acceptOtherJavaScript() {
return false;
}
};
}
};


My ultimate goal is to target the header/footer buckets with particular
scripts.  Maybe my approach is wrong.  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/usage-of-JavascriptFilteredIntoFooterHeaderResponse-tp3302046p3537524.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: Wicket Cookbook - preventing multiple form submits

2011-05-19 Thread andrea del bene

HI,

 giving a quick look at your code it seems that your form's parent and 
the form itself are removed in onsubmit method when it calls 
callViewPersonPanel.
If you wanna call super.process first and then updateProcessedForm in 
SubmitOnceForm, you should save current page reference and form path in 
a couple of fields at the beginning of SubmitOnceForm's process method.  
Then use this fields in getToken() method instead of 
'getPage().getPageReference()' and 'getPageRelativePath()'.


This should work but I'm not sure it's going to solve the back button's 
problem




Hi Andrea,
Here is form.onSubmit() functionality, as well as the panel swap
functionality and how I call it. It is pretty much all the functionality I
use:

public class CreateEditPersonPanel extends Panel {
private WebPage parentPage;
public CreatePersonPanel(String id, WebPage parentPage) {
   super(id);
   this.parentPage = parentPage;
   add( new PersonForm( "genericPersonCreationForm", (IModel)
getDefaultModel() ) );
   }
...
private void callViewPersonPanel(Long personID){
   //get parent page, pane container
   parentPage.replaceCurrentPanelWithViewPerson(personID);
}
...
private class PersonForm extends SubmitOnceForm  {
   @Override
   protected void onSubmit() {
  WicketApplication.get().getPersons_service().savePerson(person);
  callViewPersonPanel(person.getId());
  }
   }
}
And on the Parent page I have the following functionality:
  public class ParentPage extends WebPage {
...
public void replaceCurrentPanelWithViewPerson(long personID){
viewGenericPersonPanel = new ViewGenericPersonPanel("mainPanel", 
personID);
currentPanel.replaceWith(viewGenericPersonPanel);
currentPanel = viewGenericPersonPanel;
}
}

I'm sorry I cannot spot where I might have gone wrong.
Thanks for your help,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Cookbook-preventing-multiple-form-submits-tp3535159p3536181.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: Set FeedbackPanel with Error from JavaScript?

2011-05-19 Thread Igor Vaynberg
you have two options:

add the message into the feedback panel using javascript and dom
manipulation - you need to know the markup id of the feedbackpanel

or

let javascript issue an ajax request passing in the error message,
adding it to the feedback panel and repainting it.

-igor

On Thu, May 19, 2011 at 8:52 AM, eugenebalt  wrote:
> Is it possible to do some validation in JavaScript, and if that fails, have
> that error be displayed as one of the messages in the FeedbackPanel?
>
> In other words, this FeedbackPanel message won't be from server-side
> validation, it will originate from JavaScript.
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Set-FeedbackPanel-with-Error-from-JavaScript-tp3536164p3536164.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: FormComponent convertInput for children FormComponets

2011-05-19 Thread Clint Checketts
I'll validate my code again. It is running on Wicket 1.4.1 so maybe it was
linked to the older version.

Thanks everyone for the help, its good to know that it is working correctly
for others.

-Clint

On Thu, May 19, 2011 at 7:51 AM, Bertrand Guay-Paquet <
ber...@step.polymtl.ca> wrote:

> Hi,
>
> I am doing the same kind of processing and it works fine. I have a
> FormComponentPanel with children FormComponentPanels. Here is what the
> convertInput() method looks like for the "root" FormComponentPanel:
> protected void convertInput() {
>// Retrieve all children
>final List fooList = new ArrayList();
>foosRepeater.visitChildren(FooFormFields.class,
>new IVisitor() {
>@Override
>public void component(FooFormFields a_object, IVisit
> a_visit) {
>Foo foo = a_object.getConvertedInput();
>if (foo != null) {
>fooList.add(foo);
>}
>}
>});
>setConvertedInput(fooList);
> }
>
> All the children validators are called and their convertedInput is properly
> set.
>
> Bertrand
>
>
>
> On 16/05/2011 5:35 PM, Clint Checketts wrote:
>
>>   I have a FormComponentPanel that contains multiple child formcomponent.
>> The purpose of this panel is to be able to add in several cihldren
>> dynamically. The end model is supposed to be the list from all the
>> children
>> component. I get the value in my convertInput() method by iterating over
>> all
>> the children components, calling each one's getConvertedInput()
>>
>> Here's the problem, the child component's values haven't convertedTheir
>> input at that point, so i call 'validate()' on each one to trigger that
>> coversion.  Is that the right way to approach this? Am i causing
>> unneeded/duplicate processing?
>> .
>>
>> protected void convertInput() {
>>   final ArrayList  convertedInputList = new ArrayList();
>>   inForm.visitFormComponents(new IVisitor() {
>>public Object formComponent(IFormVisitorParticipant formComponent) {
>> if (formComponent instanceof FormComponent) {
>>  FormComponent  fc = (FormComponent) formComponent;
>>  *fc.validate();
>> * T convertedInput =  *fc.getConvertedInput();
>> * if(null != convertedInput){
>>   convertedInputList.add(convertedInput);
>>  }
>> }
>> return Component.IVisitor.CONTINUE_TRAVERSAL;
>>}
>>   });
>>   setConvertedInput(convertedInputList);
>>  }
>>
>>  Thanks,
>>
>> -Clint
>>
>>
>  -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket Cookbook - preventing multiple form submits

2011-05-19 Thread lucast
Hi Andrea,
Here is form.onSubmit() functionality, as well as the panel swap
functionality and how I call it. It is pretty much all the functionality I
use:

public class CreateEditPersonPanel extends Panel {
   private WebPage parentPage;
   public CreatePersonPanel(String id, WebPage parentPage) {
  super(id); 
  this.parentPage = parentPage;
  add( new PersonForm( "genericPersonCreationForm", (IModel)
getDefaultModel() ) );
  }
   ...
   private void callViewPersonPanel(Long personID){ 
  //get parent page, pane container
  parentPage.replaceCurrentPanelWithViewPerson(personID);
   }
   ...
   private class PersonForm extends SubmitOnceForm {
  @Override
  protected void onSubmit() {
 WicketApplication.get().getPersons_service().savePerson(person);
 callViewPersonPanel(person.getId());
 }   
  }
}
And on the Parent page I have the following functionality:
 public class ParentPage extends WebPage { 
...
   public void replaceCurrentPanelWithViewPerson(long personID){
viewGenericPersonPanel = new ViewGenericPersonPanel("mainPanel", 
personID);
currentPanel.replaceWith(viewGenericPersonPanel);
currentPanel = viewGenericPersonPanel;
   }
}

I'm sorry I cannot spot where I might have gone wrong. 
Thanks for your help,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Cookbook-preventing-multiple-form-submits-tp3535159p3536181.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



Set FeedbackPanel with Error from JavaScript?

2011-05-19 Thread eugenebalt
Is it possible to do some validation in JavaScript, and if that fails, have
that error be displayed as one of the messages in the FeedbackPanel?

In other words, this FeedbackPanel message won't be from server-side
validation, it will originate from JavaScript.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Set-FeedbackPanel-with-Error-from-JavaScript-tp3536164p3536164.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: Form Doesn't Reload on Bad Filename in File Input Box

2011-05-19 Thread eugenebalt
I think I know the answer, it's an IE-specific issue.

Some more info: http://www.webmasterworld.com/html/3290988.htm

Essentially, in IE6 and 7, if your file input doesn't begin with "C:\" or
some other drive-letter path, IE won't even try to submit. But if it does,
then it will submit, even if the file does not exist.

I was typing in a string like "abcd" and wondering why I wasn't getting the
form to submit.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Form-Doesn-t-Reload-on-Bad-Filename-in-File-Input-Box-tp3536134p3536146.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



Form Doesn't Reload on Bad Filename in File Input Box

2011-05-19 Thread eugenebalt
My form doesn't reload on bad (invalid) filename entered in the FileUpload
input box.

But it *does* reload in these 2 cases:

1) Empty field
2) File exists

Does anyone know why? I have to display a message on "invalid file" just
like I do with the other two cases, "no file specified" and "file OK".

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Form-Doesn-t-Reload-on-Bad-Filename-in-File-Input-Box-tp3536134p3536134.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: Wicket Widget

2011-05-19 Thread Bruno Borges
Reminds me of a problem I had playing with jQuery Mobile.

jqM plays with hash links and with Wicket 1.4.17, it does not work properly.
I had to disable all Ajax links jQuery Mobile handles.

How to avoid that?


*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Thu, May 19, 2011 at 11:50 AM, LePirlouit  wrote:

> I have the same question :
>
> Is there a way to force wicket to generate absolute urls
> for the page being rendered?
>
> for javascript, onclick events and A urls
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-Widget-tp1867919p3535951.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: Wicket Widget

2011-05-19 Thread LePirlouit
I have the same question :

Is there a way to force wicket to generate absolute urls 
for the page being rendered?

for javascript, onclick events and A urls

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Widget-tp1867919p3535951.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: Wicket Cookbook - preventing multiple form submits

2011-05-19 Thread Andrea Del Bene
Probably your form is removed from component hierarchy when it is 
submitted.That's why you don't get exceptions if you call get page 
before form processing. When does your code replace panel? What's inside 
form's onSubmit method?

Hi Andrea,
Thanks for your reply.
I call updateProcessedForms() AND THEN super.process(submittingComponent).
The reverse order to what it is shown on pg 49 on book. I described it wrong
on original post, I apologise. It is now corrected.

When calling createPerson Panel, I execute the following in order to create
new instance of person variables:
public CreatePersonPanel(String id, WebPage parentPage){
super(id);
setDefaultModel(new Model(new Person(new
PersonCreatedTimestamp()));
add( new PersonForm( "personCreationForm", (IModel)
getDefaultModel() ) );
 ...
}
And for editing I do the following:

public CreatePersonPanel(String id, Long personId , WebPage parentPage){
super( id, new LoadablePersonModel(personId) );
this.parentPage = parentPage;
 add( new PersonForm( "personCreationForm", (IModel)
getDefaultModel() ) );
...
}

Inside the form, I get a copy of the default model object:
public EventForm(String id, IModel  model) {
super(id, model);
 person = (Person) this.getDefaultModel().getObject();
...
}
When submitting the form, I simply call the following service passing the
person object I extracted from the default model, as shown above:
WicketApplication.get().getPersons_service().savePerson(person);

The only place where I create a new instance of person is when I first call
the createPersonPanel.
I hope this helps. Thanks for looking into it.
Lucas


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Cookbook-preventing-multiple-form-submits-tp3535159p3535415.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: JavaScript onClick Handler Stops Form Submit

2011-05-19 Thread eugenebalt
Thanks for the replies.

I did what Pedro suggested and when I do the onClick handler in Wicket, the
flow is OK now.

(When I did it in HTML, I still get the alert box, but the flow would stop
afterwards.)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/JavaScript-onClick-Handler-Stops-Form-Submit-tp3533771p3535803.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: FormComponent convertInput for children FormComponets

2011-05-19 Thread Bertrand Guay-Paquet

Hi,

I am doing the same kind of processing and it works fine. I have a 
FormComponentPanel with children FormComponentPanels. Here is what the 
convertInput() method looks like for the "root" FormComponentPanel:

protected void convertInput() {
// Retrieve all children
final List fooList = new ArrayList();
foosRepeater.visitChildren(FooFormFields.class,
new IVisitor() {
@Override
public void component(FooFormFields a_object, 
IVisit a_visit) {

Foo foo = a_object.getConvertedInput();
if (foo != null) {
fooList.add(foo);
}
}
});
setConvertedInput(fooList);
}

All the children validators are called and their convertedInput is 
properly set.


Bertrand


On 16/05/2011 5:35 PM, Clint Checketts wrote:

   I have a FormComponentPanel that contains multiple child formcomponent.
The purpose of this panel is to be able to add in several cihldren
dynamically. The end model is supposed to be the list from all the children
component. I get the value in my convertInput() method by iterating over all
the children components, calling each one's getConvertedInput()

Here's the problem, the child component's values haven't convertedTheir
input at that point, so i call 'validate()' on each one to trigger that
coversion.  Is that the right way to approach this? Am i causing
unneeded/duplicate processing?
.

protected void convertInput() {
   final ArrayList  convertedInputList = new ArrayList();
   inForm.visitFormComponents(new IVisitor() {
public Object formComponent(IFormVisitorParticipant formComponent) {
 if (formComponent instanceof FormComponent) {
  FormComponent  fc = (FormComponent) formComponent;
  *fc.validate();
* T convertedInput =  *fc.getConvertedInput();
* if(null != convertedInput){
   convertedInputList.add(convertedInput);
  }
 }
 return Component.IVisitor.CONTINUE_TRAVERSAL;
}
   });
   setConvertedInput(convertedInputList);
  }

  Thanks,

-Clint



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



Re: Wicket Cookbook - preventing multiple form submits

2011-05-19 Thread lucast
Hi Andrea,
Thanks for your reply.
I call updateProcessedForms() AND THEN super.process(submittingComponent).
The reverse order to what it is shown on pg 49 on book. I described it wrong
on original post, I apologise. It is now corrected.

When calling createPerson Panel, I execute the following in order to create
new instance of person variables:
public CreatePersonPanel(String id, WebPage parentPage){
super(id);
setDefaultModel(new Model(new Person(new
PersonCreatedTimestamp()));
add( new PersonForm( "personCreationForm", (IModel)
getDefaultModel() ) );
...
}
And for editing I do the following:

public CreatePersonPanel(String id, Long personId , WebPage parentPage){
super( id, new LoadablePersonModel(personId) );
this.parentPage = parentPage;
add( new PersonForm( "personCreationForm", (IModel)
getDefaultModel() ) );
... 
}

Inside the form, I get a copy of the default model object:
public EventForm(String id, IModel model) {
super(id, model);
 person = (Person) this.getDefaultModel().getObject();
...
}
When submitting the form, I simply call the following service passing the
person object I extracted from the default model, as shown above:
WicketApplication.get().getPersons_service().savePerson(person);

The only place where I create a new instance of person is when I first call
the createPersonPanel.
I hope this helps. Thanks for looking into it.
Lucas


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Cookbook-preventing-multiple-form-submits-tp3535159p3535415.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: Wicket Cookbook - preventing multiple form submits

2011-05-19 Thread Andrea Del Bene

On 19/05/11 10:58, lucast wrote:


process(IFormSubmittingComponent submittingComponent) on SubmitOnceForm
class calls  updateProcessedForms(); and super.process(submittingComponent)
if the form hasn't been processed, so I changed the order of the above so
that it calls super.process(submittingComponent) FIRST, and then
updateProcessedForms();
That way getParent() inside  getToken() doesn't throw an error any more and
the functionality works. Great!

 mmm...on book (page 49) function calls are already in this order 
(super.process first, and then updateProcessedForm).



Now, the confusing thing is that, after I created a person, if I go back
from the view person panel to the create person panel, the fields I have
entered are blank.
The blank fields happen only once. If I fill in the fields again, they stay
filled.
How can I have it so that after having created a person, if I go back the
fields are not blank?
Does it have anything to do with the order I am calling functions inside
SubmitOnceForm.process()?
Could it be with the way I am binding the fields: new
PropertyModel(person,"description") ?


I do apologise for the lenghty post and thanks for looking into this long
post.
Lucas
Do you create a new instance of Person after person's creation? How do 
you initialize 'person' variable?


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



Wicket Cookbook - preventing multiple form submits

2011-05-19 Thread lucast
Dear Forum, 
On implementing prevent-multiple-form-submits, ch 2 - Wicket Cookbook, I
found that when calling
 getToken()  {
return new FormToken(getPage().getPageReference(), 
getPageRelativePath());
 }
I get an error on getPage() because the current form doesn't have a page or
parent with a page.

I'll explain my layout.
I have a main page containing panels for navigating, instead of replacing
pages, I replace panels:
public class HomePage extends WebPage {
private Panel currentPanel = homePanel;
public HomePage(final String id, final Class c){
add(currentPanel);
...
currentPanel.replaceWith(createPersonPanel);
currentPanel = createPersonPanel;
}

I have a createPerson panel and declared it in the following manner: 
public class CreatePersonPanel extends Panel {
..
public CreatePersonPanel(String id, WebPage parent){
add( new EventForm( "createPersonForm", (IModel) getDefaultModel() )
);
}
And I also have the form which is an extension of  SubmitOnceForm described
on the Apache Wicket cookbook:
private class PersonForm extends SubmitOnceForm {
...
}

I noticed that that when I call getParent() inside CreatePersonPanel, that
throws an exception so maybe it's the way I am declaring my panels and
forms.
How can I solve this problem? 
I got around it, but I haven't solved it.
process(IFormSubmittingComponent submittingComponent) on SubmitOnceForm
class calls  updateProcessedForms(); and super.process(submittingComponent) 
if the form hasn't been processed, so I changed the order of the above so
that it calls super.process(submittingComponent) FIRST, and then
updateProcessedForms();
That way getParent() inside  getToken() doesn't throw an error any more and
the functionality works. Great!

Now, the confusing thing is that, after I created a person, if I go back
from the view person panel to the create person panel, the fields I have
entered are blank. 
The blank fields happen only once. If I fill in the fields again, they stay
filled.
How can I have it so that after having created a person, if I go back the
fields are not blank? 
Does it have anything to do with the order I am calling functions inside
SubmitOnceForm.process()?
Could it be with the way I am binding the fields: new
PropertyModel(person,"description") ?


I do apologise for the lenghty post and thanks for looking into this long
post.
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Cookbook-preventing-multiple-form-submits-tp3535159p3535159.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: IStringResourceLoader database implementation

2011-05-19 Thread Martin Grigorov
You'll need to cache both hits and misses and then it should be fine.

On Thu, May 19, 2011 at 11:34 AM, Bas Gooren  wrote:

> You could always preload all strings, or preload sets of strings. This way
> you'll have fewer database requests, and faster lookups since you'll have
> everything you need in a local map.
>
> Bas
>
> Op 19-5-2011 8:23, schreef Mathias Nilsson:
>
>  Thanks,
>>
>> My concern is also name component collition. The
>> org.apache.wicket.resource.loader.ComponentStringResourceLoader iterates
>> over the component stack to check for the values but that could leed to 10
>> times per text string and it would be a heavy load even if I implemented
>> some sort of cache. ( Or used wickets in Localizer ).
>>
>>
>> How did you go about name collition without sinking the database?
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/IStringResourceLoader-database-implementation-tp3533408p3534888.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
>>
>>


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


Re: IStringResourceLoader database implementation

2011-05-19 Thread Bas Gooren
You could always preload all strings, or preload sets of strings. This 
way you'll have fewer database requests, and faster lookups since you'll 
have everything you need in a local map.


Bas

Op 19-5-2011 8:23, schreef Mathias Nilsson:

Thanks,

My concern is also name component collition. The
org.apache.wicket.resource.loader.ComponentStringResourceLoader iterates
over the component stack to check for the values but that could leed to 10
times per text string and it would be a heavy load even if I implemented
some sort of cache. ( Or used wickets in Localizer ).


How did you go about name collition without sinking the database?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/IStringResourceLoader-database-implementation-tp3533408p3534888.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: tree

2011-05-19 Thread hubert_hupe
Unbelievable how easy a solution can be...

sven, you are my hero. thanks. please stay the way you are - helpful!

hubert
Am 18.05.2011 um 20:06 schrieb Sven Meier:

> Hi,
> 
> the method you want to override is the following:
> 
>protected void onNodeLinkClicked(Object node, BaseTree tree, 
> AjaxRequestTarget target)
>{
>}
> 
> Sven
> 
> On 05/18/2011 05:27 PM, hubert_hupe wrote:
>> Oh my goodness,
>> 
>> ok. there was an object that was null. error is gone.
>> BUT still no event is fired when i click on a node in the tree.
>> 
>> as a kind of template i tried to adapt the following for the tree:
>> add(new AjaxLink("expandAll") {
>> @Override
>> public void onClick(AjaxRequestTarget target) {
>>  tree.getTreeState().expandAll();
>>  tree.updateTree(target);
>>  System.out.println("Click");
>>  }
>> });
>> 
>> here is the current snippet:
>>  
>> 
>> add(new LinkTree("tree", createTreeModel()) {
>> protected void onNodeClicked(AjaxRequestTarget ajaxRequestTarget, TreeNode 
>> node) {
>>  System.out.println("Click");
>>  }
>> });
>> 
>> the problem is that the line with "system.out" is never reached when i click 
>> the tree node.
>> an @Override is not possible as in the AjaxLink onClik Method.
>> 
>> has anyone ever used  
>> org.apache.wicket.markup.html.tree.LinkTree.LinkTree(String id, TreeModel 
>> model)
>> i got the exampe from here: 
>> http://www.wicket-library.com/wicket-examples/ajax/tree/simple?0
>> but there is no sample to get the clicked node
>> 
>> cheers
>> 
>> Am 18.05.2011 um 15:28 schrieb Martijn Dashorst:
>> 
>>> Take a look at line 217 of your SignIn class and see why it throws a NPE.
>>> 
>>> Martijn
>>> 
>>> On Wed, May 18, 2011 at 3:24 PM, hubert_hupe  wrote:
 hi sven,
 
 here it is. cheers hubert
 
 WicketMessage: Can't instantiate page using constructor public 
 com.reporting.SignIn(org.apache.wicket.PageParameters) and argument
 
 Root cause:
 
 java.lang.NullPointerException
 at com.reporting.SignIn.(SignIn.java:217)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
 Method)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at 
 org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
 at 
 org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
 at 
 org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
 at 
 org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
 at 
 org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
 at 
 org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
 at 
 org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
 at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
 at 
 org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
 at 
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
 at 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
 at 
 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
 at 
 org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
 at 
 org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
 at 
 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
 at 
 org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
 at 
 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
 at org.mortbay.jetty.Server.handle(Server.java:295)
 at 
 org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)
 at 
 org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:827)
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:511)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)
 at 
 org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
 at 
 org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
 
 Complete stack:
 
 org.apache.wicket.WicketRuntimeException: Can't instantiate page using 
 constructor public com.reporting.SignIn(org.apache.wicket.PagePar

Re: warn on exit from browser

2011-05-19 Thread Robert Dahlström

With just a quick look:
setRedirect(true)

may help and not just setResponsePage()

Regards
Robert

On 05/19/2011 08:53 AM, rebecca wrote:

Thank you all for replying

It does sound like I'm trying to do something impossible, but I would like
to post my code here in case i did not explain the problem correctly:

I add onbeforeunload event to the body of my page, which calls a JS
function. The JS does submit to my form. In my form onSubmit() I do a
setResponsePage.

I see that it get's into the onSubmit() (and even to the destination page's
constructor), but after exit from onSubmit(), it returns to the original
page (refereshing the entered data).

Here's the code:

on page

body.add(new SimpleAttributeModifier("onload", "isSubmit=false;"));
StringBuilder js = new StringBuilder();
js.append("if(!isSubmit){checkLeaving( '");
js.append(getString("leaveWizardMessage"));
js.append("', '");
js.append(newAccountWizard.getForm().getMarkupId());
js.append("', '");
js.append(newAccountWizard.getConfirmationModal().getMarkupId());
js.append("')};");

body.add(new SimpleAttributeModifier("onbeforeunload", js.toString()));
add(body);

js file

function checkLeaving(message, formId, modalId, linkId){

//alert("formId = " + formId);
var answer = confirm(message);
if(answer == true){
var form = document.getElementById(formId);
//var modal = document.getElementById(modalId);
//var submitLink = document.getElementById(linkId);
alert("before submit");
form.submit();
//submitLink.onclick();
//return false;
}
}

wizard panel
-
@Override
protected Form newForm(String id) {

form = new Form(id){

@Override
protected void onSubmit() {
System.out.println("in form submit1");

setResponsePage(NewAccountRegistrationPage.class);
System.out.println("in form submit2");
}

protected void onError() {
System.out.println("in form error");
};
};



Can someone please tell me if it's possible?

Rebbaca


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/warn-on-exit-from-browser-tp3516569p3534945.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