You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Chang <da...@yahoo.com> on 2010/02/28 22:00:32 UTC

Better way to find a parent compoent in page hiearchy?

I have two pages. The first page is extended by the second page. On the second page, I want to access a component on the first page. One way to do this is to make the component a member variable of the first page. I feel this way may have two drawbacks:

1. A member variable uses more resources (memory, clustring, etc.)
2. Not all pages extending the first page may need to access this component, which make it seem unnecessary for such pages.

Is there any more elegant way?

I just started Wicket programming for a personal project. Thanks for any input!

Regards, David


      

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


Make Wicket component ID HTML element ID?

Posted by David Chang <da...@yahoo.com>.
I have many Wicket components that are unique on pages. I would like to make their wicket ID HTML element ID instead of typing HTML id attribute. How can I do this?

Thanks!


      

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


Re: Better way to find a parent compoent in page hiearchy?

Posted by David Chang <da...@yahoo.com>.
Major, thanks for the info. You are right. I did not look down further along the wicket class hierarchy. 

Thanks!


--- On Sun, 2/28/10, Major Péter <ma...@sch.bme.hu> wrote:

> From: Major Péter <ma...@sch.bme.hu>
> Subject: Re: Better way to find a parent compoent in page hiearchy?
> To: users@wicket.apache.org
> Date: Sunday, February 28, 2010, 7:50 PM
> and the WebPage isn't a
> MarkupContainer or what??
> 
> 2010-02-28 23:54 keltezéssel, David Chang írta:
> > Thanks for your input. This is interesting. Somehow I
> got confused. 
> > 
> > Shouldn't this method be natural part of a Component?
> As you know, each component has child components, which is
> why a Wicket page has a hiearchy of components. 
> > 
> > Let's take MarkcupContainer for the moment. Using this
> class means I have to add another element in the markup
> page, which seems complicate thhings a bit and does not seem
> elegant.
> > 
> > Did I miss something?
> > 
> > Regards.
> > 
> > 
> > --- On Sun, 2/28/10, Major Péter <ma...@sch.bme.hu>
> wrote:
> > 
> >> From: Major Péter <ma...@sch.bme.hu>
> >> Subject: Re: Better way to find a parent compoent
> in page hiearchy?
> >> To: users@wicket.apache.org
> >> Date: Sunday, February 28, 2010, 4:20 PM
> >> Maybe, this will be good for you:
> >> http://wicketstuff.org/wicket13doc/org/apache/wicket/MarkupContainer.html#get(java.lang.String)
> >>
> >> Regards,
> >> Peter
> >>
> >> 2010-02-28 22:12 keltezéssel, David Chang írta:
> >>> igor, thanks for prompt help! 
> >>>
> >>> I can use
> Component#findParent(SomeClass.class) to
> >> find the first page. How can I further find the
> component by
> >> this Wicket ID? I need to overwrite its display
> value.
> >>>
> >>> Thanks again.
> >>>
> >>> --- On Sun, 2/28/10, Igor Vaynberg <ig...@gmail.com>
> >> wrote:
> >>>
> >>>> From: Igor Vaynberg <ig...@gmail.com>
> >>>> Subject: Re: Better way to find a parent
> compoent
> >> in page hiearchy?
> >>>> To: users@wicket.apache.org
> >>>> Date: Sunday, February 28, 2010, 4:04 PM
> >>>> Component#findParent(SomeClass.class)
> >>>> may be useful
> >>>>
> >>>> -igor
> >>>>
> >>>> On Sun, Feb 28, 2010 at 1:00 PM, David
> Chang
> >> <da...@yahoo.com>
> >>>> wrote:
> >>>>> I have two pages. The first page is
> extended
> >> by the
> >>>> second page. On the second page, I want to
> access
> >> a
> >>>> component on the first page. One way to do
> this is
> >> to make
> >>>> the component a member variable of the
> first page.
> >> I feel
> >>>> this way may have two drawbacks:
> >>>>>
> >>>>> 1. A member variable uses more
> resources
> >> (memory,
> >>>> clustring, etc.)
> >>>>> 2. Not all pages extending the first
> page may
> >> need to
> >>>> access this component, which make it seem
> >> unnecessary for
> >>>> such pages.
> >>>>>
> >>>>> Is there any more elegant way?
> >>>>>
> >>>>> I just started Wicket programming for
> a
> >> personal
> >>>> project. Thanks for any input!
> >>>>>
> >>>>> Regards, David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


      

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


Re: Better way to find a parent compoent in page hiearchy?

Posted by Major Péter <ma...@sch.bme.hu>.
and the WebPage isn't a MarkupContainer or what??

2010-02-28 23:54 keltezéssel, David Chang írta:
> Thanks for your input. This is interesting. Somehow I got confused. 
> 
> Shouldn't this method be natural part of a Component? As you know, each component has child components, which is why a Wicket page has a hiearchy of components. 
> 
> Let's take MarkcupContainer for the moment. Using this class means I have to add another element in the markup page, which seems complicate thhings a bit and does not seem elegant.
> 
> Did I miss something?
> 
> Regards.
> 
> 
> --- On Sun, 2/28/10, Major Péter <ma...@sch.bme.hu> wrote:
> 
>> From: Major Péter <ma...@sch.bme.hu>
>> Subject: Re: Better way to find a parent compoent in page hiearchy?
>> To: users@wicket.apache.org
>> Date: Sunday, February 28, 2010, 4:20 PM
>> Maybe, this will be good for you:
>> http://wicketstuff.org/wicket13doc/org/apache/wicket/MarkupContainer.html#get(java.lang.String)
>>
>> Regards,
>> Peter
>>
>> 2010-02-28 22:12 keltezéssel, David Chang írta:
>>> igor, thanks for prompt help! 
>>>
>>> I can use Component#findParent(SomeClass.class) to
>> find the first page. How can I further find the component by
>> this Wicket ID? I need to overwrite its display value.
>>>
>>> Thanks again.
>>>
>>> --- On Sun, 2/28/10, Igor Vaynberg <ig...@gmail.com>
>> wrote:
>>>
>>>> From: Igor Vaynberg <ig...@gmail.com>
>>>> Subject: Re: Better way to find a parent compoent
>> in page hiearchy?
>>>> To: users@wicket.apache.org
>>>> Date: Sunday, February 28, 2010, 4:04 PM
>>>> Component#findParent(SomeClass.class)
>>>> may be useful
>>>>
>>>> -igor
>>>>
>>>> On Sun, Feb 28, 2010 at 1:00 PM, David Chang
>> <da...@yahoo.com>
>>>> wrote:
>>>>> I have two pages. The first page is extended
>> by the
>>>> second page. On the second page, I want to access
>> a
>>>> component on the first page. One way to do this is
>> to make
>>>> the component a member variable of the first page.
>> I feel
>>>> this way may have two drawbacks:
>>>>>
>>>>> 1. A member variable uses more resources
>> (memory,
>>>> clustring, etc.)
>>>>> 2. Not all pages extending the first page may
>> need to
>>>> access this component, which make it seem
>> unnecessary for
>>>> such pages.
>>>>>
>>>>> Is there any more elegant way?
>>>>>
>>>>> I just started Wicket programming for a
>> personal
>>>> project. Thanks for any input!
>>>>>
>>>>> Regards, David

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


Re: Better way to find a parent compoent in page hiearchy?

Posted by David Chang <da...@yahoo.com>.
Thanks for your input. This is interesting. Somehow I got confused. 

Shouldn't this method be natural part of a Component? As you know, each component has child components, which is why a Wicket page has a hiearchy of components. 

Let's take MarkcupContainer for the moment. Using this class means I have to add another element in the markup page, which seems complicate thhings a bit and does not seem elegant.

Did I miss something?

Regards.


--- On Sun, 2/28/10, Major Péter <ma...@sch.bme.hu> wrote:

> From: Major Péter <ma...@sch.bme.hu>
> Subject: Re: Better way to find a parent compoent in page hiearchy?
> To: users@wicket.apache.org
> Date: Sunday, February 28, 2010, 4:20 PM
> Maybe, this will be good for you:
> http://wicketstuff.org/wicket13doc/org/apache/wicket/MarkupContainer.html#get(java.lang.String)
> 
> Regards,
> Peter
> 
> 2010-02-28 22:12 keltezéssel, David Chang írta:
> > igor, thanks for prompt help! 
> > 
> > I can use Component#findParent(SomeClass.class) to
> find the first page. How can I further find the component by
> this Wicket ID? I need to overwrite its display value.
> > 
> > Thanks again.
> > 
> > --- On Sun, 2/28/10, Igor Vaynberg <ig...@gmail.com>
> wrote:
> > 
> >> From: Igor Vaynberg <ig...@gmail.com>
> >> Subject: Re: Better way to find a parent compoent
> in page hiearchy?
> >> To: users@wicket.apache.org
> >> Date: Sunday, February 28, 2010, 4:04 PM
> >> Component#findParent(SomeClass.class)
> >> may be useful
> >>
> >> -igor
> >>
> >> On Sun, Feb 28, 2010 at 1:00 PM, David Chang
> <da...@yahoo.com>
> >> wrote:
> >>> I have two pages. The first page is extended
> by the
> >> second page. On the second page, I want to access
> a
> >> component on the first page. One way to do this is
> to make
> >> the component a member variable of the first page.
> I feel
> >> this way may have two drawbacks:
> >>>
> >>> 1. A member variable uses more resources
> (memory,
> >> clustring, etc.)
> >>> 2. Not all pages extending the first page may
> need to
> >> access this component, which make it seem
> unnecessary for
> >> such pages.
> >>>
> >>> Is there any more elegant way?
> >>>
> >>> I just started Wicket programming for a
> personal
> >> project. Thanks for any input!
> >>>
> >>> Regards, David
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> > 
> > 
> >       
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


      

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


Re: Better way to find a parent compoent in page hiearchy?

Posted by Major Péter <ma...@sch.bme.hu>.
Maybe, this will be good for you:
http://wicketstuff.org/wicket13doc/org/apache/wicket/MarkupContainer.html#get(java.lang.String)

Regards,
Peter

2010-02-28 22:12 keltezéssel, David Chang írta:
> igor, thanks for prompt help! 
> 
> I can use Component#findParent(SomeClass.class) to find the first page. How can I further find the component by this Wicket ID? I need to overwrite its display value.
> 
> Thanks again.
> 
> --- On Sun, 2/28/10, Igor Vaynberg <ig...@gmail.com> wrote:
> 
>> From: Igor Vaynberg <ig...@gmail.com>
>> Subject: Re: Better way to find a parent compoent in page hiearchy?
>> To: users@wicket.apache.org
>> Date: Sunday, February 28, 2010, 4:04 PM
>> Component#findParent(SomeClass.class)
>> may be useful
>>
>> -igor
>>
>> On Sun, Feb 28, 2010 at 1:00 PM, David Chang <da...@yahoo.com>
>> wrote:
>>> I have two pages. The first page is extended by the
>> second page. On the second page, I want to access a
>> component on the first page. One way to do this is to make
>> the component a member variable of the first page. I feel
>> this way may have two drawbacks:
>>>
>>> 1. A member variable uses more resources (memory,
>> clustring, etc.)
>>> 2. Not all pages extending the first page may need to
>> access this component, which make it seem unnecessary for
>> such pages.
>>>
>>> Is there any more elegant way?
>>>
>>> I just started Wicket programming for a personal
>> project. Thanks for any input!
>>>
>>> Regards, David
>>>
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
>       
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 

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


Re: Better way to find a parent compoent in page hiearchy?

Posted by David Chang <da...@yahoo.com>.
igor, thanks for prompt help! 

I can use Component#findParent(SomeClass.class) to find the first page. How can I further find the component by this Wicket ID? I need to overwrite its display value.

Thanks again.

--- On Sun, 2/28/10, Igor Vaynberg <ig...@gmail.com> wrote:

> From: Igor Vaynberg <ig...@gmail.com>
> Subject: Re: Better way to find a parent compoent in page hiearchy?
> To: users@wicket.apache.org
> Date: Sunday, February 28, 2010, 4:04 PM
> Component#findParent(SomeClass.class)
> may be useful
> 
> -igor
> 
> On Sun, Feb 28, 2010 at 1:00 PM, David Chang <da...@yahoo.com>
> wrote:
> > I have two pages. The first page is extended by the
> second page. On the second page, I want to access a
> component on the first page. One way to do this is to make
> the component a member variable of the first page. I feel
> this way may have two drawbacks:
> >
> > 1. A member variable uses more resources (memory,
> clustring, etc.)
> > 2. Not all pages extending the first page may need to
> access this component, which make it seem unnecessary for
> such pages.
> >
> > Is there any more elegant way?
> >
> > I just started Wicket programming for a personal
> project. Thanks for any input!
> >
> > Regards, David
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


      

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


Re: Better way to find a parent compoent in page hiearchy?

Posted by Igor Vaynberg <ig...@gmail.com>.
Component#findParent(SomeClass.class) may be useful

-igor

On Sun, Feb 28, 2010 at 1:00 PM, David Chang <da...@yahoo.com> wrote:
> I have two pages. The first page is extended by the second page. On the second page, I want to access a component on the first page. One way to do this is to make the component a member variable of the first page. I feel this way may have two drawbacks:
>
> 1. A member variable uses more resources (memory, clustring, etc.)
> 2. Not all pages extending the first page may need to access this component, which make it seem unnecessary for such pages.
>
> Is there any more elegant way?
>
> I just started Wicket programming for a personal project. Thanks for any input!
>
> Regards, David
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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