You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Lewis <ch...@bellsouth.net> on 2007/10/09 23:09:02 UTC

T5: coordinating components and/or mixins

Hello again,

I've been working on a mixin that will count the characters typed into a 
TextField or TextArea, as they are typed. It works fine but among other 
things, I want to make it possible to control where and how user 
feedback is displayed. My mixin just implements the counting logic, but 
it should be possible for a user to use this mixin and configure it to 
display a counter, implement text-length restriction (something not 
possible for html text areas without JS), and implement notification. 
How should I go about doing this? I could easily have a domId parameter 
on the mixin that would receive the counter notifications, but I'd 
rather make it easy for one to plug in their own logic and receive these 
notifications as events. Obviously that part would happen in client-side 
JS, but I want the framework to coordinate the two (ensuring the 
components exist, etc). Does anyone have any thoughts on this?

sincerely,
chris

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


Re: T5: TabPanel

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
see:
http://wiki.apache.org/tapestry/Tapestry5HowToCreateATabPanel



munich@fantasymail.de 
10.10.2007 14:56
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
users@tapestry.apache.org
Kopie

Thema
T5: TabPanel






How do you translate the following example to T5 ?

  <span jwcid="@TabPanel" blockIds="ognl:{'berlin', 'rome', 'tokyo'}" 
selectColor="#FFFF00" unSelectColor="#CCFFFF" borderColor="#00CC33"/>

  <span jwcid="berlin@Block">
    <h1>Berlin</h1>
  </span>

  <span jwcid="rome@Block">
    <h1>Rome</h1>
  </span>

  <span jwcid="tokyo@Block">
    <h1>Tokyo</h1>
  </span>
</span>

Thanks!

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



T5: TabPanel

Posted by mu...@fantasymail.de.
How do you translate the following example to T5 ?

  <span jwcid="@TabPanel" blockIds="ognl:{'berlin', 'rome', 'tokyo'}" selectColor="#FFFF00" unSelectColor="#CCFFFF" borderColor="#00CC33"/>

  <span jwcid="berlin@Block">
    <h1>Berlin</h1>
  </span>

  <span jwcid="rome@Block">
    <h1>Rome</h1>
  </span>

  <span jwcid="tokyo@Block">
    <h1>Tokyo</h1>
  </span>
</span>

Thanks!

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


Re: T5: coordinating components and/or mixins

Posted by Chris Lewis <ch...@bellsouth.net>.
The JS is the easy part. What I'm trying to understand is how to allow 
arbitrary (client side) components to be provided as parameters to the 
mixin. In reality all that needs to happen is a JS object needs to be 
provided so that it can receive and handle the key events. If I wanted 
it to be dirty, I could require that the parameter to the mixin is just 
a string that represents the instantiated JS object on the client side. 
But I feel there's a way to do this cleanly, and at least have Tapestry 
assure the developer that the provided component exists (etc) by 
throwing an exception.

PS I'm not a fan of DoJo, and to my fortune prototype happens to be the 
library of choice for me and Tapestry. Of course this doesn't matter, 
and I appreciate your feedback.

chris

andyhot wrote:
> Dojo has the concept of registering for events and publishing events - 
> so, the mixin could emit js that publishes
> a set of custom events
>
> Event content could follow any protocol you decide, either json
> {nodeId:'textarea1', charsLeft:50, message:''} or even a string
> textarea1|50|
> and it would be published with dojo.event.publish(eventSlot, 
> eventContent)
>
> Then the displayer could be set up to listen for all messages of that 
> specific slot using dojo.event.subscribe(eventSlot, myHandlerObject, 
> 'onEvent');
>
> Anyway, perhaps you can do something similar to handle events in any 
> js toolkit.
>
>
> Chris Lewis wrote:
>> Hello again,
>>
>> I've been working on a mixin that will count the characters typed 
>> into a TextField or TextArea, as they are typed. It works fine but 
>> among other things, I want to make it possible to control where and 
>> how user feedback is displayed. My mixin just implements the counting 
>> logic, but it should be possible for a user to use this mixin and 
>> configure it to display a counter, implement text-length restriction 
>> (something not possible for html text areas without JS), and 
>> implement notification. How should I go about doing this? I could 
>> easily have a domId parameter on the mixin that would receive the 
>> counter notifications, but I'd rather make it easy for one to plug in 
>> their own logic and receive these notifications as events. Obviously 
>> that part would happen in client-side JS, but I want the framework to 
>> coordinate the two (ensuring the components exist, etc). Does anyone 
>> have any thoughts on this?
>>
>> sincerely,
>> chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>


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


Re: T5: coordinating components and/or mixins

Posted by andyhot <an...@di.uoa.gr>.
Dojo has the concept of registering for events and publishing events - 
so, the mixin could emit js that publishes
a set of custom events

Event content could follow any protocol you decide, either json
{nodeId:'textarea1', charsLeft:50, message:''} or even a string
textarea1|50|
and it would be published with dojo.event.publish(eventSlot, eventContent)

Then the displayer could be set up to listen for all messages of that 
specific slot using dojo.event.subscribe(eventSlot, myHandlerObject, 
'onEvent');

Anyway, perhaps you can do something similar to handle events in any js 
toolkit.


Chris Lewis wrote:
> Hello again,
>
> I've been working on a mixin that will count the characters typed into 
> a TextField or TextArea, as they are typed. It works fine but among 
> other things, I want to make it possible to control where and how user 
> feedback is displayed. My mixin just implements the counting logic, 
> but it should be possible for a user to use this mixin and configure 
> it to display a counter, implement text-length restriction (something 
> not possible for html text areas without JS), and implement 
> notification. How should I go about doing this? I could easily have a 
> domId parameter on the mixin that would receive the counter 
> notifications, but I'd rather make it easy for one to plug in their 
> own logic and receive these notifications as events. Obviously that 
> part would happen in client-side JS, but I want the framework to 
> coordinate the two (ensuring the components exist, etc). Does anyone 
> have any thoughts on this?
>
> sincerely,
> chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / JEE Consulting


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


Re: T5: coordinating components and/or mixins

Posted by Chris Lewis <ch...@bellsouth.net>.
Ah - but unfortunately there's no common super interface, so in this 
case I'd be relying on AbstractField#getClientId, since this mixin would 
probably apply only to those (although possibly not). So that's a bit of 
a pain, but you're saying that calling allocateClientId will give the 
same results (even if it requires more work)?

I'm still trying to figure out why I need Tapestry to be aware of an 
actual server side component that represents the recipient of the JS 
keystrokes. I feel like one should be there, but I'm yet sure why...

Kristian Marinkovic wrote:
> most of the components offer a public getClientId() method :)
>
> if you use some that doesn't you have to do:
>
>     @Inject
>     private PageRenderSupport _pageRenderSupport;
>
>     @Inject
>     private ComponentResources _resources;
>
> _pageRenderSupport.allocateClientId(_resources.getId());
>
>
>
>
> Chris Lewis <ch...@bellsouth.net> 
> 10.10.2007 15:10
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: T5: coordinating components and/or mixins
>
>
>
>
>
>
> So when I use @InjectComponent, what type must I inject? If the 
> PageRenderSupport service has the method I need, woudn't I inject that 
> (as an @Environmental)?
>
> thanks again :)
>
> Kristian Marinkovic wrote:
>   
>> 1) getId() returns the id of the component you used in your code.
>> you get a problem when you use your component in a loop. then your
>> id would not be unique anymore... this is also true if you use the 
>> same component with the same id in another nested component. 
>> T5 uses the PageRenderSupport service to generate unique 
>> client-side ids even in loops. getClientId returns this generated unique 
>>     
>
>   
>> id 
>>
>> 2) using heartbeat... you're right is possible too
>>
>> 3) why another service... i tend to generate  my js code only at 
>> the end of my page. therefore i first collect my data and at the end 
>> i do the js stuff like adding js event listener and the whole js wiring 
>> and such. so my mixins stay relatively dumb. i think its just a matter 
>> of taste :) 
>>
>> i'm glad i could help. i thought i scared you off with my
>> previous post :)
>>
>> g,
>> kris
>>
>>
>>
>>
>> Chris Lewis <ch...@bellsouth.net> 
>> 10.10.2007 14:28
>> Bitte antworten an
>> "Tapestry users" <us...@tapestry.apache.org>
>>
>>
>> An
>> Tapestry users <us...@tapestry.apache.org>
>> Kopie
>>
>> Thema
>> Re: T5: coordinating components and/or mixins
>>
>>
>>
>>
>>
>>
>> Sorry, but you seemed to grasp it well. I have some questions regarding 
>> your response:
>>
>> Kristian Marinkovic wrote:
>>
>>     
>>>  a few thoughts that
>>> come into my mind.....
>>>
>>> you can use a Mixin to determine the generated id of 
>>> a component by using @InjectComponent and reading
>>> getClientId.
>>>
>>>       
>> Currently I'm @Inject-ing ComponentResources and using getId() - should 
>> be the same right?
>>
>>     
>>> This Mixin would delgate the id to a service 
>>> that is contributed to PageRenderInitializer and is available
>>> through the @Environmental annotation. After your page 
>>> has been processed succesfully your service has
>>> the chance to generate the appropriate JS code for the
>>> ids it gathered (using PageRenderSupport or DocumentScriptBuilder) 
>>> ... and here is where you could add events and whatever :)
>>>
>>>
>>>       
>> Why would I delegate the id to a service? If I want to execute my 
>> mixin's rendering after the page is processed, couldn't I just use 
>> @MixinAfter or use a heartbeat, and then generate the JS code in the 
>> mixin? This is what I'm using the mixin for, to generate the appropriate 
>>     
>
>   
>> JS code to count/monitor the key-presses.
>>
>>     
>>> you can also use a Mixin to generate the counter field by
>>> intercepting the render phase methods and adding new nodes
>>> using the markupwriter... but i would'n do this because then you
>>> would have to make some assumptions on the generated 
>>> markup of the component your Mixin is attached to.
>>>
>>>       
>> Exactly.
>>
>>     
>>> Instead
>>> i'd write a component that will be passed to the mixin via a
>>> parameter. And this component can be placed whereever you
>>> want because the JS wiring will be delegated to the injected
>>> service of your mixin.
>>>
>>>
>>>       
>> I still don't see why I'd use a service to generate the JS instead of 
>> the mixin - it seems superfluous.
>> You understand exactly what I'm aiming for though, but I'm still not 
>> sure about the component that receives the events. The receiving 
>> component wouldn't need any server side validation or state - it only 
>> needs to provide the code to modify the document (counter, etc). I guess 
>>     
>
>   
>> the first thing to decide is what kind of component, and how would they 
>> be wired up...
>>
>> Sorry I'm still thinking this over, but your input helped and I'd like 
>> more if you have it :). At any rate, thanks!
>>
>> chris
>>
>>
>>     
>>> i hope i've not confused you to much :) 
>>>
>>> g,
>>> kris
>>>
>>>
>>>
>>>
>>>
>>>
>>> Chris Lewis <ch...@bellsouth.net> 
>>> 09.10.2007 23:09
>>> Bitte antworten an
>>> "Tapestry users" <us...@tapestry.apache.org>
>>>
>>>
>>> An
>>> Tapestry users <us...@tapestry.apache.org>
>>> Kopie
>>>
>>> Thema
>>> T5: coordinating components and/or mixins
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hello again,
>>>
>>> I've been working on a mixin that will count the characters typed into 
>>>       
> a 
>   
>>     
>>> TextField or TextArea, as they are typed. It works fine but among other 
>>>       
>
>   
>>> things, I want to make it possible to control where and how user 
>>> feedback is displayed. My mixin just implements the counting logic, but 
>>>       
>
>   
>>> it should be possible for a user to use this mixin and configure it to 
>>> display a counter, implement text-length restriction (something not 
>>> possible for html text areas without JS), and implement notification. 
>>> How should I go about doing this? I could easily have a domId parameter 
>>>       
>
>   
>>> on the mixin that would receive the counter notifications, but I'd 
>>> rather make it easy for one to plug in their own logic and receive 
>>>       
> these 
>   
>>     
>>> notifications as events. Obviously that part would happen in 
>>>       
> client-side 
>   
>>     
>>> JS, but I want the framework to coordinate the two (ensuring the 
>>> components exist, etc). Does anyone have any thoughts on this?
>>>
>>> sincerely,
>>> chris
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>>
>>     
>
>
>
>   


Re: T5: coordinating components and/or mixins

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
this should do it :)

    @InjectComponent
    private ClientElement component;
 
    void beginRender() {
        if(component != null)
            System.out.println(component.getClientId());
    }




Chris Lewis <ch...@bellsouth.net> 
10.10.2007 15:54
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: coordinating components and/or mixins






Ok, but in order to use the component's method getClientId, I'd have to:

1) require the component to be of a certain (base) type
2) get access to the actual instance

I'm not sure how to do #2 without specifying it as a parameter. I 
shouldn't have to do that thought because the component uses the mixin 
and the mixin should be able to get it easily (and i'm not sure how)!

Sorry I'm new to mixins and am finding it a bit cumbersome to get the 
correct client id.

Kristian Marinkovic wrote:
> be careful when you use 
> _pageRenderSupport.allocateClientId(_resources.getId());
> as it always generates a new id.
>
> i looked at my code and i check whether the injected component 
> implements the interface ClientElement
>
>
>
>
> Kristian Marinkovic <kr...@porsche.co.at> 
> 10.10.2007 15:18
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> "Tapestry users" <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: T5: coordinating components and/or mixins
>
>
>
>
>
>
> most of the components offer a public getClientId() method :)
>
> if you use some that doesn't you have to do:
>
>     @Inject
>     private PageRenderSupport _pageRenderSupport;
>
>     @Inject
>     private ComponentResources _resources;
>
> _pageRenderSupport.allocateClientId(_resources.getId());
>
>
>
>
> Chris Lewis <ch...@bellsouth.net> 
> 10.10.2007 15:10
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: T5: coordinating components and/or mixins
>
>
>
>
>
>
> So when I use @InjectComponent, what type must I inject? If the 
> PageRenderSupport service has the method I need, woudn't I inject that 
> (as an @Environmental)?
>
> thanks again :)
>
> Kristian Marinkovic wrote:
> 
>> 1) getId() returns the id of the component you used in your code.
>> you get a problem when you use your component in a loop. then your
>> id would not be unique anymore... this is also true if you use the 
>> same component with the same id in another nested component. 
>> T5 uses the PageRenderSupport service to generate unique 
>> client-side ids even in loops. getClientId returns this generated 
unique 
>> 
>
>
> 
>> id 
>>
>> 2) using heartbeat... you're right is possible too
>>
>> 3) why another service... i tend to generate  my js code only at 
>> the end of my page. therefore i first collect my data and at the end 
>> i do the js stuff like adding js event listener and the whole js wiring 

>> and such. so my mixins stay relatively dumb. i think its just a matter 
>> of taste :) 
>>
>> i'm glad i could help. i thought i scared you off with my
>> previous post :)
>>
>> g,
>> kris
>>
>>
>>
>>
>> Chris Lewis <ch...@bellsouth.net> 
>> 10.10.2007 14:28
>> Bitte antworten an
>> "Tapestry users" <us...@tapestry.apache.org>
>>
>>
>> An
>> Tapestry users <us...@tapestry.apache.org>
>> Kopie
>>
>> Thema
>> Re: T5: coordinating components and/or mixins
>>
>>
>>
>>
>>
>>
>> Sorry, but you seemed to grasp it well. I have some questions regarding 

>> your response:
>>
>> Kristian Marinkovic wrote:
>>
>> 
>>>  a few thoughts that
>>> come into my mind.....
>>>
>>> you can use a Mixin to determine the generated id of 
>>> a component by using @InjectComponent and reading
>>> getClientId.
>>>
>>> 
>> Currently I'm @Inject-ing ComponentResources and using getId() - should 

>> be the same right?
>>
>> 
>>> This Mixin would delgate the id to a service 
>>> that is contributed to PageRenderInitializer and is available
>>> through the @Environmental annotation. After your page 
>>> has been processed succesfully your service has
>>> the chance to generate the appropriate JS code for the
>>> ids it gathered (using PageRenderSupport or DocumentScriptBuilder) 
>>> ... and here is where you could add events and whatever :)
>>>
>>>
>>> 
>> Why would I delegate the id to a service? If I want to execute my 
>> mixin's rendering after the page is processed, couldn't I just use 
>> @MixinAfter or use a heartbeat, and then generate the JS code in the 
>> mixin? This is what I'm using the mixin for, to generate the 
appropriate 
>> 
>
>
> 
>> JS code to count/monitor the key-presses.
>>
>> 
>>> you can also use a Mixin to generate the counter field by
>>> intercepting the render phase methods and adding new nodes
>>> using the markupwriter... but i would'n do this because then you
>>> would have to make some assumptions on the generated 
>>> markup of the component your Mixin is attached to.
>>>
>>> 
>> Exactly.
>>
>> 
>>> Instead
>>> i'd write a component that will be passed to the mixin via a
>>> parameter. And this component can be placed whereever you
>>> want because the JS wiring will be delegated to the injected
>>> service of your mixin.
>>>
>>>
>>> 
>> I still don't see why I'd use a service to generate the JS instead of 
>> the mixin - it seems superfluous.
>> You understand exactly what I'm aiming for though, but I'm still not 
>> sure about the component that receives the events. The receiving 
>> component wouldn't need any server side validation or state - it only 
>> needs to provide the code to modify the document (counter, etc). I 
guess 
>> 
>
>
> 
>> the first thing to decide is what kind of component, and how would they 

>> be wired up...
>>
>> Sorry I'm still thinking this over, but your input helped and I'd like 
>> more if you have it :). At any rate, thanks!
>>
>> chris
>>
>>
>> 
>>> i hope i've not confused you to much :) 
>>>
>>> g,
>>> kris
>>>
>>>
>>>
>>>
>>>
>>>
>>> Chris Lewis <ch...@bellsouth.net> 
>>> 09.10.2007 23:09
>>> Bitte antworten an
>>> "Tapestry users" <us...@tapestry.apache.org>
>>>
>>>
>>> An
>>> Tapestry users <us...@tapestry.apache.org>
>>> Kopie
>>>
>>> Thema
>>> T5: coordinating components and/or mixins
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hello again,
>>>
>>> I've been working on a mixin that will count the characters typed into 

>>> 
> a 
> 
>> 
>>> TextField or TextArea, as they are typed. It works fine but among 
other 
>>> 
>
>
> 
>>> things, I want to make it possible to control where and how user 
>>> feedback is displayed. My mixin just implements the counting logic, 
but 
>>> 
>
>
> 
>>> it should be possible for a user to use this mixin and configure it to 

>>> display a counter, implement text-length restriction (something not 
>>> possible for html text areas without JS), and implement notification. 
>>> How should I go about doing this? I could easily have a domId 
parameter 
>>> 
>
>
> 
>>> on the mixin that would receive the counter notifications, but I'd 
>>> rather make it easy for one to plug in their own logic and receive 
>>> 
> these 
> 
>> 
>>> notifications as events. Obviously that part would happen in 
>>> 
> client-side 
> 
>> 
>>> JS, but I want the framework to coordinate the two (ensuring the 
>>> components exist, etc). Does anyone have any thoughts on this?
>>>
>>> sincerely,
>>> chris
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>>
>>>
>>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>>
>> 
>
>
>
>
> 



Re: T5: coordinating components and/or mixins

Posted by Chris Lewis <ch...@bellsouth.net>.
Ok, but in order to use the component's method getClientId, I'd have to:

1) require the component to be of a certain (base) type
2) get access to the actual instance

I'm not sure how to do #2 without specifying it as a parameter. I 
shouldn't have to do that thought because the component uses the mixin 
and the mixin should be able to get it easily (and i'm not sure how)!

Sorry I'm new to mixins and am finding it a bit cumbersome to get the 
correct client id.

Kristian Marinkovic wrote:
> be careful when you use 
> _pageRenderSupport.allocateClientId(_resources.getId());
> as it always generates a new id.
>
> i looked at my code and i check whether the injected component 
> implements the interface ClientElement
>
>
>
>
> Kristian Marinkovic <kr...@porsche.co.at> 
> 10.10.2007 15:18
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> "Tapestry users" <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: T5: coordinating components and/or mixins
>
>
>
>
>
>
> most of the components offer a public getClientId() method :)
>
> if you use some that doesn't you have to do:
>
>     @Inject
>     private PageRenderSupport _pageRenderSupport;
>
>     @Inject
>     private ComponentResources _resources;
>
> _pageRenderSupport.allocateClientId(_resources.getId());
>
>
>
>
> Chris Lewis <ch...@bellsouth.net> 
> 10.10.2007 15:10
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: T5: coordinating components and/or mixins
>
>
>
>
>
>
> So when I use @InjectComponent, what type must I inject? If the 
> PageRenderSupport service has the method I need, woudn't I inject that 
> (as an @Environmental)?
>
> thanks again :)
>
> Kristian Marinkovic wrote:
>   
>> 1) getId() returns the id of the component you used in your code.
>> you get a problem when you use your component in a loop. then your
>> id would not be unique anymore... this is also true if you use the 
>> same component with the same id in another nested component. 
>> T5 uses the PageRenderSupport service to generate unique 
>> client-side ids even in loops. getClientId returns this generated unique 
>>     
>
>
>   
>> id 
>>
>> 2) using heartbeat... you're right is possible too
>>
>> 3) why another service... i tend to generate  my js code only at 
>> the end of my page. therefore i first collect my data and at the end 
>> i do the js stuff like adding js event listener and the whole js wiring 
>> and such. so my mixins stay relatively dumb. i think its just a matter 
>> of taste :) 
>>
>> i'm glad i could help. i thought i scared you off with my
>> previous post :)
>>
>> g,
>> kris
>>
>>
>>
>>
>> Chris Lewis <ch...@bellsouth.net> 
>> 10.10.2007 14:28
>> Bitte antworten an
>> "Tapestry users" <us...@tapestry.apache.org>
>>
>>
>> An
>> Tapestry users <us...@tapestry.apache.org>
>> Kopie
>>
>> Thema
>> Re: T5: coordinating components and/or mixins
>>
>>
>>
>>
>>
>>
>> Sorry, but you seemed to grasp it well. I have some questions regarding 
>> your response:
>>
>> Kristian Marinkovic wrote:
>>
>>     
>>>  a few thoughts that
>>> come into my mind.....
>>>
>>> you can use a Mixin to determine the generated id of 
>>> a component by using @InjectComponent and reading
>>> getClientId.
>>>
>>>       
>> Currently I'm @Inject-ing ComponentResources and using getId() - should 
>> be the same right?
>>
>>     
>>> This Mixin would delgate the id to a service 
>>> that is contributed to PageRenderInitializer and is available
>>> through the @Environmental annotation. After your page 
>>> has been processed succesfully your service has
>>> the chance to generate the appropriate JS code for the
>>> ids it gathered (using PageRenderSupport or DocumentScriptBuilder) 
>>> ... and here is where you could add events and whatever :)
>>>
>>>
>>>       
>> Why would I delegate the id to a service? If I want to execute my 
>> mixin's rendering after the page is processed, couldn't I just use 
>> @MixinAfter or use a heartbeat, and then generate the JS code in the 
>> mixin? This is what I'm using the mixin for, to generate the appropriate 
>>     
>
>
>   
>> JS code to count/monitor the key-presses.
>>
>>     
>>> you can also use a Mixin to generate the counter field by
>>> intercepting the render phase methods and adding new nodes
>>> using the markupwriter... but i would'n do this because then you
>>> would have to make some assumptions on the generated 
>>> markup of the component your Mixin is attached to.
>>>
>>>       
>> Exactly.
>>
>>     
>>> Instead
>>> i'd write a component that will be passed to the mixin via a
>>> parameter. And this component can be placed whereever you
>>> want because the JS wiring will be delegated to the injected
>>> service of your mixin.
>>>
>>>
>>>       
>> I still don't see why I'd use a service to generate the JS instead of 
>> the mixin - it seems superfluous.
>> You understand exactly what I'm aiming for though, but I'm still not 
>> sure about the component that receives the events. The receiving 
>> component wouldn't need any server side validation or state - it only 
>> needs to provide the code to modify the document (counter, etc). I guess 
>>     
>
>
>   
>> the first thing to decide is what kind of component, and how would they 
>> be wired up...
>>
>> Sorry I'm still thinking this over, but your input helped and I'd like 
>> more if you have it :). At any rate, thanks!
>>
>> chris
>>
>>
>>     
>>> i hope i've not confused you to much :) 
>>>
>>> g,
>>> kris
>>>
>>>
>>>
>>>
>>>
>>>
>>> Chris Lewis <ch...@bellsouth.net> 
>>> 09.10.2007 23:09
>>> Bitte antworten an
>>> "Tapestry users" <us...@tapestry.apache.org>
>>>
>>>
>>> An
>>> Tapestry users <us...@tapestry.apache.org>
>>> Kopie
>>>
>>> Thema
>>> T5: coordinating components and/or mixins
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hello again,
>>>
>>> I've been working on a mixin that will count the characters typed into 
>>>       
> a 
>   
>>     
>>> TextField or TextArea, as they are typed. It works fine but among other 
>>>       
>
>
>   
>>> things, I want to make it possible to control where and how user 
>>> feedback is displayed. My mixin just implements the counting logic, but 
>>>       
>
>
>   
>>> it should be possible for a user to use this mixin and configure it to 
>>> display a counter, implement text-length restriction (something not 
>>> possible for html text areas without JS), and implement notification. 
>>> How should I go about doing this? I could easily have a domId parameter 
>>>       
>
>
>   
>>> on the mixin that would receive the counter notifications, but I'd 
>>> rather make it easy for one to plug in their own logic and receive 
>>>       
> these 
>   
>>     
>>> notifications as events. Obviously that part would happen in 
>>>       
> client-side 
>   
>>     
>>> JS, but I want the framework to coordinate the two (ensuring the 
>>> components exist, etc). Does anyone have any thoughts on this?
>>>
>>> sincerely,
>>> chris
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>>
>>     
>
>
>
>
>   


Re: T5: coordinating components and/or mixins

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
be careful when you use 
_pageRenderSupport.allocateClientId(_resources.getId());
as it always generates a new id.

i looked at my code and i check whether the injected component 
implements the interface ClientElement




Kristian Marinkovic <kr...@porsche.co.at> 
10.10.2007 15:18
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
"Tapestry users" <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: coordinating components and/or mixins






most of the components offer a public getClientId() method :)

if you use some that doesn't you have to do:

    @Inject
    private PageRenderSupport _pageRenderSupport;

    @Inject
    private ComponentResources _resources;

_pageRenderSupport.allocateClientId(_resources.getId());




Chris Lewis <ch...@bellsouth.net> 
10.10.2007 15:10
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: coordinating components and/or mixins






So when I use @InjectComponent, what type must I inject? If the 
PageRenderSupport service has the method I need, woudn't I inject that 
(as an @Environmental)?

thanks again :)

Kristian Marinkovic wrote:
> 1) getId() returns the id of the component you used in your code.
> you get a problem when you use your component in a loop. then your
> id would not be unique anymore... this is also true if you use the 
> same component with the same id in another nested component. 
> T5 uses the PageRenderSupport service to generate unique 
> client-side ids even in loops. getClientId returns this generated unique 


> id 
>
> 2) using heartbeat... you're right is possible too
>
> 3) why another service... i tend to generate  my js code only at 
> the end of my page. therefore i first collect my data and at the end 
> i do the js stuff like adding js event listener and the whole js wiring 
> and such. so my mixins stay relatively dumb. i think its just a matter 
> of taste :) 
>
> i'm glad i could help. i thought i scared you off with my
> previous post :)
>
> g,
> kris
>
>
>
>
> Chris Lewis <ch...@bellsouth.net> 
> 10.10.2007 14:28
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: T5: coordinating components and/or mixins
>
>
>
>
>
>
> Sorry, but you seemed to grasp it well. I have some questions regarding 
> your response:
>
> Kristian Marinkovic wrote:
> 
>>  a few thoughts that
>> come into my mind.....
>>
>> you can use a Mixin to determine the generated id of 
>> a component by using @InjectComponent and reading
>> getClientId.
>> 
> Currently I'm @Inject-ing ComponentResources and using getId() - should 
> be the same right?
> 
>> This Mixin would delgate the id to a service 
>> that is contributed to PageRenderInitializer and is available
>> through the @Environmental annotation. After your page 
>> has been processed succesfully your service has
>> the chance to generate the appropriate JS code for the
>> ids it gathered (using PageRenderSupport or DocumentScriptBuilder) 
>> ... and here is where you could add events and whatever :)
>>
>> 
> Why would I delegate the id to a service? If I want to execute my 
> mixin's rendering after the page is processed, couldn't I just use 
> @MixinAfter or use a heartbeat, and then generate the JS code in the 
> mixin? This is what I'm using the mixin for, to generate the appropriate 


> JS code to count/monitor the key-presses.
> 
>> you can also use a Mixin to generate the counter field by
>> intercepting the render phase methods and adding new nodes
>> using the markupwriter... but i would'n do this because then you
>> would have to make some assumptions on the generated 
>> markup of the component your Mixin is attached to.
>> 
> Exactly.
> 
>> Instead
>> i'd write a component that will be passed to the mixin via a
>> parameter. And this component can be placed whereever you
>> want because the JS wiring will be delegated to the injected
>> service of your mixin.
>>
>> 
> I still don't see why I'd use a service to generate the JS instead of 
> the mixin - it seems superfluous.
> You understand exactly what I'm aiming for though, but I'm still not 
> sure about the component that receives the events. The receiving 
> component wouldn't need any server side validation or state - it only 
> needs to provide the code to modify the document (counter, etc). I guess 


> the first thing to decide is what kind of component, and how would they 
> be wired up...
>
> Sorry I'm still thinking this over, but your input helped and I'd like 
> more if you have it :). At any rate, thanks!
>
> chris
>
> 
>> i hope i've not confused you to much :) 
>>
>> g,
>> kris
>>
>>
>>
>>
>>
>>
>> Chris Lewis <ch...@bellsouth.net> 
>> 09.10.2007 23:09
>> Bitte antworten an
>> "Tapestry users" <us...@tapestry.apache.org>
>>
>>
>> An
>> Tapestry users <us...@tapestry.apache.org>
>> Kopie
>>
>> Thema
>> T5: coordinating components and/or mixins
>>
>>
>>
>>
>>
>>
>> Hello again,
>>
>> I've been working on a mixin that will count the characters typed into 
a 
>> 
>
> 
>> TextField or TextArea, as they are typed. It works fine but among other 


>> things, I want to make it possible to control where and how user 
>> feedback is displayed. My mixin just implements the counting logic, but 


>> it should be possible for a user to use this mixin and configure it to 
>> display a counter, implement text-length restriction (something not 
>> possible for html text areas without JS), and implement notification. 
>> How should I go about doing this? I could easily have a domId parameter 


>> on the mixin that would receive the counter notifications, but I'd 
>> rather make it easy for one to plug in their own logic and receive 
these 
>> 
>
> 
>> notifications as events. Obviously that part would happen in 
client-side 
>> 
>
> 
>> JS, but I want the framework to coordinate the two (ensuring the 
>> components exist, etc). Does anyone have any thoughts on this?
>>
>> sincerely,
>> chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>>
>> 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
> 




Re: T5: coordinating components and/or mixins

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
most of the components offer a public getClientId() method :)

if you use some that doesn't you have to do:

    @Inject
    private PageRenderSupport _pageRenderSupport;

    @Inject
    private ComponentResources _resources;

_pageRenderSupport.allocateClientId(_resources.getId());




Chris Lewis <ch...@bellsouth.net> 
10.10.2007 15:10
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: coordinating components and/or mixins






So when I use @InjectComponent, what type must I inject? If the 
PageRenderSupport service has the method I need, woudn't I inject that 
(as an @Environmental)?

thanks again :)

Kristian Marinkovic wrote:
> 1) getId() returns the id of the component you used in your code.
> you get a problem when you use your component in a loop. then your
> id would not be unique anymore... this is also true if you use the 
> same component with the same id in another nested component. 
> T5 uses the PageRenderSupport service to generate unique 
> client-side ids even in loops. getClientId returns this generated unique 

> id 
>
> 2) using heartbeat... you're right is possible too
>
> 3) why another service... i tend to generate  my js code only at 
> the end of my page. therefore i first collect my data and at the end 
> i do the js stuff like adding js event listener and the whole js wiring 
> and such. so my mixins stay relatively dumb. i think its just a matter 
> of taste :) 
>
> i'm glad i could help. i thought i scared you off with my
> previous post :)
>
> g,
> kris
>
>
>
>
> Chris Lewis <ch...@bellsouth.net> 
> 10.10.2007 14:28
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: T5: coordinating components and/or mixins
>
>
>
>
>
>
> Sorry, but you seemed to grasp it well. I have some questions regarding 
> your response:
>
> Kristian Marinkovic wrote:
> 
>>  a few thoughts that
>> come into my mind.....
>>
>> you can use a Mixin to determine the generated id of 
>> a component by using @InjectComponent and reading
>> getClientId.
>> 
> Currently I'm @Inject-ing ComponentResources and using getId() - should 
> be the same right?
> 
>> This Mixin would delgate the id to a service 
>> that is contributed to PageRenderInitializer and is available
>> through the @Environmental annotation. After your page 
>> has been processed succesfully your service has
>> the chance to generate the appropriate JS code for the
>> ids it gathered (using PageRenderSupport or DocumentScriptBuilder) 
>> ... and here is where you could add events and whatever :)
>>
>> 
> Why would I delegate the id to a service? If I want to execute my 
> mixin's rendering after the page is processed, couldn't I just use 
> @MixinAfter or use a heartbeat, and then generate the JS code in the 
> mixin? This is what I'm using the mixin for, to generate the appropriate 

> JS code to count/monitor the key-presses.
> 
>> you can also use a Mixin to generate the counter field by
>> intercepting the render phase methods and adding new nodes
>> using the markupwriter... but i would'n do this because then you
>> would have to make some assumptions on the generated 
>> markup of the component your Mixin is attached to.
>> 
> Exactly.
> 
>> Instead
>> i'd write a component that will be passed to the mixin via a
>> parameter. And this component can be placed whereever you
>> want because the JS wiring will be delegated to the injected
>> service of your mixin.
>>
>> 
> I still don't see why I'd use a service to generate the JS instead of 
> the mixin - it seems superfluous.
> You understand exactly what I'm aiming for though, but I'm still not 
> sure about the component that receives the events. The receiving 
> component wouldn't need any server side validation or state - it only 
> needs to provide the code to modify the document (counter, etc). I guess 

> the first thing to decide is what kind of component, and how would they 
> be wired up...
>
> Sorry I'm still thinking this over, but your input helped and I'd like 
> more if you have it :). At any rate, thanks!
>
> chris
>
> 
>> i hope i've not confused you to much :) 
>>
>> g,
>> kris
>>
>>
>>
>>
>>
>>
>> Chris Lewis <ch...@bellsouth.net> 
>> 09.10.2007 23:09
>> Bitte antworten an
>> "Tapestry users" <us...@tapestry.apache.org>
>>
>>
>> An
>> Tapestry users <us...@tapestry.apache.org>
>> Kopie
>>
>> Thema
>> T5: coordinating components and/or mixins
>>
>>
>>
>>
>>
>>
>> Hello again,
>>
>> I've been working on a mixin that will count the characters typed into 
a 
>> 
>
> 
>> TextField or TextArea, as they are typed. It works fine but among other 

>> things, I want to make it possible to control where and how user 
>> feedback is displayed. My mixin just implements the counting logic, but 

>> it should be possible for a user to use this mixin and configure it to 
>> display a counter, implement text-length restriction (something not 
>> possible for html text areas without JS), and implement notification. 
>> How should I go about doing this? I could easily have a domId parameter 

>> on the mixin that would receive the counter notifications, but I'd 
>> rather make it easy for one to plug in their own logic and receive 
these 
>> 
>
> 
>> notifications as events. Obviously that part would happen in 
client-side 
>> 
>
> 
>> JS, but I want the framework to coordinate the two (ensuring the 
>> components exist, etc). Does anyone have any thoughts on this?
>>
>> sincerely,
>> chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>>
>> 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
> 



Re: T5: coordinating components and/or mixins

Posted by Chris Lewis <ch...@bellsouth.net>.
So when I use @InjectComponent, what type must I inject? If the 
PageRenderSupport service has the method I need, woudn't I inject that 
(as an @Environmental)?

thanks again :)

Kristian Marinkovic wrote:
> 1) getId() returns the id of the component you used in your code.
> you get a problem when you use your component in a loop. then your
> id would not be unique anymore... this is also true if you use the 
> same component with the same id in another nested component. 
> T5 uses the PageRenderSupport service to generate unique 
> client-side ids even in loops. getClientId returns this generated unique 
> id 
>
> 2) using heartbeat... you're right is possible too
>
> 3) why another service... i tend to generate  my js code only at 
> the end of my page. therefore i first collect my data and at the end 
> i do the js stuff like adding js event listener and the whole js wiring 
> and such. so my mixins stay relatively dumb. i think its just a matter 
> of taste :) 
>
> i'm glad i could help. i thought i scared you off with my
> previous post :)
>
> g,
> kris
>
>
>
>
> Chris Lewis <ch...@bellsouth.net> 
> 10.10.2007 14:28
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Re: T5: coordinating components and/or mixins
>
>
>
>
>
>
> Sorry, but you seemed to grasp it well. I have some questions regarding 
> your response:
>
> Kristian Marinkovic wrote:
>   
>>  a few thoughts that
>> come into my mind.....
>>
>> you can use a Mixin to determine the generated id of 
>> a component by using @InjectComponent and reading
>> getClientId.
>>     
> Currently I'm @Inject-ing ComponentResources and using getId() - should 
> be the same right?
>   
>> This Mixin would delgate the id to a service 
>> that is contributed to PageRenderInitializer and is available
>> through the @Environmental annotation. After your page 
>> has been processed succesfully your service has
>> the chance to generate the appropriate JS code for the
>> ids it gathered (using PageRenderSupport or DocumentScriptBuilder) 
>> ... and here is where you could add events and whatever :)
>>
>>     
> Why would I delegate the id to a service? If I want to execute my 
> mixin's rendering after the page is processed, couldn't I just use 
> @MixinAfter or use a heartbeat, and then generate the JS code in the 
> mixin? This is what I'm using the mixin for, to generate the appropriate 
> JS code to count/monitor the key-presses.
>   
>> you can also use a Mixin to generate the counter field by
>> intercepting the render phase methods and adding new nodes
>> using the markupwriter... but i would'n do this because then you
>> would have to make some assumptions on the generated 
>> markup of the component your Mixin is attached to.
>>     
> Exactly.
>   
>> Instead
>> i'd write a component that will be passed to the mixin via a
>> parameter. And this component can be placed whereever you
>> want because the JS wiring will be delegated to the injected
>> service of your mixin.
>>
>>     
> I still don't see why I'd use a service to generate the JS instead of 
> the mixin - it seems superfluous.
> You understand exactly what I'm aiming for though, but I'm still not 
> sure about the component that receives the events. The receiving 
> component wouldn't need any server side validation or state - it only 
> needs to provide the code to modify the document (counter, etc). I guess 
> the first thing to decide is what kind of component, and how would they 
> be wired up...
>
> Sorry I'm still thinking this over, but your input helped and I'd like 
> more if you have it :). At any rate, thanks!
>
> chris
>
>   
>> i hope i've not confused you to much :) 
>>
>> g,
>> kris
>>
>>
>>
>>
>>
>>
>> Chris Lewis <ch...@bellsouth.net> 
>> 09.10.2007 23:09
>> Bitte antworten an
>> "Tapestry users" <us...@tapestry.apache.org>
>>
>>
>> An
>> Tapestry users <us...@tapestry.apache.org>
>> Kopie
>>
>> Thema
>> T5: coordinating components and/or mixins
>>
>>
>>
>>
>>
>>
>> Hello again,
>>
>> I've been working on a mixin that will count the characters typed into a 
>>     
>
>   
>> TextField or TextArea, as they are typed. It works fine but among other 
>> things, I want to make it possible to control where and how user 
>> feedback is displayed. My mixin just implements the counting logic, but 
>> it should be possible for a user to use this mixin and configure it to 
>> display a counter, implement text-length restriction (something not 
>> possible for html text areas without JS), and implement notification. 
>> How should I go about doing this? I could easily have a domId parameter 
>> on the mixin that would receive the counter notifications, but I'd 
>> rather make it easy for one to plug in their own logic and receive these 
>>     
>
>   
>> notifications as events. Obviously that part would happen in client-side 
>>     
>
>   
>> JS, but I want the framework to coordinate the two (ensuring the 
>> components exist, etc). Does anyone have any thoughts on this?
>>
>> sincerely,
>> chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>   


Re: T5: coordinating components and/or mixins

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
1) getId() returns the id of the component you used in your code.
you get a problem when you use your component in a loop. then your
id would not be unique anymore... this is also true if you use the 
same component with the same id in another nested component. 
T5 uses the PageRenderSupport service to generate unique 
client-side ids even in loops. getClientId returns this generated unique 
id 

2) using heartbeat... you're right is possible too

3) why another service... i tend to generate  my js code only at 
the end of my page. therefore i first collect my data and at the end 
i do the js stuff like adding js event listener and the whole js wiring 
and such. so my mixins stay relatively dumb. i think its just a matter 
of taste :) 

i'm glad i could help. i thought i scared you off with my
previous post :)

g,
kris




Chris Lewis <ch...@bellsouth.net> 
10.10.2007 14:28
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: T5: coordinating components and/or mixins






Sorry, but you seemed to grasp it well. I have some questions regarding 
your response:

Kristian Marinkovic wrote:
>  a few thoughts that
> come into my mind.....
>
> you can use a Mixin to determine the generated id of 
> a component by using @InjectComponent and reading
> getClientId.
Currently I'm @Inject-ing ComponentResources and using getId() - should 
be the same right?
> This Mixin would delgate the id to a service 
> that is contributed to PageRenderInitializer and is available
> through the @Environmental annotation. After your page 
> has been processed succesfully your service has
> the chance to generate the appropriate JS code for the
> ids it gathered (using PageRenderSupport or DocumentScriptBuilder) 
> ... and here is where you could add events and whatever :)
> 
Why would I delegate the id to a service? If I want to execute my 
mixin's rendering after the page is processed, couldn't I just use 
@MixinAfter or use a heartbeat, and then generate the JS code in the 
mixin? This is what I'm using the mixin for, to generate the appropriate 
JS code to count/monitor the key-presses.
> you can also use a Mixin to generate the counter field by
> intercepting the render phase methods and adding new nodes
> using the markupwriter... but i would'n do this because then you
> would have to make some assumptions on the generated 
> markup of the component your Mixin is attached to.
Exactly.
> Instead
> i'd write a component that will be passed to the mixin via a
> parameter. And this component can be placed whereever you
> want because the JS wiring will be delegated to the injected
> service of your mixin.
> 
I still don't see why I'd use a service to generate the JS instead of 
the mixin - it seems superfluous.
You understand exactly what I'm aiming for though, but I'm still not 
sure about the component that receives the events. The receiving 
component wouldn't need any server side validation or state - it only 
needs to provide the code to modify the document (counter, etc). I guess 
the first thing to decide is what kind of component, and how would they 
be wired up...

Sorry I'm still thinking this over, but your input helped and I'd like 
more if you have it :). At any rate, thanks!

chris

> i hope i've not confused you to much :) 
>
> g,
> kris
> 
>
>
>
>
>
> Chris Lewis <ch...@bellsouth.net> 
> 09.10.2007 23:09
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> T5: coordinating components and/or mixins
>
>
>
>
>
>
> Hello again,
>
> I've been working on a mixin that will count the characters typed into a 

> TextField or TextArea, as they are typed. It works fine but among other 
> things, I want to make it possible to control where and how user 
> feedback is displayed. My mixin just implements the counting logic, but 
> it should be possible for a user to use this mixin and configure it to 
> display a counter, implement text-length restriction (something not 
> possible for html text areas without JS), and implement notification. 
> How should I go about doing this? I could easily have a domId parameter 
> on the mixin that would receive the counter notifications, but I'd 
> rather make it easy for one to plug in their own logic and receive these 

> notifications as events. Obviously that part would happen in client-side 

> JS, but I want the framework to coordinate the two (ensuring the 
> components exist, etc). Does anyone have any thoughts on this?
>
> sincerely,
> chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
> 


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



Re: T5: coordinating components and/or mixins

Posted by Chris Lewis <ch...@bellsouth.net>.
Sorry, but you seemed to grasp it well. I have some questions regarding 
your response:

Kristian Marinkovic wrote:
>  a few thoughts that
> come into my mind.....
>
> you can use a Mixin to determine the generated id of 
> a component by using @InjectComponent and reading
> getClientId.
Currently I'm @Inject-ing ComponentResources and using getId() - should 
be the same right?
> This Mixin would delgate the id to a service 
> that is contributed to PageRenderInitializer and is available
> through the @Environmental annotation. After your page 
> has been processed succesfully your service has
> the chance to generate the appropriate JS code for the
> ids it gathered (using PageRenderSupport or DocumentScriptBuilder) 
> ... and here is where you could add events and whatever :)
>   
Why would I delegate the id to a service? If I want to execute my 
mixin's rendering after the page is processed, couldn't I just use 
@MixinAfter or use a heartbeat, and then generate the JS code in the 
mixin? This is what I'm using the mixin for, to generate the appropriate 
JS code to count/monitor the key-presses.
> you can also use a Mixin to generate the counter field by
> intercepting the render phase methods and adding new nodes
> using the markupwriter... but i would'n do this because then you
> would have to make some assumptions on the generated 
> markup of the component your Mixin is attached to.
Exactly.
> Instead
> i'd write a component that will be passed to the mixin via a
> parameter. And this component can be placed whereever you
> want because the JS wiring will be delegated to the injected
> service of your mixin.
>   
I still don't see why I'd use a service to generate the JS instead of 
the mixin - it seems superfluous.
You understand exactly what I'm aiming for though, but I'm still not 
sure about the component that receives the events. The receiving 
component wouldn't need any server side validation or state - it only 
needs to provide the code to modify the document (counter, etc). I guess 
the first thing to decide is what kind of component, and how would they 
be wired up...

Sorry I'm still thinking this over, but your input helped and I'd like 
more if you have it :). At any rate, thanks!

chris

> i hope i've not confused you to much :) 
>
> g,
> kris
>  
>
>
>
>
>
> Chris Lewis <ch...@bellsouth.net> 
> 09.10.2007 23:09
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> T5: coordinating components and/or mixins
>
>
>
>
>
>
> Hello again,
>
> I've been working on a mixin that will count the characters typed into a 
> TextField or TextArea, as they are typed. It works fine but among other 
> things, I want to make it possible to control where and how user 
> feedback is displayed. My mixin just implements the counting logic, but 
> it should be possible for a user to use this mixin and configure it to 
> display a counter, implement text-length restriction (something not 
> possible for html text areas without JS), and implement notification. 
> How should I go about doing this? I could easily have a domId parameter 
> on the mixin that would receive the counter notifications, but I'd 
> rather make it easy for one to plug in their own logic and receive these 
> notifications as events. Obviously that part would happen in client-side 
> JS, but I want the framework to coordinate the two (ensuring the 
> components exist, etc). Does anyone have any thoughts on this?
>
> sincerely,
> chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>   


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


Re: T5: coordinating components and/or mixins

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi chris,

could you split your question into simpler parts :) 
i'm not sure where to start.... so a few thoughts that
come into my mind.....

you can use a Mixin to determine the generated id of 
a component by using @InjectComponent and reading
getClientId. This Mixin would delgate the id to a service 
that is contributed to PageRenderInitializer and is available
through the @Environmental annotation. After your page 
has been processed succesfully your service has
the chance to generate the appropriate JS code for the
ids it gathered (using PageRenderSupport or DocumentScriptBuilder) 
... and here is where you could add events and whatever :)

you can also use a Mixin to generate the counter field by
intercepting the render phase methods and adding new nodes
using the markupwriter... but i would'n do this because then you
would have to make some assumptions on the generated 
markup of the component your Mixin is attached to. Instead
i'd write a component that will be passed to the mixin via a
parameter. And this component can be placed whereever you
want because the JS wiring will be delegated to the injected
service of your mixin.

i hope i've not confused you to much :) 

g,
kris
 





Chris Lewis <ch...@bellsouth.net> 
09.10.2007 23:09
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
T5: coordinating components and/or mixins






Hello again,

I've been working on a mixin that will count the characters typed into a 
TextField or TextArea, as they are typed. It works fine but among other 
things, I want to make it possible to control where and how user 
feedback is displayed. My mixin just implements the counting logic, but 
it should be possible for a user to use this mixin and configure it to 
display a counter, implement text-length restriction (something not 
possible for html text areas without JS), and implement notification. 
How should I go about doing this? I could easily have a domId parameter 
on the mixin that would receive the counter notifications, but I'd 
rather make it easy for one to plug in their own logic and receive these 
notifications as events. Obviously that part would happen in client-side 
JS, but I want the framework to coordinate the two (ensuring the 
components exist, etc). Does anyone have any thoughts on this?

sincerely,
chris

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