You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Fernando Wermus <fe...@gmail.com> on 2009/09/09 17:12:41 UTC

ResourceModel and getting the key in it

Hi all,    I use a resourceModel to show some titles in my menu bar. But, I
also use this key as a way to construct new keys for another components
information. For instance,

menubar.client.title=this is a title for an item in the menu bar about a
client
menustatus.client.title=this is a title for the menustatus about a client

My key is "client" and I have a:

 new ResourceModel("menubar.client.title")
 new ResourceModel("menustatus.client.title");   // this key is constructed
once the user pressed on item "menubar.client.title"


That's way, I would like to get the resource key stored in resourceModel,
but I cant. I just have method getObject(), which resolve the key, but I
dont have any method to return the key itself.


Thanks in advance and I hope you understand my need.


-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

Re: ResourceModel and getting the key in it

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
You can extend the model no problem... catch the key at your constructor.

**
Martin

2009/9/9 Fernando Wermus <fe...@gmail.com>:
> Another option or should I fill up a Jira?
>
> On Wed, Sep 9, 2009 at 12:46 PM, Fernando Wermus
> <fe...@gmail.com>wrote:
>
>> I cant because the attribute is private
>>
>>
>> On Wed, Sep 9, 2009 at 12:21 PM, Martin Makundi <
>> martin.makundi@koodaripalvelut.com> wrote:
>>
>>> Just extend it?
>>>
>>> **
>>> Martin
>>>
>>> 2009/9/9 Fernando Wermus <fe...@gmail.com>:
>>> > Hi all,    I use a resourceModel to show some titles in my menu bar.
>>> But, I
>>> > also use this key as a way to construct new keys for another components
>>> > information. For instance,
>>> >
>>> > menubar.client.title=this is a title for an item in the menu bar about a
>>> > client
>>> > menustatus.client.title=this is a title for the menustatus about a
>>> client
>>> >
>>> > My key is "client" and I have a:
>>> >
>>> >  new ResourceModel("menubar.client.title")
>>> >  new ResourceModel("menustatus.client.title");   // this key is
>>> constructed
>>> > once the user pressed on item "menubar.client.title"
>>> >
>>> >
>>> > That's way, I would like to get the resource key stored in
>>> resourceModel,
>>> > but I cant. I just have method getObject(), which resolve the key, but I
>>> > dont have any method to return the key itself.
>>> >
>>> >
>>> > Thanks in advance and I hope you understand my need.
>>> >
>>> >
>>> > --
>>> > Fernando Wermus.
>>> >
>>> > www.linkedin.com/in/fernandowermus
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>> --
>> Fernando Wermus.
>>
>> www.linkedin.com/in/fernandowermus
>>
>
>
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>

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


Re: ResourceModel and getting the key in it

Posted by Pedro Santos <pe...@gmail.com>.
The ResourceModel just call:

Application.get().getResourceSettings().getLocalizer().getString(resourceKey,
(Component)null, defaultValue)

using the resourceKey you parse. You can call getString of your localizer by
your own, using your assembled resourceKey

On Wed, Sep 9, 2009 at 12:47 PM, Fernando Wermus
<fe...@gmail.com>wrote:

> Another option or should I fill up a Jira?
>
> On Wed, Sep 9, 2009 at 12:46 PM, Fernando Wermus
> <fe...@gmail.com>wrote:
>
> > I cant because the attribute is private
> >
> >
> > On Wed, Sep 9, 2009 at 12:21 PM, Martin Makundi <
> > martin.makundi@koodaripalvelut.com> wrote:
> >
> >> Just extend it?
> >>
> >> **
> >> Martin
> >>
> >> 2009/9/9 Fernando Wermus <fe...@gmail.com>:
> >> > Hi all,    I use a resourceModel to show some titles in my menu bar.
> >> But, I
> >> > also use this key as a way to construct new keys for another
> components
> >> > information. For instance,
> >> >
> >> > menubar.client.title=this is a title for an item in the menu bar about
> a
> >> > client
> >> > menustatus.client.title=this is a title for the menustatus about a
> >> client
> >> >
> >> > My key is "client" and I have a:
> >> >
> >> >  new ResourceModel("menubar.client.title")
> >> >  new ResourceModel("menustatus.client.title");   // this key is
> >> constructed
> >> > once the user pressed on item "menubar.client.title"
> >> >
> >> >
> >> > That's way, I would like to get the resource key stored in
> >> resourceModel,
> >> > but I cant. I just have method getObject(), which resolve the key, but
> I
> >> > dont have any method to return the key itself.
> >> >
> >> >
> >> > Thanks in advance and I hope you understand my need.
> >> >
> >> >
> >> > --
> >> > Fernando Wermus.
> >> >
> >> > www.linkedin.com/in/fernandowermus
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
> > --
> > Fernando Wermus.
> >
> > www.linkedin.com/in/fernandowermus
> >
>
>
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>

Re: ResourceModel and getting the key in it

Posted by Fernando Wermus <fe...@gmail.com>.
Another option or should I fill up a Jira?

On Wed, Sep 9, 2009 at 12:46 PM, Fernando Wermus
<fe...@gmail.com>wrote:

> I cant because the attribute is private
>
>
> On Wed, Sep 9, 2009 at 12:21 PM, Martin Makundi <
> martin.makundi@koodaripalvelut.com> wrote:
>
>> Just extend it?
>>
>> **
>> Martin
>>
>> 2009/9/9 Fernando Wermus <fe...@gmail.com>:
>> > Hi all,    I use a resourceModel to show some titles in my menu bar.
>> But, I
>> > also use this key as a way to construct new keys for another components
>> > information. For instance,
>> >
>> > menubar.client.title=this is a title for an item in the menu bar about a
>> > client
>> > menustatus.client.title=this is a title for the menustatus about a
>> client
>> >
>> > My key is "client" and I have a:
>> >
>> >  new ResourceModel("menubar.client.title")
>> >  new ResourceModel("menustatus.client.title");   // this key is
>> constructed
>> > once the user pressed on item "menubar.client.title"
>> >
>> >
>> > That's way, I would like to get the resource key stored in
>> resourceModel,
>> > but I cant. I just have method getObject(), which resolve the key, but I
>> > dont have any method to return the key itself.
>> >
>> >
>> > Thanks in advance and I hope you understand my need.
>> >
>> >
>> > --
>> > Fernando Wermus.
>> >
>> > www.linkedin.com/in/fernandowermus
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>



-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

Re: ResourceModel and getting the key in it

Posted by Fernando Wermus <fe...@gmail.com>.
I cant because the attribute is private

On Wed, Sep 9, 2009 at 12:21 PM, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:

> Just extend it?
>
> **
> Martin
>
> 2009/9/9 Fernando Wermus <fe...@gmail.com>:
> > Hi all,    I use a resourceModel to show some titles in my menu bar. But,
> I
> > also use this key as a way to construct new keys for another components
> > information. For instance,
> >
> > menubar.client.title=this is a title for an item in the menu bar about a
> > client
> > menustatus.client.title=this is a title for the menustatus about a client
> >
> > My key is "client" and I have a:
> >
> >  new ResourceModel("menubar.client.title")
> >  new ResourceModel("menustatus.client.title");   // this key is
> constructed
> > once the user pressed on item "menubar.client.title"
> >
> >
> > That's way, I would like to get the resource key stored in resourceModel,
> > but I cant. I just have method getObject(), which resolve the key, but I
> > dont have any method to return the key itself.
> >
> >
> > Thanks in advance and I hope you understand my need.
> >
> >
> > --
> > Fernando Wermus.
> >
> > www.linkedin.com/in/fernandowermus
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

Re: ResourceModel and getting the key in it

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Just extend it?

**
Martin

2009/9/9 Fernando Wermus <fe...@gmail.com>:
> Hi all,    I use a resourceModel to show some titles in my menu bar. But, I
> also use this key as a way to construct new keys for another components
> information. For instance,
>
> menubar.client.title=this is a title for an item in the menu bar about a
> client
> menustatus.client.title=this is a title for the menustatus about a client
>
> My key is "client" and I have a:
>
>  new ResourceModel("menubar.client.title")
>  new ResourceModel("menustatus.client.title");   // this key is constructed
> once the user pressed on item "menubar.client.title"
>
>
> That's way, I would like to get the resource key stored in resourceModel,
> but I cant. I just have method getObject(), which resolve the key, but I
> dont have any method to return the key itself.
>
>
> Thanks in advance and I hope you understand my need.
>
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>

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