You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Sabine K." <la...@gmail.com> on 2008/02/20 16:08:21 UTC

Only reload components?

Hi,

is there a way to change only components and not reload the hole page? In
example i have an activex component on the page (an image viewer). I can
control the image viewer with java script ( goToNextPosition() and so on).
For every position the user should be able to make some comments with some
forms. So if the user press the send button for the forms the activex
component should not reload (because it takes a while to load it). Is there
a way to do this with tapestry, or with tapestry + ajax?

Best regards,

Sabine
-- 
View this message in context: http://www.nabble.com/Only-reload-components--tp15590452p15590452.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


Re: Only reload components?

Posted by Ulrich Stärk <ul...@spielviel.de>.
This also works out of the box with a DirectLink and you can even update 
a component when some javascript or dom event is triggered by simply 
adding an EventListener to your page class. E.g.

@EventListener(targets="targetComponent", events="onmousover")
public void updateSomething(IRequestCycle cycle)
{
   cycle.getResponseBuilder().updateComponent("componentToUpdate");
}

Uli

Loïc Talbot schrieb:
> Hi Uli,
> 
> I didn't say I was using form component. So I cannot use your solution.
> 
> Loïc


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


Re: Only reload components?

Posted by Loïc Talbot <lo...@gmail.com>.
Hi Uli,

I didn't say I was using form component. So I cannot use your solution.

Loïc

Re: Only reload components?

Posted by Ulrich Stärk <ul...@spielviel.de>.
You could also go and reinvent the wheel. But if you were smart and 
using T4 you'd just add async="true" to your form component and you are 
set. If you also want to reload the comments on your page without 
reloading the whole page wrap them in an Any component and pass its id 
to the updateComponents parameter of your form. See 
http://tapestry.apache.org/tapestry4.1/components/form/form.html for 
details.

Uli

Loïc Talbot schrieb:
>> Hi,
>>
>> is there a way to change only components and not reload the hole page? In
>> example i have an activex component on the page (an image viewer). I can
>> control the image viewer with java script ( goToNextPosition() and so on).
>> For every position the user should be able to make some comments with some
>> forms. So if the user press the send button for the forms the activex
>> component should not reload (because it takes a while to load it). Is
>> there
>> a way to do this with tapestry, or with tapestry + ajax?
>>
>> Best regards,
>>
> 
> Hi Sabine,
> If you are trying to get only some elements of a page through an ajax
> request, assuming you are using T4, you could implement a class that
> inherits from AbstractComponent and overrides renderComponent() method.
>     @Override
>     protected void renderComponent(IMarkupWriter writer, IRequestCycle
> cycle) {
>         StringBuffer s = new StringBuffer();
>         writer.begin("script");
>         writer.attribute("type", "text/text");
>         s.append("the elements for your next forms");
>         writer.printRaw(new String(s));
>         writer.end();
>     }
> this component could  then be accessed directly if it also implements
> IDirect or through a BasePage.
> Your javascript should be responsible for calling this component and then
> replacing the right elements of the page with the returned elements of this
> Tapestry component.
> 
> Loïc


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


Re: Only reload components?

Posted by Loïc Talbot <lo...@gmail.com>.
> Hi,
>
> is there a way to change only components and not reload the hole page? In
> example i have an activex component on the page (an image viewer). I can
> control the image viewer with java script ( goToNextPosition() and so on).
> For every position the user should be able to make some comments with some
> forms. So if the user press the send button for the forms the activex
> component should not reload (because it takes a while to load it). Is
> there
> a way to do this with tapestry, or with tapestry + ajax?
>
> Best regards,
>

Hi Sabine,
If you are trying to get only some elements of a page through an ajax
request, assuming you are using T4, you could implement a class that
inherits from AbstractComponent and overrides renderComponent() method.
    @Override
    protected void renderComponent(IMarkupWriter writer, IRequestCycle
cycle) {
        StringBuffer s = new StringBuffer();
        writer.begin("script");
        writer.attribute("type", "text/text");
        s.append("the elements for your next forms");
        writer.printRaw(new String(s));
        writer.end();
    }
this component could  then be accessed directly if it also implements
IDirect or through a BasePage.
Your javascript should be responsible for calling this component and then
replacing the right elements of the page with the returned elements of this
Tapestry component.

Loïc

Re: Only reload components?

Posted by "Sabine K." <la...@gmail.com>.
Hi Francois,

thank you for that link. On the page:     
    * zone parameter for Form components
    * Extending a Form with a Zone
    * Additional Tapestry.ZoneEffect functions, plus documentation
    * Real examples ...

So i think i have to wait for the zome parameter for Form components
implementation. Did you have any examples how to use the zone component?

Best regards



Francois Armand wrote:
> 
> Sabine K. wrote:
>> Hi,
>>
>> is there a way to change only components and not reload the hole page?
>> [...] Is there
>> a way to do this with tapestry, or with tapestry + ajax?
>>
>>   
> Hello Sabine,
> 
> Tapesty has some Ajax facilities, which are describe here : 
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/ajax.html
> I believe that you are looking for something like the zone component and 
> Ajax use.
> 
> -- 
> Francois Armand
> Etudes & Développements J2EE
> Groupe Linagora - http://www.linagora.com
> Tél.: +33 (0)1 58 18 68 28
> -----------
> InterLDAP - http://interldap.org 
> FederID - http://www.federid.org/
> Open Source identities management and federation
> 
> 
> ---------------------------------------------------------------------
> 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/Only-reload-components--tp15590452p15630996.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


Re: Only reload components?

Posted by Francois Armand <fa...@linagora.com>.
Sabine K. wrote:
> Hi,
>
> is there a way to change only components and not reload the hole page? [...] Is there
> a way to do this with tapestry, or with tapestry + ajax?
>
>   
Hello Sabine,

Tapesty has some Ajax facilities, which are describe here : 
http://tapestry.apache.org/tapestry5/tapestry-core/guide/ajax.html
I believe that you are looking for something like the zone component and 
Ajax use.

-- 
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


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