You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andrea Chiumenti <ki...@gmail.com> on 2009/03/06 08:16:21 UTC

about T5 javascript

Hi to avoid me to read all Tapestry js code, could you tell me waht
is/are the js Class and method(s) that replace a zone on a xhr call ?

Thanks,
kiuma

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


Re: about T5 javascript

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Sun, 08 Mar 2009 15:13:58 -0300, Fernando Padilla <fe...@alum.mit.edu>  
escreveu:

> that said, any committers want to add a simple function for people to  
> use?? something like this:
>
> Tapestry.activateZone = function( zoneId, url ) {
> 	var zoneManager = Tapestry.findZoneManagerFromId( zoneId );
> 	zoneManager.updateFromURL( url );
> }

Nice idea! Could you file a JIRA for this? So the committers will not  
forget about it? :)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: about T5 javascript

Posted by Fernando Padilla <fe...@alum.mit.edu>.
that said, any committers want to add a simple function for people to 
use?? something like this:

Tapestry.activateZone = function( zoneId, url ) {
	var zoneManager = Tapestry.findZoneManagerFromId( zoneId );
	zoneManager.updateFromURL( url );
}


Inge Solvoll wrote:
> var zoneObject = Tapestry.findZoneManager(elementConnectedToZone);
> 
> zoneObject.updateFromURL(link);
> 
> On Fri, Mar 6, 2009 at 8:16 AM, Andrea Chiumenti <ki...@gmail.com> wrote:
> 
>> Hi to avoid me to read all Tapestry js code, could you tell me waht
>> is/are the js Class and method(s) that replace a zone on a xhr call ?
>>
>> Thanks,
>> kiuma
>>
>> ---------------------------------------------------------------------
>> 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: about T5 javascript

Posted by Inge Solvoll <in...@gmail.com>.
var zoneObject = Tapestry.findZoneManager(elementConnectedToZone);

zoneObject.updateFromURL(link);

On Fri, Mar 6, 2009 at 8:16 AM, Andrea Chiumenti <ki...@gmail.com> wrote:

> Hi to avoid me to read all Tapestry js code, could you tell me waht
> is/are the js Class and method(s) that replace a zone on a xhr call ?
>
> Thanks,
> kiuma
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: about T5 javascript

Posted by Fernando Padilla <fe...@alum.mit.edu>.
https://issues.apache.org/jira/browse/TAP5-569

here, this bug has more js that you should include.  Then you can just use:

Tapestry.activateZone( "vMessage", validLink );


On 3/10/09 8:03 AM, Michael Williamson wrote:
> I'm having problems creating a ZoneManager.  Here are is my code.
>
> Component tml
>
> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> 	<t:zone t:id="vMessage" class="errorDiv">
> 	<p>${message}</p>
> 	</t:zone>
> 	<p>  Check</p>
> </t:container>
>
> container java
>
> package roa.components;
>
> import org.apache.tapestry5.ComponentResources;
> import org.apache.tapestry5.Link;
> import org.apache.tapestry5.MarkupWriter;
> import org.apache.tapestry5.RenderSupport;
> import org.apache.tapestry5.annotations.ApplicationState;
> import org.apache.tapestry5.annotations.Environmental;
> import org.apache.tapestry5.annotations.InjectComponent;
> import org.apache.tapestry5.annotations.Parameter;
> import org.apache.tapestry5.annotations.Persist;
> import org.apache.tapestry5.annotations.Property;
> import org.apache.tapestry5.corelib.components.Zone;
> import org.apache.tapestry5.ioc.annotations.Inject;
>
> import roa.business.AppObject;
> import roa.business.AssemblyPart;
> import roa.business.Validation;
> import roa.data.VenderInworkAssyParts;
>
>
> public class ValidateMessage
> {
> 	@Property
> 	@Persist
> 	private String message;
> 	
> 	@Property
> 	@Persist
> 	private String currentValues;
> 	
> 	@ApplicationState
> 	private AppObject appObject;
> 	
> 	@InjectComponent
> 	private Zone vMessage;
> 	
>
> 	@Inject
>      private ComponentResources resources;
>
>      @Environmental
>      private RenderSupport renderSupport;
>
>      void afterRender(MarkupWriter writer)
>      {
>          Link link = resources.createEventLink("actionFromCheck");
>          renderSupport.addScript("var validLink = " + link);
>      }
>
> 	public Object onActionFromCheck()
> 	{
> 			this.message = "New Message";
>
> 		return vMessage.getBody();
> 	}
> }
>
> JavaScript
>
> 			var element = document.forms[0].all("check");
> 			var zoneObject = Tapestry.findZoneManager(element);
> 			zoneObject.updateFromURL(validLink);
>
> the ZoneManager is null.  I have tried serval variations on this code based
> on google search. I think I need to remove the ActionLink in the component
> tml file and create a new ZoneManager from the zone element and the link but
> I can't get that to work ether.
>
>
> Fernando Padilla wrote:
>> URL = a url you would build on the serverside using something like:
>> resources.createEventLink( "".... );
>>
>>
>> Let me review the background below.. I hope I don't confuse you too much..
>>
>>
>> Normally:
>>
>> <t:zone id="zoneId"/>
>>   activateZone
>>
>>
>> Generates:Html:
>>
>> <div id="zoneId">
>> </div>
>>
>>   URL activateZone
>>
>>
>> Generates:Javascript:
>>
>> 1) setup a ZoneManager against the div#zoneId
>> 2) setup a click listener on the actionlink.. to fetch actionlink URL
>> from tapestry, (which calls the event listener which returns a Block,
>> and then tapestry renders block.. ), once the URL returns, it squirts
>> the contents of the results into the appropriate div#zoneId.
>>
>> step 2 is basically what Tapestry.activateZone would replace.. so you
>> can do this without relying on an actionlink or form..
>>
>>
>> mwilliamson@kcp.com wrote:
>>> I would like to use this feature but I can't figure out what url this is.
>>>
>>> Fernando Padilla wrote:
>>>> that said, any committers want to add a simple function for people to
>>>> use?? something like this:
>>>>
>>>> Tapestry.activateZone = function( zoneId, url ) {
>>>> 	var zoneManager = Tapestry.findZoneManagerFromId( zoneId );
>>>> 	zoneManager.updateFromURL( url );
>>>> }
>>>>
>>>>
>>>> Inge Solvoll wrote:
>>>>> var zoneObject = Tapestry.findZoneManager(elementConnectedToZone);
>>>>>
>>>>> zoneObject.updateFromURL(link);
>>>>>
>>>>> On Fri, Mar 6, 2009 at 8:16 AM, Andrea Chiumenti<ki...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi to avoid me to read all Tapestry js code, could you tell me waht
>>>>>> is/are the js Class and method(s) that replace a zone on a xhr call ?
>>>>>>
>>>>>> Thanks,
>>>>>> kiuma
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>>>
>>>>
>>>>
>>> Quoted from:
>>> http://www.nabble.com/about-T5-javascript-tp22367350p22400998.html
>>>
>> ---------------------------------------------------------------------
>> 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: about T5 javascript

Posted by Michael Williamson <mw...@kcp.com>.
I'm having problems creating a ZoneManager.  Here are is my code.

Component tml

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
	<t:zone t:id="vMessage" class="errorDiv">
	<p>${message}</p>
	</t:zone>
	<p> Check </p>
</t:container>

container java

package roa.components;

import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.RenderSupport;
import org.apache.tapestry5.annotations.ApplicationState;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;

import roa.business.AppObject;
import roa.business.AssemblyPart;
import roa.business.Validation;
import roa.data.VenderInworkAssyParts;


public class ValidateMessage
{
	@Property
	@Persist
	private String message;
	
	@Property
	@Persist
	private String currentValues;
	
	@ApplicationState
	private AppObject appObject;
	
	@InjectComponent
	private Zone vMessage;
	

	@Inject
    private ComponentResources resources;

    @Environmental
    private RenderSupport renderSupport;
    
    void afterRender(MarkupWriter writer)
    {
        Link link = resources.createEventLink("actionFromCheck");
        renderSupport.addScript("var validLink = " + link);
    }

	public Object onActionFromCheck()
	{
			this.message = "New Message";

		return vMessage.getBody();
	}
}

JavaScript

			var element = document.forms[0].all("check");
			var zoneObject = Tapestry.findZoneManager(element); 
			zoneObject.updateFromURL(validLink); 

the ZoneManager is null.  I have tried serval variations on this code based
on google search. I think I need to remove the ActionLink in the component
tml file and create a new ZoneManager from the zone element and the link but
I can't get that to work ether.


Fernando Padilla wrote:
> 
> URL = a url you would build on the serverside using something like:
> resources.createEventLink( "".... );
> 
> 
> Let me review the background below.. I hope I don't confuse you too much..
> 
> 
> Normally:
> 
> <t:zone id="zoneId"/>
>  activateZone 
> 
> 
> Generates:Html:
> 
> <div id="zoneId">
> </div>
> 
>  URL activateZone 
> 
> 
> Generates:Javascript:
> 
> 1) setup a ZoneManager against the div#zoneId
> 2) setup a click listener on the actionlink.. to fetch actionlink URL 
> from tapestry, (which calls the event listener which returns a Block, 
> and then tapestry renders block.. ), once the URL returns, it squirts 
> the contents of the results into the appropriate div#zoneId.
> 
> step 2 is basically what Tapestry.activateZone would replace.. so you 
> can do this without relying on an actionlink or form..
> 
> 
> mwilliamson@kcp.com wrote:
>> I would like to use this feature but I can't figure out what url this is.  
>> 
>> Fernando Padilla wrote:
>>> that said, any committers want to add a simple function for people to 
>>> use?? something like this:
>>>
>>> Tapestry.activateZone = function( zoneId, url ) {
>>> 	var zoneManager = Tapestry.findZoneManagerFromId( zoneId );
>>> 	zoneManager.updateFromURL( url );
>>> }
>>>
>>>
>>> Inge Solvoll wrote:
>>>> var zoneObject = Tapestry.findZoneManager(elementConnectedToZone);
>>>>
>>>> zoneObject.updateFromURL(link);
>>>>
>>>> On Fri, Mar 6, 2009 at 8:16 AM, Andrea Chiumenti <ki...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi to avoid me to read all Tapestry js code, could you tell me waht
>>>>> is/are the js Class and method(s) that replace a zone on a xhr call ?
>>>>>
>>>>> Thanks,
>>>>> kiuma
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>>
>>>
>> Quoted from: 
>> http://www.nabble.com/about-T5-javascript-tp22367350p22400998.html
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/about-T5-javascript-tp22367350p22436222.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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