Iterate over Pages in Pagemap

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

 

how to iterate over latest version of all pages in pagemap?

All my Pages have the ability to reload the navigation, but to
accomplish this,  I need to tell the page to reload the navigation.

So my first idea was to iterate over latest version of all pages in
pagemap and call the needed method on it.

But Session#getPageMaps returns a list of IPageMap which doesn't offer
an iterator.

How can a accomplish this?

 

Greets

Chris

 



Force page reload/re-render

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

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

Any tips?

Thanks,
pieter

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



Re: User count

2009-11-09 Thread Pieter Degraeuwe
Have a look at http://www.statcounter.com/ , a free and easy to use
analytics provider.

On Tue, Nov 10, 2009 at 7:59 AM, pieter claassen
wrote:

> You can also use your logger implementation and then log in a format
> that a log analysis tool can read. This however, is a very old style
> approach compared to analytics in my opinion. The quality of the
> analysis and ease of implementation with analytics is just so much
> better.
>
> http://en.wikipedia.org/wiki/List_of_web_analytics_software
>
> Rgds,
> Pieter
>
> On Mon, Nov 9, 2009 at 2:20 PM, Martin Makundi
>  wrote:
> > External analytics is much more simpler to manage.
> >
> > **
> > Martin
> >
> > 2009/11/9 vela :
> >>
> >> Hello again,
> >>
> >> can't we count it using the wicket application, some thing like this in
> jsp
> >>
> >>
> >> <%! int i= 0;%>
> >> <% out.println("People visited "+(++i)); %>
> >>
> >>
> >>
> >> --
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
>
>
> --
> Pieter Claassen
> musmato.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Pieter Degraeuwe
Systemworks bvba
Belgiëlaan 61
9070 Destelbergen
GSM: +32 (0)485/68.60.85
Email: pieter.degrae...@systemworks.be
visit us at http://www.systemworks.be


Re: User count

2009-11-09 Thread pieter claassen
You can also use your logger implementation and then log in a format
that a log analysis tool can read. This however, is a very old style
approach compared to analytics in my opinion. The quality of the
analysis and ease of implementation with analytics is just so much
better.

http://en.wikipedia.org/wiki/List_of_web_analytics_software

Rgds,
Pieter

On Mon, Nov 9, 2009 at 2:20 PM, Martin Makundi
 wrote:
> External analytics is much more simpler to manage.
>
> **
> Martin
>
> 2009/11/9 vela :
>>
>> Hello again,
>>
>> can't we count it using the wicket application, some thing like this in jsp
>>
>>
>> <%! int i= 0;%>
>> <% out.println("People visited "+(++i)); %>
>>
>>
>>
>> --
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Pieter Claassen
musmato.com

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



Inheritance strips XML header

2009-11-09 Thread Neil Curzon
Hi all,

It seems that Wicket 1.4.3 is stripping the XML header when using page
inheritance for layout. My super page defines the layout and has a ?xml
header at the top. If a sub page has content, when wicket renders it, the
?xml header will be excluded. Strangely, for subclasses with no content (no
html file), the ?xml header is preserved.

Am I doing something wrong? If not, I have a sample application that shows
this issue and would be happy to file a bug. We're actually using 1.3.7, but
if this will only be fixed on 1.4, that would be a great excuse to upgrade
:)

Thanks,
Neil


Re: serialization

2009-11-09 Thread Sam Barrow
It is.
Problem was actually solved by Martijn's response. Thanks alot!

On Mon, 2009-11-09 at 21:25 +0100, Michael Mosmann wrote:
> Am Montag, den 09.11.2009, 13:07 -0500 schrieb Sam Barrow:
> > protected void populateItem(final ListItem item) {
> > final Money price =
> > getPricingService().calculatePrice(item.getModelObject());
> > add(new Label("price", price.toString()));
> > }
> 
> is Money serializable?
> 
> mm:)
> 
> 
> -
> 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: serialization

2009-11-09 Thread James Carman
It wouldn't matter because they're not "injecting" it into the
components in any way.  Notice they only call price.toString().

On Mon, Nov 9, 2009 at 3:25 PM, Michael Mosmann  wrote:
> Am Montag, den 09.11.2009, 13:07 -0500 schrieb Sam Barrow:
>> protected void populateItem(final ListItem item) {
>>       final Money price =
>> getPricingService().calculatePrice(item.getModelObject());
>>       add(new Label("price", price.toString()));
>> }
>
> is Money serializable?
>
> mm:)
>
>
> -
> 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: serialization

2009-11-09 Thread Michael Mosmann
Am Montag, den 09.11.2009, 13:07 -0500 schrieb Sam Barrow:
> protected void populateItem(final ListItem item) {
>   final Money price =
> getPricingService().calculatePrice(item.getModelObject());
>   add(new Label("price", price.toString()));
> }

is Money serializable?

mm:)


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



Re: Help me with setting up Ubuntu, NetBeans, Maven2, Wicket, Jetty and Google App Engine

2009-11-09 Thread Piotr Tarsa
Can you share your pom files? Just to know how other people deals with
GAE. Also settings and profiles files would be helpful.

2009/11/7 Pieter Degraeuwe :
> unfortunately, there are no public maven repositories that contain the
> needed artifacts. I did install them all manually in my local repo...
> If you are interested I can send you my pom (but that'll be monday, since I
> can't access my pc right now...)
>
>
> pieter
>
> On Sat, Nov 7, 2009 at 3:52 PM, Piotr Tarsa  wrote:
>
>> Hi,
>>
>> I am trying to develop Wicket application (site about my research in
>> Data Compression Algorithms) to Google App Engine using NetBeans and
>> Maven2.
>>
>> I need an up-to-date pom.xml files with short dependencies, ie. the
>> ones I saw had a long list of dependencies.
>>
>> Currently I've found two unsatisfactory solutions:
>> http://gae-j-maven.appspot.com/
>> http://code.google.com/p/maven-gae-plugin/
>>
>> Do you know something better? I need to have access to Google App
>> Engine features like DataStore, MemCache etc.
>>
>> I've set netbeans.deploy=false so NetBeans doesn't ask for deploying
>> server (besides, I am using embedded Jetty to run that, so the
>> question was weird), but sadly, now NetBeans doesn't open new browser
>> window and doesn't stop Jetty before another run command.
>>
>> Do you think that using Maven2 with that project makes sense? Maybe I
>> should make regular NetBeans project...
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> --
> Pieter Degraeuwe
> Systemworks bvba
> Belgiëlaan 61
> 9070 Destelbergen
> GSM: +32 (0)485/68.60.85
> Email: pieter.degrae...@systemworks.be
> visit us at http://www.systemworks.be
>

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



RE: Combination CompoundPropertyModel and ChoiceRenderer on DropDownChoice gives problems

2009-11-09 Thread Alex Rass
I am a newb here, so I may be way off, but this works for me:

public final static ChoiceRenderer listRenderer = new
ChoiceRenderer("description", "id");

Expose description and id on your model's object.

And just add the listRenderer to the DDChoice (last param).
Seems a lot simpler than what you are doing.


-Original Message-
From: Xavier López [mailto:xavil...@gmail.com] 
Sent: Monday, November 09, 2009 9:37 AM
To: users@wicket.apache.org
Subject: Re: Combination CompoundPropertyModel and ChoiceRenderer on
DropDownChoice gives problems

Got it!

Here is the code i got into. Improvements and critics are welcome !

class MappedModel extends Model {
protected Map map;
public String getDescription(Object id){
return (String) map.get(id);
}
}

// Localized choices
final MappedModel countryModel = new MappedModel(){
public Object getObject() {
super.map = referenceData.getCountries(getLanguage());
return new ArrayList(super.map.keySet());
}
};
DropDownChoice ddcCountry= new
DropDownChoice("country",countryModel);
ddcCountry.setChoiceRenderer(new IChoiceRenderer() {
   public Object getDisplayValue(Object object) {
   return countryModel.getDescription(object);
   }
   public String getIdValue(Object object, int index) {
   return object.toString();
   }
});


Thanks to everyone on this list not only for the heads up on this one but
for many more I did not need to ask ;)


2009/11/9 Xavier López 

> Hi Sven,
>
> Absolutely awesome. So sweet how problems vanish away when you know the
> right way to address them on Wicket: ).
>
> But, what if I had a list of countries in the database (better example
than
> gender in this case), with its descriptions in it? Should I store a
Country
> entity in my bean, instead of simply and Id (taking into account this
entity
> possibly contains the descriptions and other unuseful stuff) ? Could I
> manage someway, using the countryId's in the ddc's choiceList model, to
look
> for those descriptions in i.e. a memory-stored Map ?
>
> Thanks a lot!
> Xavier
>
> 2009/11/9 svenmeier 
>
>
>> You want to select one value from a list of values, so obviously
>> everything
>> has to have the same type.
>>
>> These 'IdDescrBeans' smell like Struts, such constructs are not needed.
>> What's wrong with the following:
>>
>>  List genders = new ArrayList();
>>  list.add("M");
>>  list.add("F");
>>  form.add(new DropDownChoice("gender", genders) {
>>protected boolean localizeDisplayValues() {
>>  return true;
>>}
>>  });
>>
>> Creating an enum would be a nice alternative to strings though.
>> Put the following keys in you page's property file:
>>
>>  gender.M = male
>>  gender.F = female
>>
>> i18n for free.
>>
>> Sven
>>
>>
>> Xavier López-2 wrote:
>> >
>> > Hi Ann,
>> >
>> > I've also encountered this problem, but with RadioChoice instead of
>> > DropDownChoice.
>> >
>> > This is the thread I started about it:
>> >
>> >
>> http://mail-archives.apache.org/mod_mbox/wicket-users/200911.mbox/browser
>> >
>> > After all this thread, I still don't know what should I do to model,
for
>> > instance, a gender radioChoice which would be backed by a String
>> property
>> > ("M" of "F"), providing a list of choices (multilingual) with
>> IdDescrBeans
>> > like you propose.
>> > Should I change my bean's 'String gender' property to 'IdDescrBean
>> gender'
>> > ?
>> > Why should I store description's information on my model entity ?
>> >
>> > Although I agree with having same object's on choices and model when
>> it's
>> > about more complex data...
>> >
>> > Possible solutions I've thought of so far:
>> >
>> >- Ideally, do not use different object types in
>> compundpropertymodel's
>> >bean and choice List. Use same object type instead.
>> >- When using RadioChoice, it works if you substitute it with a
>> > RadioGroup
>> >and Radio's, using the 'id' property as the Radio's model and the
>> >'description' property as the label's model. However, when it's
about
>> >DropDownChoice, I'm clueless about it at the moment (already having
>> > problems
>> >with them).
>> >- Provide a list of choices in which each element is an Id, and then
>> >provide a ChoiceRenderer display expression such that gets the
proper
>> >description (I don't like that at all).
>> >- Modify IdDescrBean so that it returns the 'id' property in its
>> >'toString' method, and, assuming the compundpropertymodel's bean
>> > related
>> >property is String, provide an implementation for some useless
method
>> >('trim' for example), so that it returns the desctiption. Then, in
>> the
>> >ChoiceRenderer, you can set the displayExpression to 'trim()', which
>> > will
>> >ensure that when the component model's object is a String, th

Re: Autogenerating HTML files ...?

2009-11-09 Thread kellerautomat

Hi,

I think you can use WicketTester for it:
http://cwiki.apache.org/WICKET/testing-pages.html

Use this method to dump the page:
http://wicket.apache.org/docs/1.4/org/apache/wicket/util/tester/BaseWicketTester.html#dumpPage%28%29

Frido



Casper Bang wrote:
> 
> Hi Ashley,
> 
> I actually wrote the list regarding a similar idea about a year ago. It
> seems like a handy thing for RAD and for newbies struggling with keeping
> simple CRUD pages in sync. However I can offer nothing but an
> encurraging "great idea, go for it". :)
> 
> /Casper
> 
> 
> Igor Vaynberg wrote:
>> i dont see why it wouldnt be possible. if you can instantiate a page
>> you can use a visitor to visit all the components and generate
>> approximately appropriate markup.
>>
>> perhaps if you had something working you would get more interest.
>>
>> -igor
>>
>> On Mon, Nov 9, 2009 at 1:57 AM, Ashley Aitken  wrote:
>>   
>>> Dear All,
>>>
>>> I have seen a feature in Wicket Bench (I think it is) that can
>>> automatically
>>> generate the Web component object construction hierarchy for a given Web
>>> form with Wicket ids.  It's a neat feature.  However, I am wondering if
>>> it
>>> would be possible to do the reverse.
>>>
>>> Could Wicket classes be extended to automatically generate the HTML file
>>> (based on the Wicket object hierarchy) if the HTML file doesn't already
>>> exist?  Obviously, it couldn't generate the non-dynamic HTML aspects of
>>> a
>>> Web page, but at least it could provide a skeleton page?
>>>
>>> This could be configured to overwrite (or not) existing files each time
>>> the
>>> code changed. Perhaps it could be configured to include (for debugging
>>> purposes) some Wicket information for each item in the page (almost like
>>> a
>>> RAD solution but the intention is not for RAD).
>>>
>>> Perhaps it could even use a form of the "generation gap pattern" by
>>> putting
>>> each dynamic chunk into a separate HTML file and then #include them into
>>> a
>>> main HTML file which it doesn't get overwritten.  Though I'm not sure
>>> how
>>> this would exactly work ...
>>>
>>> I've seen Wicket RAD and Wicket Web Beans but these are not what I am
>>> thinking about.  Eventually, I would want a graphics / Web designer to
>>> complete the page around the skeleton dynamic HTML parts (that perhaps
>>> Wicket has autogenerated).
>>>
>>> I know this would never be the full solution but it may allow one to
>>> concentrate just on the Java code and not even have to worry about the
>>> HTML
>>> to start with.  I think it could be an interesting approach.  Is this
>>> possible? Has this already been done?
>>>
>>> Any comments appreciate.
>>>
>>> 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
>>>
>>>
>>> 
>>
>> -
>> 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
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Autogenerating-HTML-files-...--tp26263720p26271589.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: serialization

2009-11-09 Thread Martijn Dashorst
populateItem(*FINAL* ListItem item1) {
add(new ListView("child", getOthers()) {
populateItem(ListItem item2) {
ValueObject valueObject1 = item1.getModelObject();
 .
}


Martijn

On Mon, Nov 9, 2009 at 7:12 PM, Sam Barrow  wrote:
> sorry sorry i made a mistake in the populateItem
> these is a nested listview
>
> populateItem(ListItem item) {
>        final ValueObject valueObject = item.getModelObject();
>        add(new ListView("child", getOthers()) {
>                populateItem(ListItem item) {
>                        Money price = 
> getPricingService().calculatePrice(valueObject,
> item.getModelObject())
>                }
>        }
> }
>
> Looks like the problem has to do with me accessing the valueObject
> variable from inside the nested ListView. any clean way around this?
>
> On Mon, 2009-11-09 at 09:56 -0800, Igor Vaynberg wrote:
>> what does your listview's populateitem look like?
>>
>> -igor
>>
>> On Mon, Nov 9, 2009 at 9:50 AM, Sam Barrow  wrote:
>> > Hi. Wondering if someone can help me with a serialization problem I'm
>> > having.
>> > To start off, the domain model in this application does not use
>> > serializable domain objects (the project is using db4o, which does not
>> > play well with serialized objects).
>> >
>> > I have a page with this code:
>> >
>> > IModel valueObjectList = new
>> > LoadableDetachableModel() {
>> >        protected void load() {
>> >                return getVOGenerator().generateVOs();
>> >        }
>> > }
>> > add(new ListView("vos", valueObjectList) {
>> > ...
>> > });
>> >
>> > I'm getting this error:
>> > org.apache.wicket.util.io.SerializableChecker
>> > $WicketNotSerializableException: Unable to serialize
>> > class: ...ValueObject
>> >
>> > How do I get around this?
>> >
>> >
>> >
>> > -
>> > 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
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0

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



Re: serialization

2009-11-09 Thread Sam Barrow
sorry sorry i made a mistake in the populateItem
these is a nested listview

populateItem(ListItem item) {
final ValueObject valueObject = item.getModelObject();
add(new ListView("child", getOthers()) {
populateItem(ListItem item) {
Money price = 
getPricingService().calculatePrice(valueObject,
item.getModelObject())
}
}
}

Looks like the problem has to do with me accessing the valueObject
variable from inside the nested ListView. any clean way around this?

On Mon, 2009-11-09 at 09:56 -0800, Igor Vaynberg wrote:
> what does your listview's populateitem look like?
> 
> -igor
> 
> On Mon, Nov 9, 2009 at 9:50 AM, Sam Barrow  wrote:
> > Hi. Wondering if someone can help me with a serialization problem I'm
> > having.
> > To start off, the domain model in this application does not use
> > serializable domain objects (the project is using db4o, which does not
> > play well with serialized objects).
> >
> > I have a page with this code:
> >
> > IModel valueObjectList = new
> > LoadableDetachableModel() {
> >protected void load() {
> >return getVOGenerator().generateVOs();
> >}
> > }
> > add(new ListView("vos", valueObjectList) {
> > ...
> > });
> >
> > I'm getting this error:
> > org.apache.wicket.util.io.SerializableChecker
> > $WicketNotSerializableException: Unable to serialize
> > class: ...ValueObject
> >
> > How do I get around this?
> >
> >
> >
> > -
> > 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: serialization

2009-11-09 Thread Igor Vaynberg
hrm, nothing interesting there.

can you post the code for the entire page/panel...

also the serialization checker should tell you the exact field that is
holding the reference to the object further in its message...

-igor

On Mon, Nov 9, 2009 at 10:07 AM, Sam Barrow  wrote:
> protected void populateItem(final ListItem item) {
>        final Money price =
> getPricingService().calculatePrice(item.getModelObject());
>        add(new Label("price", price.toString()));
> }
>
> On Mon, 2009-11-09 at 09:56 -0800, Igor Vaynberg wrote:
>> what does your listview's populateitem look like?
>>
>> -igor
>>
>> On Mon, Nov 9, 2009 at 9:50 AM, Sam Barrow  wrote:
>> > Hi. Wondering if someone can help me with a serialization problem I'm
>> > having.
>> > To start off, the domain model in this application does not use
>> > serializable domain objects (the project is using db4o, which does not
>> > play well with serialized objects).
>> >
>> > I have a page with this code:
>> >
>> > IModel valueObjectList = new
>> > LoadableDetachableModel() {
>> >        protected void load() {
>> >                return getVOGenerator().generateVOs();
>> >        }
>> > }
>> > add(new ListView("vos", valueObjectList) {
>> > ...
>> > });
>> >
>> > I'm getting this error:
>> > org.apache.wicket.util.io.SerializableChecker
>> > $WicketNotSerializableException: Unable to serialize
>> > class: ...ValueObject
>> >
>> > How do I get around this?
>> >
>> >
>> >
>> > -
>> > 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: serialization

2009-11-09 Thread Sam Barrow
protected void populateItem(final ListItem item) {
final Money price =
getPricingService().calculatePrice(item.getModelObject());
add(new Label("price", price.toString()));
}

On Mon, 2009-11-09 at 09:56 -0800, Igor Vaynberg wrote:
> what does your listview's populateitem look like?
> 
> -igor
> 
> On Mon, Nov 9, 2009 at 9:50 AM, Sam Barrow  wrote:
> > Hi. Wondering if someone can help me with a serialization problem I'm
> > having.
> > To start off, the domain model in this application does not use
> > serializable domain objects (the project is using db4o, which does not
> > play well with serialized objects).
> >
> > I have a page with this code:
> >
> > IModel valueObjectList = new
> > LoadableDetachableModel() {
> >protected void load() {
> >return getVOGenerator().generateVOs();
> >}
> > }
> > add(new ListView("vos", valueObjectList) {
> > ...
> > });
> >
> > I'm getting this error:
> > org.apache.wicket.util.io.SerializableChecker
> > $WicketNotSerializableException: Unable to serialize
> > class: ...ValueObject
> >
> > How do I get around this?
> >
> >
> >
> > -
> > 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: serialization

2009-11-09 Thread Igor Vaynberg
what does your listview's populateitem look like?

-igor

On Mon, Nov 9, 2009 at 9:50 AM, Sam Barrow  wrote:
> Hi. Wondering if someone can help me with a serialization problem I'm
> having.
> To start off, the domain model in this application does not use
> serializable domain objects (the project is using db4o, which does not
> play well with serialized objects).
>
> I have a page with this code:
>
> IModel valueObjectList = new
> LoadableDetachableModel() {
>        protected void load() {
>                return getVOGenerator().generateVOs();
>        }
> }
> add(new ListView("vos", valueObjectList) {
> ...
> });
>
> I'm getting this error:
> org.apache.wicket.util.io.SerializableChecker
> $WicketNotSerializableException: Unable to serialize
> class: ...ValueObject
>
> How do I get around this?
>
>
>
> -
> 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



serialization

2009-11-09 Thread Sam Barrow
Hi. Wondering if someone can help me with a serialization problem I'm
having.
To start off, the domain model in this application does not use
serializable domain objects (the project is using db4o, which does not
play well with serialized objects).

I have a page with this code:

IModel valueObjectList = new
LoadableDetachableModel() {
protected void load() {
return getVOGenerator().generateVOs();
}
}
add(new ListView("vos", valueObjectList) {
...
});

I'm getting this error:
org.apache.wicket.util.io.SerializableChecker
$WicketNotSerializableException: Unable to serialize
class: ...ValueObject

How do I get around this?



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



Re: Autogenerating HTML files ...?

2009-11-09 Thread Casper Bang
Hi Ashley,

I actually wrote the list regarding a similar idea about a year ago. It
seems like a handy thing for RAD and for newbies struggling with keeping
simple CRUD pages in sync. However I can offer nothing but an
encurraging "great idea, go for it". :)

/Casper


Igor Vaynberg wrote:
> i dont see why it wouldnt be possible. if you can instantiate a page
> you can use a visitor to visit all the components and generate
> approximately appropriate markup.
>
> perhaps if you had something working you would get more interest.
>
> -igor
>
> On Mon, Nov 9, 2009 at 1:57 AM, Ashley Aitken  wrote:
>   
>> Dear All,
>>
>> I have seen a feature in Wicket Bench (I think it is) that can automatically
>> generate the Web component object construction hierarchy for a given Web
>> form with Wicket ids.  It's a neat feature.  However, I am wondering if it
>> would be possible to do the reverse.
>>
>> Could Wicket classes be extended to automatically generate the HTML file
>> (based on the Wicket object hierarchy) if the HTML file doesn't already
>> exist?  Obviously, it couldn't generate the non-dynamic HTML aspects of a
>> Web page, but at least it could provide a skeleton page?
>>
>> This could be configured to overwrite (or not) existing files each time the
>> code changed. Perhaps it could be configured to include (for debugging
>> purposes) some Wicket information for each item in the page (almost like a
>> RAD solution but the intention is not for RAD).
>>
>> Perhaps it could even use a form of the "generation gap pattern" by putting
>> each dynamic chunk into a separate HTML file and then #include them into a
>> main HTML file which it doesn't get overwritten.  Though I'm not sure how
>> this would exactly work ...
>>
>> I've seen Wicket RAD and Wicket Web Beans but these are not what I am
>> thinking about.  Eventually, I would want a graphics / Web designer to
>> complete the page around the skeleton dynamic HTML parts (that perhaps
>> Wicket has autogenerated).
>>
>> I know this would never be the full solution but it may allow one to
>> concentrate just on the Java code and not even have to worry about the HTML
>> to start with.  I think it could be an interesting approach.  Is this
>> possible? Has this already been done?
>>
>> Any comments appreciate.
>>
>> 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
>>
>>
>> 
>
> -
> 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: best approach for a criteria and result page

2009-11-09 Thread Igor Vaynberg
On Mon, Nov 9, 2009 at 6:21 AM,   wrote:
> Hi all,
>
> I browsed a lot of wicket example and searched through many articles,
> but never found this classical web application example : I would have on
> the same page a form with some criteria, a search button and a result
> list : I enter some data, hit search and get the results under my
> criteria, just like google does.
>
> No problem for me to define all these parts using wicket components, but
> I don't know how to manage the workflow, and  especially what code
> should I put in my form's onSubmit method.

you dont need to put any code in your onsubmit...

class mysearchpage extends webpage {
  private searchcriteria criteria=new searchcriteria();

  public mysearchpage() {
 add(new searchcriteriaform("form", new propertymodel(this,
"searchcriteria")));
 ^ form object connected to the criteria field of this page via a
property model

 add(new listview("results", new propertymodel(this,
"searchresults")) {...});
 ^ listview that will display results retrieved from the
getSearchresults() method on this page
   }

   public list getSearchresults() {
   // get whatever results based on the criteria field
   }
}

so in short, form pushes your criteria into the criteria field,
listview uses the criteria field to build the resultset. yes, its that
simple :)

-igor





>
> Here is a sample code :
>
> public class TestPage extends WebPage {
>        public TestPage() {
>                super();
>                createComponents();
>        }
>
>       �...@suppresswarnings("serial")
>        protected void createComponents() {
>                final WebMarkupContainer datacontainer = new
> WebMarkupContainer("data");
>
>                Form searchForm = new
> Form("searchForm",
>                                new
> CompoundPropertyModel(new SearchParameterBean())) {
>                       �...@override
>                        protected void onSubmit() {
>                                SearchParameterBean searchParam =
> (SearchParameterBean) getModelObject();
>                                // get contract list in a
> LoadableDetachableModel, but can't give it to ListView
>                                IModel>
> contractListModel = new LoadableDetachableModel>()
> {
>                                       �...@override
>                                        protected List
> load() {
>                                                List
> contractList = manageContract.getContracts();
>                                                return contractList;
>                                        }
>                                };
>                                // This is working, but I must have an
> inner class and final WebMarkupContainer datacontainer
>                                // What to do if I want to create a
> class ConsultForm extends Form
>                                datacontainer.setVisible(true);
>
>                        }
>                };
>                searchForm.add(new TextField("Id"));
>                add(searchForm);
>
>                datacontainer.setVersioned(false);
>                datacontainer.setVisible(false);
>                add(datacontainer);
>
>                // here I do not have access to my contractListModel
>                PageableListView listView = new
> PageableListView("contracts", contractListModel, 10){
>                       �...@override
>                        public void
> populateItem(ListItem listItem) {
>                                ResultParameter contract =
> listItem.getModelObject();
>                                Label name = new Label("Name",
> contract.getName());
>                                listItem.add(name);
>                        }
>                };
>                datacontainer.add(listView);
>        }
>
>
> The questions I have are :
> - How to pass model between the onSubmit() message which defines it, and
> the FormView which shows itin the page ?
> - Do I have to define a setResponsePage() in my onSubmit() ? If I do so,
> I must go to another page, and then I lost the user's choosen criteria
> - What is the best practice to build such an application ?
> - Is there somewhere an example with criteria and results on the same
> page ?
>
> Thank you very much,
> Bernard
>
> *
> This message and any attachments (the "message") are confidential and 
> intended solely for the addressees.
> Any unauthorised use or dissemination is prohibited.
> Messages are susceptible to alteration.
> France Telecom Group shall not be liable for the message if altered, changed 
> or falsified.
> If you are not the intended addressee of this message, please cancel it 
> immediately and inform the sender.
> 
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wick

Re: Unnecessary method calls in IDataProvider?

2009-11-09 Thread Igor Vaynberg
jira issue please

-igor

On Mon, Nov 9, 2009 at 5:53 AM, Michael Sparer  wrote:
> Hey,
>
> I could have sworn that if a IDataProvider used in a DataView returns 0 as
> size, the iterator(int,int) method won't be called. But that assumption
> proved me wrong some minutes ago. Is there any specific reason why iterator
> gets called when the only possible result is an empty Iterator? Wouldn't it
> be more sensible to assume an empty iterator if size() returns 0 and leave
> out the method call?
>
> regards,
>
> -
> 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: org.omg.CORBA.BAD_OPERATION: The delegate has not been set! - exception on back button

2009-11-09 Thread Igor Vaynberg
look for wicket-javaee project in wicket-stuff

-igor

On Mon, Nov 9, 2009 at 4:35 AM, zabian  wrote:
> I just have noticed it could be a problem.
> Do you know any example how to create that serializable proxy using spring?
>
> Thanks.
> Regards,
> Wojtek.
>
> Pieter Degraeuwe pisze:
>>
>> Your Page (HomePage) contains a reference to your SpeedService EJB. Since
>> that one is not serializable, your page cannot be serialized.
>> A possible solution is to inject your ejb (by using for example
>> @SpringBean). This makes serializable proxies, so your page can be
>> serialized...
>>
>>
>> 2009/11/9 zabian 
>>
>>
>>>
>>> Hi there,
>>> I am working on the project using Wicket and EJB3.0 on Glassfish AS.
>>> I've got such case:
>>> There is a page with some test, using Sateful bean. When you press a
>>> start
>>> button, the model using the bean is created, bean is beeing looked up on
>>> each start button pressed. When I change the page and then use back
>>> button
>>> and press start button again i get such exception:
>>>
>>>
>>> [#|2009-11-09 13:10:01,395 ERROR none:none[-1.0]
>>> httpSSLWorkerThread-8080-1
>>> (org.apache.wicket.util.lang.Objects:1134): Error serializing object
>>> class
>>> com.aster.prov.speed.web.HomePage [object=[Page class =
>>> com.aster.prov.speed.web.HomePage, id = 3, version = 0, ajax = 4]]|#]
>>>
>>> org.omg.CORBA.BAD_OPERATION: The delegate has not been set!  vmcid: 0x0
>>>  minor code: 0  completed: No
>>>  at org.omg.CORBA.portable.ObjectImpl._get_delegate(ObjectImpl.java:53)
>>>  at
>>>
>>> com.sun.corba.ee.spi.presentation.rmi.StubAdapter.getDelegate(StubAdapter.java:174)
>>>  at
>>>
>>> com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.selfAsBaseClass(BCELStubBase.java:214)
>>>  at
>>>
>>> com.aster.prov.speed.ejb.__SpeedServiceRemote_Remote_DynamicStub.writeReplace(com/aster/prov/speed/ejb/__SpeedServiceRemote_Remote_DynamicStub.java)
>>>  at sun.reflect.GeneratedMethodAccessor548.invoke(Unknown Source)
>>>  at
>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>  at java.lang.reflect.Method.invoke(Method.java:597)
>>>  at
>>> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>>>  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>>>  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>>  at
>>>
>>> com.sun.ejb.containers.RemoteBusinessWrapperBase.writeObject(RemoteBusinessWrapperBase.java:106)
>>>  at sun.reflect.GeneratedMethodAccessor431.invoke(Unknown Source)
>>>  at
>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>  at java.lang.reflect.Method.invoke(Method.java:597)
>>>  at
>>> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
>>>  at
>>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
>>>  at
>>>
>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>>  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>>  at
>>>
>>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>>>  at
>>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>>>  at
>>>
>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>>  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>>  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>>  at
>>>
>>> org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121)
>>>  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
>>>  at
>>> org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1120)
>>>  at
>>>
>>> org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:203)
>>>  at
>>>
>>> org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:840)
>>>  at
>>>
>>> org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:332)
>>>  at org.apache.wicket.Session.requestDetached(Session.java:1404)
>>>  at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1176)
>>>  at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1454)
>>>  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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
>>>  at
>>>
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
>>>  at
>>>
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)
>>>  at
>>>
>>> org.apache.catalina.core.StandardContextValve.invoke

Re: Autogenerating HTML files ...?

2009-11-09 Thread Igor Vaynberg
i dont see why it wouldnt be possible. if you can instantiate a page
you can use a visitor to visit all the components and generate
approximately appropriate markup.

perhaps if you had something working you would get more interest.

-igor

On Mon, Nov 9, 2009 at 1:57 AM, Ashley Aitken  wrote:
>
> Dear All,
>
> I have seen a feature in Wicket Bench (I think it is) that can automatically
> generate the Web component object construction hierarchy for a given Web
> form with Wicket ids.  It's a neat feature.  However, I am wondering if it
> would be possible to do the reverse.
>
> Could Wicket classes be extended to automatically generate the HTML file
> (based on the Wicket object hierarchy) if the HTML file doesn't already
> exist?  Obviously, it couldn't generate the non-dynamic HTML aspects of a
> Web page, but at least it could provide a skeleton page?
>
> This could be configured to overwrite (or not) existing files each time the
> code changed. Perhaps it could be configured to include (for debugging
> purposes) some Wicket information for each item in the page (almost like a
> RAD solution but the intention is not for RAD).
>
> Perhaps it could even use a form of the "generation gap pattern" by putting
> each dynamic chunk into a separate HTML file and then #include them into a
> main HTML file which it doesn't get overwritten.  Though I'm not sure how
> this would exactly work ...
>
> I've seen Wicket RAD and Wicket Web Beans but these are not what I am
> thinking about.  Eventually, I would want a graphics / Web designer to
> complete the page around the skeleton dynamic HTML parts (that perhaps
> Wicket has autogenerated).
>
> I know this would never be the full solution but it may allow one to
> concentrate just on the Java code and not even have to worry about the HTML
> to start with.  I think it could be an interesting approach.  Is this
> possible? Has this already been done?
>
> Any comments appreciate.
>
> 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
>
>

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



Re: Combination CompoundPropertyModel and ChoiceRenderer on DropDownChoice gives problems

2009-11-09 Thread Xavier López
Got it!

Here is the code i got into. Improvements and critics are welcome !

class MappedModel extends Model {
protected Map map;
public String getDescription(Object id){
return (String) map.get(id);
}
}

// Localized choices
final MappedModel countryModel = new MappedModel(){
public Object getObject() {
super.map = referenceData.getCountries(getLanguage());
return new ArrayList(super.map.keySet());
}
};
DropDownChoice ddcCountry= new
DropDownChoice("country",countryModel);
ddcCountry.setChoiceRenderer(new IChoiceRenderer() {
   public Object getDisplayValue(Object object) {
   return countryModel.getDescription(object);
   }
   public String getIdValue(Object object, int index) {
   return object.toString();
   }
});


Thanks to everyone on this list not only for the heads up on this one but
for many more I did not need to ask ;)


2009/11/9 Xavier López 

> Hi Sven,
>
> Absolutely awesome. So sweet how problems vanish away when you know the
> right way to address them on Wicket: ).
>
> But, what if I had a list of countries in the database (better example than
> gender in this case), with its descriptions in it? Should I store a Country
> entity in my bean, instead of simply and Id (taking into account this entity
> possibly contains the descriptions and other unuseful stuff) ? Could I
> manage someway, using the countryId's in the ddc's choiceList model, to look
> for those descriptions in i.e. a memory-stored Map ?
>
> Thanks a lot!
> Xavier
>
> 2009/11/9 svenmeier 
>
>
>> You want to select one value from a list of values, so obviously
>> everything
>> has to have the same type.
>>
>> These 'IdDescrBeans' smell like Struts, such constructs are not needed.
>> What's wrong with the following:
>>
>>  List genders = new ArrayList();
>>  list.add("M");
>>  list.add("F");
>>  form.add(new DropDownChoice("gender", genders) {
>>protected boolean localizeDisplayValues() {
>>  return true;
>>}
>>  });
>>
>> Creating an enum would be a nice alternative to strings though.
>> Put the following keys in you page's property file:
>>
>>  gender.M = male
>>  gender.F = female
>>
>> i18n for free.
>>
>> Sven
>>
>>
>> Xavier López-2 wrote:
>> >
>> > Hi Ann,
>> >
>> > I've also encountered this problem, but with RadioChoice instead of
>> > DropDownChoice.
>> >
>> > This is the thread I started about it:
>> >
>> >
>> http://mail-archives.apache.org/mod_mbox/wicket-users/200911.mbox/browser
>> >
>> > After all this thread, I still don't know what should I do to model, for
>> > instance, a gender radioChoice which would be backed by a String
>> property
>> > ("M" of "F"), providing a list of choices (multilingual) with
>> IdDescrBeans
>> > like you propose.
>> > Should I change my bean's 'String gender' property to 'IdDescrBean
>> gender'
>> > ?
>> > Why should I store description's information on my model entity ?
>> >
>> > Although I agree with having same object's on choices and model when
>> it's
>> > about more complex data...
>> >
>> > Possible solutions I've thought of so far:
>> >
>> >- Ideally, do not use different object types in
>> compundpropertymodel's
>> >bean and choice List. Use same object type instead.
>> >- When using RadioChoice, it works if you substitute it with a
>> > RadioGroup
>> >and Radio's, using the 'id' property as the Radio's model and the
>> >'description' property as the label's model. However, when it's about
>> >DropDownChoice, I'm clueless about it at the moment (already having
>> > problems
>> >with them).
>> >- Provide a list of choices in which each element is an Id, and then
>> >provide a ChoiceRenderer display expression such that gets the proper
>> >description (I don't like that at all).
>> >- Modify IdDescrBean so that it returns the 'id' property in its
>> >'toString' method, and, assuming the compundpropertymodel's bean
>> > related
>> >property is String, provide an implementation for some useless method
>> >('trim' for example), so that it returns the desctiption. Then, in
>> the
>> >ChoiceRenderer, you can set the displayExpression to 'trim()', which
>> > will
>> >ensure that when the component model's object is a String, this error
>> > will
>> >not happen (also, it will return the trimmed id as description, but
>> > that
>> >will have no effect). But there is more to it, in order to achieve
>> >AbstractSingleSelectChoice's getModelValue() to identify the selected
>> > choice
>> >element, it calls 'indexOf' on the Choice List, using the
>> >compundpropertymodel's bean related property value. That is, it
>> > searches in
>> >a List of IdDescrBean a String. Problem is 'indexOf' invokes
>> >'searchedElement.equals(choices[i])', which will never

Re: Combination CompoundPropertyModel and ChoiceRenderer on DropDownChoice gives problems

2009-11-09 Thread Xavier López
Hi Ernesto, Sven,

Regarding the usage of localizeDisplayValues, I see that if I put simply "M"
or "F" it also works. Wonderful! Now I can define a general description for
"M" and "F", and provide specialized ones in case of need (thinking about
yes/no literals). But, could I someway define 'groups' of yes/no
descriptions (i.e. yes/no, positive/negative) and tell someway the component
to look for one or antoher having only the "Y", "N" literals? (maybe out of
scope on this question)


Why not use IChoiceRenderer?
>

I suppose you mean anonimously subclassing ChoiceRenderer and overriding
getDisplayValue in order to get the proper description... Something like
what Pedro proposed here maybe?
http://mail-archives.apache.org/mod_mbox/wicket-users/200911.mbox/%3c341aa5500911040801j3f2cb9e0tc1109314522d5...@mail.gmail.com%3e

That could be good, although maybe pulling out the description for each
choice could penalize performance...

Igor also proposed a solution to another problem that might come in handy in
http://www.mail-archive.com/wicket-u...@lists.sourceforge.net/msg26881.html

I'd like to do something like this:

// Localized choices
final Model countryModel = new Model(){
public Object getObject() {
return referenceData.getCountries(getLanguage());
}
};
DropDownChoice ddcCountry = new DropDownChoice("country",countryModel);
ddcCountry.setChoiceRenderer(new IChoiceRenderer() {
   public Object getDisplayValue(Object object) {
   return ((Map)countryModel.getObject()).get(object);
   }
   public String getIdValue(Object object, int index) {
   return object.toString();
   }
};

Only that countryModel's getObject should return a List instead of a Map
(and I'd like the model to be dynamic)

Thanks a lot!
Xavier


2009/11/9 Ernesto Reinaldo Barreiro 

> Why not use IChoiceRenderer?
>
> Ernesto
>
> On Mon, Nov 9, 2009 at 2:27 PM, Xavier López  wrote:
>
> > Hi Sven,
> >
> > Absolutely awesome. So sweet how problems vanish away when you know the
> > right way to address them on Wicket: ).
> >
> > But, what if I had a list of countries in the database (better example
> than
> > gender in this case), with its descriptions in it? Should I store a
> Country
> > entity in my bean, instead of simply and Id (taking into account this
> > entity
> > possibly contains the descriptions and other unuseful stuff) ? Could I
> > manage someway, using the countryId's in the ddc's choiceList model, to
> > look
> > for those descriptions in i.e. a memory-stored Map ?
> >
> > Thanks a lot!
> > Xavier
> >
> > 2009/11/9 svenmeier 
> >
> > >
> > > You want to select one value from a list of values, so obviously
> > everything
> > > has to have the same type.
> > >
> > > These 'IdDescrBeans' smell like Struts, such constructs are not needed.
> > > What's wrong with the following:
> > >
> > >  List genders = new ArrayList();
> > >  list.add("M");
> > >  list.add("F");
> > >  form.add(new DropDownChoice("gender", genders) {
> > >protected boolean localizeDisplayValues() {
> > >  return true;
> > >}
> > >  });
> > >
> > > Creating an enum would be a nice alternative to strings though.
> > > Put the following keys in you page's property file:
> > >
> > >  gender.M = male
> > >  gender.F = female
> > >
> > > i18n for free.
> > >
> > > Sven
> > >
> > >
> > > Xavier López-2 wrote:
> > > >
> > > > Hi Ann,
> > > >
> > > > I've also encountered this problem, but with RadioChoice instead of
> > > > DropDownChoice.
> > > >
> > > > This is the thread I started about it:
> > > >
> > > >
> > >
> >
> http://mail-archives.apache.org/mod_mbox/wicket-users/200911.mbox/browser
> > > >
> > > > After all this thread, I still don't know what should I do to model,
> > for
> > > > instance, a gender radioChoice which would be backed by a String
> > property
> > > > ("M" of "F"), providing a list of choices (multilingual) with
> > > IdDescrBeans
> > > > like you propose.
> > > > Should I change my bean's 'String gender' property to 'IdDescrBean
> > > gender'
> > > > ?
> > > > Why should I store description's information on my model entity ?
> > > >
> > > > Although I agree with having same object's on choices and model when
> > it's
> > > > about more complex data...
> > > >
> > > > Possible solutions I've thought of so far:
> > > >
> > > >- Ideally, do not use different object types in
> > compundpropertymodel's
> > > >bean and choice List. Use same object type instead.
> > > >- When using RadioChoice, it works if you substitute it with a
> > > > RadioGroup
> > > >and Radio's, using the 'id' property as the Radio's model and the
> > > >'description' property as the label's model. However, when it's
> > about
> > > >DropDownChoice, I'm clueless about it at the moment (already
> having
> > > > problems
> > > >with them).
> > > >- Provide a list of choices in which each element is an Id, and
> then
> > > >provide a Cho

best approach for a criteria and result page

2009-11-09 Thread bernard.lupin
Hi all,

I browsed a lot of wicket example and searched through many articles,
but never found this classical web application example : I would have on
the same page a form with some criteria, a search button and a result
list : I enter some data, hit search and get the results under my
criteria, just like google does.

No problem for me to define all these parts using wicket components, but
I don't know how to manage the workflow, and  especially what code
should I put in my form's onSubmit method.

Here is a sample code :

public class TestPage extends WebPage {
public TestPage() {
super();
createComponents();
}

@SuppressWarnings("serial")
protected void createComponents() {
final WebMarkupContainer datacontainer = new
WebMarkupContainer("data");

Form searchForm = new
Form("searchForm",
new
CompoundPropertyModel(new SearchParameterBean())) {
@Override
protected void onSubmit() {
SearchParameterBean searchParam =
(SearchParameterBean) getModelObject();
// get contract list in a
LoadableDetachableModel, but can't give it to ListView
IModel>
contractListModel = new LoadableDetachableModel>()
{
@Override
protected List
load() {
List
contractList = manageContract.getContracts();
return contractList;
}
};
// This is working, but I must have an
inner class and final WebMarkupContainer datacontainer
// What to do if I want to create a
class ConsultForm extends Form
datacontainer.setVisible(true);

}   
};
searchForm.add(new TextField("Id"));
add(searchForm);

datacontainer.setVersioned(false);
datacontainer.setVisible(false);
add(datacontainer);

// here I do not have access to my contractListModel
PageableListView listView = new
PageableListView("contracts", contractListModel, 10){
@Override
public void
populateItem(ListItem listItem) {
ResultParameter contract =
listItem.getModelObject();
Label name = new Label("Name",
contract.getName());
listItem.add(name);
}
};
datacontainer.add(listView);
}


The questions I have are :
- How to pass model between the onSubmit() message which defines it, and
the FormView which shows itin the page ?
- Do I have to define a setResponsePage() in my onSubmit() ? If I do so,
I must go to another page, and then I lost the user's choosen criteria
- What is the best practice to build such an application ?
- Is there somewhere an example with criteria and results on the same
page ?

Thank you very much,
Bernard

*
This message and any attachments (the "message") are confidential and intended 
solely for the addressees. 
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration. 
France Telecom Group shall not be liable for the message if altered, changed or 
falsified.
If you are not the intended addressee of this message, please cancel it 
immediately and inform the sender.



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



Unnecessary method calls in IDataProvider?

2009-11-09 Thread Michael Sparer

Hey,

I could have sworn that if a IDataProvider used in a DataView returns 0 
as size, the iterator(int,int) method won't be called. But that 
assumption proved me wrong some minutes ago. Is there any specific 
reason why iterator gets called when the only possible result is an 
empty Iterator? Wouldn't it be more sensible to assume an empty iterator 
if size() returns 0 and leave out the method call?


regards,

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



Re: Combination CompoundPropertyModel and ChoiceRenderer on DropDownChoice gives problems

2009-11-09 Thread Ernesto Reinaldo Barreiro
Why not use IChoiceRenderer?

Ernesto

On Mon, Nov 9, 2009 at 2:27 PM, Xavier López  wrote:

> Hi Sven,
>
> Absolutely awesome. So sweet how problems vanish away when you know the
> right way to address them on Wicket: ).
>
> But, what if I had a list of countries in the database (better example than
> gender in this case), with its descriptions in it? Should I store a Country
> entity in my bean, instead of simply and Id (taking into account this
> entity
> possibly contains the descriptions and other unuseful stuff) ? Could I
> manage someway, using the countryId's in the ddc's choiceList model, to
> look
> for those descriptions in i.e. a memory-stored Map ?
>
> Thanks a lot!
> Xavier
>
> 2009/11/9 svenmeier 
>
> >
> > You want to select one value from a list of values, so obviously
> everything
> > has to have the same type.
> >
> > These 'IdDescrBeans' smell like Struts, such constructs are not needed.
> > What's wrong with the following:
> >
> >  List genders = new ArrayList();
> >  list.add("M");
> >  list.add("F");
> >  form.add(new DropDownChoice("gender", genders) {
> >protected boolean localizeDisplayValues() {
> >  return true;
> >}
> >  });
> >
> > Creating an enum would be a nice alternative to strings though.
> > Put the following keys in you page's property file:
> >
> >  gender.M = male
> >  gender.F = female
> >
> > i18n for free.
> >
> > Sven
> >
> >
> > Xavier López-2 wrote:
> > >
> > > Hi Ann,
> > >
> > > I've also encountered this problem, but with RadioChoice instead of
> > > DropDownChoice.
> > >
> > > This is the thread I started about it:
> > >
> > >
> >
> http://mail-archives.apache.org/mod_mbox/wicket-users/200911.mbox/browser
> > >
> > > After all this thread, I still don't know what should I do to model,
> for
> > > instance, a gender radioChoice which would be backed by a String
> property
> > > ("M" of "F"), providing a list of choices (multilingual) with
> > IdDescrBeans
> > > like you propose.
> > > Should I change my bean's 'String gender' property to 'IdDescrBean
> > gender'
> > > ?
> > > Why should I store description's information on my model entity ?
> > >
> > > Although I agree with having same object's on choices and model when
> it's
> > > about more complex data...
> > >
> > > Possible solutions I've thought of so far:
> > >
> > >- Ideally, do not use different object types in
> compundpropertymodel's
> > >bean and choice List. Use same object type instead.
> > >- When using RadioChoice, it works if you substitute it with a
> > > RadioGroup
> > >and Radio's, using the 'id' property as the Radio's model and the
> > >'description' property as the label's model. However, when it's
> about
> > >DropDownChoice, I'm clueless about it at the moment (already having
> > > problems
> > >with them).
> > >- Provide a list of choices in which each element is an Id, and then
> > >provide a ChoiceRenderer display expression such that gets the
> proper
> > >description (I don't like that at all).
> > >- Modify IdDescrBean so that it returns the 'id' property in its
> > >'toString' method, and, assuming the compundpropertymodel's bean
> > > related
> > >property is String, provide an implementation for some useless
> method
> > >('trim' for example), so that it returns the desctiption. Then, in
> the
> > >ChoiceRenderer, you can set the displayExpression to 'trim()', which
> > > will
> > >ensure that when the component model's object is a String, this
> error
> > > will
> > >not happen (also, it will return the trimmed id as description, but
> > > that
> > >will have no effect). But there is more to it, in order to achieve
> > >AbstractSingleSelectChoice's getModelValue() to identify the
> selected
> > > choice
> > >element, it calls 'indexOf' on the Choice List, using the
> > >compundpropertymodel's bean related property value. That is, it
> > > searches in
> > >a List of IdDescrBean a String. Problem is 'indexOf' invokes
> > >'searchedElement.equals(choices[i])', which will never return true.
> I
> > > got it
> > >to work overriding 'getModelObject' and doing this search with the
> > > opposite
> > >comparation (choices[i].equals(searchedElement), and providing a
> > > suitable
> > >implementation of 'equals' in the IdDescrBean class... But that's
> > > extremely
> > >hacky and ugly, and... it would not work for ListMultipleChoice, as
> > >getModelValue is final...
> > >
> > >
> > >
> > > 2009/11/9 Ann Baert 
> > >
> > >> I've created a jira issue with more information and an example for
> this
> > >> problem:
> > >> https://issues.apache.org/jira/browse/WICKET-2565
> > >>  DISCLAIMER 
> > >>
> > >> http://www.tvh.com/newen2/emaildisclaimer/default.html
> > >>
> > >> "This message is delivered to all addressees subject to the conditions
> > >> set forth in the attached disclaimer, which is an integral part of
> this
> > >> message."
> > >>
> > >
> >

SV: Get all active session objects

2009-11-09 Thread Wilhelmsen Tor Iver
> Yep, we need something to take those obj out from there.

Maybe a collection of weak references?

- Tor Iver

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



Re: Combination CompoundPropertyModel and ChoiceRenderer on DropDownChoice gives problems

2009-11-09 Thread Xavier López
Hi Sven,

Absolutely awesome. So sweet how problems vanish away when you know the
right way to address them on Wicket: ).

But, what if I had a list of countries in the database (better example than
gender in this case), with its descriptions in it? Should I store a Country
entity in my bean, instead of simply and Id (taking into account this entity
possibly contains the descriptions and other unuseful stuff) ? Could I
manage someway, using the countryId's in the ddc's choiceList model, to look
for those descriptions in i.e. a memory-stored Map ?

Thanks a lot!
Xavier

2009/11/9 svenmeier 

>
> You want to select one value from a list of values, so obviously everything
> has to have the same type.
>
> These 'IdDescrBeans' smell like Struts, such constructs are not needed.
> What's wrong with the following:
>
>  List genders = new ArrayList();
>  list.add("M");
>  list.add("F");
>  form.add(new DropDownChoice("gender", genders) {
>protected boolean localizeDisplayValues() {
>  return true;
>}
>  });
>
> Creating an enum would be a nice alternative to strings though.
> Put the following keys in you page's property file:
>
>  gender.M = male
>  gender.F = female
>
> i18n for free.
>
> Sven
>
>
> Xavier López-2 wrote:
> >
> > Hi Ann,
> >
> > I've also encountered this problem, but with RadioChoice instead of
> > DropDownChoice.
> >
> > This is the thread I started about it:
> >
> >
> http://mail-archives.apache.org/mod_mbox/wicket-users/200911.mbox/browser
> >
> > After all this thread, I still don't know what should I do to model, for
> > instance, a gender radioChoice which would be backed by a String property
> > ("M" of "F"), providing a list of choices (multilingual) with
> IdDescrBeans
> > like you propose.
> > Should I change my bean's 'String gender' property to 'IdDescrBean
> gender'
> > ?
> > Why should I store description's information on my model entity ?
> >
> > Although I agree with having same object's on choices and model when it's
> > about more complex data...
> >
> > Possible solutions I've thought of so far:
> >
> >- Ideally, do not use different object types in compundpropertymodel's
> >bean and choice List. Use same object type instead.
> >- When using RadioChoice, it works if you substitute it with a
> > RadioGroup
> >and Radio's, using the 'id' property as the Radio's model and the
> >'description' property as the label's model. However, when it's about
> >DropDownChoice, I'm clueless about it at the moment (already having
> > problems
> >with them).
> >- Provide a list of choices in which each element is an Id, and then
> >provide a ChoiceRenderer display expression such that gets the proper
> >description (I don't like that at all).
> >- Modify IdDescrBean so that it returns the 'id' property in its
> >'toString' method, and, assuming the compundpropertymodel's bean
> > related
> >property is String, provide an implementation for some useless method
> >('trim' for example), so that it returns the desctiption. Then, in the
> >ChoiceRenderer, you can set the displayExpression to 'trim()', which
> > will
> >ensure that when the component model's object is a String, this error
> > will
> >not happen (also, it will return the trimmed id as description, but
> > that
> >will have no effect). But there is more to it, in order to achieve
> >AbstractSingleSelectChoice's getModelValue() to identify the selected
> > choice
> >element, it calls 'indexOf' on the Choice List, using the
> >compundpropertymodel's bean related property value. That is, it
> > searches in
> >a List of IdDescrBean a String. Problem is 'indexOf' invokes
> >'searchedElement.equals(choices[i])', which will never return true. I
> > got it
> >to work overriding 'getModelObject' and doing this search with the
> > opposite
> >comparation (choices[i].equals(searchedElement), and providing a
> > suitable
> >implementation of 'equals' in the IdDescrBean class... But that's
> > extremely
> >hacky and ugly, and... it would not work for ListMultipleChoice, as
> >getModelValue is final...
> >
> >
> >
> > 2009/11/9 Ann Baert 
> >
> >> I've created a jira issue with more information and an example for this
> >> problem:
> >> https://issues.apache.org/jira/browse/WICKET-2565
> >>  DISCLAIMER 
> >>
> >> http://www.tvh.com/newen2/emaildisclaimer/default.html
> >>
> >> "This message is delivered to all addressees subject to the conditions
> >> set forth in the attached disclaimer, which is an integral part of this
> >> message."
> >>
> >
> >
> >
> > --
> > "To err is human; to make real mess, you need a computer."
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Combination-CompoundPropertyModel-and-ChoiceRenderer-on-DropDownChoice-gives-problems-tp26262235p26266089.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -

Re: User count

2009-11-09 Thread Martin Makundi
External analytics is much more simpler to manage.

**
Martin

2009/11/9 vela :
>
> Hello again,
>
> can't we count it using the wicket application, some thing like this in jsp
>
>
> <%! int i= 0;%>
> <% out.println("People visited "+(++i)); %>
>
>
>
> --

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



Re: User count

2009-11-09 Thread Pieter Degraeuwe
restart your server and your hitcount drops to zero (I think you don't want
that :-) )

On Mon, Nov 9, 2009 at 1:37 PM, vela  wrote:

>
> Hello again,
>
> can't we count it using the wicket application, some thing like this in jsp
>
>
> <%! int i= 0;%>
> <% out.println("People visited "+(++i)); %>
>
>
>
> --
> View this message in context:
> http://old.nabble.com/User-count-tp26253854p26265729.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
>
>


-- 
Pieter Degraeuwe
Systemworks bvba
Belgiëlaan 61
9070 Destelbergen
GSM: +32 (0)485/68.60.85
Email: pieter.degrae...@systemworks.be
visit us at http://www.systemworks.be


Re: Getting the "Choose Option" on page reload

2009-11-09 Thread Wilhelmsen Tor Iver
> I have 2 drop-downs and a search button my page. When the page is
> loaded
> for the first time, the first option in both the drop-downs is "Choose
> Option". Now if I select some value and click Search, the page is
> rendered again and the Choose Option is gone forever. But I want it
> back. How do I go this?

It is a consequence of disabling null values; you need to tell the dropdown to 
accept null values which is what "Choose Option" represents:

theDropdownComponent.setNullValid(true);

You will also want to override the display value property in the .properties 
file:

theDropdownComponent.null_valid=Not set

- Tor Iver

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



Re: org.omg.CORBA.BAD_OPERATION: The delegate has not been set! - exception on back button

2009-11-09 Thread Pieter Degraeuwe
I didn't do it myself yet, but have a look at
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory
(wicket-spring-1.4.1).

On Mon, Nov 9, 2009 at 1:35 PM, zabian  wrote:

> I just have noticed it could be a problem.
> Do you know any example how to create that serializable proxy using spring?
>
> Thanks.
> Regards,
> Wojtek.
>
> Pieter Degraeuwe pisze:
>
>  Your Page (HomePage) contains a reference to your SpeedService EJB. Since
>> that one is not serializable, your page cannot be serialized.
>> A possible solution is to inject your ejb (by using for example
>> @SpringBean). This makes serializable proxies, so your page can be
>> serialized...
>>
>>
>> 2009/11/9 zabian 
>>
>>
>>
>>> Hi there,
>>> I am working on the project using Wicket and EJB3.0 on Glassfish AS.
>>> I've got such case:
>>> There is a page with some test, using Sateful bean. When you press a
>>> start
>>> button, the model using the bean is created, bean is beeing looked up on
>>> each start button pressed. When I change the page and then use back
>>> button
>>> and press start button again i get such exception:
>>>
>>>
>>> [#|2009-11-09 13:10:01,395 ERROR none:none[-1.0]
>>> httpSSLWorkerThread-8080-1
>>> (org.apache.wicket.util.lang.Objects:1134): Error serializing object
>>> class
>>> com.aster.prov.speed.web.HomePage [object=[Page class =
>>> com.aster.prov.speed.web.HomePage, id = 3, version = 0, ajax = 4]]|#]
>>>
>>> org.omg.CORBA.BAD_OPERATION: The delegate has not been set!  vmcid: 0x0
>>>  minor code: 0  completed: No
>>>  at org.omg.CORBA.portable.ObjectImpl._get_delegate(ObjectImpl.java:53)
>>>  at
>>>
>>> com.sun.corba.ee.spi.presentation.rmi.StubAdapter.getDelegate(StubAdapter.java:174)
>>>  at
>>>
>>> com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.selfAsBaseClass(BCELStubBase.java:214)
>>>  at
>>>
>>> com.aster.prov.speed.ejb.__SpeedServiceRemote_Remote_DynamicStub.writeReplace(com/aster/prov/speed/ejb/__SpeedServiceRemote_Remote_DynamicStub.java)
>>>  at sun.reflect.GeneratedMethodAccessor548.invoke(Unknown Source)
>>>  at
>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>  at java.lang.reflect.Method.invoke(Method.java:597)
>>>  at
>>> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>>>  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>>>  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>>  at
>>>
>>> com.sun.ejb.containers.RemoteBusinessWrapperBase.writeObject(RemoteBusinessWrapperBase.java:106)
>>>  at sun.reflect.GeneratedMethodAccessor431.invoke(Unknown Source)
>>>  at
>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>  at java.lang.reflect.Method.invoke(Method.java:597)
>>>  at
>>> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
>>>  at
>>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
>>>  at
>>>
>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>>  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>>  at
>>>
>>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>>>  at
>>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>>>  at
>>>
>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>>  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>>  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>>  at
>>>
>>> org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121)
>>>  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
>>>  at
>>> org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1120)
>>>  at
>>>
>>> org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:203)
>>>  at
>>>
>>> org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:840)
>>>  at
>>>
>>> org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:332)
>>>  at org.apache.wicket.Session.requestDetached(Session.java:1404)
>>>  at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1176)
>>>  at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1454)
>>>  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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
>>>  at
>>>
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
>>>  at
>>>
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV

Re: Combination CompoundPropertyModel and ChoiceRenderer on DropDownChoice gives problems

2009-11-09 Thread svenmeier

You want to select one value from a list of values, so obviously everything
has to have the same type.

These 'IdDescrBeans' smell like Struts, such constructs are not needed.
What's wrong with the following:

  List genders = new ArrayList();
  list.add("M");
  list.add("F");
  form.add(new DropDownChoice("gender", genders) {
protected boolean localizeDisplayValues() {
  return true;
}
  });

Creating an enum would be a nice alternative to strings though.
Put the following keys in you page's property file:

  gender.M = male
  gender.F = female

i18n for free.

Sven


Xavier López-2 wrote:
> 
> Hi Ann,
> 
> I've also encountered this problem, but with RadioChoice instead of
> DropDownChoice.
> 
> This is the thread I started about it:
> 
> http://mail-archives.apache.org/mod_mbox/wicket-users/200911.mbox/browser
> 
> After all this thread, I still don't know what should I do to model, for
> instance, a gender radioChoice which would be backed by a String property
> ("M" of "F"), providing a list of choices (multilingual) with IdDescrBeans
> like you propose.
> Should I change my bean's 'String gender' property to 'IdDescrBean gender'
> ?
> Why should I store description's information on my model entity ?
> 
> Although I agree with having same object's on choices and model when it's
> about more complex data...
> 
> Possible solutions I've thought of so far:
> 
>- Ideally, do not use different object types in compundpropertymodel's
>bean and choice List. Use same object type instead.
>- When using RadioChoice, it works if you substitute it with a
> RadioGroup
>and Radio's, using the 'id' property as the Radio's model and the
>'description' property as the label's model. However, when it's about
>DropDownChoice, I'm clueless about it at the moment (already having
> problems
>with them).
>- Provide a list of choices in which each element is an Id, and then
>provide a ChoiceRenderer display expression such that gets the proper
>description (I don't like that at all).
>- Modify IdDescrBean so that it returns the 'id' property in its
>'toString' method, and, assuming the compundpropertymodel's bean
> related
>property is String, provide an implementation for some useless method
>('trim' for example), so that it returns the desctiption. Then, in the
>ChoiceRenderer, you can set the displayExpression to 'trim()', which
> will
>ensure that when the component model's object is a String, this error
> will
>not happen (also, it will return the trimmed id as description, but
> that
>will have no effect). But there is more to it, in order to achieve
>AbstractSingleSelectChoice's getModelValue() to identify the selected
> choice
>element, it calls 'indexOf' on the Choice List, using the
>compundpropertymodel's bean related property value. That is, it
> searches in
>a List of IdDescrBean a String. Problem is 'indexOf' invokes
>'searchedElement.equals(choices[i])', which will never return true. I
> got it
>to work overriding 'getModelObject' and doing this search with the
> opposite
>comparation (choices[i].equals(searchedElement), and providing a
> suitable
>implementation of 'equals' in the IdDescrBean class... But that's
> extremely
>hacky and ugly, and... it would not work for ListMultipleChoice, as
>getModelValue is final...
> 
> 
> 
> 2009/11/9 Ann Baert 
> 
>> I've created a jira issue with more information and an example for this
>> problem:
>> https://issues.apache.org/jira/browse/WICKET-2565
>>  DISCLAIMER 
>>
>> http://www.tvh.com/newen2/emaildisclaimer/default.html
>>
>> "This message is delivered to all addressees subject to the conditions
>> set forth in the attached disclaimer, which is an integral part of this
>> message."
>>
> 
> 
> 
> -- 
> "To err is human; to make real mess, you need a computer."
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Combination-CompoundPropertyModel-and-ChoiceRenderer-on-DropDownChoice-gives-problems-tp26262235p26266089.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: User count

2009-11-09 Thread vela

Hello again,

can't we count it using the wicket application, some thing like this in jsp


<%! int i= 0;%>
<% out.println("People visited "+(++i)); %>



-- 
View this message in context: 
http://old.nabble.com/User-count-tp26253854p26265729.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: org.omg.CORBA.BAD_OPERATION: The delegate has not been set! - exception on back button

2009-11-09 Thread zabian

I just have noticed it could be a problem.
Do you know any example how to create that serializable proxy using spring?

Thanks.
Regards,
Wojtek.

Pieter Degraeuwe pisze:

Your Page (HomePage) contains a reference to your SpeedService EJB. Since
that one is not serializable, your page cannot be serialized.
A possible solution is to inject your ejb (by using for example
@SpringBean). This makes serializable proxies, so your page can be
serialized...


2009/11/9 zabian 

  

Hi there,
I am working on the project using Wicket and EJB3.0 on Glassfish AS.
I've got such case:
There is a page with some test, using Sateful bean. When you press a start
button, the model using the bean is created, bean is beeing looked up on
each start button pressed. When I change the page and then use back button
and press start button again i get such exception:


[#|2009-11-09 13:10:01,395 ERROR none:none[-1.0] httpSSLWorkerThread-8080-1
(org.apache.wicket.util.lang.Objects:1134): Error serializing object class
com.aster.prov.speed.web.HomePage [object=[Page class =
com.aster.prov.speed.web.HomePage, id = 3, version = 0, ajax = 4]]|#]

org.omg.CORBA.BAD_OPERATION: The delegate has not been set!  vmcid: 0x0
 minor code: 0  completed: No
  at org.omg.CORBA.portable.ObjectImpl._get_delegate(ObjectImpl.java:53)
  at
com.sun.corba.ee.spi.presentation.rmi.StubAdapter.getDelegate(StubAdapter.java:174)
  at
com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.selfAsBaseClass(BCELStubBase.java:214)
  at
com.aster.prov.speed.ejb.__SpeedServiceRemote_Remote_DynamicStub.writeReplace(com/aster/prov/speed/ejb/__SpeedServiceRemote_Remote_DynamicStub.java)
  at sun.reflect.GeneratedMethodAccessor548.invoke(Unknown Source)
  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at
java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
  at
com.sun.ejb.containers.RemoteBusinessWrapperBase.writeObject(RemoteBusinessWrapperBase.java:106)
  at sun.reflect.GeneratedMethodAccessor431.invoke(Unknown Source)
  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
  at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
  at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
  at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
  at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
  at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
  at
org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121)
  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
  at
org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1120)
  at
org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:203)
  at
org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:840)
  at
org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:332)
  at org.apache.wicket.Session.requestDetached(Session.java:1404)
  at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1176)
  at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1454)
  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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
  at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
  at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)
  at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
  at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
  at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
  at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
  at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
  at
com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
  at
org.apache.catalina.core.Sta

Re: org.omg.CORBA.BAD_OPERATION: The delegate has not been set! - exception on back button

2009-11-09 Thread Pieter Degraeuwe
Your Page (HomePage) contains a reference to your SpeedService EJB. Since
that one is not serializable, your page cannot be serialized.
A possible solution is to inject your ejb (by using for example
@SpringBean). This makes serializable proxies, so your page can be
serialized...


2009/11/9 zabian 

> Hi there,
> I am working on the project using Wicket and EJB3.0 on Glassfish AS.
> I've got such case:
> There is a page with some test, using Sateful bean. When you press a start
> button, the model using the bean is created, bean is beeing looked up on
> each start button pressed. When I change the page and then use back button
> and press start button again i get such exception:
>
>
> [#|2009-11-09 13:10:01,395 ERROR none:none[-1.0] httpSSLWorkerThread-8080-1
> (org.apache.wicket.util.lang.Objects:1134): Error serializing object class
> com.aster.prov.speed.web.HomePage [object=[Page class =
> com.aster.prov.speed.web.HomePage, id = 3, version = 0, ajax = 4]]|#]
>
> org.omg.CORBA.BAD_OPERATION: The delegate has not been set!  vmcid: 0x0
>  minor code: 0  completed: No
>   at org.omg.CORBA.portable.ObjectImpl._get_delegate(ObjectImpl.java:53)
>   at
> com.sun.corba.ee.spi.presentation.rmi.StubAdapter.getDelegate(StubAdapter.java:174)
>   at
> com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.selfAsBaseClass(BCELStubBase.java:214)
>   at
> com.aster.prov.speed.ejb.__SpeedServiceRemote_Remote_DynamicStub.writeReplace(com/aster/prov/speed/ejb/__SpeedServiceRemote_Remote_DynamicStub.java)
>   at sun.reflect.GeneratedMethodAccessor548.invoke(Unknown Source)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>   at
> com.sun.ejb.containers.RemoteBusinessWrapperBase.writeObject(RemoteBusinessWrapperBase.java:106)
>   at sun.reflect.GeneratedMethodAccessor431.invoke(Unknown Source)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at java.lang.reflect.Method.invoke(Method.java:597)
>   at
> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
>   at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
>   at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>   at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>   at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>   at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>   at
> org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
>   at
> org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1120)
>   at
> org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:203)
>   at
> org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:840)
>   at
> org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:332)
>   at org.apache.wicket.Session.requestDetached(Session.java:1404)
>   at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1176)
>   at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1454)
>   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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
>   at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
>   at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)
>   at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
>   at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
>   at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
>   at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
>   at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
>   at
> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
>   at
> org.apache.catalina.core.St

org.omg.CORBA.BAD_OPERATION: The delegate has not been set! - exception on back button

2009-11-09 Thread zabian

Hi there,
I am working on the project using Wicket and EJB3.0 on Glassfish AS.
I've got such case:
There is a page with some test, using Sateful bean. When you press a 
start button, the model using the bean is created, bean is beeing looked 
up on each start button pressed. When I change the page and then use 
back button and press start button again i get such exception:



[#|2009-11-09 13:10:01,395 ERROR none:none[-1.0] 
httpSSLWorkerThread-8080-1 (org.apache.wicket.util.lang.Objects:1134): 
Error serializing object class com.aster.prov.speed.web.HomePage 
[object=[Page class = com.aster.prov.speed.web.HomePage, id = 3, version 
= 0, ajax = 4]]|#]


org.omg.CORBA.BAD_OPERATION: The delegate has not been set!  vmcid: 0x0  
minor code: 0  completed: No

   at org.omg.CORBA.portable.ObjectImpl._get_delegate(ObjectImpl.java:53)
   at 
com.sun.corba.ee.spi.presentation.rmi.StubAdapter.getDelegate(StubAdapter.java:174)
   at 
com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.selfAsBaseClass(BCELStubBase.java:214)
   at 
com.aster.prov.speed.ejb.__SpeedServiceRemote_Remote_DynamicStub.writeReplace(com/aster/prov/speed/ejb/__SpeedServiceRemote_Remote_DynamicStub.java)

   at sun.reflect.GeneratedMethodAccessor548.invoke(Unknown Source)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

   at java.lang.reflect.Method.invoke(Method.java:597)
   at 
java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)

   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
   at 
com.sun.ejb.containers.RemoteBusinessWrapperBase.writeObject(RemoteBusinessWrapperBase.java:106)

   at sun.reflect.GeneratedMethodAccessor431.invoke(Unknown Source)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

   at java.lang.reflect.Method.invoke(Method.java:597)
   at 
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
   at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
   at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
   at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
   at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
   at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
   at 
org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121)

   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
   at 
org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1120)
   at 
org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:203)
   at 
org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:840)
   at 
org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:332)

   at org.apache.wicket.Session.requestDetached(Session.java:1404)
   at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1176)
   at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1454)
   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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
   at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
   at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)
   at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
   at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
   at 
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
   at 
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

   at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
   at 
com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
   at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
   at 
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
   at 
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
   at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
   at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
 

Autogenerating HTML files ...?

2009-11-09 Thread Ashley Aitken


Dear All,

I have seen a feature in Wicket Bench (I think it is) that can  
automatically generate the Web component object construction hierarchy  
for a given Web form with Wicket ids.  It's a neat feature.  However,  
I am wondering if it would be possible to do the reverse.


Could Wicket classes be extended to automatically generate the HTML  
file (based on the Wicket object hierarchy) if the HTML file doesn't  
already exist?  Obviously, it couldn't generate the non-dynamic HTML  
aspects of a Web page, but at least it could provide a skeleton page?


This could be configured to overwrite (or not) existing files each  
time the code changed. Perhaps it could be configured to include (for  
debugging purposes) some Wicket information for each item in the page  
(almost like a RAD solution but the intention is not for RAD).


Perhaps it could even use a form of the "generation gap pattern" by  
putting each dynamic chunk into a separate HTML file and then #include  
them into a main HTML file which it doesn't get overwritten.  Though  
I'm not sure how this would exactly work ...


I've seen Wicket RAD and Wicket Web Beans but these are not what I am  
thinking about.  Eventually, I would want a graphics / Web designer to  
complete the page around the skeleton dynamic HTML parts (that perhaps  
Wicket has autogenerated).


I know this would never be the full solution but it may allow one to  
concentrate just on the Java code and not even have to worry about the  
HTML to start with.  I think it could be an interesting approach.  Is  
this possible? Has this already been done?


Any comments appreciate.

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



Re: Encoding Pageparameters

2009-11-09 Thread Sjoerd Schunselaar
Excuse me, it looks like a problem in my local firefox settings.

Kind regards

Sjoerd Schunselaar



On Mon, Nov 9, 2009 at 10:05 AM, Sjoerd Schunselaar
 wrote:
> Hello all,
>
> Is it possible to automatically encode PageParameters?
> When I put a String like "bien-être" in a parameter, and redirect to a
> page using that parameter,
> I get an illegal url request. (only 0-9, a-z, A-Z and some characters
> are legal).
> Is it possible to encode it automatically, to: "bien-%C3%AAtre"?
>
> Kind regards,
>
> Sjoerd Schunselaar
>

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



Encoding Pageparameters

2009-11-09 Thread Sjoerd Schunselaar
Hello all,

Is it possible to automatically encode PageParameters?
When I put a String like "bien-être" in a parameter, and redirect to a
page using that parameter,
I get an illegal url request. (only 0-9, a-z, A-Z and some characters
are legal).
Is it possible to encode it automatically, to: "bien-%C3%AAtre"?

Kind regards,

Sjoerd Schunselaar

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



Re: Combination CompoundPropertyModel and ChoiceRenderer on DropDownChoice gives problems

2009-11-09 Thread Xavier López
Hi Ann,

I've also encountered this problem, but with RadioChoice instead of
DropDownChoice.

This is the thread I started about it:

http://mail-archives.apache.org/mod_mbox/wicket-users/200911.mbox/browser

After all this thread, I still don't know what should I do to model, for
instance, a gender radioChoice which would be backed by a String property
("M" of "F"), providing a list of choices (multilingual) with IdDescrBeans
like you propose.
Should I change my bean's 'String gender' property to 'IdDescrBean gender' ?
Why should I store description's information on my model entity ?

Although I agree with having same object's on choices and model when it's
about more complex data...

Possible solutions I've thought of so far:

   - Ideally, do not use different object types in compundpropertymodel's
   bean and choice List. Use same object type instead.
   - When using RadioChoice, it works if you substitute it with a RadioGroup
   and Radio's, using the 'id' property as the Radio's model and the
   'description' property as the label's model. However, when it's about
   DropDownChoice, I'm clueless about it at the moment (already having problems
   with them).
   - Provide a list of choices in which each element is an Id, and then
   provide a ChoiceRenderer display expression such that gets the proper
   description (I don't like that at all).
   - Modify IdDescrBean so that it returns the 'id' property in its
   'toString' method, and, assuming the compundpropertymodel's bean related
   property is String, provide an implementation for some useless method
   ('trim' for example), so that it returns the desctiption. Then, in the
   ChoiceRenderer, you can set the displayExpression to 'trim()', which will
   ensure that when the component model's object is a String, this error will
   not happen (also, it will return the trimmed id as description, but that
   will have no effect). But there is more to it, in order to achieve
   AbstractSingleSelectChoice's getModelValue() to identify the selected choice
   element, it calls 'indexOf' on the Choice List, using the
   compundpropertymodel's bean related property value. That is, it searches in
   a List of IdDescrBean a String. Problem is 'indexOf' invokes
   'searchedElement.equals(choices[i])', which will never return true. I got it
   to work overriding 'getModelObject' and doing this search with the opposite
   comparation (choices[i].equals(searchedElement), and providing a suitable
   implementation of 'equals' in the IdDescrBean class... But that's extremely
   hacky and ugly, and... it would not work for ListMultipleChoice, as
   getModelValue is final...



2009/11/9 Ann Baert 

> I've created a jira issue with more information and an example for this
> problem:
> https://issues.apache.org/jira/browse/WICKET-2565
>  DISCLAIMER 
>
> http://www.tvh.com/newen2/emaildisclaimer/default.html
>
> "This message is delivered to all addressees subject to the conditions
> set forth in the attached disclaimer, which is an integral part of this
> message."
>



-- 
"To err is human; to make real mess, you need a computer."


Re: WicketFilter.getLastModified creates a RequestCycle but does not clean it up

2009-11-09 Thread Peter Dotchev

created jira item
https://issues.apache.org/jira/browse/WICKET-2566

Regards,
Peter


igor.vaynberg wrote:
> 
> peter, please open a jira issue. looks like a bug to me.
> 
> -igor
> 
> On Sat, Nov 7, 2009 at 1:52 PM, Peter Dotchev  wrote:
>> Hi Wicketeers,
>>
>> I noticed that WicketFilter.getLastModified creates a RequestCycle but
>> does
>> not /detach /it, so onEndRequest is not called.
>> I use JCR and open a session to it on first use (lazy init). I store the
>> JCR
>> session in th RequestCycle. I close the JCR session in
>> RequestCycle.onEndRequest (overriden). Kind of Open Session In View
>> pattern.
>> When WicketFilter.getLastModified calls Resource.getResourceStream() I
>> have
>> to open a JCR session to stream the requested resource. But then
>> onEndRequest is not called on the RequestCycle so the JCR session remains
>> open.
>>
>> By debugging I found the following sequence in WicketFilter:
>> doFilter
>>   getLastModified
>>      webApplication.newRequestCycle
>>      resource.getResourceStream
>>      // requestCycle.detach - this is commented
>>      requestCycle.unset // this does not call onEndRequest
>>   doGet
>>      webApplication.newRequestCycle // second RequestCycle is created
>>      cycle.request() // this calls again getResourceStream but also
>> RequestCycle.detach
>>
>> It turns out two RequestCycle's are created but only the second one is
>> detached. Also Resource.getResourceStream is called twice. This is all
>> for
>> one request.
>>
>> I use Wicket 1.4.1.
>>
>> Best regards,
>> 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/WicketFilter.getLastModified-creates-a-RequestCycle-but-does-not-clean-it-up-tp26249003p26262469.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