Yeah, that's what I thought you were going to say.

What I ended up doing was to make two complimentary methods

// keep a registry of Components that are event sources (stored as Map on
the Page)
registerAsEventSource(String sourceName, Component source)  

// keep a registry of event targets (stored in the source Component
MetaData)
registerAsRefreshTarget(Component target, Component source)  
registerAsRefreshTarget(Component target, String sourceName)  // lookup
source from eventRegistry

Then, I can either reference the Component itself or the sourceName in the
eventRegistry.  The Page acts as the middleman in that case.

Chuck


igor.vaynberg wrote:
> 
> you could keep component instances as fields so you can reference them
> directly instead of getting them via their path
> 
> -igor
> 
> 
> On 3/14/07, ChuckDeal <[EMAIL PROTECTED]> wrote:
>>
>>
>> This feels like something someone would have asked before, but I couldn't
>> find any relevant answers.
>>
>> I have a usecase where my page/components have role-based security;
>> ENABLE/RENDER actions are dynamic as opposed to static based upon the
>> user/data on the page.  When data on the page changes that could affect
>> another field, I want to refresh the other field so that it's
>> ENABLE/RENDER
>> function can be re-evaluated.
>>
>> In my specific example, a field in one Panel is enabled ONLY when you are
>> in
>> the List of Responsible Individuals (a field on a different Panel).  If
>> that
>> list of RIs change, I want to immediately refresh (via AJAX) the other
>> (dependent) field.
>>
>> I am working towards a Listerner(?) pattern whereby a Component registers
>> itself with another Component to be refreshed.  In order for that to
>> work,
>> I
>> need to geta handle to the other Component and the only way I know to do
>> that is by calling get from a common parent.  Other ways?
>>
>> Given this hierarchy, I want to register OtherMdays to be refreshed when
>> ResponsibleIndividuals changes (ResponsibleIndividuals panel is
>> responsible
>> for knowing when to refresh it's listeners).
>>
>> content (Panel)
>>   + form
>>     + headerSection (Panel)
>>       + collapsibleBody (WebMarkupContainer)
>>         + sections (RepeatingView)
>>           + header (Panel)
>>             + responsibleIndividuals (Panel)
>>             (other textfields, etc)
>>     + romEvents (RepeatingView)
>>       + baseEvent (Panel)
>>         + collapsibleBody (WebMarkupContainer)
>>           + sections (RepeatingView)
>>             + event (Panel)
>>               + rates (Panel)
>>                 OtherMdays (TextField)
>>                 (other textfields, etc)
>>               + signatures (Panel)
>>
>> So, the name of the RI Panel (relative to form) is
>> "headerSection:collapsibleBody:sections:header:responsibleIndividuals".
>>
>> Therefore, I can do
>> form.get
>> ("headerSection:collapsibleBody:sections:header:responsibleIndividuals")
>> to return that Component.  But that means that everywhere that I want to
>> get
>> a handle to the RI Panel, I need to use that string.  Is that really the
>> only/best way to do it?  I suppose I could extract that string into a
>> constant at the Page level so that at least I am not propagating a raw
>> string, but it is still just a plain old string, then why not store a ref
>> to
>> the component at the page level?  There could be many such "refreshers"
>> that
>> listener Components register with.
>>
>> Chuck
>> --
>> View this message in context:
>> http://www.nabble.com/find-a-%22cousin%22-Component-tf3401959.html#a9473809
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 

-- 
View this message in context: 
http://www.nabble.com/find-a-%22cousin%22-Component-tf3401959.html#a9478053
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to