Re: Use a property file to change the choose one option

2018-06-26 Thread Maxim Solodovnik
https://ci.apache.org/projects/wicket/guide/8.x/single.html#_localization_of_component_s_choices

On Tue, Jun 26, 2018 at 3:41 PM JavaTraveler  wrote:

> Hello everyone, I have another question.
>
> Where do you put the properties file to change the label of the null option
> for a dropdownchoice ?
> Next to your java class ? Can you put in the same arboresence in resources,
> like for the css files ?
>
> And what do you write in it ?
> .null ? .nullvalid ?
>
>
> My dropdown has it's "setNullValid" to false.
>
> I found multiple solutions on the internet, but none have worked yet.
>
> --
> Sent from:
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-- 
WBR
Maxim aka solomax


Use a property file to change the choose one option

2018-06-26 Thread JavaTraveler
Hello everyone, I have another question.

Where do you put the properties file to change the label of the null option
for a dropdownchoice ?
Next to your java class ? Can you put in the same arboresence in resources,
like for the css files ?

And what do you write in it ?
.null ? .nullvalid ?


My dropdown has it's "setNullValid" to false.

I found multiple solutions on the internet, but none have worked yet.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: FormValidators and messages property file

2014-10-02 Thread Martin Grigorov
Hi,

As I said the simplest is to just use form.error("the.key"):

@Override
public void validate(Form form)
{
Date fromDate = fromDateFormComponent.getConvertedInput();
Date toDate = toDateFormComponent.getConvertedInput();

if (fromDate != null
 && toDate != null
 && fromDate.after(toDate))
{
form.error(getClass().getSimpleName() + "." +
"fromDateAfterToDate");
}
}


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 2, 2014 at 12:30 AM, msalman  wrote:

> Well, I wanted these to be independent validation classes.  But now it
> seems
> like a bad idea.  I will make them part of the form.
>
> Martin, your comments and help are much appreciated.
>
> Thanks.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767p4667790.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: FormValidators and messages property file

2014-10-01 Thread msalman
Well, I wanted these to be independent validation classes.  But now it seems
like a bad idea.  I will make them part of the form.

Martin, your comments and help are much appreciated.

Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767p4667790.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: FormValidators and messages property file

2014-10-01 Thread Martin Grigorov
Hi,

I see what happens.
form.getString() would work because of
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/resource/loader/ValidatorStringResourceLoader.java#L100
But using ValidationError has no reference to the form, and thus its form
validators, and it fails.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Oct 1, 2014 at 7:04 PM, msalman  wrote:

> Hi Martin,
>
> Thanks for your help.  That worked but I had to do a few extra things such
> as setting the values for '${label0}', etc.  What I don't get is why do we
> need to do this extra thing for Form validation classes (extending
> AbstractFormValidator) but not for component validation classes
> (implementing IValidator).
>
>
>
> For others who may face the same problem, this is how got it working:
>
>
> @Override
> public void validate(Form form)
> {
> Date fromDate = fromDateFormComponent.getConvertedInput();
> Date toDate = toDateFormComponent.getConvertedInput();
>
> if (fromDate != null
>  && toDate != null
>  && fromDate.after(toDate))
> {
> ClassStringResourceLoader loader = new
> ClassStringResourceLoader(FromDateBeforeToDate.class);
>
>
> Application.get().getResourceSettings().getStringResourceLoaders().add(loader);
>

I hope this is not your real code for production.
This will add the loader to the list of loaders on every validation.


>
> ValidationError error = new ValidationError();
> error.addMessageKey(getClass().getSimpleName() +
> "." +
> "fromDateAfterToDate");
> error.setVariable("label0",
> fromDateFormComponent.getLabel().getObject());
> error.setVariable("label1",
> toDateFormComponent.getLabel().getObject());
>
>
> fromDateFormComponent.newValidatable().error(error);
> }
> }
>
>
>
>  FromDateBeforeToDate.properties
>
> FromDateBeforeToDate.fromDateAfterToDate=Invalid input: The '${label}' date
> is after the '${label}' date
>
>
> I thank you again for teh quick and helpful response.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767p4667783.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: FormValidators and messages property file

2014-10-01 Thread msalman
Hi Martin,

Thanks for your help.  That worked but I had to do a few extra things such
as setting the values for '${label0}', etc.  What I don't get is why do we
need to do this extra thing for Form validation classes (extending
AbstractFormValidator) but not for component validation classes
(implementing IValidator).



For others who may face the same problem, this is how got it working:


@Override
public void validate(Form form) 
{
Date fromDate = fromDateFormComponent.getConvertedInput();
Date toDate = toDateFormComponent.getConvertedInput();

if (fromDate != null
 && toDate != null
 && fromDate.after(toDate))
{ 
ClassStringResourceLoader loader = new
ClassStringResourceLoader(FromDateBeforeToDate.class);

Application.get().getResourceSettings().getStringResourceLoaders().add(loader);

ValidationError error = new ValidationError();
error.addMessageKey(getClass().getSimpleName() + "." +
"fromDateAfterToDate");
error.setVariable("label0",
fromDateFormComponent.getLabel().getObject());
error.setVariable("label1", 
toDateFormComponent.getLabel().getObject());

fromDateFormComponent.newValidatable().error(error);

}   
}



 FromDateBeforeToDate.properties 

FromDateBeforeToDate.fromDateAfterToDate=Invalid input: The '${label}' date
is after the '${label}' date


I thank you again for teh quick and helpful response.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767p4667783.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: FormValidators and messages property file

2014-09-30 Thread Martin Grigorov
Hi,

According to
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/resource/loader/ValidatorStringResourceLoader.java#L62
it should work !
There is even a test for this:
https://github.com/apache/wicket/tree/master/wicket-core/src/test/java/org/apache/wicket/resource/loader

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Sep 30, 2014 at 9:36 PM, msalman  wrote:

> Hi,
>
> I have created form validator classes as shown below.  The problem is that
> the code is not picking up messages from the corresponding
> 'FromDateBeforeToDate.properties' file in the same package. It works if the
> messages are in the page.properties or application.properties file.
>
> I can see works OK for class implementing IValidator but can't seem to make
> it work for class extending AbstractFormValidator.Are my expectations
> wrong?  If not then please tell me how I can fix the code.
>
>
>
> public class FromDateBeforeToDate extends AbstractFormValidator
> {
>
> /**
>  *
>  */
> private static final long serialVersionUID = 3503966266288025266L;
>
>
> DateField fromDateFormComponent;
> DateField toDateFormComponent;
>
>
> public FromDateBeforeToDate(
> DateField fromDateFormComponent,
> DateField toDateFormComponent)
> {
> if (fromDateFormComponent == null)
> {
> throw new IllegalArgumentException("Argument
> dateFromFormComponent cannot
> be null");
> }
> this.fromDateFormComponent = fromDateFormComponent;
>
>
> if (toDateFormComponent == null)
> {
> throw new IllegalArgumentException("Argument
> dateToFormComponent cannot
> be null");
> }
> this.toDateFormComponent = toDateFormComponent;
> }
>
>
> @Override
> public FormComponent[] getDependentFormComponents()
> {
> return new FormComponent[]
> {
> fromDateFormComponent,
> toDateFormComponent,
> };
> }
>
>
>
> @Override
> public void validate(Form form)
> {
> Date fromDate = fromDateFormComponent.getConvertedInput();
> Date toDate = toDateFormComponent.getConvertedInput();
>
> if (fromDate != null
>  && toDate != null
>  && fromDate.after(toDate))
> {
> //error(fromDateFormComponent,
> "fromDateAfterToDate");
>
> ValidationError error = new ValidationError();
> error.addMessageKey(getClass().getSimpleName() +
> "." +
> "fromDateAfterToDate");
>
> fromDateFormComponent.newValidatable().error(error);
> //this.error(fromDateFormComponent);
> }
> }
> }
>
> FromDateBeforeToDate.properties
>
> #fromDateAfterToDate=Invalid input: The '${label}' date is after the
> '${label}' date
> FromDateBeforeToDate.fromDateAfterToDate=Invalid input: The '${label}' date
> is after the '${label}' date
>
>
>
> Thanks.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


FormValidators and messages property file

2014-09-30 Thread msalman
Hi,

I have created form validator classes as shown below.  The problem is that
the code is not picking up messages from the corresponding
'FromDateBeforeToDate.properties' file in the same package. It works if the
messages are in the page.properties or application.properties file.   

I can see works OK for class implementing IValidator but can't seem to make
it work for class extending AbstractFormValidator.Are my expectations
wrong?  If not then please tell me how I can fix the code.



public class FromDateBeforeToDate extends AbstractFormValidator
{

/**
 * 
 */
private static final long serialVersionUID = 3503966266288025266L;


DateField fromDateFormComponent;
DateField toDateFormComponent;


public FromDateBeforeToDate(
DateField fromDateFormComponent,
DateField toDateFormComponent)
{
if (fromDateFormComponent == null)
{
throw new IllegalArgumentException("Argument 
dateFromFormComponent cannot
be null");
}
this.fromDateFormComponent = fromDateFormComponent;


if (toDateFormComponent == null)
{
throw new IllegalArgumentException("Argument 
dateToFormComponent cannot
be null");
}
this.toDateFormComponent = toDateFormComponent; 
}


@Override
public FormComponent[] getDependentFormComponents() 
{
return new FormComponent[]
{
fromDateFormComponent,
toDateFormComponent,
};
}



@Override
public void validate(Form form) 
{
Date fromDate = fromDateFormComponent.getConvertedInput();
Date toDate = toDateFormComponent.getConvertedInput();

if (fromDate != null
 && toDate != null
 && fromDate.after(toDate))
{ 
//error(fromDateFormComponent, "fromDateAfterToDate");

ValidationError error = new ValidationError();
error.addMessageKey(getClass().getSimpleName() + "." +
"fromDateAfterToDate");
fromDateFormComponent.newValidatable().error(error);
//this.error(fromDateFormComponent);
}   
}
}

FromDateBeforeToDate.properties

#fromDateAfterToDate=Invalid input: The '${label}' date is after the
'${label}' date
FromDateBeforeToDate.fromDateAfterToDate=Invalid input: The '${label}' date
is after the '${label}' date



Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767.html
Sent from the Users forum mailing list archive at Nabble.com.

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



property file and stringresourcemodel

2011-05-06 Thread Clément Tamisier
Hi,

I am wondering about stringresourcemodel stategy to retrieve label in
properties file.

In the join project which can be launch with "mvn clean compile jetty:run" :

I run

public class MyModalWindow extends ModalWindow {

private static int height = 700;

public MyModalWindow(String id) {
super(id);
StringResourceModel title = *new StringResourceModel("title",
MyModalWindow.this, null);*
 setTitle(title);
setInitialHeight(height -= 60);
}
}

but wicket don't take "title" property in *MyModalWindow.properties *but in
the root component properties file. (WebPage extended by HelloWorld then
taken in *HelloWorld.properties*).

Am I doing wrong ? do you have any ideas ?

Thank you

Clément


bug.tar.gz
Description: GNU Zip compressed data

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

Re: "Shared" message property file not working on 1.4

2010-11-25 Thread Martin Grigorov
you can use com/example/something/package.properties
or MyApplication.properties (global)

On Thu, Nov 25, 2010 at 11:12 AM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> Another possibility is that had your own IStringResourceLoader registered
> via
> getResourceSettings().addStringResourceLoader(new MyResourceLoader())?
>
> Ernesto
>
> On Thu, Nov 25, 2010 at 10:57 AM, andrea.castello
>  wrote:
> >
> > Hi,
> >
> >
> > Martin Grigorov-4 wrote:
> >>
> >> What is the relation between CarMessages.java (if there is such file)
> >> and CarDetail.java
> >> ?
> >> Does the one extend/implement the other ?
> >>
> >> On Thu, Nov 25, 2010 at 10:11 AM, adam.gibbons
> >> wrote:
> >>
> >
> > There's no CarMessages.java, just the two I mentioned, which are not
> > apparently related (that surprieses me a bit)
> >
> > CarDetail extends a generic DetailPanel class (which extends Wicket's
> > panel), while CarListPage extends a genric ListPage...so apparently no
> > relation between the two. I wonder how they could work with just the
> > Carmessages.properties resource...anyway. How can I use package resource?
> Is
> > there a convention to do it in 1.4?
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Shared-message-property-file-not-working-on-1-4-tp3058612p3058686.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: "Shared" message property file not working on 1.4

2010-11-25 Thread Ernesto Reinaldo Barreiro
Another possibility is that had your own IStringResourceLoader registered via
getResourceSettings().addStringResourceLoader(new MyResourceLoader())?

Ernesto

On Thu, Nov 25, 2010 at 10:57 AM, andrea.castello
 wrote:
>
> Hi,
>
>
> Martin Grigorov-4 wrote:
>>
>> What is the relation between CarMessages.java (if there is such file)
>> and CarDetail.java
>> ?
>> Does the one extend/implement the other ?
>>
>> On Thu, Nov 25, 2010 at 10:11 AM, adam.gibbons
>> wrote:
>>
>
> There's no CarMessages.java, just the two I mentioned, which are not
> apparently related (that surprieses me a bit)
>
> CarDetail extends a generic DetailPanel class (which extends Wicket's
> panel), while CarListPage extends a genric ListPage...so apparently no
> relation between the two. I wonder how they could work with just the
> Carmessages.properties resource...anyway. How can I use package resource? Is
> there a convention to do it in 1.4?
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Shared-message-property-file-not-working-on-1-4-tp3058612p3058686.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: "Shared" message property file not working on 1.4

2010-11-25 Thread andrea.castello

Hi,


Martin Grigorov-4 wrote:
> 
> What is the relation between CarMessages.java (if there is such file)
> and CarDetail.java
> ?
> Does the one extend/implement the other ?
> 
> On Thu, Nov 25, 2010 at 10:11 AM, adam.gibbons
> wrote:
> 

There's no CarMessages.java, just the two I mentioned, which are not
apparently related (that surprieses me a bit)

CarDetail extends a generic DetailPanel class (which extends Wicket's
panel), while CarListPage extends a genric ListPage...so apparently no
relation between the two. I wonder how they could work with just the
Carmessages.properties resource...anyway. How can I use package resource? Is
there a convention to do it in 1.4?
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Shared-message-property-file-not-working-on-1-4-tp3058612p3058686.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: "Shared" message property file not working on 1.4

2010-11-25 Thread Martin Grigorov
What is the relation between CarMessages.java (if there is such file)
and CarDetail.java
?
Does the one extend/implement the other ?

On Thu, Nov 25, 2010 at 10:11 AM, adam.gibbons wrote:

>
> How about better architecture? Using a database instead of a file would be
> much nicer. With proper caching there's little to no difference in terms of
> performance than using a file.
>
> Cheers,
> Adam
>
> On 25 November 2010 09:07, andrea.castello [via Apache Wicket] <
> ml-node+3058612-308220060-201...@n4.nabble.com
> 
> >
> > wrote:
>
> > Hi, here's a new episode of my Wicket "upgrade saga".
> > Hope I'm not disturbing anyone :D
> >
> > In my application developed with Wicket 1.3.6 I have a
> > CarMessages.properties file which was sort of "shared" by two classes
> > CarListPage and CarDetail, since they use the same messages.
> > When I upgraded to 1.4 all the labels in CarMessages.properties are not
> > resolved anymore.
> >
> > I solved the problem by creating two new properties file
> > CarListPage.properties and CarDetail.properties and it all works fine,
> but
> > this is kind of awful because I need to duplicate the messages in these
> two
> > files.
> >
> > Is there any other way I can workaround this problem?
> >
> > Thanks,
> >
> > Andrea
> >
> > --
> >  View message @
> >
> http://apache-wicket.1842946.n4.nabble.com/Shared-message-property-file-not-working-on-1-4-tp3058612p3058612.html
> > To start a new topic under Apache Wicket, email
> > ml-node+1842946-1499480286-201...@n4.nabble.com
> 
> >
> > To unsubscribe from Apache Wicket, click here<
> http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1842946&code=YWRhbS5zLmdpYmJvbnNAZ21haWwuY29tfDE4NDI5NDZ8LTUzNzMyMDU4OQ==
> >.
> >
> >
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Shared-message-property-file-not-working-on-1-4-tp3058612p3058616.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: "Shared" message property file not working on 1.4

2010-11-25 Thread Ernesto Reinaldo Barreiro
How was this CarMessages.properties shared by the two classes? If your
car CarListPage uses CarDetail placing them on CarListPage should be
enough, AFAIK. Additionally on 1.4.X I think package level resource
files are supported.

Ernesto

On Thu, Nov 25, 2010 at 10:07 AM, andrea.castello
 wrote:
>
> Hi, here's a new episode of my Wicket "upgrade saga".
> Hope I'm not disturbing anyone :D
>
> In my application developed with Wicket 1.3.6 I have a
> CarMessages.properties file which was sort of "shared" by two classes
> CarListPage and CarDetail, since they use the same messages.
> When I upgraded to 1.4 all the labels in CarMessages.properties are not
> resolved anymore.
>
> I solved the problem by creating two new properties file
> CarListPage.properties and CarDetail.properties and it all works fine, but
> this is kind of awful because I need to duplicate the messages in these two
> files.
>
> Is there any other way I can workaround this problem?
>
> Thanks,
>
> Andrea
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Shared-message-property-file-not-working-on-1-4-tp3058612p3058612.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: "Shared" message property file not working on 1.4

2010-11-25 Thread adam.gibbons

How about better architecture? Using a database instead of a file would be
much nicer. With proper caching there's little to no difference in terms of
performance than using a file.

Cheers,
Adam

On 25 November 2010 09:07, andrea.castello [via Apache Wicket] <
ml-node+3058612-308220060-201...@n4.nabble.com
> wrote:

> Hi, here's a new episode of my Wicket "upgrade saga".
> Hope I'm not disturbing anyone :D
>
> In my application developed with Wicket 1.3.6 I have a
> CarMessages.properties file which was sort of "shared" by two classes
> CarListPage and CarDetail, since they use the same messages.
> When I upgraded to 1.4 all the labels in CarMessages.properties are not
> resolved anymore.
>
> I solved the problem by creating two new properties file
> CarListPage.properties and CarDetail.properties and it all works fine, but
> this is kind of awful because I need to duplicate the messages in these two
> files.
>
> Is there any other way I can workaround this problem?
>
> Thanks,
>
> Andrea
>
> --
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/Shared-message-property-file-not-working-on-1-4-tp3058612p3058612.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-1499480286-201...@n4.nabble.com
> To unsubscribe from Apache Wicket, click 
> here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1842946&code=YWRhbS5zLmdpYmJvbnNAZ21haWwuY29tfDE4NDI5NDZ8LTUzNzMyMDU4OQ==>.
>
>

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Shared-message-property-file-not-working-on-1-4-tp3058612p3058616.html
Sent from the Users forum mailing list archive at Nabble.com.

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



"Shared" message property file not working on 1.4

2010-11-25 Thread andrea.castello

Hi, here's a new episode of my Wicket "upgrade saga".
Hope I'm not disturbing anyone :D

In my application developed with Wicket 1.3.6 I have a
CarMessages.properties file which was sort of "shared" by two classes
CarListPage and CarDetail, since they use the same messages.
When I upgraded to 1.4 all the labels in CarMessages.properties are not
resolved anymore.

I solved the problem by creating two new properties file
CarListPage.properties and CarDetail.properties and it all works fine, but
this is kind of awful because I need to duplicate the messages in these two
files.

Is there any other way I can workaround this problem?

Thanks,

Andrea
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Shared-message-property-file-not-working-on-1-4-tp3058612p3058612.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: "Choose One" Text Without Property File?

2010-03-24 Thread Pedro Santos
You can add to your application an Localizer that return the user designated
verbiage for the string key "null"

On Wed, Mar 24, 2010 at 12:51 PM, Matthias Keller
wrote:

> Hi Brad
>
> You'd probably have to subclass DropDownChoice and override the method
> getDefaultChoice() to return whatever value you'd like.
>
> Matt
>
>
> On 2010-03-24 16:45, Brad Grier wrote:
>
>> I'd like to be able to change the "Choose One" text for a DropDownChoice
>> without using a property file. I have a dynamic form generator and I need
>> the user to be able to designate the verbiage. Is this possible?
>>
>> Thanks,
>> Brad
>>
>>
>
>
>
>


-- 
Pedro Henrique Oliveira dos Santos


Re: "Choose One" Text Without Property File?

2010-03-24 Thread Matthias Keller

Hi Brad

You'd probably have to subclass DropDownChoice and override the method 
getDefaultChoice() to return whatever value you'd like.


Matt

On 2010-03-24 16:45, Brad Grier wrote:

I'd like to be able to change the "Choose One" text for a DropDownChoice 
without using a property file. I have a dynamic form generator and I need the user to be 
able to designate the verbiage. Is this possible?

Thanks,
Brad
   






smime.p7s
Description: S/MIME Cryptographic Signature


"Choose One" Text Without Property File?

2010-03-24 Thread Brad Grier
I'd like to be able to change the "Choose One" text for a DropDownChoice 
without using a property file. I have a dynamic form generator and I need the 
user to be able to designate the verbiage. Is this possible?

Thanks,
Brad

Re: property file location feature request (ComponentStringResourceLoader)

2010-02-04 Thread pete swulius
For future reference.
https://issues.apache.org/jira/browse/WICKET-2713


Re: property file location feature request (ComponentStringResourceLoader)

2010-01-31 Thread Igor Vaynberg
i think this is due to historical reasons, the path is kept together
in references as a single string. feel free to add an rfe for this, i
think we are already working on this in 1.5 but an rfe in jira will
help us remember.

-igor

On Sun, Jan 31, 2010 at 1:41 PM, pete swulius  wrote:
> Everyone,
>
> I am curious.  Why are .properties files not located in the same way as
> .html?  I've overridden:
>
> [ResourceStreamLocator]
> public IResourceStream locate( Class clazz, String aPath, String aStyle,
> Locale aLocale, String anExtension )
>
> I notice that property file locating doesn't invoke this method, but only
> invokes the lesser arg version with the style/variation/locale already
> embedded in the path.  This is an inconvenience for me because I'm trying to
> inspect the style during location.  Perhaps I shouldn't be doing what I'm
> trying to do, but after reading the docs, I expected locating to work the
> way it does for .html, but .properties threw me.
>
> Thanks!  And again, thanks to all contributors for making such an awesome
> product.
>
> Peter Swulius
>

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



property file location feature request (ComponentStringResourceLoader)

2010-01-31 Thread pete swulius
Everyone,

I am curious.  Why are .properties files not located in the same way as
.html?  I've overridden:

[ResourceStreamLocator]
public IResourceStream locate( Class clazz, String aPath, String aStyle,
Locale aLocale, String anExtension )

I notice that property file locating doesn't invoke this method, but only
invokes the lesser arg version with the style/variation/locale already
embedded in the path.  This is an inconvenience for me because I'm trying to
inspect the style during location.  Perhaps I shouldn't be doing what I'm
trying to do, but after reading the docs, I expected locating to work the
way it does for .html, but .properties threw me.

Thanks!  And again, thanks to all contributors for making such an awesome
product.

Peter Swulius


Re: How to insert ${...} literal in property file?

2009-03-30 Thread Martijn Dashorst
1. Please file a jira
2. Use 2 patternvalidators: one for each pattern

Martijn

On 3/30/09, Heidi Burn  wrote:
> Hello, guys,
>
> Please, help me to insert ${id} literal in a property file. Back
> slashes don't work for me.
> And how to tell PatternValidator to work differently for two fields in a
> form?
>
> Heidi
>
> -
> 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.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



How to insert ${...} literal in property file?

2009-03-30 Thread Heidi Burn
Hello, guys,

Please, help me to insert ${id} literal in a property file. Back
slashes don't work for me.
And how to tell PatternValidator to work differently for two fields in a form?

Heidi

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



Re: how to get values from a property file

2008-09-22 Thread Eyal Golan
OK,
that's an option which I moved to.
Is there another way?

On Mon, Sep 22, 2008 at 3:22 PM, Uwe Schäfer <[EMAIL PROTECTED]>wrote:

> Eyal Golan schrieb:
>
>>ResourceModel rmAsc = new
>> ResourceModel("Reports.Parameters.ascending");
>>String ascending = (String) rmAsc.getObject();
>>
>
> if it were an inner class, you could just
>
> String ascending = getString("Reports.Parameters.ascending");
>
> cu uwe
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P Save a tree. Please don't print this e-mail unless it's really necessary


Re: how to get values from a property file

2008-09-22 Thread Uwe Schäfer

Eyal Golan schrieb:

ResourceModel rmAsc = new
ResourceModel("Reports.Parameters.ascending");
String ascending = (String) rmAsc.getObject();


if it were an inner class, you could just

String ascending = getString("Reports.Parameters.ascending");

cu uwe

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



how to get values from a property file

2008-09-22 Thread Eyal Golan
Hi,
I have this Model:
public final class SortOptionsModel extends AbstractReadOnlyModel {
private static final long serialVersionUID = -772846448053016L;
private final List sortOptions;
public SortOptionsModel() {
ResourceModel rmAsc = new
ResourceModel("Reports.Parameters.ascending");
String ascending = (String) rmAsc.getObject();
ResourceModel rmDes = new
ResourceModel("Reports.Parameters.descending");
String descending = (String) rmDes.getObject();

sortOptions = new ArrayList();
sortOptions.add(ascending);
sortOptions.add(descending);
}
@Override
public Object getObject() {
return sortOptions;
}

}

I am pretty sure that the way I get the values is not the way I should.
How can I do that the Wicket way?

-- 
Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P Save a tree. Please don't print this e-mail unless it's really necessary


Re: MenuPanel gets menu item from the .property file

2008-07-23 Thread Rick Shen

I wish to store the menu item information in the properties file, so when I
add or remove one it is easy.




Nino.Martinez wrote:
> 
> Well it's just java, listview just requires a list or model that 
> contains lists.. So give it a list:)
> 
> If you are building a menu you can take a look at the accordion menu on 
> wicket stuff...
> 
> Rick Shen wrote:
>> I am write a MenuPanel using ListView. How can I load the each menu item
>> from
>> .property file (just like ASP.net menu control sitemap)? 
>>   
> 
> -- 
> -Wicket for love
> 
> Nino Martinez Wael
> Java Specialist @ Jayway DK
> http://www.jayway.dk
> +45 2936 7684
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/MenuPanel-gets-menu-item-from-the-.property-file-tp18604090p18605693.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: MenuPanel gets menu item from the .property file

2008-07-22 Thread Nino Saturnino Martinez Vazquez Wael
Well it's just java, listview just requires a list or model that 
contains lists.. So give it a list:)


If you are building a menu you can take a look at the accordion menu on 
wicket stuff...


Rick Shen wrote:

I am write a MenuPanel using ListView. How can I load the each menu item from
.property file (just like ASP.net menu control sitemap)? 
  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



MenuPanel gets menu item from the .property file

2008-07-22 Thread Rick Shen

I am write a MenuPanel using ListView. How can I load the each menu item from
.property file (just like ASP.net menu control sitemap)? 
-- 
View this message in context: 
http://www.nabble.com/MenuPanel-gets-menu-item-from-the-.property-file-tp18604090p18604090.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: property file

2008-04-07 Thread Korbinian Bachl - privat

Hi,

you mean for i8n issues?


if you want to use properties on your pages you dont need to mess with 
the file, just use it in your label or message-resource,
look here for some simple cases: 
http://cwiki.apache.org/WICKET/general-i18n-in-wicket.html


Best,

Korbinian

tbt schrieb:

Hi,

I like to know a way to read a property file the wicket way. Currently i'm
using the following code snippet but i get the
PackageResourceBlockedException.

/*...*/
Properties properties = new Properties();
properties.load(PackageResource.get(ApplicationProperties.class,
"app.properties").getResourceStream().getInputStream());
String propertyName = properties.getProperty(name);
propertyFile.close();
return propertyName;
/*...*/

Is this the correct way to get property files using wicket. My
app.properties file and ApplicationProperties.class is in the same package.
I like to know a way to load property files which are stored in the same
package as the class file.

Thanks
tbt




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



property file

2008-04-07 Thread tbt

Hi,

I like to know a way to read a property file the wicket way. Currently i'm
using the following code snippet but i get the
PackageResourceBlockedException.

/*...*/
Properties properties = new Properties();
properties.load(PackageResource.get(ApplicationProperties.class,
"app.properties").getResourceStream().getInputStream());
String propertyName = properties.getProperty(name);
propertyFile.close();
return propertyName;
/*...*/

Is this the correct way to get property files using wicket. My
app.properties file and ApplicationProperties.class is in the same package.
I like to know a way to load property files which are stored in the same
package as the class file.

Thanks
tbt


-- 
View this message in context: 
http://www.nabble.com/property-file-tp16537257p16537257.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic updating of property file

2008-03-19 Thread jnorris

Hi All,

I was able to get this to work for a tomcat deployment by adding the
"\WEB-INF\classes\ as shown in the code snippet below but this obviously
won't work with jetty for testing and is not generic. I'm sure there must be
a simple generic way to accomplish this using Wicket classes but I haven't
found anything in the archives that gives me a clue.

Any help in coming up with a generic solution would be appreciated!

Jim

Code Snippet:
String propsPath = PackageResource.get( ReportsPage.class, "ReportsPage.xml"
).getAbsolutePath();
File file = new File ( DemoApp.get().getServletContext().getRealPath(
"/WEB-INF/classes/" + propsPath ));
String absPath = file.getAbsolutePath();
StringBuffer sbuf =    // create the xml
Writer out = new BufferedWriter( new OutputStreamWriter( new
FileOutputStream( absPath ), "UTF8" ));
out.write( sbuf.toString());


jnorris wrote:
> 
> Hi all,
> 
> Does anyone know if it is possible to dynamically modify a property file
> or overwrite it using Wicket?  The property files are all in .xml format
> and the keys are taken from a database when a tree is dynamically built
> based on the values read in.  The keys are used in a StringResourceModel
> to provide the text for the tree nodes.  On another page, the admin user
> can add/edit new entries and I would like to also have the new or revised
> key-value data items written to the property file(s) (including supported
> locales) at the same time.  The app deployment is expanded.  I know I can
> get the path starting with the package nameusing getAbsolutePath() on a
> PackageResource but I'm not sure how to get the full path from the root
> folder.
> 
> Thanks,
> Jim
> 

-- 
View this message in context: 
http://www.nabble.com/Dynamic-updating-of-property-file-tp16146867p16148601.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic updating of property file

2008-03-19 Thread Igor Vaynberg
you could just write your own IStringResourceLoader and pull those
resources right out of the db

-igor


On Wed, Mar 19, 2008 at 10:19 AM, jnorris <[EMAIL PROTECTED]> wrote:
>
>  Hi all,
>
>  Does anyone know if it is possible to dynamically modify a property file or
>  overwrite it using Wicket?  The property files are all in .xml format and
>  the keys are taken from a database when a tree is dynamically built based on
>  the values read in.  The keys are used in a StringResourceModel to provide
>  the text for the tree nodes.  On another page, the admin user can add/edit
>  new entries and I would like to also have the new or revised key-value data
>  items written to the property file(s) (including supported locales) at the
>  same time.  The app deployment is expanded.  I know I can get the path
>  starting with the package nameusing getAbsolutePath() on a PackageResource
>  but I'm not sure how to get the full path from the root folder.
>
>  Thanks,
>  Jim
>  --
>  View this message in context: 
> http://www.nabble.com/Dynamic-updating-of-property-file-tp16146867p16146867.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>  -
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Dynamic updating of property file

2008-03-19 Thread jnorris

Hi all,

Does anyone know if it is possible to dynamically modify a property file or
overwrite it using Wicket?  The property files are all in .xml format and
the keys are taken from a database when a tree is dynamically built based on
the values read in.  The keys are used in a StringResourceModel to provide
the text for the tree nodes.  On another page, the admin user can add/edit
new entries and I would like to also have the new or revised key-value data
items written to the property file(s) (including supported locales) at the
same time.  The app deployment is expanded.  I know I can get the path
starting with the package nameusing getAbsolutePath() on a PackageResource
but I'm not sure how to get the full path from the root folder.

Thanks,
Jim
-- 
View this message in context: 
http://www.nabble.com/Dynamic-updating-of-property-file-tp16146867p16146867.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]