Re: [Wicket-user] how to redirect to another page?

2005-05-21 Thread Eelco Hillenius
setResponsePage(new MyPage())

setResponsePage(... (e.g. use IPageFactory) )

and a special case is when you want to redirect directly to a non-wicket
address (e.g. the serverside):

setResponsePage(new RedirectPage("http://www.theserverside.com";));

Eelco


叶卫国 wrote:

> :-p
>
>
>
>---
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>___
>Wicket-user mailing list
>Wicket-user@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/wicket-user
>  
>



---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] how to redirect to another page?

2005-05-21 Thread 叶卫国
 :-p



---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] how to localize a dropdown list

2005-05-21 Thread allbg
Hello!

I am trying to understand Wicket since a few weeks...( and quite unexperienced 
in Java ;-(  )
The last struggle I came up to is how to localize a drop down selection.
The first point of course is that all 'values' normally associated with 
selections get out of sight in Wicket.. 

How can I localize display strings in a Dropdown list? After lots of looking 
through the wicket docs and code, I tried the 
following:

public InputForm(String name, IFeedback feedback)
{
super(name,new CompoundPropertyModel(new  SrchFormModel()), feedback);
 add(new DropDownChoice("testType", new 
StringResourceModel("testType", this, null),
TESTCONTAINER ) ) ;
}

This to my amazement worked to produce the desired result in the selection.. ( 
I made a srchform.properties file of course 
with some testType values )

But I was very disappointed that I got an exception that setObject in the used 
model (StringResourceModel) is not 
supported
What should I do?

I too came upon the problem how to forward Form-submission results to the page 
that will handle the form input.
Do I need to pack all returned parameters  in a Page parameters object, and 
construct the new page (target) with this 
parameters object?, or can I somehow create a model (object) of a form that I 
can access in the result page..and if sow, 
how do I do that? (That is, how to forward this object to the target page ; as 
somehow happens in the library example with a 
bookdetails - page  ) 

Help will be much appreciated!

Dick








---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: Re: [Wicket-user] how to redirect to another page?

2005-05-21 Thread 叶卫国
Eelco Hillenius,您好!

many thanks :)

=== 2005-05-21 17:33:48 您在来信中写道:===

>setResponsePage(new MyPage())
>
>setResponsePage(... (e.g. use IPageFactory) )
>
>and a special case is when you want to redirect directly to a non-wicket
>address (e.g. the serverside):
>
>setResponsePage(new RedirectPage("http://www.theserverside.com";));
>
>Eelco
>
>
>叶卫国 wrote:
>
>> :-p
>>
>>
>>
>>---
>>This SF.Net email is sponsored by Oracle Space Sweepstakes
>>Want to be the first software developer in space?
>>Enter now for the Oracle Space Sweepstakes!
>>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>>___
>>Wicket-user mailing list
>>Wicket-user@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/wicket-user
>>  
>>
>
>
>
>---
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>___
>Wicket-user mailing list
>Wicket-user@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/wicket-user

= = = = = = = = = = = = = = = = = = = =


致
礼!
 
 
叶卫国
[EMAIL PROTECTED]
  2005-05-21



Re: [Wicket-user] how to localize a dropdown list

2005-05-21 Thread Eelco Hillenius
First, the thing to understand here is that the IModel parameter is used 
to get the current value (to be used to see whether the option rendered 
is the currently selected one) and, when a selection changes/ the form 
is submitted, the model is updated with the new selection.


So in your case, as you use a StringResourceModel, Wicket tries to 
update that model. However that model is read-only as it can't write to 
the properties files.


What you should do is either pre-fill you localized options and provide 
it as a collection (e.g. a List) or implement your custom IChoiceList 
(start by overriding wicket.markup.html.form.model.ChoiceList or 
DetachableChoiceList) in order to 'pull' the available options. If you 
override ChoiceList.newChoice, you can provide your own IChoice 
implementation, with the localized display string you want.


Also, you should use an updatable model to store what the current 
selected option is.


Now, about navigating to result pages etc... Like I wrote earlier today 
(but I think just before you joined this list), you have these options 
to navigate:


setResponsePage(new MyPage())

setResponsePage(... (e.g. use IPageFactory) )

and a special case is when you want to redirect directly to a non-wicket
address (e.g. the serverside):

setResponsePage(new RedirectPage("http://www.theserverside.com";));


If you look at the first option, it is clear that you can do anything you want, 
e.g. doing:

FooModel fooModel ...

setResponsePage(new MyPage(fooModel));

or setResponsePage(new MyPage(myList, myOtherObject))

etc.



Hope this helps.

Eelco

P.s. we *really* need to write more about Choices, as questions about 
them keep comming up. There also isn't any example of how to use custom 
IChoices. I'll try to find some time today, allthough we also have to 
release the next RC, and I have to create a new release of JettyLauncher.



[EMAIL PROTECTED] wrote:


Hello!

I am trying to understand Wicket since a few weeks...( and quite unexperienced 
in Java ;-(  )
The last struggle I came up to is how to localize a drop down selection.
The first point of course is that all 'values' normally associated with selections get out of sight in Wicket.. 

How can I localize display strings in a Dropdown list? After lots of looking through the wicket docs and code, I tried the 
following:


public InputForm(String name, IFeedback feedback)
{
super(name,new CompoundPropertyModel(new  SrchFormModel()), feedback);
 add(new DropDownChoice("testType", new 
StringResourceModel("testType", this, null),
TESTCONTAINER ) ) ;
}

This to my amazement worked to produce the desired result in the selection.. ( I made a srchform.properties file of course 
with some testType values )


But I was very disappointed that I got an exception that setObject in the used model (StringResourceModel) is not 
supported

What should I do?

I too came upon the problem how to forward Form-submission results to the page 
that will handle the form input.
Do I need to pack all returned parameters  in a Page parameters object, and construct the new page (target) with this 
parameters object?, or can I somehow create a model (object) of a form that I can access in the result page..and if sow, 
how do I do that? (That is, how to forward this object to the target page ; as somehow happens in the library example with a 
bookdetails - page  ) 


Help will be much appreciated!

Dick








---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
 





---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: Re: [Wicket-user] the order of feeback messages

2005-05-21 Thread 叶卫国
Eelco Hillenius,您好!
  
   Adding a sort() method is flexible, but how to sort by the occurrence order 
of the form fields ? 




=== 2005-05-17 20:46:42 您在来信中写道:===

>I refactored FeedbackMessages, FeedbackPanel and
>FormComponentFeedbackBorder so that it is easier to use and to extend.
>One of the things I added is that you can now set a comparator on
>FeedbackPanel for any sorting you want.
>
>Good luck,
>
>Eelco
>
>
>---
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>___
>Wicket-user mailing list
>Wicket-user@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/wicket-user

= = = = = = = = = = = = = = = = = = = =


致
礼!
 
 
叶卫国
[EMAIL PROTECTED]
  2005-05-21



Re: [Wicket-user] the order of feeback messages

2005-05-21 Thread Eelco Hillenius
Well... I've discussed this with Johan offline, but that is very hard to 
do. Even if we had ordering in the child maps, that doesn't mean that 
that's the order you're going to use them in your markup. And even if 
you did, by using CSS, the order could be even different from what is in 
your markup.


So, I'm afraid you have to do any sorting this manually, which means 
that you have to keep track of the order as you want it somewhere.


Regards,

Eelco



叶卫国 wrote:


Eelco Hillenius,您好!
 
  Adding a sort() method is flexible, but how to sort by the occurrence order of the form fields ? 
	




=== 2005-05-17 20:46:42 您在来信中写道:===

 


I refactored FeedbackMessages, FeedbackPanel and
FormComponentFeedbackBorder so that it is easier to use and to extend.
One of the things I added is that you can now set a comparator on
FeedbackPanel for any sorting you want.

Good luck,

Eelco


---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
   



= = = = = = = = = = = = = = = = = = = =


致
礼!

 
叶卫国

[EMAIL PROTECTED]
  2005-05-21

N琀S^甸殜X�'矈辵紟%y*Zq浒y阬旦眆Ф�z豝~*於��珁庄zZ)z抚矕渪I韟硅龙+�幁�%y*Zq浒y阬旦�m��趘�,vw(涼潐秀]殩Z壭雫8�'$Z'$z郜z箽奨Xh湋雗标鍔薼矉玵玷�豰稕?⺋�(悍~娻zwX襄娝b濟?�'$z郜er==





---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: Re: [Wicket-user] the order of feeback messages

2005-05-21 Thread 叶卫国
Eelco Hillenius,您好!

emm so can you add a member variable(e.g. "order" or something 
else) to Component class, thus i can set 
the order manually

=== 2005-05-21 19:28:37 您在来信中写道:===

>Well... I've discussed this with Johan offline, but that is very hard to 
>do. Even if we had ordering in the child maps, that doesn't mean that 
>that's the order you're going to use them in your markup. And even if 
>you did, by using CSS, the order could be even different from what is in 
>your markup.
>
>So, I'm afraid you have to do any sorting this manually, which means 
>that you have to keep track of the order as you want it somewhere.
>
>Regards,
>
>Eelco
>
>
>
>叶卫国 wrote:
>
>>Eelco Hillenius,您好!
>>  
>>   Adding a sort() method is flexible, but how to sort by the occurrence 
>> order of the form fields ? 
>>  
>>
>>
>>
>>=== 2005-05-17 20:46:42 您在来信中写道:===
>>
>>  
>>
>>>I refactored FeedbackMessages, FeedbackPanel and
>>>FormComponentFeedbackBorder so that it is easier to use and to extend.
>>>One of the things I added is that you can now set a comparator on
>>>FeedbackPanel for any sorting you want.
>>>
>>>Good luck,
>>>
>>>Eelco
>>>
>>>
>>>---
>>>This SF.Net email is sponsored by Oracle Space Sweepstakes
>>>Want to be the first software developer in space?
>>>Enter now for the Oracle Space Sweepstakes!
>>>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>>>___
>>>Wicket-user mailing list
>>>Wicket-user@lists.sourceforge.net
>>>https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>
>>>
>>
>>= = = = = = = = = = = = = = = = = = = =
>>  
>>
>>致
>>礼!
>> 
>>   
>>叶卫国
>>[EMAIL PROTECTED]
>>  2005-05-21
>>
>>N?S^甸?X??'%y*Zq浒y?旦?Ф?z?~*於???庄zZ)z抚??I?硅龙+???%y*Zq浒y?旦?m,vw(??秀]?Z??8??'$Z'$z郜z???X?h??标玷????(悍~?zw?X?襄?b???'$z郜er==
>>
>
>
>
>---
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>___
>Wicket-user mailing list
>Wicket-user@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/wicket-user

= = = = = = = = = = = = = = = = = = = =


致
礼!
 
 
叶卫国
[EMAIL PROTECTED]
  2005-05-21



Re: Re: Re: [Wicket-user] the order of feeback messages

2005-05-21 Thread 叶卫国
叶卫国,您好!

or set the order when rendering


=== 2005-05-21 20:17:55 您在来信中写道:===

>Eelco Hillenius,您好!
>
>  the order of component can increase automatically when added, this 
> is the default behavior, and user can still set it manually:
>
>  add(new RequiredTextField("id", Long.class).setOrder(1));
>add(new RequiredTextField("domain").setOrder(2));
>add(new RequiredTextField("name").setOrder(3));
>add(new 
> TextArea("description").add(RequiredValidator.getInstance()).setOrder(4));
>add(new RequiredTextField("email").add(new 
> EmailAddressPatternValidator()).setOrder(5));
>
>
>
>=== 2005-05-21 19:28:37 您在来信中写道:===
>
>>Well... I've discussed this with Johan offline, but that is very hard to 
>>do. Even if we had ordering in the child maps, that doesn't mean that 
>>that's the order you're going to use them in your markup. And even if 
>>you did, by using CSS, the order could be even different from what is in 
>>your markup.
>>
>>So, I'm afraid you have to do any sorting this manually, which means 
>>that you have to keep track of the order as you want it somewhere.
>>
>>Regards,
>>
>>Eelco
>>
>>
>>
>>叶卫国 wrote:
>>
>>>Eelco Hillenius,您好!
>>>  
>>>   Adding a sort() method is flexible, but how to sort by the occurrence 
>>> order of the form fields ? 
>>> 
>>>
>>>
>>>
>>>=== 2005-05-17 20:46:42 您在来信中写道:===
>>>
>>>  
>>>
I refactored FeedbackMessages, FeedbackPanel and
FormComponentFeedbackBorder so that it is easier to use and to extend.
One of the things I added is that you can now set a comparator on
FeedbackPanel for any sorting you want.

Good luck,

Eelco


---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


>>>
>>>= = = = = = = = = = = = = = = = = = = =
>>> 
>>>
>>>致
>>>礼!
>>> 
>>>  
>>>叶卫国
>>>[EMAIL PROTECTED]
>>>  2005-05-21
>>>
>>>N?S^甸?X??'%y*Zq浒y?旦?Ф?z?~*於???庄zZ)z抚??I?硅龙+???%y*Zq浒y?旦?m,vw(??秀]?Z??8??'$Z'$z郜z???X?h??标玷????(悍~?zw?X?襄?b???'$z郜er==
>>>
>>
>>
>>
>>---
>>This SF.Net email is sponsored by Oracle Space Sweepstakes
>>Want to be the first software developer in space?
>>Enter now for the Oracle Space Sweepstakes!
>>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>>___
>>Wicket-user mailing list
>>Wicket-user@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>= = = = = = = = = = = = = = = = = = = =
>   
>
>致
>礼!
> 
>
>叶卫国
>[EMAIL PROTECTED]
>  2005-05-21
>
>N?S^甸?X??%y*Zq浒y?旦?Ф?z?~*於???庄zZ)z抚??I?硅龙+???y*Zq浒y?旦?m???vw(?Z?5?8??$Z'$z郜z???X?h??标玷悍~?zw?X?襄?b???$z郜z

= = = = = = = = = = = = = = = = = = = =


致
礼!
 
 
叶卫国
[EMAIL PROTECTED]
  2005-05-21



Re: Re: [Wicket-user] the order of feeback messages

2005-05-21 Thread 叶卫国
Eelco Hillenius,您好!

  the order of component can increase automatically when added, this is 
the default behavior, and user can still set it manually:

  add(new RequiredTextField("id", Long.class).setOrder(1));
add(new RequiredTextField("domain").setOrder(2));
add(new RequiredTextField("name").setOrder(3));
add(new 
TextArea("description").add(RequiredValidator.getInstance()).setOrder(4));
add(new RequiredTextField("email").add(new 
EmailAddressPatternValidator()).setOrder(5));



=== 2005-05-21 19:28:37 您在来信中写道:===

>Well... I've discussed this with Johan offline, but that is very hard to 
>do. Even if we had ordering in the child maps, that doesn't mean that 
>that's the order you're going to use them in your markup. And even if 
>you did, by using CSS, the order could be even different from what is in 
>your markup.
>
>So, I'm afraid you have to do any sorting this manually, which means 
>that you have to keep track of the order as you want it somewhere.
>
>Regards,
>
>Eelco
>
>
>
>叶卫国 wrote:
>
>>Eelco Hillenius,您好!
>>  
>>   Adding a sort() method is flexible, but how to sort by the occurrence 
>> order of the form fields ? 
>>  
>>
>>
>>
>>=== 2005-05-17 20:46:42 您在来信中写道:===
>>
>>  
>>
>>>I refactored FeedbackMessages, FeedbackPanel and
>>>FormComponentFeedbackBorder so that it is easier to use and to extend.
>>>One of the things I added is that you can now set a comparator on
>>>FeedbackPanel for any sorting you want.
>>>
>>>Good luck,
>>>
>>>Eelco
>>>
>>>
>>>---
>>>This SF.Net email is sponsored by Oracle Space Sweepstakes
>>>Want to be the first software developer in space?
>>>Enter now for the Oracle Space Sweepstakes!
>>>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>>>___
>>>Wicket-user mailing list
>>>Wicket-user@lists.sourceforge.net
>>>https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>
>>>
>>
>>= = = = = = = = = = = = = = = = = = = =
>>  
>>
>>致
>>礼!
>> 
>>   
>>叶卫国
>>[EMAIL PROTECTED]
>>  2005-05-21
>>
>>N?S^甸?X??'%y*Zq浒y?旦?Ф?z?~*於???庄zZ)z抚??I?硅龙+???%y*Zq浒y?旦?m,vw(??秀]?Z??8??'$Z'$z郜z???X?h??标玷????(悍~?zw?X?襄?b???'$z郜er==
>>
>
>
>
>---
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>___
>Wicket-user mailing list
>Wicket-user@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/wicket-user

= = = = = = = = = = = = = = = = = = = =


致
礼!
 
 
叶卫国
[EMAIL PROTECTED]
  2005-05-21



Re: [Wicket-user] how to localize a dropdown list

2005-05-21 Thread Eelco Hillenius
I just updated the FormInput example to use a customized, localized 
version of a dropdown; it now displays the available locales with the 
localized names.


I attached the new version (as it takes some hours for sourceforge to 
sync the dev and the public cvs servers) to give you an idea. Note that 
there were some problems with displaying special characters propertly. 
This is fixed in  HEAD now, but you have to wait until the next release 
candidate tomorrow to get all fixes.


Hope it helps,

Eelco
/*
 * $Id: FormInput.java,v 1.41 2005/05/21 13:31:02 eelco12 Exp $ $Revision:
 * 1.20 $ $Date: 2005/05/21 13:31:02 $
 * 
 * 
==
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package wicket.examples.forminput;

import java.net.URL;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Locale;

import wicket.IFeedback;
import wicket.examples.WicketExamplePage;
import wicket.markup.html.form.CheckBox;
import wicket.markup.html.form.DropDownChoice;
import wicket.markup.html.form.Form;
import wicket.markup.html.form.ImageButton;
import wicket.markup.html.form.ListMultipleChoice;
import wicket.markup.html.form.RadioChoice;
import wicket.markup.html.form.RequiredTextField;
import wicket.markup.html.form.TextField;
import wicket.markup.html.form.model.ChoiceList;
import wicket.markup.html.form.model.IChoice;
import wicket.markup.html.form.validation.IntegerValidator;
import wicket.markup.html.image.Image;
import wicket.markup.html.link.Link;
import wicket.markup.html.panel.FeedbackPanel;
import wicket.model.CompoundPropertyModel;
import wicket.model.PropertyModel;
import wicket.protocol.http.WebRequest;
import wicket.util.convert.IConverter;

/**
 * Example for form input.
 * 
 * @author Eelco Hillenius
 * @author Jonathan Locke
 */
public class FormInput extends WicketExamplePage
{
/** Relevant locales wrapped in a list. */
private static final List LOCALES = Arrays.asList(new Locale[] 
{ Locale.US, new Locale("nl"), Locale.GERMANY , 
Locale.SIMPLIFIED_CHINESE });

/** available numbers for the radio selection. */
private static final List NUMBERS = Arrays.asList(new String[]{"1", 
"2", "3"});

/** available sites for the multiple select. */
private static final List SITES = Arrays.asList(
new String[]{"The Server Side", "Java Lobby", 
"Java.Net"});

/**
 * Constructor
 */
public FormInput()
{
Locale locale = getLocale();

// Construct form and feedback panel and hook them up
final FeedbackPanel feedback = new FeedbackPanel("feedback");
add(feedback);
add(new InputForm("inputForm", feedback));

// Dropdown for selecting locale
add(new LocaleDropDownChoice("localeSelect"));

// Link to return to default locale
add(new Link("defaultLocaleLink")
{
public void onClick()
{
WebRequest request = (WebRequest)getRequest();
setLocale(request.getLocale());
}
});
}

/**
 * Sets locale for the user's session (getLocale() is inherited from
 * Component)
 * 
 * @param locale
 *The new locale
 */
public void setLocale(Locale locale)
{
getSession().setLocale(locale);
}

/**
 * Form for collecting input. 
 */
private static class InputForm extends Form
{
/**
 * Construct.
 * 
 * @param name
 *Component name
 * @param feedback
 *Feedback display for form
 */
public InputForm(String name, IFeedback feedback)
{
super(name, new CompoundPropertyModel(new 
FormInputModel()), feedback);

add(new RequiredTextField("stringProperty"));
add(new RequiredTextField("integerProperty", 
Integer.class));
add(new RequiredTextField("doubleProperty", 
Double.class));

Re: [Wicket-user] the order of feeback messages

2005-05-21 Thread Eelco Hillenius
You could create a custom component for this if you want to. The whole
idea of Wicket is to make it super easy for users to create their own
components and add the behaviour they want themselves without bloating
the core project too much.

Personally, I would take a different approach though:

Use a variable (like a list) to store your order:

private List componentOrder = new ArrayList();

Override method add to automatically add the order:

/**
* @see wicket.MarkupContainer#add(wicket.Component)
*/
public MarkupContainer add(Component component)
{
super.add(component);
componentOrder.add(component);
return (MarkupContainer)component;
}

Create a comparator that uses this and set it on the FeedbackPanel:

feedback.setSortingComparator(new Comparator()
{
public int compare(Object o1, Object o2)
{
FeedbackMessage m1 = (FeedbackMessage)o1;
FeedbackMessage m2 = (FeedbackMessage)o2;
int ix1 = componentOrder.indexOf(m1.getReporter());
int ix2 = componentOrder.indexOf(m2.getReporter());
return ix1 - ix2;
}
});

I have attached the complete example (an altered version of InputForm
which I am not going to check in) to this email.

Good luck,

Eelco


叶卫国 wrote:

>Eelco Hillenius,您好!
>
>   emm so can you add a member variable(e.g. "order" or something 
> else) to Component class, thus i can set 
>the order manually
>
>=== 2005-05-21 19:28:37 您在来信中写道:===
>
>  
>
>>Well... I've discussed this with Johan offline, but that is very hard to 
>>do. Even if we had ordering in the child maps, that doesn't mean that 
>>that's the order you're going to use them in your markup. And even if 
>>you did, by using CSS, the order could be even different from what is in 
>>your markup.
>>
>>So, I'm afraid you have to do any sorting this manually, which means 
>>that you have to keep track of the order as you want it somewhere.
>>
>>Regards,
>>
>>Eelco
>>
>>
>>
>>叶卫国 wrote:
>>
>>
>>
>>>Eelco Hillenius,您好!
>>> 
>>>  Adding a sort() method is flexible, but how to sort by the occurrence 
>>> order of the form fields ? 
>>> 
>>>
>>>
>>>
>>>=== 2005-05-17 20:46:42 您在来信中写道:===
>>>
>>> 
>>>
>>>  
>>>
I refactored FeedbackMessages, FeedbackPanel and
FormComponentFeedbackBorder so that it is easier to use and to extend.
One of the things I added is that you can now set a comparator on
FeedbackPanel for any sorting you want.

Good luck,

Eelco


---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
   



>>>= = = = = = = = = = = = = = = = = = = =
>>> 
>>>
>>>致
>>>礼!
>>>
>>>  
>>>叶卫国
>>>[EMAIL PROTECTED]
>>>  2005-05-21
>>>
>>>N?S^甸?X??'%y*Zq浒y?旦?Ф?z?~*於???庄zZ)z抚??I?硅龙+???%y*Zq浒y?旦?m,vw(??秀]?Z??8??'$Z'$z郜z???X?h??标玷????(悍~?zw?X?襄?b???'$z郜er==
>>>
>>>  
>>>
>>
>>---
>>This SF.Net email is sponsored by Oracle Space Sweepstakes
>>Want to be the first software developer in space?
>>Enter now for the Oracle Space Sweepstakes!
>>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>>___
>>Wicket-user mailing list
>>Wicket-user@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>>

/*
 * $Id: FormInput.java,v 1.41 2005/05/21 13:31:02 eelco12 Exp $ $Revision:
 * 1.20 $ $Date: 2005/05/21 13:31:02 $
 * 
 * 
==
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package wicket.examples.forminput;

import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Locale;

import wicket.Component;
import wicket.FeedbackMessage;
import wicket.MarkupContainer;
import wicket.examples.WicketExamplePage;
import wicket.markup.html.form.CheckBox;
import wicket.markup.html.form.DropDownChoice;
import wicket.markup.html.form.Form;
import wicket.markup.html.form.

Re: Re: [Wicket-user] the order of feeback messages

2005-05-21 Thread 叶卫国
Eelco Hillenius,您好!

thanks a lot ~~~

=== 2005-05-21 22:00:39 您在来信中写道:===

>You could create a custom component for this if you want to. The whole
>idea of Wicket is to make it super easy for users to create their own
>components and add the behaviour they want themselves without bloating
>the core project too much.
>
>Personally, I would take a different approach though:
>
>Use a variable (like a list) to store your order:
>
>private List componentOrder = new ArrayList();
>
>Override method add to automatically add the order:
>
>/**
>* @see wicket.MarkupContainer#add(wicket.Component)
>*/
>public MarkupContainer add(Component component)
>{
>super.add(component);
>componentOrder.add(component);
>return (MarkupContainer)component;
>}
>
>Create a comparator that uses this and set it on the FeedbackPanel:
>
>feedback.setSortingComparator(new Comparator()
>{
>public int compare(Object o1, Object o2)
>{
>FeedbackMessage m1 = (FeedbackMessage)o1;
>FeedbackMessage m2 = (FeedbackMessage)o2;
>int ix1 = componentOrder.indexOf(m1.getReporter());
>int ix2 = componentOrder.indexOf(m2.getReporter());
>return ix1 - ix2;
>}
>});
>
>I have attached the complete example (an altered version of InputForm
>which I am not going to check in) to this email.
>
>Good luck,
>
>Eelco
>
>
>叶卫国 wrote:
>
>>Eelco Hillenius,您好!
>>
>>  emm so can you add a member variable(e.g. "order" or something 
>> else) to Component class, thus i can set 
>>the order manually
>>
>>=== 2005-05-21 19:28:37 您在来信中写道:===
>>
>>  
>>
>>>Well... I've discussed this with Johan offline, but that is very hard to 
>>>do. Even if we had ordering in the child maps, that doesn't mean that 
>>>that's the order you're going to use them in your markup. And even if 
>>>you did, by using CSS, the order could be even different from what is in 
>>>your markup.
>>>
>>>So, I'm afraid you have to do any sorting this manually, which means 
>>>that you have to keep track of the order as you want it somewhere.
>>>
>>>Regards,
>>>
>>>Eelco
>>>
>>>
>>>
>>>叶卫国 wrote:
>>>
>>>
>>>
Eelco Hillenius,您好!
 
  Adding a sort() method is flexible, but how to sort by the occurrence 
 order of the form fields ? 




=== 2005-05-17 20:46:42 您在来信中写道:===

 

  

>I refactored FeedbackMessages, FeedbackPanel and
>FormComponentFeedbackBorder so that it is easier to use and to extend.
>One of the things I added is that you can now set a comparator on
>FeedbackPanel for any sorting you want.
>
>Good luck,
>
>Eelco
>
>
>---
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>___
>Wicket-user mailing list
>Wicket-user@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/wicket-user
>   
>
>
>
= = = = = = = = = = = = = = = = = = = =


致
礼!

 
叶卫国
[EMAIL PROTECTED]
  2005-05-21

N?S^甸?X??'%y*Zq浒y?旦?Ф?z?~*於???庄zZ)z抚??I?硅龙+???%y*Zq浒y?旦?m,vw(??秀]?Z??8??'$Z'$z郜z???X?h??标玷????(悍~?zw?X?襄?b???'$z郜er==

  

>>>
>>>---
>>>This SF.Net email is sponsored by Oracle Space Sweepstakes
>>>Want to be the first software developer in space?
>>>Enter now for the Oracle Space Sweepstakes!
>>>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
>>>___
>>>Wicket-user mailing list
>>>Wicket-user@lists.sourceforge.net
>>>https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>
>>>
>
>

= = = = = = = = = = = = = = = = = = = =


致
礼!
 
 
叶卫国
[EMAIL PROTECTED]
  2005-05-21