Re: HTML Editing component

2009-11-11 Thread Igor Vaynberg
you need to add wicketstuff repo to your  pom tag

-igor

On Wed, Nov 11, 2009 at 11:48 PM, Alex Rass  wrote:
> Went to the page (thanks!) got the SVN copy down.
> Ran Maven.
> Maven blows up with an error (below).
> Anyone knows how to get past this (or can fix it).
>
> Thanks.
>
> Output from running maven is here:
>
> G:\comp\apache-wicket-1.4.1\tinymce>\comp\maven\bin\mvn
> [INFO] Scanning for projects...
> [INFO]
> 
> [ERROR] FATAL ERROR
> [INFO]
> 
> [INFO] Failed to resolve artifact.
>
> GroupId: org.wicketstuff
> ArtifactId: tinymce-parent
> Version: 1.4-SNAPSHOT
>
> Reason: Unable to download the artifact from any repository
>
>  org.wicketstuff:tinymce-parent:pom:1.4-SNAPSHOT
>
> from the specified remote repositories:
>  central (http://repo1.maven.org/maven2)
>
>
>
> [INFO]
> 
> [INFO] Trace
> org.apache.maven.reactor.MavenExecutionException: Cannot find parent:
> org.wicketstuff:tinymce-parent
>  for project: null:tinymce:jar:null for project null:tinymce:jar:null
>
>
>
> -Original Message-
> From: Sam Barrow [mailto:s...@sambarrow.com]
> Sent: Wednesday, November 11, 2009 8:13 PM
> To: users@wicket.apache.org
> Subject: Re: HTML Editing component
>
> TinyMCE is one of the most popular out there, it has some wicket
> integration already done
> http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-tinymce
>
>
> On Wed, 2009-11-11 at 20:02 -0500, Alex Rass wrote:
>> Hi.
>>
>> Hi.
>>
>> Did a bit of googling, but didn't find anything good...
>>
>> Anyone ever had to create an edit screen where you can do html/source
>> editor?
>>
>> Any idea what I can use?
>>
>> In other words: I store html in database.
>> I would like to be able to let my users bring it up inside a wicket
> screen.
>> Edit html as "pretty text" (and not as bunch of markup)
>> And post it back into the database.
>>
>> What I am looking for is the a component I can use from inside Wicket
>> instead of TextField()
>>
>> Any ideas? I'd prefer one where I have access to source as well as
> "pretty"
>> (plenty of them around where it's a 2-tab edit component).
>>
>> Thanks in advance.
>>
>> I saw something about TinyMCE in some forums...
>>
>> - Alex.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: EntityModel

2009-11-11 Thread Sam Barrow
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/
> >>>   
> >>>   
> >
> >
> > -
> > 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: 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: HTML Editing component

2009-11-11 Thread Alex Rass
Went to the page (thanks!) got the SVN copy down.
Ran Maven.
Maven blows up with an error (below).
Anyone knows how to get past this (or can fix it).

Thanks.

Output from running maven is here:

G:\comp\apache-wicket-1.4.1\tinymce>\comp\maven\bin\mvn
[INFO] Scanning for projects...
[INFO]

[ERROR] FATAL ERROR
[INFO]

[INFO] Failed to resolve artifact.

GroupId: org.wicketstuff
ArtifactId: tinymce-parent
Version: 1.4-SNAPSHOT

Reason: Unable to download the artifact from any repository

  org.wicketstuff:tinymce-parent:pom:1.4-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)



[INFO]

[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot find parent:
org.wicketstuff:tinymce-parent
 for project: null:tinymce:jar:null for project null:tinymce:jar:null



-Original Message-
From: Sam Barrow [mailto:s...@sambarrow.com] 
Sent: Wednesday, November 11, 2009 8:13 PM
To: users@wicket.apache.org
Subject: Re: HTML Editing component

TinyMCE is one of the most popular out there, it has some wicket
integration already done
http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-tinymce


On Wed, 2009-11-11 at 20:02 -0500, Alex Rass wrote:
> Hi.
> 
> Hi.
> 
> Did a bit of googling, but didn't find anything good...
> 
> Anyone ever had to create an edit screen where you can do html/source
> editor?
> 
> Any idea what I can use?
> 
> In other words: I store html in database.
> I would like to be able to let my users bring it up inside a wicket
screen.
> Edit html as "pretty text" (and not as bunch of markup)
> And post it back into the database.
> 
> What I am looking for is the a component I can use from inside Wicket
> instead of TextField()
> 
> Any ideas? I'd prefer one where I have access to source as well as
"pretty"
> (plenty of them around where it's a 2-tab edit component).
> 
> Thanks in advance.
> 
> I saw something about TinyMCE in some forums...
> 
> - Alex.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


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



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



Re: EntityModel

2009-11-11 Thread Sam Barrow
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



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: bindgen release

2009-11-11 Thread Stephen Haberman

> Have you done any more work with using Bindgen with Wicket?  It looks
> interesting to me.

No, but coincidentally I got an email from Igor about bindgen a few days
ago. He's been putting some work into a maven apt plugin and then
submitting a hand full of bindgen bugs that I've fixed.

Igor's current concern is that bindgen recursively generates
bindings...e.g. if you have @Bindable FooPage with an Employee
field/method that has a first name string, bindgen will generate
FooPageBinding, EmployeeBinding, and StringBinding, allowing you to do:

foo().employee().name()

Which is cool. Except that it doesn't know when to stop, so you'll end
up with `XxxBinding` classes for a lot of classes you probably won't
ever actually use.

So, Igor is thinking about how to trim this back. It hasn't been a
problem on my non-wicket projects, but I get what he's saying.

Earlier this evening I released bindgen 2.3 to the http://repo.joist.ws
maven repo with a fix for one of Igor's bugs, so you can try that out.
Please do let me know how it goes.

Fair warning, the bindgen docs are light-to-non-existent, but since
people are starting to express interest in it, I'll get some in to
place.

Thanks!

- Stephen


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



Re: London Wicket Event at Foyles Bookshop, November 21st, 2009

2009-11-11 Thread Jeremy Thomerson
Just to confirm (for me as a foreigner) - this is the correct place?

http://tinyurl.com/foyles

--
Jeremy Thomerson
http://www.wickettraining.com



On Mon, Nov 2, 2009 at 5:11 PM, jWeekend wrote:

> We will hold our next London Wicket Event on Saturday, 21st November, from
> 14:45. This time we have hired "The Gallery" at the iconic Foyles Bookshop
> in central London.
> We again welcome guests and speakers from several countries, including at
> least 3 core committers, Matej, Jeremy and of course, Alastair, as well as
> the founders of WiQuery (Wicket-jQuery integration), Lionel Armanet and his
> team.
>
> Join us for some very interesting, high quality presentations and to chat
> with fellow Wicket users and developers at all levels. We're expecting this
> to be another popular event and since places are limited book and confirm
> early if you can make it. Details and registration are at the usual place
> [1].
> There is a cool little Jazz cafe at Foyles too, where there'll be a live
> act (Femi Temowo) at 13:00 if you enjoy some Jazz guitar relaxation before
> your intellectual stimulation. They offer a decent range of food and drink
> there too.
>
> The event schedule looks like:
> Cemal Bayramoglu: Introduction
>
> Jeremy Thomerson (USA): Custom JavaScript Integrations with Wicket + Auto
> Resolvers
> Lionel Armanet (FR): Announcing WiQuery 1.0: Introduction & Demo
>
> Matej Knopp (SK): BRIX CMS + Wicket 1.5 Developments Q&A
> Alastair Maw (UK): The Al Talk
> Our Regular General Wicket Q&A with Al and Cemal
> We expect to formally finish by around 19:00. I would expect the usual
> suspects will be heading somewhere in the neighbourhood for refreshments
> straight after the event, and of course you are more than welcome to join
> us.
> Regards - Cemal jWeekend http://jWeekend.com
> Training, Consulting, Development
> [1] http://jweekend.com/dev/LWUGReg/
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: OT: Relational database + Hibenate vs Content Repository (Jackrabbit)

2009-11-11 Thread Jeremy Thomerson
Anybody have thoughts on this?  I am curious also.

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Nov 4, 2009 at 10:27 AM, danisevsky  wrote:

> Hallo, I am thinking about learning and using Jackrabbit instead of
> relational database (+ Hibernate) in my new wicket application (which will
> be build on Brix CMS).
> Is it very wrong idea?
> Thanks
>


Re: bindgen release

2009-11-11 Thread Jeremy Thomerson
Have you done any more work with using Bindgen with Wicket?  It looks
interesting to me.

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Jul 22, 2009 at 2:34 PM, Stephen Haberman
wrote:

> Hi,
>
> I just released bindgen 2, a type-safe alternative to OGNL-like string
> expressions, that works particularly well in component-based frameworks
> like Wicket.
>
> It integrates with javac and/or Eclipse to do things like:
>
>Employee e = new Employee();
>Form f = new Form();
>f.add(new TextField(e.name());
>f.add(new TextField(e.employer().name());
>
> (Pseudo-code.)
>
> The Eclipse integration is such that, as soon as you change Employee
> getName() to getName2(), and hit save, the "e.name()" line will no
> longer compile, and you'll have to fix the expression to "e.name2()".
>
> Disclaimer: I haven't actually tried it in a Wicket project, but, from
> what I know of Wicket, it should work well for binding to objects
> without string-based property models or inner classes. My post is
> somewhat motivated by a side-comment Gavin King made on his blog [1]
> about using annotation processors (as bindgen does) for Wicket's
> databinding.
>
> If you'd like to check it out, the website is:
>
>http://joist.ws/bindgen.html
>
> (Technically I built bindgen for use in my own web/orm framework
> project, Joist, but bindgen itself is standalone and has no
> dependencies on the rest of Joist.)
>
> Any feedback is appreciated.
>
> Thanks,
> Stephen
>
> 1:
> http://blog.hibernate.org/Bloggers/Java6CompilerPluginsAndTypesafeCriteriaQueries#comment10340
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


EntityModel

2009-11-11 Thread Sam Barrow

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



Datepicker model change problem

2009-11-11 Thread Swarnim Ranjitkar

I have a page with date picker that picks the date, DropdownChoice for hour and 
minute. When I click "today" button I change the model in onsubmit method. It 
is suppose to change the form value in datepicker, hour and minute to 
today/now.This changes hour and minute but doesn't change the value in the
datepicker. Is there something that I need to do to make this work. Here is the 
partial code


  public void onSubmit() {

Calendar startDate = Calendar.getInstance();



// initialize end date

Calendar endDate = Calendar.getInstance();



model.getObject().setStartDate(startDate);

model.getObject().setEndDate(endDate);

getForm().modelChanged();

super.onSubmit();

}

Here is the whole code.

public final class DateTimeSelectionModel implements IClusterable {
   
private Calendar startDate;
private Calendar endDate;

public DateTimeSelectionModel() {

// initialize start date
startDate = Calendar.getInstance();
startDate.add(Calendar.DATE, -5);
startDate.set(Calendar.HOUR_OF_DAY, 0);
startDate.set(Calendar.MINUTE, 0);
startDate.set(Calendar.SECOND, 0);

// initialize end date
endDate = Calendar.getInstance();
endDate.add(Calendar.DATE, -5);
endDate.set(Calendar.HOUR_OF_DAY, 23);
endDate.set(Calendar.MINUTE, 59);
endDate.set(Calendar.SECOND, 59);

System.out.println("hello");
}

public void setStartDate(Calendar startDate) {
this.startDate = startDate;
}

public void setEndDate(Calendar endDate) {
this.endDate = endDate;
}

// this method is called to get the default for the form.
public Date getStartDate() {
return startDate.getTime();
}
public void setStartDate(Date date) {
//we want to set only year month and day here not the whole date
Calendar cal = Calendar.getInstance();
cal.setTime(date);
this.startDate.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 
cal.get(Calendar.DAY_OF_MONTH));
}

public SelectOption getStartHour() {
SelectOption option = new SelectOption("Unknown", new String("" + 
startDate.get(Calendar.HOUR_OF_DAY)));
return option;
}
public void setStartHour(SelectOption hour) {
startDate.set(Calendar.HOUR_OF_DAY, Integer.valueOf(hour.getValue()));
}

public void setStartMinute(String minute) {
startDate.set(Calendar.MINUTE, Integer.valueOf(minute));
}
public void setStartMinute(int minute) {
startDate.set(Calendar.MINUTE, minute);
}
public int getStartMinute() {
return startDate.get(Calendar.MINUTE);
}


public Date getEndDate() {
return endDate.getTime();
}
public void setEndDate(Date date) {
//we want to set only year month and day here not the whole date
Calendar cal = Calendar.getInstance();
cal.setTime(date);
this.endDate.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 
cal.get(Calendar.DAY_OF_MONTH));
}

public SelectOption getEndHour() {
SelectOption option = new SelectOption("Unknown", new String("" + 
endDate.get(Calendar.HOUR_OF_DAY)));
return option;
}
public void setEndHour(SelectOption hour) {
endDate.set(Calendar.HOUR_OF_DAY, Integer.valueOf(hour.getValue()));
}

public void setEndMinute(String minute) {
endDate.set(Calendar.MINUTE, Integer.valueOf(minute));
}
public void setEndMinute(int minute) {
endDate.set(Calendar.MINUTE, minute);
}
public int getEndMinute() {
return endDate.get(Calendar.MINUTE);
}



}


public class DateTimeSelectionForm extends Form {

public DateTimeSelectionForm(String id, final 
IModel model) {
//super(id);
super(id, model);

final DateTextField dateStartField = new DateTextField("startDate",new 
PropertyModel(model, "startDate"), new 
PatternDateConverter("MM-dd-",true)) ;
add(dateStartField);
dateStartField.add(new DatePicker());

// Start Hour
DropDownChoice startHourChoice = new 
DropDownChoice("startHour", getHourChoices(), new 
ChoiceRenderer("label", "value"));
startHourChoice.setNullValid(false);
add(startHourChoice);

DropDownChoice startMinuteChoice = new 
DropDownChoice("startMinute" , getMinuteChoices());
startMinuteChoice.setNullValid(false);
add(startMinuteChoice);

DateTextField dateEndField = new DateTextField("endDate", new 
PropertyModel(model, "endDate"), new PatternDateConverter("MM-dd-", 
true)) ;
add(dateEndField);
dateEndField.add(new DatePicker());

DropDownChoice endHourChoice = new 
DropDownChoice("endHour", getHourChoices(), new 
ChoiceRende

Re: HTML Editing component

2009-11-11 Thread Sam Barrow
TinyMCE is one of the most popular out there, it has some wicket
integration already done
http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-tinymce


On Wed, 2009-11-11 at 20:02 -0500, Alex Rass wrote:
> Hi.
> 
> Hi.
> 
> Did a bit of googling, but didn't find anything good...
> 
> Anyone ever had to create an edit screen where you can do html/source
> editor?
> 
> Any idea what I can use?
> 
> In other words: I store html in database.
> I would like to be able to let my users bring it up inside a wicket screen.
> Edit html as "pretty text" (and not as bunch of markup)
> And post it back into the database.
> 
> What I am looking for is the a component I can use from inside Wicket
> instead of TextField()
> 
> Any ideas? I'd prefer one where I have access to source as well as "pretty"
> (plenty of them around where it's a 2-tab edit component).
> 
> Thanks in advance.
> 
> I saw something about TinyMCE in some forums...
> 
> - Alex.
> 
> 
> -
> 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



HTML Editing component

2009-11-11 Thread Alex Rass
Hi.

Hi.

Did a bit of googling, but didn't find anything good...

Anyone ever had to create an edit screen where you can do html/source
editor?

Any idea what I can use?

In other words: I store html in database.
I would like to be able to let my users bring it up inside a wicket screen.
Edit html as "pretty text" (and not as bunch of markup)
And post it back into the database.

What I am looking for is the a component I can use from inside Wicket
instead of TextField()

Any ideas? I'd prefer one where I have access to source as well as "pretty"
(plenty of them around where it's a 2-tab edit component).

Thanks in advance.

I saw something about TinyMCE in some forums...

- Alex.


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



Calling IN TO Wicket from JSP

2009-11-11 Thread Corbin, James
Is it possible to build a wicket URL in a JSP that gets forwarded to and
handle by the Wicket filter mechanism?

 

This seems like it should be simple but doesn't appear to work right in
1.4.1.

 

We build up a wicketized URL that makes it into the WicketFilter, but
that filter strips all the request parameters.

 

Any suggestions on how to approach redirecting from JSP into Wicket
would be greatly appreciated.

 

 

 

J.D. Corbin | IQNavigator, Inc. | Technology 6465 Greenwood Village
Blvd, Suite 800, Centennial, CO  80111 | Office 303.563.1503 | Mobile
303.912.0958 | www.iqnavigator.com | jcor...@iqnavigator.com

 



Re: ajax autocomplete

2009-11-11 Thread nino martinez wael
Please try to ask the question again, try to restructure the sentences? I
cant understand what you wrote (not to be rude).

2009/11/11 hxysun 

> hi,
> I have a question:I run wicket-examples-1.4.3 in tomcat 6.0.20 windows
> sys,findig Auto-Complete TestField Example not enable,no down-list
> automaticly.but
> http://wicketstuff.org/wicket14/ajax/ is ok.I downloaded exampes of other
> version running on my pc,it is same.So,I think maybe it lost datas in my
> pc.Who can help me?
> Thinks!
> Java He.
> 11-11 2009
>


Re: Scala, dependency injection and wicket

2009-11-11 Thread nino martinez wael
I agree on Jeremy on this one. I actually don't know much about ajax (migth
be an understatement), but with wicket I've been able todo alot of ajax
integrations.

Heres something to read (if you want to know the inner workings):
http://ninomartinez.wordpress.com/2008/09/09/apache-wicket-javascript-integration/
http://blog.jayway.com/2008/09/26/wicket-javascript-internals-dissected/

Otherwise just see the examples and see how easy it are todo ajax with
wicket:
http://wicketstuff.org/wicket14/ajax/

regards Nino

2009/11/10 Jeremy Thomerson 

> On Tue, Nov 10, 2009 at 12:42 PM, Ashley Aitken  wrote:
>
> >
> > On 08/10/2009, at 4:42 AM, Alex Rass wrote:
> >
> >   And so far: ajax is a pain in the ass that
> >> requires explicit work even for a simple form verification (bad
> >> architecture
> >> there).
> >>
> >
> > Is this true?
> >
> > One of my attractions to Wicket was that, hopefully, AJAX was easy (or at
> > least easier) than other frameworks.
>
>
> No - it's not true.  AJAX is simpler in Wicket than I've seen in ANY other
> application framework.  You just have to know how to use it.  It's also
> very
> easy to do custom AJAX things in Wicket.
>
>
>
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>


Re: Wicket and JQuery

2009-11-11 Thread Peter Ross
On Wed, Nov 11, 2009 at 3:53 PM, Peter Ross  wrote:
> On Wed, Oct 28, 2009 at 5:08 PM, Jason Novotny  wrote:
>> Martin Makundi wrote:
>>>
>>> ... and expect trouble with ajaxifying jquery plugins that skin html
>>> components. They will not work properly if you replace your components
>>> via ajax - or at least you might have to work hard on it.
>>>
>>
>>   Bingo!! I've been hitting this wall, and pulling my hair out-- in fact I
>> may ditch jQuery for this very reason since I can't find a suitable
>> workaround :-(
>>
> Here is the solution I used, I just emailed the list to ask if this is
> the correct approach:
>
> The following is some code which has an integer field with an associated 
> slider
>
> The AbstractBehavior is the bit which determines if we are in an ajax
> request or not and adds the init js code in the correct place to make
> sure it's called.
>    private void init() {
>        field = new TextField("field", getModel());
>        add(field);
>
>        WebComponent c = new WebComponent("slider");
>        c.setOutputMarkupId(true);
>        slider_id = c.getMarkupId();
>        add(c);
>
>        // Write out the javascript to initialize the slider
>        add(new AbstractBehavior() {
>           �...@override
>            public void renderHead(IHeaderResponse response) {
>                IRequestTarget target = RequestCycle.get().getRequestTarget();
>
>                if (target instanceof AjaxRequestTarget) {
>                    // If the target is an ajax request then we need
>                    // to execute just the slider js.
>                    AjaxRequestTarget t = (AjaxRequestTarget) target;
>                    t.appendJavascript(init_slider_js());
>                } else {
>                    // Otherwise render the slider when the document is ready.
>
> response.renderJavascript(init_slider_when_doc_ready_js(), null);
>                }
>            }
>        });
>
>    }
>
Someone helpfully pointed out to me that renderHead could be simplified to

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

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



Re: Newbie: add spring to wicket quickstart

2009-11-11 Thread nino martinez wael
I think wicket iolite has this aswell...


2009/11/10 Владимир Михайленко 

> Thank you, now it works.
>
> On Tue, Nov 10, 2009 at 8:29 PM, Pieter Degraeuwe <
> pieter.degrae...@systemworks.be> wrote:
>
> > You are getting this exception from a unittest. When you use WicketTester
> > in
> > combination with Spring injection, you have to tweak it a bit:
> > You have to add the spring applicationContext to the mock ServletContext:
> >
> > Soe here a expect that you already did construct the spring
> > applicationContext. Creating the WicketTester:
> >
> >tester = new WicketTester(createWebApplication()) {
> >@Override
> >public ServletContext newServletContext(String path) {
> >MockServletContext servletContext =
> (MockServletContext)
> > super.newServletContext(path);
> >
> >
> >
> servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
> > applicationContext);
> >return servletContext;
> >}
> >};
> >tester.getWicketSession().setLocale(getLocale());
> >new SpringComponentInjector(tester.getApplication(),
> > applicationContext);
> >testerHolder = tester;
> >
> >
> > That should do it:
> >
> > 2009/11/10 Владимир Михайленко 
> >
> > > Hello.
> > >
> > > I just created wicket quickstart project via maven and want add Spring
> DI
> > > to
> > > Wicket. So I added to WicketApplication:
> > >
> > >@Override
> > >protected void init()
> > >{
> > >super.init();
> > >addComponentInstantiationListener(new
> > > SpringComponentInjector(this));
> > >}
> > >
> > > In web.xml I added:
> > >
> > > 
> > >  contextConfigLocation
> > >/WEB-INF/applicationContext.xml
> > > 
> > >
> > >
> > >wicket.jobmd
> > >
> > >
> org.apache.wicket.protocol.http.WicketFilter
> > > 
> > >applicationFactoryClassName
> > >
> > >
> > >
> >
> org.apache.wicket.spring.SpringWebApplicationFactory
> > >
> > >
> > >applicationBean
> > >wicketApplication
> > >
> > > 
> > >
> > > 
> > >
> > >
> > >
> >
> org.springframework.web.context.ContextLoaderListener
> > > 
> > >
> > > In pom.xml:
> > >
> > >
> > >org.apache.wicket
> > >wicket-spring
> > >${wicket.version}
> > >
> > >
> > >org.springframework
> > >spring
> > >2.5.6
> > >
> > >
> > > In applicationContext.xml:
> > >
> > >  > > class="com.mihailenco.WicketApplication">
> > >
> > > Then when I build project in latest stable NetBeans I get this error in
> > > console:
> > >
> > > Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.579
> sec
> > > <<< FAILURE!
> > > testRenderMyPage(com.mihailenco.TestHomePage)  Time elapsed: 1.435 sec
> >  <<<
> > > ERROR!
> > > java.lang.IllegalStateException: No WebApplicationContext found: no
> > > ContextLoaderListener registered?
> > >at
> > >
> > >
> >
> org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:70)
> > >at
> > >
> > >
> >
> org.apache.wicket.spring.injection.annot.SpringComponentInjector.(SpringComponentInjector.java:72)
> > >at
> > com.mihailenco.WicketApplication.init(WicketApplication.java:24)
> > >at
> > >
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:708)
> > >at
> > >
> > >
> >
> org.apache.wicket.protocol.http.MockWebApplication.(MockWebApplication.java:168)
> > >at
> > >
> > >
> >
> org.apache.wicket.util.tester.BaseWicketTester.(BaseWicketTester.java:217)
> > >at
> > >
> org.apache.wicket.util.tester.WicketTester.(WicketTester.java:317)
> > >at
> > >
> org.apache.wicket.util.tester.WicketTester.(WicketTester.java:300)
> > >at com.mihailenco.TestHomePage.setUp(TestHomePage.java:16)
> > >at junit.framework.TestCase.runBare(TestCase.java:128)
> > >at junit.framework.TestResult$1.protect(TestResult.java:106)
> > >at junit.framework.TestResult.runProtected(TestResult.java:124)
> > >at junit.framework.TestResult.run(TestResult.java:109)
> > >at junit.framework.TestCase.run(TestCase.java:120)
> > >at junit.framework.TestSuite.runTest(TestSuite.java:230)
> > >at junit.framework.TestSuite.run(TestSuite.java:225)
> > >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.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java

Re: Proxying SSL on Apache to HTTP on Jetty + Wicket

2009-11-11 Thread nino martinez wael
I think last time this came up it ended out being some issue with jetty?

2009/11/11 Rangel Preis 

> I extends HttpsRequestCycleProcessor and SwitchProtocolRequestTarget
> to make my custom HttpsRequestCycleProcessor
> In the method getUrl from SwitchProtocolRequestTarget i just remove the
> port:
>
> if (port != null) {
>  result.append(":");
>  result.append(port);
> }
>
> But don't work, the url are correct but the page don't load i think i
> miss something in apache.
>
> Anyone make something like this?
>
> Thanks.
>
> 2009/11/10 Rangel Preis :
> > The unique solution that i found is extends HttpsRequestCycleProcessor
> > to change only the protocol.
> >
> > Any other ideia? Thanks All.
> >
> > 2009/11/10 Rangel Preis :
> >> The situation here is:
> >>
> >> https  http
> >> ->   Apache   ---> Jetty
> >>
> >>
> >> Using wicket in my WicketApplication I put
> >>
> >>  private static final HttpsConfig HTTPS_CONFIG = new
> >> HttpsConfig(HTTP_PORT, HTTPS_PORT);
> >>
> >>@Override
> >>protected IRequestCycleProcessor newRequestCycleProcessor() {
> >>return new HttpsRequestCycleProcessor(HTTPS_CONFIG);
> >>}
> >>
> >> And in my LoginPage.java i have @RequireHttps
> >>
> >> When i try to run the system with this config i get a error because
> >> Wicket assumes the HTTPS control and try to change the URL (port and
> >> replace http to https)
> >>
> >> How i say to wicket to just change the protocol to HTTPS? And don't
> >> change the port?
> >>
> >> Thanks
> >>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Unable to change label of FileUploadField

2009-11-11 Thread nino martinez wael
you should be able to put the change in a property file.. Like described
here :
http://day-to-day-stuff.blogspot.com/2008/05/wicket-internationalization.html,
so you just need to find the key for the field.

2009/11/11 Rene Peters 

>
> Hello,
>
>
>
> I developed a component (a Panel containing a Form) for uploading a file.
>
>
>
> It works fine but it I would like to change the label of the button and the
> text displayed next to the button.
>
>
>
> The text it displays by default is "choose file" on the button and the text
> displayed next to the button when no file has been chosen yet is "no file
> chosen" (when a file has been chosen it displays the filename of the file
> chosen).
>
>
>
> I tried using setLabel() on the FileUploadField but it didn't work. Neither
> did overriding the getLabel() method. I haven't been able to find any
> information on how to achieve this. I have no idea how I could chang the
> default text next to the FileUploadField either.
>
>
>
> Any suggestions are very welcome.
>
>
>
> Regards,
>
>
>
> René
>
> _
> Het laatste nieuws, shownieuws en voetbalnieuws op MSN.nl
> http://nl.msn.com/
>


Unable to change label of FileUploadField

2009-11-11 Thread Rene Peters

Hello,

 

I developed a component (a Panel containing a Form) for uploading a file.

 

It works fine but it I would like to change the label of the button and the 
text displayed next to the button.

 

The text it displays by default is "choose file" on the button and the text 
displayed next to the button when no file has been chosen yet is "no file 
chosen" (when a file has been chosen it displays the filename of the file 
chosen).

 

I tried using setLabel() on the FileUploadField but it didn't work. Neither did 
overriding the getLabel() method. I haven't been able to find any information 
on how to achieve this. I have no idea how I could chang the default text next 
to the FileUploadField either.

 

Any suggestions are very welcome.

 

Regards,

 

René
  
_
Het laatste nieuws, shownieuws en voetbalnieuws op MSN.nl
http://nl.msn.com/

Re: correct way to call necessary javascript initialization when a component is added via ajax

2009-11-11 Thread Peter Ross
On Wed, Nov 11, 2009 at 7:23 PM, svenmeier wrote:
>
> Why so complicated?
>
because I started by looking at what wiquery did and then simplifying
it to my case.  However I wasn't sure if it was the correct approach
or the most simple hence the question is there a better solution.

> @Override
> public void renderHead(IHeaderResponse response) {
>    response.renderOnDomReadyJavascript(init_slider_js());
> }
>
This works great and is much simpler, thanks for the help.

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



Re: How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread srm
Yes. Looks like this is the only non-JS way to go (still searching).
Simple but ugly.

Regards,
Stephan

Am 11.11.2009 um 21:53 schrieb Igor Vaynberg:

> you should do something like this
> 
> [form1][select/][submit button/][/form1]
> [form2][form components panel/][/form2]
> 
> user presses the submit button in form 1, in form 1's onsubmit you
> swap the form components panel based on the selection.
> 
> simple.
> 
> -igor
> 
> On Wed, Nov 11, 2009 at 12:50 PM, srm  wrote:
>> Ah! Stupid me!
>> I've read that it is working with JS and I didn't make sure to disable JS for
>> my local host.
>> Argh.
>> 
>> So it's not solved. Need to find a way around then.
>> 
>> Thanks for the pointer.
>> 
>> Regards,
>> Stephan
>> 
>> Am 11.11.2009 um 21:44 schrieb Martijn Dashorst:
>> 
>>> How do you think wantOnSelectionChangedNotification() works? With or 
>>> without JS?
>>> 
>>> Martijn
>>> 
>>> On Wed, Nov 11, 2009 at 9:39 PM, srm  wrote:
 SOLVED!
 w/o JS/AJAX
 
 I created a factory to produce the corresponding Panel(including the form)
 and I use a call to replaceWith() in onSelectionChanged():
 
 [code]
  @Override
   protected void onSelectionChanged(final Object newSelection) {
Panel newPanel = AddItemPanel.getAddItemPanel(selected, 
 "addArticlePanel"); //the factory call
addArticlePanel.replaceWith(newPanel);
addArticlePanel = newPanel;
   }
 
 Thanks to martin-g @ #wicket.
 
 Regards,
 Stephan
 
 Am 11.11.2009 um 16:18 schrieb srm:
 
> Am 11.11.2009 um 15:59 schrieb Ernesto Reinaldo Barreiro:
> 
>> If you reload the page when selecting the element, instead of using 
>> AJAX, I
>> guess the same will work because you have a selected article... I think 
>> AJAX
>> is just a detail here, maybe you can use
>> 
>> protected boolean wantOnSelectionChangedNotifications()
>>   {
>>   return false;
>>   }
>> 
>> on DropDownChoice?
>> 
> 
> 
> From my understanding, I need wantOnSelectionChangedNotifications()
> returning TRUE, otherwise onSelectionChanged() is never triggered.
> My current approach as follows. That's working but it doesn't feel right.
> To clumsy. Any ideas? (and I beg your pardon for mixing german
> with english in the code ;) )
> 
> package view;
> 
> ..some imports...
> public class AddArticlePage extends StorePage {
> 
>  private AddArticlePanel addArticlePanel;
> 
>  @SuppressWarnings("unchecked")
>  public AddArticlePage() {
>   addArticlePanel = new AddArticlePanel("addArticlePanel");
>   addArticlePanel.setVisible(false);
>   DropDownChoice dropDownType = new DropDownChoice("dropDownType",
> new PropertyModel(this, "selected"), Artikel.TYPELIST) {
>protected boolean wantOnSelectionChangedNotifications() {
>return true;
>}
>@Override
>protected void onSelectionChanged(final Object newSelection) {
> System.out.println("SELECTION CHANGED!");
> System.out.println("new Selection = " + (String) newSelection);
> addArticlePanel.setVisibleFields((String) newSelection);
> addArticlePanel.setVisible(true);
>}
>   };
> 
>   Form formAdd = new Form("addArticleForm") {
>@Override
>protected void onSubmit() {
> System.out.println("Added Article...");
>}
>   };
> 
>   add(dropDownType);
>   add(addArticlePanel);
>   add(formAdd);
> 
>  }
> }
> 
> 
> /* THE PANEL CLASS **/
> public class AddArticlePanel extends Panel {
> 
>  private TextField artikelNummer;
>  private TextField preis;
>  private TextField erscheinungsJahr;
>  private TextField beschreibung;
>  private TextField titel;
> 
>  //fields for BOOK
>  private TextField isbn;
>  private TextField autor;
>  private TextField verlag;
> 
>  //fields for CD
>  private TextField label;
>  private TextField artist;
> 
>  public AddArticlePanel(String id) {
>   super(id);
> 
>   artikelNummer = new TextField("artikelNummer", new Model());
>   preis = new TextField("preis", new Model());
>   erscheinungsJahr = new TextField("erscheinungsJahr", new Model());
>   beschreibung = new TextField("beschreibung", new Model());
>   titel = new TextField("titel", new Model());
>   isbn = new TextField("isbn", new Model());
>   autor = new TextField("autor", new Model());
>   verlag = new TextField("verlag", new Model());
>   label = new TextField("label", new Model());
>   artist = new TextField("artist", new Model());
>   add(artikelNummer);
>   add(preis);
>   add(erscheinungsJahr);
>   add(beschreibung);
>   add(titel);
>   add(isbn);
>   add(autor);
>   add(verlag);

Re: How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread Igor Vaynberg
you should do something like this

[form1][select/][submit button/][/form1]
[form2][form components panel/][/form2]

user presses the submit button in form 1, in form 1's onsubmit you
swap the form components panel based on the selection.

simple.

-igor

On Wed, Nov 11, 2009 at 12:50 PM, srm  wrote:
> Ah! Stupid me!
> I've read that it is working with JS and I didn't make sure to disable JS for
> my local host.
> Argh.
>
> So it's not solved. Need to find a way around then.
>
> Thanks for the pointer.
>
> Regards,
> Stephan
>
> Am 11.11.2009 um 21:44 schrieb Martijn Dashorst:
>
>> How do you think wantOnSelectionChangedNotification() works? With or without 
>> JS?
>>
>> Martijn
>>
>> On Wed, Nov 11, 2009 at 9:39 PM, srm  wrote:
>>> SOLVED!
>>> w/o JS/AJAX
>>>
>>> I created a factory to produce the corresponding Panel(including the form)
>>> and I use a call to replaceWith() in onSelectionChanged():
>>>
>>> [code]
>>> �...@override
>>>   protected void onSelectionChanged(final Object newSelection) {
>>>    Panel newPanel = AddItemPanel.getAddItemPanel(selected, 
>>> "addArticlePanel"); //the factory call
>>>    addArticlePanel.replaceWith(newPanel);
>>>    addArticlePanel = newPanel;
>>>   }
>>>
>>> Thanks to martin-g @ #wicket.
>>>
>>> Regards,
>>> Stephan
>>>
>>> Am 11.11.2009 um 16:18 schrieb srm:
>>>
 Am 11.11.2009 um 15:59 schrieb Ernesto Reinaldo Barreiro:

> If you reload the page when selecting the element, instead of using AJAX, 
> I
> guess the same will work because you have a selected article... I think 
> AJAX
> is just a detail here, maybe you can use
>
> protected boolean wantOnSelectionChangedNotifications()
>   {
>       return false;
>   }
>
> on DropDownChoice?
>


 From my understanding, I need wantOnSelectionChangedNotifications()
 returning TRUE, otherwise onSelectionChanged() is never triggered.
 My current approach as follows. That's working but it doesn't feel right.
 To clumsy. Any ideas? (and I beg your pardon for mixing german
 with english in the code ;) )

 package view;

 ..some imports...
 public class AddArticlePage extends StorePage {

  private AddArticlePanel addArticlePanel;

 �...@suppresswarnings("unchecked")
  public AddArticlePage() {
   addArticlePanel = new AddArticlePanel("addArticlePanel");
   addArticlePanel.setVisible(false);
   DropDownChoice dropDownType = new DropDownChoice("dropDownType",
     new PropertyModel(this, "selected"), Artikel.TYPELIST) {
    protected boolean wantOnSelectionChangedNotifications() {
                return true;
            }
   �...@override
    protected void onSelectionChanged(final Object newSelection) {
     System.out.println("SELECTION CHANGED!");
     System.out.println("new Selection = " + (String) newSelection);
     addArticlePanel.setVisibleFields((String) newSelection);
     addArticlePanel.setVisible(true);
    }
   };

   Form formAdd = new Form("addArticleForm") {
   �...@override
    protected void onSubmit() {
     System.out.println("Added Article...");
    }
   };

   add(dropDownType);
   add(addArticlePanel);
   add(formAdd);

  }
 }


 /* THE PANEL CLASS **/
 public class AddArticlePanel extends Panel {

  private TextField artikelNummer;
  private TextField preis;
  private TextField erscheinungsJahr;
  private TextField beschreibung;
  private TextField titel;

  //fields for BOOK
  private TextField isbn;
  private TextField autor;
  private TextField verlag;

  //fields for CD
  private TextField label;
  private TextField artist;

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

   artikelNummer = new TextField("artikelNummer", new Model());
   preis = new TextField("preis", new Model());
   erscheinungsJahr = new TextField("erscheinungsJahr", new Model());
   beschreibung = new TextField("beschreibung", new Model());
   titel = new TextField("titel", new Model());
   isbn = new TextField("isbn", new Model());
   autor = new TextField("autor", new Model());
   verlag = new TextField("verlag", new Model());
   label = new TextField("label", new Model());
   artist = new TextField("artist", new Model());
   add(artikelNummer);
   add(preis);
   add(erscheinungsJahr);
   add(beschreibung);
   add(titel);
   add(isbn);
   add(autor);
   add(verlag);
   add(label);
   add(artist);

 // THIS WHOLE THING WOULD HAVE TO BE DONE FOR EACH ITEM AGAIN TO
 // DISPLAY A LABEL IN FRONT OF EACH TEXTFIELD, HOLDING A DESCRIPTION
 // SOUNDS AWFULL!

  }

        //could probably be optimised
  public void setVisibleFields(String type) {
   if (type.equals("BO

Re: How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread srm
Ah! Stupid me!
I've read that it is working with JS and I didn't make sure to disable JS for
my local host.
Argh.

So it's not solved. Need to find a way around then.

Thanks for the pointer.

Regards,
Stephan

Am 11.11.2009 um 21:44 schrieb Martijn Dashorst:

> How do you think wantOnSelectionChangedNotification() works? With or without 
> JS?
> 
> Martijn
> 
> On Wed, Nov 11, 2009 at 9:39 PM, srm  wrote:
>> SOLVED!
>> w/o JS/AJAX
>> 
>> I created a factory to produce the corresponding Panel(including the form)
>> and I use a call to replaceWith() in onSelectionChanged():
>> 
>> [code]
>>  @Override
>>   protected void onSelectionChanged(final Object newSelection) {
>>Panel newPanel = AddItemPanel.getAddItemPanel(selected, 
>> "addArticlePanel"); //the factory call
>>addArticlePanel.replaceWith(newPanel);
>>addArticlePanel = newPanel;
>>   }
>> 
>> Thanks to martin-g @ #wicket.
>> 
>> Regards,
>> Stephan
>> 
>> Am 11.11.2009 um 16:18 schrieb srm:
>> 
>>> Am 11.11.2009 um 15:59 schrieb Ernesto Reinaldo Barreiro:
>>> 
 If you reload the page when selecting the element, instead of using AJAX, I
 guess the same will work because you have a selected article... I think 
 AJAX
 is just a detail here, maybe you can use
 
 protected boolean wantOnSelectionChangedNotifications()
   {
   return false;
   }
 
 on DropDownChoice?
 
>>> 
>>> 
>>> From my understanding, I need wantOnSelectionChangedNotifications()
>>> returning TRUE, otherwise onSelectionChanged() is never triggered.
>>> My current approach as follows. That's working but it doesn't feel right.
>>> To clumsy. Any ideas? (and I beg your pardon for mixing german
>>> with english in the code ;) )
>>> 
>>> package view;
>>> 
>>> ..some imports...
>>> public class AddArticlePage extends StorePage {
>>> 
>>>  private AddArticlePanel addArticlePanel;
>>> 
>>>  @SuppressWarnings("unchecked")
>>>  public AddArticlePage() {
>>>   addArticlePanel = new AddArticlePanel("addArticlePanel");
>>>   addArticlePanel.setVisible(false);
>>>   DropDownChoice dropDownType = new DropDownChoice("dropDownType",
>>> new PropertyModel(this, "selected"), Artikel.TYPELIST) {
>>>protected boolean wantOnSelectionChangedNotifications() {
>>>return true;
>>>}
>>>@Override
>>>protected void onSelectionChanged(final Object newSelection) {
>>> System.out.println("SELECTION CHANGED!");
>>> System.out.println("new Selection = " + (String) newSelection);
>>> addArticlePanel.setVisibleFields((String) newSelection);
>>> addArticlePanel.setVisible(true);
>>>}
>>>   };
>>> 
>>>   Form formAdd = new Form("addArticleForm") {
>>>@Override
>>>protected void onSubmit() {
>>> System.out.println("Added Article...");
>>>}
>>>   };
>>> 
>>>   add(dropDownType);
>>>   add(addArticlePanel);
>>>   add(formAdd);
>>> 
>>>  }
>>> }
>>> 
>>> 
>>> /* THE PANEL CLASS **/
>>> public class AddArticlePanel extends Panel {
>>> 
>>>  private TextField artikelNummer;
>>>  private TextField preis;
>>>  private TextField erscheinungsJahr;
>>>  private TextField beschreibung;
>>>  private TextField titel;
>>> 
>>>  //fields for BOOK
>>>  private TextField isbn;
>>>  private TextField autor;
>>>  private TextField verlag;
>>> 
>>>  //fields for CD
>>>  private TextField label;
>>>  private TextField artist;
>>> 
>>>  public AddArticlePanel(String id) {
>>>   super(id);
>>> 
>>>   artikelNummer = new TextField("artikelNummer", new Model());
>>>   preis = new TextField("preis", new Model());
>>>   erscheinungsJahr = new TextField("erscheinungsJahr", new Model());
>>>   beschreibung = new TextField("beschreibung", new Model());
>>>   titel = new TextField("titel", new Model());
>>>   isbn = new TextField("isbn", new Model());
>>>   autor = new TextField("autor", new Model());
>>>   verlag = new TextField("verlag", new Model());
>>>   label = new TextField("label", new Model());
>>>   artist = new TextField("artist", new Model());
>>>   add(artikelNummer);
>>>   add(preis);
>>>   add(erscheinungsJahr);
>>>   add(beschreibung);
>>>   add(titel);
>>>   add(isbn);
>>>   add(autor);
>>>   add(verlag);
>>>   add(label);
>>>   add(artist);
>>> 
>>> // THIS WHOLE THING WOULD HAVE TO BE DONE FOR EACH ITEM AGAIN TO
>>> // DISPLAY A LABEL IN FRONT OF EACH TEXTFIELD, HOLDING A DESCRIPTION
>>> // SOUNDS AWFULL!
>>> 
>>>  }
>>> 
>>>//could probably be optimised
>>>  public void setVisibleFields(String type) {
>>>   if (type.equals("BOOK")) {
>>>isbn.setVisible(true);
>>>autor.setVisible(true);
>>>verlag.setVisible(true);
>>> 
>>>label.setVisible(false);
>>>artist.setVisible(false);
>>>   }
>>>   else {
>>>isbn.setVisible(false);
>>>autor.setVisible(false);
>>>verlag.setVisible(false);
>>> 
>>>label.setVisible(true);
>>>artist.setVisible(true);
>>>   }
>>>  }
>>> 
>>> 
>>> }
>>> 
>>> Comments please :)
>>> 
>>> 
 Best,
 
 Ernesto

Re: How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread Martijn Dashorst
How do you think wantOnSelectionChangedNotification() works? With or without JS?

Martijn

On Wed, Nov 11, 2009 at 9:39 PM, srm  wrote:
> SOLVED!
> w/o JS/AJAX
>
> I created a factory to produce the corresponding Panel(including the form)
> and I use a call to replaceWith() in onSelectionChanged():
>
> [code]
> �...@override
>   protected void onSelectionChanged(final Object newSelection) {
>    Panel newPanel = AddItemPanel.getAddItemPanel(selected, 
> "addArticlePanel"); //the factory call
>    addArticlePanel.replaceWith(newPanel);
>    addArticlePanel = newPanel;
>   }
>
> Thanks to martin-g @ #wicket.
>
> Regards,
> Stephan
>
> Am 11.11.2009 um 16:18 schrieb srm:
>
>> Am 11.11.2009 um 15:59 schrieb Ernesto Reinaldo Barreiro:
>>
>>> If you reload the page when selecting the element, instead of using AJAX, I
>>> guess the same will work because you have a selected article... I think AJAX
>>> is just a detail here, maybe you can use
>>>
>>> protected boolean wantOnSelectionChangedNotifications()
>>>   {
>>>       return false;
>>>   }
>>>
>>> on DropDownChoice?
>>>
>>
>>
>> From my understanding, I need wantOnSelectionChangedNotifications()
>> returning TRUE, otherwise onSelectionChanged() is never triggered.
>> My current approach as follows. That's working but it doesn't feel right.
>> To clumsy. Any ideas? (and I beg your pardon for mixing german
>> with english in the code ;) )
>>
>> package view;
>>
>> ..some imports...
>> public class AddArticlePage extends StorePage {
>>
>>  private AddArticlePanel addArticlePanel;
>>
>> �...@suppresswarnings("unchecked")
>>  public AddArticlePage() {
>>   addArticlePanel = new AddArticlePanel("addArticlePanel");
>>   addArticlePanel.setVisible(false);
>>   DropDownChoice dropDownType = new DropDownChoice("dropDownType",
>>     new PropertyModel(this, "selected"), Artikel.TYPELIST) {
>>    protected boolean wantOnSelectionChangedNotifications() {
>>                return true;
>>            }
>>   �...@override
>>    protected void onSelectionChanged(final Object newSelection) {
>>     System.out.println("SELECTION CHANGED!");
>>     System.out.println("new Selection = " + (String) newSelection);
>>     addArticlePanel.setVisibleFields((String) newSelection);
>>     addArticlePanel.setVisible(true);
>>    }
>>   };
>>
>>   Form formAdd = new Form("addArticleForm") {
>>   �...@override
>>    protected void onSubmit() {
>>     System.out.println("Added Article...");
>>    }
>>   };
>>
>>   add(dropDownType);
>>   add(addArticlePanel);
>>   add(formAdd);
>>
>>  }
>> }
>>
>>
>> /* THE PANEL CLASS **/
>> public class AddArticlePanel extends Panel {
>>
>>  private TextField artikelNummer;
>>  private TextField preis;
>>  private TextField erscheinungsJahr;
>>  private TextField beschreibung;
>>  private TextField titel;
>>
>>  //fields for BOOK
>>  private TextField isbn;
>>  private TextField autor;
>>  private TextField verlag;
>>
>>  //fields for CD
>>  private TextField label;
>>  private TextField artist;
>>
>>  public AddArticlePanel(String id) {
>>   super(id);
>>
>>   artikelNummer = new TextField("artikelNummer", new Model());
>>   preis = new TextField("preis", new Model());
>>   erscheinungsJahr = new TextField("erscheinungsJahr", new Model());
>>   beschreibung = new TextField("beschreibung", new Model());
>>   titel = new TextField("titel", new Model());
>>   isbn = new TextField("isbn", new Model());
>>   autor = new TextField("autor", new Model());
>>   verlag = new TextField("verlag", new Model());
>>   label = new TextField("label", new Model());
>>   artist = new TextField("artist", new Model());
>>   add(artikelNummer);
>>   add(preis);
>>   add(erscheinungsJahr);
>>   add(beschreibung);
>>   add(titel);
>>   add(isbn);
>>   add(autor);
>>   add(verlag);
>>   add(label);
>>   add(artist);
>>
>> // THIS WHOLE THING WOULD HAVE TO BE DONE FOR EACH ITEM AGAIN TO
>> // DISPLAY A LABEL IN FRONT OF EACH TEXTFIELD, HOLDING A DESCRIPTION
>> // SOUNDS AWFULL!
>>
>>  }
>>
>>        //could probably be optimised
>>  public void setVisibleFields(String type) {
>>   if (type.equals("BOOK")) {
>>    isbn.setVisible(true);
>>    autor.setVisible(true);
>>    verlag.setVisible(true);
>>
>>    label.setVisible(false);
>>    artist.setVisible(false);
>>   }
>>   else {
>>    isbn.setVisible(false);
>>    autor.setVisible(false);
>>    verlag.setVisible(false);
>>
>>    label.setVisible(true);
>>    artist.setVisible(true);
>>   }
>>  }
>>
>>
>> }
>>
>> Comments please :)
>>
>>
>>> Best,
>>>
>>> Ernesto
>>>
>>> On Wed, Nov 11, 2009 at 3:45 PM, srm  wrote:
>>>

 Am 11.11.2009 um 15:25 schrieb Ernesto Reinaldo Barreiro:

> I have used something similar to
 [snip]
 [snap]
>
> for such situations... I delegate creation to a factory class (so that
 new
> products can be plugged in).
>
> Best,
>
> Ernesto
>


 Thank you for this example.
 But I'm bound to not use Ajax/JavaScript...and now I'm s

Re: How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread srm
SOLVED!
w/o JS/AJAX

I created a factory to produce the corresponding Panel(including the form)
and I use a call to replaceWith() in onSelectionChanged():

[code]
 @Override
   protected void onSelectionChanged(final Object newSelection) {
Panel newPanel = AddItemPanel.getAddItemPanel(selected, "addArticlePanel"); 
//the factory call
addArticlePanel.replaceWith(newPanel);
addArticlePanel = newPanel;
   }

Thanks to martin-g @ #wicket.

Regards,
Stephan

Am 11.11.2009 um 16:18 schrieb srm:

> Am 11.11.2009 um 15:59 schrieb Ernesto Reinaldo Barreiro:
> 
>> If you reload the page when selecting the element, instead of using AJAX, I
>> guess the same will work because you have a selected article... I think AJAX
>> is just a detail here, maybe you can use
>> 
>> protected boolean wantOnSelectionChangedNotifications()
>>   {
>>   return false;
>>   }
>> 
>> on DropDownChoice?
>> 
> 
> 
> From my understanding, I need wantOnSelectionChangedNotifications()
> returning TRUE, otherwise onSelectionChanged() is never triggered.
> My current approach as follows. That's working but it doesn't feel right.
> To clumsy. Any ideas? (and I beg your pardon for mixing german 
> with english in the code ;) )
> 
> package view;
> 
> ..some imports...
> public class AddArticlePage extends StorePage {
> 
>  private AddArticlePanel addArticlePanel;
> 
>  @SuppressWarnings("unchecked")
>  public AddArticlePage() {
>   addArticlePanel = new AddArticlePanel("addArticlePanel");
>   addArticlePanel.setVisible(false);
>   DropDownChoice dropDownType = new DropDownChoice("dropDownType",
> new PropertyModel(this, "selected"), Artikel.TYPELIST) {
>protected boolean wantOnSelectionChangedNotifications() {
>return true;
>}
>@Override
>protected void onSelectionChanged(final Object newSelection) {
> System.out.println("SELECTION CHANGED!");
> System.out.println("new Selection = " + (String) newSelection);
> addArticlePanel.setVisibleFields((String) newSelection);
> addArticlePanel.setVisible(true);
>}
>   };
> 
>   Form formAdd = new Form("addArticleForm") {
>@Override
>protected void onSubmit() {
> System.out.println("Added Article...");
>}
>   };
> 
>   add(dropDownType);
>   add(addArticlePanel);
>   add(formAdd);
>   
>  }
> }
> 
> 
> /* THE PANEL CLASS **/
> public class AddArticlePanel extends Panel {
> 
>  private TextField artikelNummer;
>  private TextField preis;
>  private TextField erscheinungsJahr;
>  private TextField beschreibung;
>  private TextField titel;
>  
>  //fields for BOOK
>  private TextField isbn; 
>  private TextField autor;
>  private TextField verlag;
>  
>  //fields for CD
>  private TextField label;
>  private TextField artist;
>  
>  public AddArticlePanel(String id) {
>   super(id);
>   
>   artikelNummer = new TextField("artikelNummer", new Model());
>   preis = new TextField("preis", new Model());
>   erscheinungsJahr = new TextField("erscheinungsJahr", new Model());
>   beschreibung = new TextField("beschreibung", new Model());
>   titel = new TextField("titel", new Model());
>   isbn = new TextField("isbn", new Model());
>   autor = new TextField("autor", new Model());
>   verlag = new TextField("verlag", new Model());
>   label = new TextField("label", new Model());
>   artist = new TextField("artist", new Model());
>   add(artikelNummer);
>   add(preis);
>   add(erscheinungsJahr);
>   add(beschreibung);
>   add(titel);
>   add(isbn);
>   add(autor);
>   add(verlag);
>   add(label);
>   add(artist);
> 
> // THIS WHOLE THING WOULD HAVE TO BE DONE FOR EACH ITEM AGAIN TO
> // DISPLAY A LABEL IN FRONT OF EACH TEXTFIELD, HOLDING A DESCRIPTION
> // SOUNDS AWFULL!
>   
>  }
>   
>//could probably be optimised
>  public void setVisibleFields(String type) {
>   if (type.equals("BOOK")) {
>isbn.setVisible(true);
>autor.setVisible(true);
>verlag.setVisible(true);
>
>label.setVisible(false);
>artist.setVisible(false);
>   }
>   else {
>isbn.setVisible(false);
>autor.setVisible(false);
>verlag.setVisible(false);
>
>label.setVisible(true);
>artist.setVisible(true);
>   }
>  }
>  
> 
> }
> 
> Comments please :)
> 
> 
>> Best,
>> 
>> Ernesto
>> 
>> On Wed, Nov 11, 2009 at 3:45 PM, srm  wrote:
>> 
>>> 
>>> Am 11.11.2009 um 15:25 schrieb Ernesto Reinaldo Barreiro:
>>> 
 I have used something similar to
>>> [snip]
>>> [snap]
 
 for such situations... I delegate creation to a factory class (so that
>>> new
 products can be plugged in).
 
 Best,
 
 Ernesto
 
>>> 
>>> 
>>> Thank you for this example.
>>> But I'm bound to not use Ajax/JavaScript...and now I'm stuck.
>>> 
>>> Regards,
>>> Stephan
>>> 
>>> 
>>> 
 On Wed, Nov 11, 2009 at 2:53 PM, srm  wrote:
 
> How would you approach the following:
> PageA is used to insert an article. At first, the user chooses what kind
>>> of
> article to insert (DropDownChoice).
>

Browser back, Panel replacement

2009-11-11 Thread bht
Hi,

I have been using panel replacement instead of multiple different
pages as a way to avoid a kind of back button problem but I am not
happy with my solution.

The objective is to prevent the user from going back after an update
to previous pages/versions of the page containing state of domain data
which really does not exist anymore.

This worked without AJAX when using HybridUrlCodingStrategy.

Because of a high number of pages, I want to get away from any
WebRequestCodingStrategy because of the Performance hint in
IRequestTargetUrlCodingStrategy#getMountEncoder. I don't mind ugly
URLs.  When I remove the HybridUrlCodingStrategy then the approach
does not seem to work anymore.

Also I am suspicous of any missing panel crashes on navigation with
the panel replacement approach.

How can I meet my objective? Is there a Wicket best practice approach
for this? I feel I am running round in circles considering options
such as IRequestCycleSettings.RenderStrategy, setVersioned(false).

My possibly oversimplified thought is that Wicket keeps changing page
state on the server and via HTTP post redirect back to the same page
there would never be a browser back option because the same page
cannot have multiple subsequent entries in the browser history.

I feel that this is such an obvious and common problem - I hope this
has already been written about and I just missed the article.


Many thanks,

Bernard

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



Re: correct way to call necessary javascript initialization when a component is added via ajax

2009-11-11 Thread Sven Meier

Right?


Wrong, see explanation below.

Sven

mbrictson wrote:

Actually wicket-ajax.js is smart enough to fire these "dom ready" events
after an ajax request.

Of course, a jQuery $(document).ready() will not fire; neither will the
"ready" events of other various JS libraries. However if you specifically
use Wicket's "dom ready" event (i.e. renderOnDomReadyJavascript() as in the
Java example below, or manually in JavaScript using
Wicket.Event.addDomReadyEvent()), then the event will fire after the ajax
call.


jthomerson wrote:
  

Won't work on an ajax request because the dom ready event isn't fired.
Right?

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Nov 11, 2009 at 2:23 AM, svenmeier  wrote:



Why so complicated?

@Override
public void renderHead(IHeaderResponse response) {
response.renderOnDomReadyJavascript(init_slider_js());
}

  



  



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



Re: correct way to call necessary javascript initialization when a component is added via ajax

2009-11-11 Thread mbrictson

Actually wicket-ajax.js is smart enough to fire these "dom ready" events
after an ajax request.

Of course, a jQuery $(document).ready() will not fire; neither will the
"ready" events of other various JS libraries. However if you specifically
use Wicket's "dom ready" event (i.e. renderOnDomReadyJavascript() as in the
Java example below, or manually in JavaScript using
Wicket.Event.addDomReadyEvent()), then the event will fire after the ajax
call.


jthomerson wrote:
> 
> Won't work on an ajax request because the dom ready event isn't fired.
> Right?
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> On Wed, Nov 11, 2009 at 2:23 AM, svenmeier  wrote:
> 
>>
>> Why so complicated?
>>
>> @Override
>> public void renderHead(IHeaderResponse response) {
>> response.renderOnDomReadyJavascript(init_slider_js());
>> }
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/correct-way-to-call-necessary-javascript-initialization-when-a--component-is-added-via-ajax-tp26295973p26307595.html
Sent from the Wicket - User 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: LDM and OSIV problem

2009-11-11 Thread Jeremy Thomerson
Are you holding the model as an instance variable somewhere?  If so, you'll
need to detach it manually.  The component only auto-detaches the default
model.

i.e. this will get auto-detached:

public class SomeComponent extends Component {
  public SomeComponent(String id, IModel model) {
super(id, model); // this will go into default model and will be
auto-detached
  }
}

i.e. this will NOT get auto-detached:

public class SomeComponent extends Component {
  private IModel myModel;
  public SomeComponent(String id, IModel model) {
super(id);
myModel = model; // this will not be auto-detached
  }

  // you need this:
  public void onDetach() {
myModel.detach();
  }
}



--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Nov 11, 2009 at 10:52 AM, Fernando Wermus  wrote:

> Hi all,
> I have a wizard with five wizardSteps.
>
> Also I have an LDM called EntityModel,
>
> EntityModel extends LDM{
>
> EntityModel(Key key)
>this.key=key;
> }
>
> load(){   // I  look up for the entity with the key}
>
> }
>
> But I have a case where it doesnt behave as expected.
> There is a case where the fifth step consults to EntityModel to get the
> entity and it doesnt look up the db because it does have the entity in its
> transient attribute. Thus, I got a LazyLoadingException.
>
> Isnt it supposed that  LDMs get rid off transient objects for each request?
>
> Why is this case behaving in this way?
>
> Am I supposed to overwrite onAttach to verify that the entity attached is
> not still connected to the session? I thought LDM will work it out.
>
> thanks in advance
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>


Re: correct way to call necessary javascript initialization when a component is added via ajax

2009-11-11 Thread Jeremy Thomerson
Won't work on an ajax request because the dom ready event isn't fired.
Right?

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Nov 11, 2009 at 2:23 AM, svenmeier  wrote:

>
> Why so complicated?
>
> @Override
> public void renderHead(IHeaderResponse response) {
> response.renderOnDomReadyJavascript(init_slider_js());
> }
>
>
> Peter Ross-6 wrote:
> >
> > On Wed, Nov 11, 2009 at 3:48 PM, Jeremy Thomerson
> >  wrote:
> >> On Tue, Nov 10, 2009 at 10:38 PM, Peter Ross
> >> wrote:
> >>
> >>> Hi,
> >>>
> >>> I'm implementing a control which consists of an integer field and a
> >>> slider where the slider comes from jquery UI.
> >>>
> >>> My question is that whenever the component is refreshed via ajax, you
> >>> need to call the js initialization function.
> >>>
> >>> I've done this by adding a behaviour which determines the request
> >>> target, if it's an AjaxRequestTarget it adds the init js to the target
> >>> otherwise it outputs it in the header.
> >>>
> >>> Is this the correct way to do it?  Is there a simpler way?
> >>>
> >> Yes - this looks fine.  There are multiple ways of accomplishing it, but
> >> this one is fine.
> >>
> > Could you elaborate on what some of the other ways are?
> >
> > Just enough key words so that I can do the google search would be fine :)
> >
> > Peter
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/correct-way-to-call-necessary-javascript-initialization-when-a--component-is-added-via-ajax-tp26295973p26297483.html
> Sent from the Wicket - User 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: Proxying SSL on Apache to HTTP on Jetty + Wicket

2009-11-11 Thread Rangel Preis
I extends HttpsRequestCycleProcessor and SwitchProtocolRequestTarget
to make my custom HttpsRequestCycleProcessor
In the method getUrl from SwitchProtocolRequestTarget i just remove the port:

 if (port != null) {
  result.append(":");
  result.append(port);
 }

But don't work, the url are correct but the page don't load i think i
miss something in apache.

Anyone make something like this?

Thanks.

2009/11/10 Rangel Preis :
> The unique solution that i found is extends HttpsRequestCycleProcessor
> to change only the protocol.
>
> Any other ideia? Thanks All.
>
> 2009/11/10 Rangel Preis :
>> The situation here is:
>>
>> https                          http
>> ->   Apache   ---> Jetty
>>
>>
>> Using wicket in my WicketApplication I put
>>
>>  private static final HttpsConfig HTTPS_CONFIG = new
>> HttpsConfig(HTTP_PORT, HTTPS_PORT);
>>
>>   �...@override
>>    protected IRequestCycleProcessor newRequestCycleProcessor() {
>>        return new HttpsRequestCycleProcessor(HTTPS_CONFIG);
>>    }
>>
>> And in my LoginPage.java i have @RequireHttps
>>
>> When i try to run the system with this config i get a error because
>> Wicket assumes the HTTPS control and try to change the URL (port and
>> replace http to https)
>>
>> How i say to wicket to just change the protocol to HTTPS? And don't
>> change the port?
>>
>> Thanks
>>
>

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



LDM and OSIV problem

2009-11-11 Thread Fernando Wermus
Hi all,
 I have a wizard with five wizardSteps.

Also I have an LDM called EntityModel,

EntityModel extends LDM{

EntityModel(Key key)
this.key=key;
}

load(){   // I  look up for the entity with the key}

}

But I have a case where it doesnt behave as expected.
There is a case where the fifth step consults to EntityModel to get the
entity and it doesnt look up the db because it does have the entity in its
transient attribute. Thus, I got a LazyLoadingException.

Isnt it supposed that  LDMs get rid off transient objects for each request?

Why is this case behaving in this way?

Am I supposed to overwrite onAttach to verify that the entity attached is
not still connected to the session? I thought LDM will work it out.

thanks in advance

-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus


Re: Bug with RadioGroup in FormComponentFeedbackBorder

2009-11-11 Thread Daniel Pote
Has anyone seen this before, and maybe know a workaround for this problem?
 
Regards,
Daniel

>>> "Daniel Pote"  2009-11-11 11:00 >>>
I had a RadioGroup with an ajax-call working fine, but when i added it to a 
FormComponentFeedbackBorder it stopped working in MSIE6. However its working in 
MSIE8 and Firefox.
If I remove the FormComponentFeedbackBorder it starts working again.

I traced it down to FormComponent.class where 
getRequest().getParameters(getInputName()) equals null for MSI6, and I get the 
name of the Radio in Firefox and MSIE8

/Daniel

Code snippet:
Java:
  final FormComponentFeedbackBorder bosattBorder = new 
FormComponentFeedbackBorder("bosattSverige.border");
  final RadioGroup group = new 
RadioGroup("sokande.bosattSverige");
  final Radio bosattJa = new Radio("bosattJa", new 
Model(Boolean.TRUE));
  Radio bosattNej = new Radio("bosattNej", new 
Model(Boolean.FALSE));
  group.add(bosattJa);
  group.add(bosattNej);
  group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   @Override
   protected void onUpdate(AjaxRequestTarget target) {
System.out.println(".onUpdate()");
   }
  });
  group.setOutputMarkupId(true);
  group.setOutputMarkupPlaceholderTag(true);
  bosattBorder.add(group);
  add(bosattBorder);
html:

  
   Bor du i Sverige?
   

 Ja


 Nej

   
  



Re: How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread srm
Am 11.11.2009 um 15:59 schrieb Ernesto Reinaldo Barreiro:

> If you reload the page when selecting the element, instead of using AJAX, I
> guess the same will work because you have a selected article... I think AJAX
> is just a detail here, maybe you can use
> 
> protected boolean wantOnSelectionChangedNotifications()
>{
>return false;
>}
> 
> on DropDownChoice?
> 


From my understanding, I need wantOnSelectionChangedNotifications()
returning TRUE, otherwise onSelectionChanged() is never triggered.
My current approach as follows. That's working but it doesn't feel right.
To clumsy. Any ideas? (and I beg your pardon for mixing german 
with english in the code ;) )

package view;

..some imports...
public class AddArticlePage extends StorePage {

private AddArticlePanel addArticlePanel;

@SuppressWarnings("unchecked")
public AddArticlePage() {
addArticlePanel = new AddArticlePanel("addArticlePanel");
addArticlePanel.setVisible(false);
DropDownChoice dropDownType = new DropDownChoice("dropDownType",
new PropertyModel(this, "selected"), 
Artikel.TYPELIST) {
protected boolean wantOnSelectionChangedNotifications() 
{
return true;
}
@Override
protected void onSelectionChanged(final Object 
newSelection) {
System.out.println("SELECTION CHANGED!");
System.out.println("new Selection = " + 
(String) newSelection);
addArticlePanel.setVisibleFields((String) 
newSelection);
addArticlePanel.setVisible(true);
}
};

Form formAdd = new Form("addArticleForm") {
@Override
protected void onSubmit() {
System.out.println("Added Article...");
}
};

add(dropDownType);
add(addArticlePanel);
add(formAdd);

}
}


/* THE PANEL CLASS **/
public class AddArticlePanel extends Panel {

private TextField artikelNummer;
private TextField preis;
private TextField erscheinungsJahr;
private TextField beschreibung;
private TextField titel;

//fields for BOOK
private TextField isbn; 
private TextField autor;
private TextField verlag;

//fields for CD
private TextField label;
private TextField artist;

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

artikelNummer = new TextField("artikelNummer", new Model());
preis = new TextField("preis", new Model());
erscheinungsJahr = new TextField("erscheinungsJahr", new 
Model());
beschreibung = new TextField("beschreibung", new Model());
titel = new TextField("titel", new Model());
isbn = new TextField("isbn", new Model());
autor = new TextField("autor", new Model());
verlag = new TextField("verlag", new Model());
label = new TextField("label", new Model());
artist = new TextField("artist", new Model());
add(artikelNummer);
add(preis);
add(erscheinungsJahr);
add(beschreibung);
add(titel);
add(isbn);
add(autor);
add(verlag);
add(label);
add(artist);

// THIS WHOLE THING WOULD HAVE TO BE DONE FOR EACH ITEM AGAIN TO
// DISPLAY A LABEL IN FRONT OF EACH TEXTFIELD, HOLDING A DESCRIPTION
// SOUNDS AWFULL!

}
 
//could probably be optimised
public void setVisibleFields(String type) {
if (type.equals("BOOK")) {
isbn.setVisible(true);
autor.setVisible(true);
verlag.setVisible(true);

label.setVisible(false);
artist.setVisible(false);
}
else {
isbn.setVisible(false);
autor.setVisible(false);
verlag.setVisible(false);

label.setVisible(true);
artist.setVisible(true);
}
}


}

Comments please :)


> Best,
> 
> Ernesto
> 
> On Wed, Nov 11, 2009 at 3:45 PM, srm  wrote:
> 
>> 
>> Am 11.11.2009 um 15:25 schrieb Ernesto Reinaldo Barreiro:
>> 
>>> I have used something similar to
>> [snip]
>> [snap]
>>> 
>>> for such situations... I delegate creation to

Re: How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread Ernesto Reinaldo Barreiro
If you reload the page when selecting the element, instead of using AJAX, I
guess the same will work because you have a selected article... I think AJAX
is just a detail here, maybe you can use

protected boolean wantOnSelectionChangedNotifications()
{
return false;
}

on DropDownChoice?

Best,

Ernesto

On Wed, Nov 11, 2009 at 3:45 PM, srm  wrote:

>
> Am 11.11.2009 um 15:25 schrieb Ernesto Reinaldo Barreiro:
>
> > I have used something similar to
> [snip]
> [snap]
> >
> > for such situations... I delegate creation to a factory class (so that
> new
> > products can be plugged in).
> >
> > Best,
> >
> > Ernesto
> >
>
>
> Thank you for this example.
> But I'm bound to not use Ajax/JavaScript...and now I'm stuck.
>
> Regards,
> Stephan
>
>
>
> > On Wed, Nov 11, 2009 at 2:53 PM, srm  wrote:
> >
> >> How would you approach the following:
> >> PageA is used to insert an article. At first, the user chooses what kind
> of
> >> article to insert (DropDownChoice).
> >> When the User made his choice, a coresponding form should be
> loaded/visible
> >> underneath the
> >> DropDownChoice. That's all to be solved without JavaScript.
> >> My current idea is currently to add an Panel (AddArticlePanel) which
> holds
> >> all fields for any kind of article
> >> and make them visible depending on what the user has chosen (using
> >> onSelectionChanged).
> >> But that seems like a brute approach so I wanted to get your opinions on
> >> this.
> >>
> >> Further information will be happily provided.
> >>
> >> Regards,
> >> Stephan
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread srm

Am 11.11.2009 um 15:25 schrieb Ernesto Reinaldo Barreiro:

> I have used something similar to
[snip]
[snap]
> 
> for such situations... I delegate creation to a factory class (so that new
> products can be plugged in).
> 
> Best,
> 
> Ernesto
> 


Thank you for this example.
But I'm bound to not use Ajax/JavaScript...and now I'm stuck.

Regards,
Stephan



> On Wed, Nov 11, 2009 at 2:53 PM, srm  wrote:
> 
>> How would you approach the following:
>> PageA is used to insert an article. At first, the user chooses what kind of
>> article to insert (DropDownChoice).
>> When the User made his choice, a coresponding form should be loaded/visible
>> underneath the
>> DropDownChoice. That's all to be solved without JavaScript.
>> My current idea is currently to add an Panel (AddArticlePanel) which holds
>> all fields for any kind of article
>> and make them visible depending on what the user has chosen (using
>> onSelectionChanged).
>> But that seems like a brute approach so I wanted to get your opinions on
>> this.
>> 
>> Further information will be happily provided.
>> 
>> Regards,
>> Stephan
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 


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



Re: How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread Ernesto Reinaldo Barreiro
I have used something similar to

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;

import com.google.inject.Inject;


public class EditPanel extends Panel {

private IArticleEditFactory factory;

private IArticle selected;

private Form form;

/**
 * @param id
 */
public EditPanel(String id) {
super(id);
setOutputMarkupId(true);

form = new Form("form");
DropDownChoice choice = new
DropDownChoice("article", new Model() {

public IArticle getObject() {
return EditPanel.this.selected;
};

public void setObject(IArticle object) {
EditPanel.this.selected = object;
};

}, listWithArticles );

choice.add(new OnChangeAjaxBehavior() {

@Override
protected void onUpdate(AjaxRequestTarget target) {
if(target != null) {
target.addComponent(EditPanel.this);
}
}
});

form.add(choice);
}

@Override
protected void onBeforeRender() {
if(selected != null) {
form.addOrReplace(factory.createArticleEditPanel("content",
selected));
} else {
form.addOrReplace(new EmptyPanel("content"));
}
super.onBeforeRender();
}

}

for such situations... I delegate creation to a factory class (so that new
products can be plugged in).

Best,

Ernesto

On Wed, Nov 11, 2009 at 2:53 PM, srm  wrote:

> How would you approach the following:
> PageA is used to insert an article. At first, the user chooses what kind of
> article to insert (DropDownChoice).
> When the User made his choice, a coresponding form should be loaded/visible
> underneath the
> DropDownChoice. That's all to be solved without JavaScript.
> My current idea is currently to add an Panel (AddArticlePanel) which holds
> all fields for any kind of article
> and make them visible depending on what the user has chosen (using
> onSelectionChanged).
> But that seems like a brute approach so I wanted to get your opinions on
> this.
>
> Further information will be happily provided.
>
> Regards,
> Stephan
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


How to dynamically display a Form depending on a DropDownChoice?

2009-11-11 Thread srm
How would you approach the following: 
PageA is used to insert an article. At first, the user chooses what kind of 
article to insert (DropDownChoice). 
When the User made his choice, a coresponding form should be loaded/visible 
underneath the 
DropDownChoice. That's all to be solved without JavaScript.
My current idea is currently to add an Panel (AddArticlePanel) which holds all 
fields for any kind of article
and make them visible depending on what the user has chosen (using 
onSelectionChanged).
But that seems like a brute approach so I wanted to get your opinions on this.

Further information will be happily provided.

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



Re: another serialization question

2009-11-11 Thread James Carman
How do you "already know" the attributes of all of the research items?  Does
that mean that you could enumerate them?

On Nov 11, 2009 12:23 AM, "Sam Barrow"  wrote:

The value objects are not simple attributes of an entity. Let me explain
what they do (a little simplified but the fundamentals are there).

We have a research module that performs pricing research.

ResearchItem
 CellPhoneResearchItem
 IPodResearchItem
 LaptopResearchItem
 Etc

Since the identity of these research items is defined solely by their
attributes they are implemented as value objects. I know this is different
from your everyday value object (eg Address) Does this sound like maybe a
problem that should be addressed in the domain model?
Value objects were chosen since it makes it much easier in many other areas
to just create a new research item, rather than call repositories to load
old ones (impossible in some places). No point in loading something you know
all the attributes of.

The only way to get them reliably is to call
ResearchItemGenerationService.generateResearchItems()

-Original Message- From: James Carman 
Date: Wed, 11 Nov 2009...

Subject: Re: another serialization question Can you go through the entity to
get to these objects? ...


Re: HTTP Status 400 - There are some problems in the request: invalid URLPatternSpec

2009-11-11 Thread FakeBoy

I checked
http://docs.huihoo.com/javadoc/jboss/4.0.2/javax/security/jacc/URLPatternSpec.java.html.
 
I need change url to this :
http://xyz.sk/mymount?wicket:interface=:0:form::IFormSubmitListener:: and
everything work fine. 
Strange thing is that I developed app on Jetty and Tomcat and everything
works fine. Now I have more info a I need to expect some complication when i
will be migrating to other web container.

Dave


igor.vaynberg wrote:
> 
> there should be a way for you to relax your server's checks, that is a
> little crazy.
> 
> -igor
> 
> On Tue, Nov 10, 2009 at 2:02 PM, David Skuben 
> wrote:
>> Hellou everyone,
>> I use StatelessForm on GlassFish Ent Server 2.1 and I have this prob.
>> When I submit form with method POST and Action url:
>> http://xyz.sk/mymount/wicket:interface/:0:form::IFormSubmitListener::
>> server
>> send me back status code 400 (There are some problems in the request:
>> invalid URLPatternSpec). When I deploy same app in jetty or tomcat
>> everything works fine. But my production enviroment is GlassFish.
>>
>> I think that prob is in character ":" in URL, but i dont understand
>> because
>> i debug that all params are decoded thrue
>> WicketURLEncoder.PATH_INSTANCE.encode(string).
>>
>> Do you have some ideas ?
>> Thanks a lot.
>> Dave
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/HTTP-Status-400---There-are-some-problems-in-the-request%3A-invalid--URLPatternSpec-tp26292073p26299985.html
Sent from the Wicket - User 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: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Ernesto Reinaldo Barreiro
public class HomePage extends WebPage {

private static final long serialVersionUID = 1L;

private static int testCounter = 0;


WebMarkupContainer container;

/**
 * Constructor that is invoked when page is invoked without a session.
 *
 * @param parameters
 *Page parameters
 */
public HomePage(final PageParameters parameters) {

container = new WebMarkupContainer("container");

// Add the simplest type of label
container.add(new PanelC("panel"));
container.setOutputMarkupId(true);
container.add(new AbstractAjaxTimerBehavior(Duration.seconds(4))
{
private static final long serialVersionUID = 1L;

@Override
protected void onTimer(AjaxRequestTarget target)
{
Panel replacement = null;
testCounter++;

switch((testCounter%3))
{
case 0:
replacement = new PanelA("panel");
break;

case 1:
replacement = new PanelB("panel");
break;

case 2:
replacement = new PanelC("panel");
break;
}

container.addOrReplace(replacement);
target.addComponent(container);
}
});
add(container);
}
}

and

http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"; >

Wicket Quickstart Archetype Homepage


Wicket Quickstart Archetype Homepage


message will be here




will do it

Best,

Ernesto

On Wed, Nov 11, 2009 at 10:25 AM, Giambalvo, Christian <
christian.giamba...@excelsisnet.com> wrote:

> Look at the sample project.
>
>
> -Ursprüngliche Nachricht-
> Von: Giambalvo, Christian [mailto:christian.giamba...@excelsisnet.com]
> Gesendet: Mittwoch, 11. November 2009 10:24
> An: users@wicket.apache.org
> Betreff: AW: AbstractAjaxTimerBehavior causes exception
>
> You're right Ernesto, your example works, but what if I want to replace a
> whole panel and not just the model of a label?
>
>
> -Ursprüngliche Nachricht-
> Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Gesendet: Mittwoch, 11. November 2009 10:15
> An: users@wicket.apache.org
> Betreff: Re: AbstractAjaxTimerBehavior causes exception
>
> Well I think it all boils down to the explanation a gave on my first
> e-mail:
> if you replace the component with a new one that does not have the behavior
> then you will get an exception (the same will happend if you remove the
> behavior during a round trip).  I guess Martin was just trying to say that
> you should use the same label...? Did you try the code I posted? It does
> work ;-)
>
> Cheers,
>
> Ernesto
>
> On Wed, Nov 11, 2009 at 10:06 AM, Giambalvo, Christian <
> christian.giamba...@excelsisnet.com> wrote:
>
> > Hi Martin,
> >
> > this doesn't work.
> >
> >@Override
> >protected void onTimer(AjaxRequestTarget target)
> >{
> >Label t2 = new Label("message", "Test " + testCounter);
> > t2.setOutputMarkupId(true);
> > test = t2;
> >testCounter++;
> >target.addComponent(test);
> >}
> > It doesn't throw an exception, but the t2 didn't show up.
> > I think this is because t2 isn't added to the page.
> > That's why there is Component#replaceWith(Component).
> >
> > Greets
> >
> > -Ursprüngliche Nachricht-
> > Von: Martin Grigorov [mailto:mcgreg...@e-card.bg]
> > Gesendet: Mittwoch, 11. November 2009 09:59
> > An: users@wicket.apache.org
> > Betreff: Re: AbstractAjaxTimerBehavior causes exception
> >
> > On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote:
> > > Hi all,
> > >
> > >
> > >
> > > maybe i found a bug.
> > >
> > > Don't know if I'm doing something wrong.
> > >
> > > But it's a simple usecase.
> > >
> > >
> > >
> > > Following code produces an exception:
> > >
> > >
> > >
> > > public class HomePage extends WebPage {
> > >
> > >
> > >
> > > private static final long serialVersionUID = 1L;
> > >
> > >
> > >
> > > private static int testCounter = 0;
> > >
> > >
> > >
> > > public HomePage(final PageParameters parameters) {
> > >
> > >
> > >
> > > // Add the simplest type of label
> > >
> > > final Label test = new Label("message", "If you see this
> message
> > > wicket is properly configured and running");
> > >
> > > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
> > >
> > > {
> > >
> > > @Override
> > >
> > > protected void onTimer(AjaxRequestTarget target)
> > >
> > > {
> > >
> > > Label t2 = new Label("message", "Test " + testCounter);
> > >
> > > test.replaceWith(t2);
> > here

AW: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Giambalvo, Christian
Works great with a Container.

Thanks Ernesto, you're the best :)

Saludo
Chris

-Ursprüngliche Nachricht-
Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] 
Gesendet: Mittwoch, 11. November 2009 10:28
An: users@wicket.apache.org
Betreff: Re: AbstractAjaxTimerBehavior causes exception

Put a container (WebMarkupContainer?) around components you want to update,
atatch the behavior to that container and make sure the comapoent you want
to update are "dynamic": meaning that theirs "state" should change every
time they are rendered.

Best,

Ernesto

On Wed, Nov 11, 2009 at 10:24 AM, Giambalvo, Christian <
christian.giamba...@excelsisnet.com> wrote:

> You're right Ernesto, your example works, but what if I want to replace a
> whole panel and not just the model of a label?
>
>
> -Ursprüngliche Nachricht-
> Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Gesendet: Mittwoch, 11. November 2009 10:15
> An: users@wicket.apache.org
> Betreff: Re: AbstractAjaxTimerBehavior causes exception
>
> Well I think it all boils down to the explanation a gave on my first
> e-mail:
> if you replace the component with a new one that does not have the behavior
> then you will get an exception (the same will happend if you remove the
> behavior during a round trip).  I guess Martin was just trying to say that
> you should use the same label...? Did you try the code I posted? It does
> work ;-)
>
> Cheers,
>
> Ernesto
>
> On Wed, Nov 11, 2009 at 10:06 AM, Giambalvo, Christian <
> christian.giamba...@excelsisnet.com> wrote:
>
> > Hi Martin,
> >
> > this doesn't work.
> >
> >@Override
> >protected void onTimer(AjaxRequestTarget target)
> >{
> >Label t2 = new Label("message", "Test " + testCounter);
> > t2.setOutputMarkupId(true);
> > test = t2;
> >testCounter++;
> >target.addComponent(test);
> >}
> > It doesn't throw an exception, but the t2 didn't show up.
> > I think this is because t2 isn't added to the page.
> > That's why there is Component#replaceWith(Component).
> >
> > Greets
> >
> > -Ursprüngliche Nachricht-
> > Von: Martin Grigorov [mailto:mcgreg...@e-card.bg]
> > Gesendet: Mittwoch, 11. November 2009 09:59
> > An: users@wicket.apache.org
> > Betreff: Re: AbstractAjaxTimerBehavior causes exception
> >
> > On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote:
> > > Hi all,
> > >
> > >
> > >
> > > maybe i found a bug.
> > >
> > > Don't know if I'm doing something wrong.
> > >
> > > But it's a simple usecase.
> > >
> > >
> > >
> > > Following code produces an exception:
> > >
> > >
> > >
> > > public class HomePage extends WebPage {
> > >
> > >
> > >
> > > private static final long serialVersionUID = 1L;
> > >
> > >
> > >
> > > private static int testCounter = 0;
> > >
> > >
> > >
> > > public HomePage(final PageParameters parameters) {
> > >
> > >
> > >
> > > // Add the simplest type of label
> > >
> > > final Label test = new Label("message", "If you see this
> message
> > > wicket is properly configured and running");
> > >
> > > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
> > >
> > > {
> > >
> > > @Override
> > >
> > > protected void onTimer(AjaxRequestTarget target)
> > >
> > > {
> > >
> > > Label t2 = new Label("message", "Test " + testCounter);
> > >
> > > test.replaceWith(t2);
> > here you need to make : test = t2;
> > >
> > > testCounter++;
> > >
> > > target.addComponent(test);
> > >
> > > }
> > >
> > > });
> > >
> > >
> > >
> > > add(test);
> > >
> > > }
> > >
> > > }
> > >
> > >
> > >
> > > Exception:
> > >
> > > Root cause:
> > >
> > > java.lang.IllegalStateException: No Page found for component [Component
> > > id = message]
> > >  at org.apache.wicket.Component.getPage(Component.java:1754)
> > >  at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
> > >  at org.apache.wicket.Component.urlFor(Component.java:3286)
> > >  at
> > >
> org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> > > jaxBehavior.java:124)
> > >  at
> > >
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> > > actAjaxTimerBehavior.java:127)
> > >  at
> > >
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> > > ctAjaxTimerBehavior.java:120)
> > >  at
> > >
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> > > erBehavior.java:163)
> > >  at
> > >
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> > > aultAjaxBehavior.java:299)
> > >  at
> > >
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> > > t.processEvents(BehaviorRequestTarget.java:119)
> > >  at
> > >
> org.apache.wicket.requ

Re: Autogenerating HTML files ...?

2009-11-11 Thread kellerautomat

Try using startComponent instead of startPage


Ashley Aitken wrote:
> 
> 
> Thanks All.
> 
> Igor - I'm a Wicket newbie.  When I get more experience I'll see if I  
> can do something along the lines you suggest.  For now I just wished  
> to know if it would be possible / sensible.
> 
> Casper - Sorry I'm a Wicket newbie as well (but I do have experience  
> with some other Web frameworks and will have a go sometime when I  
> understand Wicket better).
> 
> Frido - Unfortunately, I don't think that is what I am looking for -  
> I'm not looking for the rendered page, but rather what the bare source  
> page / component HTML would look like.
> 
> Cheers,
> Ashley.
> 
> 
> --
> Ashley Aitken
> Perth, Western Australia
> mrhatken at mac dot com
> Skype Name: MrHatken (GMT + 8 Hours!)
> 
> 
> 
> 
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Autogenerating-HTML-files-...--tp26263720p26299005.html
Sent from the Wicket - User 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



Bug with RadioGroup in FormComponentFeedbackBorder

2009-11-11 Thread Daniel Pote
I had a RadioGroup with an ajax-call working fine, but when i added it to a 
FormComponentFeedbackBorder it stopped working in MSIE6. However its working in 
MSIE8 and Firefox.
If I remove the FormComponentFeedbackBorder it starts working again.
 
I traced it down to FormComponent.class where 
getRequest().getParameters(getInputName()) equals null for MSI6, and I get the 
name of the Radio in Firefox and MSIE8
 
/Daniel
 
Code snippet:
Java:
  final FormComponentFeedbackBorder bosattBorder = new 
FormComponentFeedbackBorder("bosattSverige.border");
  final RadioGroup group = new 
RadioGroup("sokande.bosattSverige");
  final Radio bosattJa = new Radio("bosattJa", new 
Model(Boolean.TRUE));
  Radio bosattNej = new Radio("bosattNej", new 
Model(Boolean.FALSE));
  group.add(bosattJa);
  group.add(bosattNej);
  group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   @Override
   protected void onUpdate(AjaxRequestTarget target) {
System.out.println(".onUpdate()");
   }
  });
  group.setOutputMarkupId(true);
  group.setOutputMarkupPlaceholderTag(true);
  bosattBorder.add(group);
  add(bosattBorder);
html:
 
  
   Bor du i Sverige?
   

 Ja


 Nej

   
  
 


Re: AW: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Martin Grigorov
I didn't mean to 'replace' but to 'add'. You need both lines.


On Wed, 2009-11-11 at 10:06 +0100, Giambalvo, Christian wrote:
> Hi Martin,
> 
> this doesn't work.
> 
>   @Override
> protected void onTimer(AjaxRequestTarget target) 
> {
> Label t2 = new Label("message", "Test " + testCounter);
> t2.setOutputMarkupId(true);
> test = t2;
> testCounter++;
> target.addComponent(test);
> }
> It doesn't throw an exception, but the t2 didn't show up.
> I think this is because t2 isn't added to the page.
> That’s why there is Component#replaceWith(Component).
> 
> Greets
> 
> -Ursprüngliche Nachricht-
> Von: Martin Grigorov [mailto:mcgreg...@e-card.bg] 
> Gesendet: Mittwoch, 11. November 2009 09:59
> An: users@wicket.apache.org
> Betreff: Re: AbstractAjaxTimerBehavior causes exception
> 
> On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote:
> > Hi all,
> > 
> >  
> > 
> > maybe i found a bug.
> > 
> > Don't know if I'm doing something wrong.
> > 
> > But it's a simple usecase.
> > 
> >  
> > 
> > Following code produces an exception:
> > 
> >  
> > 
> > public class HomePage extends WebPage {
> > 
> >  
> > 
> > private static final long serialVersionUID = 1L;
> > 
> >  
> > 
> > private static int testCounter = 0;
> > 
> >  
> > 
> > public HomePage(final PageParameters parameters) {
> > 
> >  
> > 
> > // Add the simplest type of label
> > 
> > final Label test = new Label("message", "If you see this message
> > wicket is properly configured and running");
> > 
> > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
> > 
> > {
> > 
> > @Override
> > 
> > protected void onTimer(AjaxRequestTarget target) 
> > 
> > {
> > 
> > Label t2 = new Label("message", "Test " + testCounter);
> > 
> > test.replaceWith(t2);
> here you need to make : test = t2;
> > 
> > testCounter++;
> > 
> > target.addComponent(test);
> > 
> > }
> > 
> > });
> > 
> >  
> > 
> > add(test);
> > 
> > }
> > 
> > }
> > 
> >  
> > 
> > Exception:
> > 
> > Root cause:
> > 
> > java.lang.IllegalStateException: No Page found for component [Component
> > id = message]
> >  at org.apache.wicket.Component.getPage(Component.java:1754)
> >  at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
> >  at org.apache.wicket.Component.urlFor(Component.java:3286)
> >  at
> > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> > jaxBehavior.java:124)
> >  at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> > actAjaxTimerBehavior.java:127)
> >  at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> > ctAjaxTimerBehavior.java:120)
> >  at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> > erBehavior.java:163)
> >  at
> > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> > aultAjaxBehavior.java:299)
> >  at
> > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> > t.processEvents(BehaviorRequestTarget.java:119)
> >  at
> > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> > stractRequestCycleProcessor.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:1428)
> >  at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> >  at
> > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468
> > )
> >  at
> > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> > 301)
> >  at
> > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
> > dler.java:1157)
> >  at
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> >  at
> > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
> > 16)
> >  at
> > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> >  at
> > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> >  at
> > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> >  at
> > org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler
> > Collection.java:230)
> >  at
> > org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav
> > a:114)
> >  at
> > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> >  at org.mortbay.jetty.Server.handle(Server.java:326)
> >  at
> > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
> >  at
> > org

Re: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Ernesto Reinaldo Barreiro
Put a container (WebMarkupContainer?) around components you want to update,
atatch the behavior to that container and make sure the comapoent you want
to update are "dynamic": meaning that theirs "state" should change every
time they are rendered.

Best,

Ernesto

On Wed, Nov 11, 2009 at 10:24 AM, Giambalvo, Christian <
christian.giamba...@excelsisnet.com> wrote:

> You're right Ernesto, your example works, but what if I want to replace a
> whole panel and not just the model of a label?
>
>
> -Ursprüngliche Nachricht-
> Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Gesendet: Mittwoch, 11. November 2009 10:15
> An: users@wicket.apache.org
> Betreff: Re: AbstractAjaxTimerBehavior causes exception
>
> Well I think it all boils down to the explanation a gave on my first
> e-mail:
> if you replace the component with a new one that does not have the behavior
> then you will get an exception (the same will happend if you remove the
> behavior during a round trip).  I guess Martin was just trying to say that
> you should use the same label...? Did you try the code I posted? It does
> work ;-)
>
> Cheers,
>
> Ernesto
>
> On Wed, Nov 11, 2009 at 10:06 AM, Giambalvo, Christian <
> christian.giamba...@excelsisnet.com> wrote:
>
> > Hi Martin,
> >
> > this doesn't work.
> >
> >@Override
> >protected void onTimer(AjaxRequestTarget target)
> >{
> >Label t2 = new Label("message", "Test " + testCounter);
> > t2.setOutputMarkupId(true);
> > test = t2;
> >testCounter++;
> >target.addComponent(test);
> >}
> > It doesn't throw an exception, but the t2 didn't show up.
> > I think this is because t2 isn't added to the page.
> > That's why there is Component#replaceWith(Component).
> >
> > Greets
> >
> > -Ursprüngliche Nachricht-
> > Von: Martin Grigorov [mailto:mcgreg...@e-card.bg]
> > Gesendet: Mittwoch, 11. November 2009 09:59
> > An: users@wicket.apache.org
> > Betreff: Re: AbstractAjaxTimerBehavior causes exception
> >
> > On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote:
> > > Hi all,
> > >
> > >
> > >
> > > maybe i found a bug.
> > >
> > > Don't know if I'm doing something wrong.
> > >
> > > But it's a simple usecase.
> > >
> > >
> > >
> > > Following code produces an exception:
> > >
> > >
> > >
> > > public class HomePage extends WebPage {
> > >
> > >
> > >
> > > private static final long serialVersionUID = 1L;
> > >
> > >
> > >
> > > private static int testCounter = 0;
> > >
> > >
> > >
> > > public HomePage(final PageParameters parameters) {
> > >
> > >
> > >
> > > // Add the simplest type of label
> > >
> > > final Label test = new Label("message", "If you see this
> message
> > > wicket is properly configured and running");
> > >
> > > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
> > >
> > > {
> > >
> > > @Override
> > >
> > > protected void onTimer(AjaxRequestTarget target)
> > >
> > > {
> > >
> > > Label t2 = new Label("message", "Test " + testCounter);
> > >
> > > test.replaceWith(t2);
> > here you need to make : test = t2;
> > >
> > > testCounter++;
> > >
> > > target.addComponent(test);
> > >
> > > }
> > >
> > > });
> > >
> > >
> > >
> > > add(test);
> > >
> > > }
> > >
> > > }
> > >
> > >
> > >
> > > Exception:
> > >
> > > Root cause:
> > >
> > > java.lang.IllegalStateException: No Page found for component [Component
> > > id = message]
> > >  at org.apache.wicket.Component.getPage(Component.java:1754)
> > >  at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
> > >  at org.apache.wicket.Component.urlFor(Component.java:3286)
> > >  at
> > >
> org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> > > jaxBehavior.java:124)
> > >  at
> > >
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> > > actAjaxTimerBehavior.java:127)
> > >  at
> > >
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> > > ctAjaxTimerBehavior.java:120)
> > >  at
> > >
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> > > erBehavior.java:163)
> > >  at
> > >
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> > > aultAjaxBehavior.java:299)
> > >  at
> > >
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> > > t.processEvents(BehaviorRequestTarget.java:119)
> > >  at
> > >
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> > > stractRequestCycleProcessor.java:92)
> > >  at
> > >
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java
> > > :1250)
> > >  at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
> > >  at org.apache.wic

AW: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Giambalvo, Christian
You're right Ernesto, your example works, but what if I want to replace a whole 
panel and not just the model of a label?


-Ursprüngliche Nachricht-
Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] 
Gesendet: Mittwoch, 11. November 2009 10:15
An: users@wicket.apache.org
Betreff: Re: AbstractAjaxTimerBehavior causes exception

Well I think it all boils down to the explanation a gave on my first e-mail:
if you replace the component with a new one that does not have the behavior
then you will get an exception (the same will happend if you remove the
behavior during a round trip).  I guess Martin was just trying to say that
you should use the same label...? Did you try the code I posted? It does
work ;-)

Cheers,

Ernesto

On Wed, Nov 11, 2009 at 10:06 AM, Giambalvo, Christian <
christian.giamba...@excelsisnet.com> wrote:

> Hi Martin,
>
> this doesn't work.
>
>@Override
>protected void onTimer(AjaxRequestTarget target)
>{
>Label t2 = new Label("message", "Test " + testCounter);
> t2.setOutputMarkupId(true);
> test = t2;
>testCounter++;
>target.addComponent(test);
>}
> It doesn't throw an exception, but the t2 didn't show up.
> I think this is because t2 isn't added to the page.
> That's why there is Component#replaceWith(Component).
>
> Greets
>
> -Ursprüngliche Nachricht-
> Von: Martin Grigorov [mailto:mcgreg...@e-card.bg]
> Gesendet: Mittwoch, 11. November 2009 09:59
> An: users@wicket.apache.org
> Betreff: Re: AbstractAjaxTimerBehavior causes exception
>
> On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote:
> > Hi all,
> >
> >
> >
> > maybe i found a bug.
> >
> > Don't know if I'm doing something wrong.
> >
> > But it's a simple usecase.
> >
> >
> >
> > Following code produces an exception:
> >
> >
> >
> > public class HomePage extends WebPage {
> >
> >
> >
> > private static final long serialVersionUID = 1L;
> >
> >
> >
> > private static int testCounter = 0;
> >
> >
> >
> > public HomePage(final PageParameters parameters) {
> >
> >
> >
> > // Add the simplest type of label
> >
> > final Label test = new Label("message", "If you see this message
> > wicket is properly configured and running");
> >
> > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
> >
> > {
> >
> > @Override
> >
> > protected void onTimer(AjaxRequestTarget target)
> >
> > {
> >
> > Label t2 = new Label("message", "Test " + testCounter);
> >
> > test.replaceWith(t2);
> here you need to make : test = t2;
> >
> > testCounter++;
> >
> > target.addComponent(test);
> >
> > }
> >
> > });
> >
> >
> >
> > add(test);
> >
> > }
> >
> > }
> >
> >
> >
> > Exception:
> >
> > Root cause:
> >
> > java.lang.IllegalStateException: No Page found for component [Component
> > id = message]
> >  at org.apache.wicket.Component.getPage(Component.java:1754)
> >  at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
> >  at org.apache.wicket.Component.urlFor(Component.java:3286)
> >  at
> > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> > jaxBehavior.java:124)
> >  at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> > actAjaxTimerBehavior.java:127)
> >  at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> > ctAjaxTimerBehavior.java:120)
> >  at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> > erBehavior.java:163)
> >  at
> > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> > aultAjaxBehavior.java:299)
> >  at
> > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> > t.processEvents(BehaviorRequestTarget.java:119)
> >  at
> > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> > stractRequestCycleProcessor.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:1428)
> >  at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> >  at
> > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468
> > )
> >  at
> > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> > 301)
> >  at
> > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
> > dler.java:1157)
> >  at
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> >  at
> > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
> > 16)
> >  at
> > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.

Re: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Ernesto Reinaldo Barreiro
Well I think it all boils down to the explanation a gave on my first e-mail:
if you replace the component with a new one that does not have the behavior
then you will get an exception (the same will happend if you remove the
behavior during a round trip).  I guess Martin was just trying to say that
you should use the same label...? Did you try the code I posted? It does
work ;-)

Cheers,

Ernesto

On Wed, Nov 11, 2009 at 10:06 AM, Giambalvo, Christian <
christian.giamba...@excelsisnet.com> wrote:

> Hi Martin,
>
> this doesn't work.
>
>@Override
>protected void onTimer(AjaxRequestTarget target)
>{
>Label t2 = new Label("message", "Test " + testCounter);
> t2.setOutputMarkupId(true);
> test = t2;
>testCounter++;
>target.addComponent(test);
>}
> It doesn't throw an exception, but the t2 didn't show up.
> I think this is because t2 isn't added to the page.
> That’s why there is Component#replaceWith(Component).
>
> Greets
>
> -Ursprüngliche Nachricht-
> Von: Martin Grigorov [mailto:mcgreg...@e-card.bg]
> Gesendet: Mittwoch, 11. November 2009 09:59
> An: users@wicket.apache.org
> Betreff: Re: AbstractAjaxTimerBehavior causes exception
>
> On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote:
> > Hi all,
> >
> >
> >
> > maybe i found a bug.
> >
> > Don't know if I'm doing something wrong.
> >
> > But it's a simple usecase.
> >
> >
> >
> > Following code produces an exception:
> >
> >
> >
> > public class HomePage extends WebPage {
> >
> >
> >
> > private static final long serialVersionUID = 1L;
> >
> >
> >
> > private static int testCounter = 0;
> >
> >
> >
> > public HomePage(final PageParameters parameters) {
> >
> >
> >
> > // Add the simplest type of label
> >
> > final Label test = new Label("message", "If you see this message
> > wicket is properly configured and running");
> >
> > test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
> >
> > {
> >
> > @Override
> >
> > protected void onTimer(AjaxRequestTarget target)
> >
> > {
> >
> > Label t2 = new Label("message", "Test " + testCounter);
> >
> > test.replaceWith(t2);
> here you need to make : test = t2;
> >
> > testCounter++;
> >
> > target.addComponent(test);
> >
> > }
> >
> > });
> >
> >
> >
> > add(test);
> >
> > }
> >
> > }
> >
> >
> >
> > Exception:
> >
> > Root cause:
> >
> > java.lang.IllegalStateException: No Page found for component [Component
> > id = message]
> >  at org.apache.wicket.Component.getPage(Component.java:1754)
> >  at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
> >  at org.apache.wicket.Component.urlFor(Component.java:3286)
> >  at
> > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> > jaxBehavior.java:124)
> >  at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> > actAjaxTimerBehavior.java:127)
> >  at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> > ctAjaxTimerBehavior.java:120)
> >  at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> > erBehavior.java:163)
> >  at
> > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> > aultAjaxBehavior.java:299)
> >  at
> > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> > t.processEvents(BehaviorRequestTarget.java:119)
> >  at
> > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> > stractRequestCycleProcessor.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:1428)
> >  at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> >  at
> > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468
> > )
> >  at
> > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> > 301)
> >  at
> > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
> > dler.java:1157)
> >  at
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> >  at
> > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
> > 16)
> >  at
> > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> >  at
> > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> >  at
> > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> >  at
> > org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler
> > Collection.java:230)
> >  at
> > org.mortbay.jetty.handler.Handle

AW: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Giambalvo, Christian
Hi Martin,

this doesn't work.

@Override
protected void onTimer(AjaxRequestTarget target) 
{
Label t2 = new Label("message", "Test " + testCounter);
t2.setOutputMarkupId(true);
test = t2;
testCounter++;
target.addComponent(test);
}
It doesn't throw an exception, but the t2 didn't show up.
I think this is because t2 isn't added to the page.
That’s why there is Component#replaceWith(Component).

Greets

-Ursprüngliche Nachricht-
Von: Martin Grigorov [mailto:mcgreg...@e-card.bg] 
Gesendet: Mittwoch, 11. November 2009 09:59
An: users@wicket.apache.org
Betreff: Re: AbstractAjaxTimerBehavior causes exception

On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote:
> Hi all,
> 
>  
> 
> maybe i found a bug.
> 
> Don't know if I'm doing something wrong.
> 
> But it's a simple usecase.
> 
>  
> 
> Following code produces an exception:
> 
>  
> 
> public class HomePage extends WebPage {
> 
>  
> 
> private static final long serialVersionUID = 1L;
> 
>  
> 
> private static int testCounter = 0;
> 
>  
> 
> public HomePage(final PageParameters parameters) {
> 
>  
> 
> // Add the simplest type of label
> 
> final Label test = new Label("message", "If you see this message
> wicket is properly configured and running");
> 
> test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
> 
> {
> 
> @Override
> 
> protected void onTimer(AjaxRequestTarget target) 
> 
> {
> 
> Label t2 = new Label("message", "Test " + testCounter);
> 
> test.replaceWith(t2);
here you need to make : test = t2;
> 
> testCounter++;
> 
> target.addComponent(test);
> 
> }
> 
> });
> 
>  
> 
> add(test);
> 
> }
> 
> }
> 
>  
> 
> Exception:
> 
> Root cause:
> 
> java.lang.IllegalStateException: No Page found for component [Component
> id = message]
>  at org.apache.wicket.Component.getPage(Component.java:1754)
>  at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
>  at org.apache.wicket.Component.urlFor(Component.java:3286)
>  at
> org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> jaxBehavior.java:124)
>  at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> actAjaxTimerBehavior.java:127)
>  at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> ctAjaxTimerBehavior.java:120)
>  at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> erBehavior.java:163)
>  at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> aultAjaxBehavior.java:299)
>  at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> t.processEvents(BehaviorRequestTarget.java:119)
>  at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> stractRequestCycleProcessor.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:1428)
>  at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
>  at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468
> )
>  at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> 301)
>  at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
> dler.java:1157)
>  at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
>  at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
> 16)
>  at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>  at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>  at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
>  at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler
> Collection.java:230)
>  at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav
> a:114)
>  at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>  at org.mortbay.jetty.Server.handle(Server.java:326)
>  at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
>  at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne
> ction.java:915)
>  at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
>  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>  at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
>  at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 409)
>  at
> org.mortbay.thread.QueuedThreadPool$PoolThr

Re: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Martin Grigorov
On Wed, 2009-11-11 at 09:21 +0100, Giambalvo, Christian wrote:
> Hi all,
> 
>  
> 
> maybe i found a bug.
> 
> Don't know if I'm doing something wrong.
> 
> But it's a simple usecase.
> 
>  
> 
> Following code produces an exception:
> 
>  
> 
> public class HomePage extends WebPage {
> 
>  
> 
> private static final long serialVersionUID = 1L;
> 
>  
> 
> private static int testCounter = 0;
> 
>  
> 
> public HomePage(final PageParameters parameters) {
> 
>  
> 
> // Add the simplest type of label
> 
> final Label test = new Label("message", "If you see this message
> wicket is properly configured and running");
> 
> test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
> 
> {
> 
> @Override
> 
> protected void onTimer(AjaxRequestTarget target) 
> 
> {
> 
> Label t2 = new Label("message", "Test " + testCounter);
> 
> test.replaceWith(t2);
here you need to make : test = t2;
> 
> testCounter++;
> 
> target.addComponent(test);
> 
> }
> 
> });
> 
>  
> 
> add(test);
> 
> }
> 
> }
> 
>  
> 
> Exception:
> 
> Root cause:
> 
> java.lang.IllegalStateException: No Page found for component [Component
> id = message]
>  at org.apache.wicket.Component.getPage(Component.java:1754)
>  at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
>  at org.apache.wicket.Component.urlFor(Component.java:3286)
>  at
> org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> jaxBehavior.java:124)
>  at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> actAjaxTimerBehavior.java:127)
>  at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> ctAjaxTimerBehavior.java:120)
>  at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> erBehavior.java:163)
>  at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> aultAjaxBehavior.java:299)
>  at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> t.processEvents(BehaviorRequestTarget.java:119)
>  at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> stractRequestCycleProcessor.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:1428)
>  at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
>  at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468
> )
>  at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> 301)
>  at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
> dler.java:1157)
>  at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
>  at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
> 16)
>  at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>  at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>  at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
>  at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler
> Collection.java:230)
>  at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav
> a:114)
>  at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>  at org.mortbay.jetty.Server.handle(Server.java:326)
>  at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
>  at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne
> ction.java:915)
>  at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
>  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>  at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
>  at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 409)
>  at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java
> :582)
> 
>  
> 
> Greets
> 
> Chris
> 



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



Re: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Ernesto Reinaldo Barreiro
Following example works fine

public class TestCounter extends WebPage {

private int counter = 0;

private Label message;
/**
 *
 */
public TestCounter() {

message = new Label("message", new AbstractReadOnlyModel(){

private static final long serialVersionUID = 1L;

public String getObject() {
counter++;
if(TestCounter.this.getCounter() == 0) {
return "Hi!";
} else {
return "I have been update " + getCounter();
}
};
});
message.setOutputMarkupId(true);
add(message);
message.add(new AbstractAjaxTimerBehavior(Duration.seconds(3)) {

private static final long serialVersionUID = 1L;

@Override
protected void onTimer(AjaxRequestTarget target) {
if(target != null) {
target.addComponent(message);
}
}
});
}

public int getCounter() {
return counter;
}
}

and







On Wed, Nov 11, 2009 at 9:43 AM, Giambalvo, Christian <
christian.giamba...@excelsisnet.com> wrote:

> Btw, the exception is thrown on first call not on second round trip.
>
>
> -Ursprüngliche Nachricht-
> Von: Giambalvo, Christian [mailto:christian.giamba...@excelsisnet.com]
> Gesendet: Mittwoch, 11. November 2009 09:39
> An: users@wicket.apache.org
> Betreff: AW: AbstractAjaxTimerBehavior causes exception
>
> Hi Ernesto,
>
> the label was just an example.
> In my app i try to replace the navigation (you remember your suggestion
> with a timer?)
> The navigation is a panel. So recreate the whole panel and then try to
> replace it with the new one.
> This is where the AbstractAjaxTimerBehavior comes in.
>
> Greets Chris
>
>
> -Ursprüngliche Nachricht-
> Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com]
> Gesendet: Mittwoch, 11. November 2009 09:35
> An: users@wicket.apache.org
> Betreff: Re: AbstractAjaxTimerBehavior causes exception
>
> Hi Chris,
>
> Maybe it is because you are adding  the timer to the label and later on
> replacing it is another component. Then the second AJAX round trip to the
> page will look for the AbstractAjaxTimerBehavior associated to the
> "message"
> component, but the new one does not have associated such a behavior. And
> you
> do not need to replace the label component (just udpate it via AJAX): just
> write a model that displays "If you see this message wicket is properly
> configured and running" if count =0 and "Test " + testCounter if >0.
>
> Best,
>
> Ernesto
>
> On Wed, Nov 11, 2009 at 9:21 AM, Giambalvo, Christian <
> christian.giamba...@excelsisnet.com> wrote:
>
> > Hi all,
> >
> >
> >
> > maybe i found a bug.
> >
> > Don't know if I'm doing something wrong.
> >
> > But it's a simple usecase.
> >
> >
> >
> > Following code produces an exception:
> >
> >
> >
> > public class HomePage extends WebPage {
> >
> >
> >
> >private static final long serialVersionUID = 1L;
> >
> >
> >
> >private static int testCounter = 0;
> >
> >
> >
> >public HomePage(final PageParameters parameters) {
> >
> >
> >
> >// Add the simplest type of label
> >
> >final Label test = new Label("message", "If you see this message
> > wicket is properly configured and running");
> >
> >test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
> >
> >{
> >
> >@Override
> >
> >protected void onTimer(AjaxRequestTarget target)
> >
> >{
> >
> >Label t2 = new Label("message", "Test " + testCounter);
> >
> >test.replaceWith(t2);
> >
> >testCounter++;
> >
> >target.addComponent(test);
> >
> >}
> >
> >});
> >
> >
> >
> >add(test);
> >
> >}
> >
> > }
> >
> >
> >
> > Exception:
> >
> > Root cause:
> >
> > java.lang.IllegalStateException: No Page found for component [Component
> > id = message]
> > at org.apache.wicket.Component.getPage(Component.java:1754)
> > at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
> > at org.apache.wicket.Component.urlFor(Component.java:3286)
> > at
> > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> > jaxBehavior.java:124)
> > at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> > actAjaxTimerBehavior.java:127)
> > at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> > ctAjaxTimerBehavior.java:120)
> > at
> > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> > erBehavior.java:163)
> > at
> > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> > aultAjaxBehavior.java:299)
> > at
> > org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> > t.processEvents(BehaviorRequestTarget.java:119)
> > 

AW: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Giambalvo, Christian
Btw, the exception is thrown on first call not on second round trip. 


-Ursprüngliche Nachricht-
Von: Giambalvo, Christian [mailto:christian.giamba...@excelsisnet.com] 
Gesendet: Mittwoch, 11. November 2009 09:39
An: users@wicket.apache.org
Betreff: AW: AbstractAjaxTimerBehavior causes exception

Hi Ernesto,

the label was just an example.
In my app i try to replace the navigation (you remember your suggestion with a 
timer?)
The navigation is a panel. So recreate the whole panel and then try to replace 
it with the new one.
This is where the AbstractAjaxTimerBehavior comes in.

Greets Chris


-Ursprüngliche Nachricht-
Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] 
Gesendet: Mittwoch, 11. November 2009 09:35
An: users@wicket.apache.org
Betreff: Re: AbstractAjaxTimerBehavior causes exception

Hi Chris,

Maybe it is because you are adding  the timer to the label and later on
replacing it is another component. Then the second AJAX round trip to the
page will look for the AbstractAjaxTimerBehavior associated to the "message"
component, but the new one does not have associated such a behavior. And you
do not need to replace the label component (just udpate it via AJAX): just
write a model that displays "If you see this message wicket is properly
configured and running" if count =0 and "Test " + testCounter if >0.

Best,

Ernesto

On Wed, Nov 11, 2009 at 9:21 AM, Giambalvo, Christian <
christian.giamba...@excelsisnet.com> wrote:

> Hi all,
>
>
>
> maybe i found a bug.
>
> Don't know if I'm doing something wrong.
>
> But it's a simple usecase.
>
>
>
> Following code produces an exception:
>
>
>
> public class HomePage extends WebPage {
>
>
>
>private static final long serialVersionUID = 1L;
>
>
>
>private static int testCounter = 0;
>
>
>
>public HomePage(final PageParameters parameters) {
>
>
>
>// Add the simplest type of label
>
>final Label test = new Label("message", "If you see this message
> wicket is properly configured and running");
>
>test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
>
>{
>
>@Override
>
>protected void onTimer(AjaxRequestTarget target)
>
>{
>
>Label t2 = new Label("message", "Test " + testCounter);
>
>test.replaceWith(t2);
>
>testCounter++;
>
>target.addComponent(test);
>
>}
>
>});
>
>
>
>add(test);
>
>}
>
> }
>
>
>
> Exception:
>
> Root cause:
>
> java.lang.IllegalStateException: No Page found for component [Component
> id = message]
> at org.apache.wicket.Component.getPage(Component.java:1754)
> at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
> at org.apache.wicket.Component.urlFor(Component.java:3286)
> at
> org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> jaxBehavior.java:124)
> at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> actAjaxTimerBehavior.java:127)
> at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> ctAjaxTimerBehavior.java:120)
> at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> erBehavior.java:163)
> at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> aultAjaxBehavior.java:299)
> at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> t.processEvents(BehaviorRequestTarget.java:119)
> at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> stractRequestCycleProcessor.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:1428)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468
> )
> at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> 301)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
> dler.java:1157)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
> 16)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler
> Collection.java:230)
> at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav
> a:114)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:326)
> at
> org.mo

AW: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Giambalvo, Christian
Hi Ernesto,

the label was just an example.
In my app i try to replace the navigation (you remember your suggestion with a 
timer?)
The navigation is a panel. So recreate the whole panel and then try to replace 
it with the new one.
This is where the AbstractAjaxTimerBehavior comes in.

Greets Chris


-Ursprüngliche Nachricht-
Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] 
Gesendet: Mittwoch, 11. November 2009 09:35
An: users@wicket.apache.org
Betreff: Re: AbstractAjaxTimerBehavior causes exception

Hi Chris,

Maybe it is because you are adding  the timer to the label and later on
replacing it is another component. Then the second AJAX round trip to the
page will look for the AbstractAjaxTimerBehavior associated to the "message"
component, but the new one does not have associated such a behavior. And you
do not need to replace the label component (just udpate it via AJAX): just
write a model that displays "If you see this message wicket is properly
configured and running" if count =0 and "Test " + testCounter if >0.

Best,

Ernesto

On Wed, Nov 11, 2009 at 9:21 AM, Giambalvo, Christian <
christian.giamba...@excelsisnet.com> wrote:

> Hi all,
>
>
>
> maybe i found a bug.
>
> Don't know if I'm doing something wrong.
>
> But it's a simple usecase.
>
>
>
> Following code produces an exception:
>
>
>
> public class HomePage extends WebPage {
>
>
>
>private static final long serialVersionUID = 1L;
>
>
>
>private static int testCounter = 0;
>
>
>
>public HomePage(final PageParameters parameters) {
>
>
>
>// Add the simplest type of label
>
>final Label test = new Label("message", "If you see this message
> wicket is properly configured and running");
>
>test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
>
>{
>
>@Override
>
>protected void onTimer(AjaxRequestTarget target)
>
>{
>
>Label t2 = new Label("message", "Test " + testCounter);
>
>test.replaceWith(t2);
>
>testCounter++;
>
>target.addComponent(test);
>
>}
>
>});
>
>
>
>add(test);
>
>}
>
> }
>
>
>
> Exception:
>
> Root cause:
>
> java.lang.IllegalStateException: No Page found for component [Component
> id = message]
> at org.apache.wicket.Component.getPage(Component.java:1754)
> at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
> at org.apache.wicket.Component.urlFor(Component.java:3286)
> at
> org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> jaxBehavior.java:124)
> at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> actAjaxTimerBehavior.java:127)
> at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> ctAjaxTimerBehavior.java:120)
> at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> erBehavior.java:163)
> at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> aultAjaxBehavior.java:299)
> at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> t.processEvents(BehaviorRequestTarget.java:119)
> at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> stractRequestCycleProcessor.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:1428)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468
> )
> at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> 301)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
> dler.java:1157)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
> 16)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler
> Collection.java:230)
> at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav
> a:114)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:326)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne
> ction.java:915)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:2

Re: AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Ernesto Reinaldo Barreiro
Hi Chris,

Maybe it is because you are adding  the timer to the label and later on
replacing it is another component. Then the second AJAX round trip to the
page will look for the AbstractAjaxTimerBehavior associated to the "message"
component, but the new one does not have associated such a behavior. And you
do not need to replace the label component (just udpate it via AJAX): just
write a model that displays "If you see this message wicket is properly
configured and running" if count =0 and "Test " + testCounter if >0.

Best,

Ernesto

On Wed, Nov 11, 2009 at 9:21 AM, Giambalvo, Christian <
christian.giamba...@excelsisnet.com> wrote:

> Hi all,
>
>
>
> maybe i found a bug.
>
> Don't know if I'm doing something wrong.
>
> But it's a simple usecase.
>
>
>
> Following code produces an exception:
>
>
>
> public class HomePage extends WebPage {
>
>
>
>private static final long serialVersionUID = 1L;
>
>
>
>private static int testCounter = 0;
>
>
>
>public HomePage(final PageParameters parameters) {
>
>
>
>// Add the simplest type of label
>
>final Label test = new Label("message", "If you see this message
> wicket is properly configured and running");
>
>test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
>
>{
>
>@Override
>
>protected void onTimer(AjaxRequestTarget target)
>
>{
>
>Label t2 = new Label("message", "Test " + testCounter);
>
>test.replaceWith(t2);
>
>testCounter++;
>
>target.addComponent(test);
>
>}
>
>});
>
>
>
>add(test);
>
>}
>
> }
>
>
>
> Exception:
>
> Root cause:
>
> java.lang.IllegalStateException: No Page found for component [Component
> id = message]
> at org.apache.wicket.Component.getPage(Component.java:1754)
> at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
> at org.apache.wicket.Component.urlFor(Component.java:3286)
> at
> org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
> jaxBehavior.java:124)
> at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
> actAjaxTimerBehavior.java:127)
> at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
> ctAjaxTimerBehavior.java:120)
> at
> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
> erBehavior.java:163)
> at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> aultAjaxBehavior.java:299)
> at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> t.processEvents(BehaviorRequestTarget.java:119)
> at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> stractRequestCycleProcessor.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:1428)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468
> )
> at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> 301)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
> dler.java:1157)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
> 16)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler
> Collection.java:230)
> at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav
> a:114)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:326)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne
> ction.java:915)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
> at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 409)
> at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java
> :582)
>
>
>
> Greets
>
> Chris
>
>


Re: correct way to call necessary javascript initialization when a component is added via ajax

2009-11-11 Thread svenmeier

Why so complicated?

@Override
public void renderHead(IHeaderResponse response) {
response.renderOnDomReadyJavascript(init_slider_js());
} 


Peter Ross-6 wrote:
> 
> On Wed, Nov 11, 2009 at 3:48 PM, Jeremy Thomerson
>  wrote:
>> On Tue, Nov 10, 2009 at 10:38 PM, Peter Ross
>> wrote:
>>
>>> Hi,
>>>
>>> I'm implementing a control which consists of an integer field and a
>>> slider where the slider comes from jquery UI.
>>>
>>> My question is that whenever the component is refreshed via ajax, you
>>> need to call the js initialization function.
>>>
>>> I've done this by adding a behaviour which determines the request
>>> target, if it's an AjaxRequestTarget it adds the init js to the target
>>> otherwise it outputs it in the header.
>>>
>>> Is this the correct way to do it?  Is there a simpler way?
>>>
>> Yes - this looks fine.  There are multiple ways of accomplishing it, but
>> this one is fine.
>>
> Could you elaborate on what some of the other ways are?
> 
> Just enough key words so that I can do the google search would be fine :)
> 
> Peter
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/correct-way-to-call-necessary-javascript-initialization-when-a--component-is-added-via-ajax-tp26295973p26297483.html
Sent from the Wicket - User 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



AbstractAjaxTimerBehavior causes exception

2009-11-11 Thread Giambalvo, Christian
Hi all,

 

maybe i found a bug.

Don't know if I'm doing something wrong.

But it's a simple usecase.

 

Following code produces an exception:

 

public class HomePage extends WebPage {

 

private static final long serialVersionUID = 1L;

 

private static int testCounter = 0;

 

public HomePage(final PageParameters parameters) {

 

// Add the simplest type of label

final Label test = new Label("message", "If you see this message
wicket is properly configured and running");

test.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))

{

@Override

protected void onTimer(AjaxRequestTarget target) 

{

Label t2 = new Label("message", "Test " + testCounter);

test.replaceWith(t2);

testCounter++;

target.addComponent(test);

}

});

 

add(test);

}

}

 

Exception:

Root cause:

java.lang.IllegalStateException: No Page found for component [Component
id = message]
 at org.apache.wicket.Component.getPage(Component.java:1754)
 at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:872)
 at org.apache.wicket.Component.urlFor(Component.java:3286)
 at
org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractA
jaxBehavior.java:124)
 at
org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(Abstr
actAjaxTimerBehavior.java:127)
 at
org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(Abstra
ctAjaxTimerBehavior.java:120)
 at
org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTim
erBehavior.java:163)
 at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
aultAjaxBehavior.java:299)
 at
org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
t.processEvents(BehaviorRequestTarget.java:119)
 at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
stractRequestCycleProcessor.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:1428)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
 at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468
)
 at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
301)
 at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
dler.java:1157)
 at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
 at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:2
16)
 at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
 at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
 at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
 at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandler
Collection.java:230)
 at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.jav
a:114)
 at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
 at org.mortbay.jetty.Server.handle(Server.java:326)
 at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
 at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne
ction.java:915)
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
 at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
 at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java
:582)

 

Greets

Chris



Re: another serialization question

2009-11-11 Thread svenmeier

Then just keep the criteria to get those items in your components?


samb0057 wrote:
> 
> The value objects are not simple attributes of an entity. Let me explain
> what they do (a little simplified but the fundamentals are there).
> 
> We have a research module that performs pricing research.
> 
> ResearchItem
>   CellPhoneResearchItem
>   IPodResearchItem
>   LaptopResearchItem
>   Etc
> 
> Since the identity of these research items is defined solely by their
> attributes they are implemented as value objects. I know this is different
> from your everyday value object (eg Address) Does this sound like maybe a
> problem that should be addressed in the domain model?
> Value objects were chosen since it makes it much easier in many other
> areas to just create a new research item, rather than call repositories to
> load old ones (impossible in some places). No point in loading something
> you know all the attributes of.
> 
> The only way to get them reliably is to call
> ResearchItemGenerationService.generateResearchItems()
> 

-- 
View this message in context: 
http://old.nabble.com/another-serialization-question-tp26295325p26297467.html
Sent from the Wicket - User 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