You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leonardo Quijano Vincenzi <le...@dtqsoftware.com> on 2005/12/14 01:13:46 UTC

Unique Ids

I wonder if there is any supported property for a Tapestry component 
that gives unique Ids, for any kind of component, not only form ones?

-- 
Ing. Leonardo Quijano Vincenzi
DTQ Software



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


Re: Unique Ids

Posted by Leonardo Quijano Vincenzi <le...@dtqsoftware.com>.
Geoff Longman wrote:
> In Tap 3 you can do this:
>
> Body body = Body.get(cycle);
>
> String uniqueId = body.getUniqueString("foo");
>
> and know that uniqueId is unique for the whole the page render.
>
> dunno about Tap4 though.
>
> Geoff
>   
I think there's a Tapestry.uniqueId() floating around. But I'm actually 
referring to a solution that's not a workaround. I wonder: what makes 
form components so special that they can have their clientId() - and not 
the normal components?

-- 
Ing. Leonardo Quijano Vincenzi
DTQ Software



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


Re: Unique Ids

Posted by Geoff Longman <gl...@gmail.com>.
In Tap 3 you can do this:

Body body = Body.get(cycle);

String uniqueId = body.getUniqueString("foo");

and know that uniqueId is unique for the whole the page render.

dunno about Tap4 though.

Geoff

On 12/13/05, andyhot@di.uoa.gr <an...@di.uoa.gr> wrote:
> From  Leonardo Quijano Vincenzi <le...@dtqsoftware.com>:
>
> > I just need to guarantee (mostly for Tacos) that this:
> >
> > updateComponents="ognl:{components.someComponent.id}"
> >
> > Renders the same id as this:
> >
> > <span
> >      id="ognl:components.someComponent.id"
> >      jwcid="someComponent@Any">
> >
> > *And*
> >
> > that several instances of this "someComponent" on a page will render
> > unique Tapestry IDs for every one.
> >
> > (Now... you say - "you can't put 2 components with the same name on a
> > page!!". But what if "someComponent" is contained in another component,
> > and *that* one is used twice in a page?)
>
> That's the problem. I'ld have to see tapestry's source, but if i remember correctly,
> component 1 (contained in page A) and component 2 (contained in component 3 of
> page A)
> have different namespaces, and so they get different IdAllocators, which means
> they can
> generate the same id.
> Perhaps if we make all tacos components use the same IdAllocator (i.e. take the
> one of the
> current page, or have one injected into them - which will be the same for each
> page request)
> then this would be solved.
> But again, you'ld have to take a look at the source, cause I don't have it handy
> where i am right now :)
>
>
> >
> > --
> > Ing. Leonardo Quijano Vincenzi
> > DTQ Software
> >
> > andyhot@di.uoa.gr wrote:
> > > org.apache.tapestry.util.IdAllocator
> > >
> > > I think it's also used in tacos somewhere.
> > >
> > > It can generate unique ids for a given namespace.
> > > I think that every page has an instance of this class,
> > > but I don't remember if a component embedded in a page gets the
> > > same idallocator.
> > >
> > >
> > > From  Leonardo Quijano Vincenzi <le...@dtqsoftware.com>:
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> --
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
The Spindle guy.           http://spindle.sf.net
Get help with Spindle:   
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:    
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates:            http://spindle.sf.net/updates

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


Re: Unique Ids

Posted by an...@di.uoa.gr.
>From  Leonardo Quijano Vincenzi <le...@dtqsoftware.com>:

> I just need to guarantee (mostly for Tacos) that this:
> 
> updateComponents="ognl:{components.someComponent.id}"
> 
> Renders the same id as this:
> 
> <span
>      id="ognl:components.someComponent.id"
>      jwcid="someComponent@Any">
> 
> *And*
> 
> that several instances of this "someComponent" on a page will render 
> unique Tapestry IDs for every one.
> 
> (Now... you say - "you can't put 2 components with the same name on a 
> page!!". But what if "someComponent" is contained in another component, 
> and *that* one is used twice in a page?)

That's the problem. I'ld have to see tapestry's source, but if i remember correctly,
component 1 (contained in page A) and component 2 (contained in component 3 of
page A)
have different namespaces, and so they get different IdAllocators, which means
they can 
generate the same id. 
Perhaps if we make all tacos components use the same IdAllocator (i.e. take the
one of the
current page, or have one injected into them - which will be the same for each
page request)
then this would be solved. 
But again, you'ld have to take a look at the source, cause I don't have it handy
where i am right now :)


> 
> -- 
> Ing. Leonardo Quijano Vincenzi
> DTQ Software
> 
> andyhot@di.uoa.gr wrote:
> > org.apache.tapestry.util.IdAllocator
> >
> > I think it's also used in tacos somewhere. 
> >
> > It can generate unique ids for a given namespace.
> > I think that every page has an instance of this class,
> > but I don't remember if a component embedded in a page gets the
> > same idallocator.
> >
> >
> > From  Leonardo Quijano Vincenzi <le...@dtqsoftware.com>:
> >   
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 



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


Re: Unique Ids

Posted by Leonardo Quijano Vincenzi <le...@dtqsoftware.com>.
I just need to guarantee (mostly for Tacos) that this:

updateComponents="ognl:{components.someComponent.id}"

Renders the same id as this:

<span
     id="ognl:components.someComponent.id"
     jwcid="someComponent@Any">

*And*

that several instances of this "someComponent" on a page will render 
unique Tapestry IDs for every one.

(Now... you say - "you can't put 2 components with the same name on a 
page!!". But what if "someComponent" is contained in another component, 
and *that* one is used twice in a page?)

-- 
Ing. Leonardo Quijano Vincenzi
DTQ Software

andyhot@di.uoa.gr wrote:
> org.apache.tapestry.util.IdAllocator
>
> I think it's also used in tacos somewhere. 
>
> It can generate unique ids for a given namespace.
> I think that every page has an instance of this class,
> but I don't remember if a component embedded in a page gets the
> same idallocator.
>
>
> From  Leonardo Quijano Vincenzi <le...@dtqsoftware.com>:
>   



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


Re: Unique Ids

Posted by an...@di.uoa.gr.
org.apache.tapestry.util.IdAllocator

I think it's also used in tacos somewhere. 

It can generate unique ids for a given namespace.
I think that every page has an instance of this class,
but I don't remember if a component embedded in a page gets the
same idallocator.


>From  Leonardo Quijano Vincenzi <le...@dtqsoftware.com>:

> I wonder if there is any supported property for a Tapestry component 
> that gives unique Ids, for any kind of component, not only form ones?
> 
> -- 
> Ing. Leonardo Quijano Vincenzi
> DTQ Software
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 



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


Re: Unique Ids

Posted by Derick Fernando <de...@thelabllc.com>.
Leonardo Quijano Vincenzi wrote:
> I was checking this issue and it seems that "IComponent.getIdPath()" 
> gives us a truly unique id, as long as all parent components have an 
> assigned ID (not very sure about this last constraint, though). Is 
> "compX.compY.compZ" a valid XML / HTML id ?
> 

Yes, It is valid, for the sake of HTML4 compatiblitly 
[A-Za-z][A-Za-z0-9:_.-] is valid.

.........................................

Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com

Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC

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


Re: Unique Ids

Posted by Leonardo Quijano Vincenzi <le...@dtqsoftware.com>.
I was checking this issue and it seems that "IComponent.getIdPath()" 
gives us a truly unique id, as long as all parent components have an 
assigned ID (not very sure about this last constraint, though). Is 
"compX.compY.compZ" a valid XML / HTML id ?

-- 
Ing. Leonardo Quijano Vincenzi
DTQ Software


Ron Piterman wrote:
> Leonardo Quijano Vincenzi wrote:
>> I wonder if there is any supported property for a Tapestry component 
>> that gives unique Ids, for any kind of component, not only form ones?
>>
>
> the requestCycle has a method which generates a unique Id based on a 
> key, so you can pass "input" and get back "input133" knowing in the 
> same cycle no other component will get the same id.
> i think getUniqueId(String), but am not sure.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>




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


Re: Unique Ids

Posted by Ron Piterman <rp...@gmx.net>.
Leonardo Quijano Vincenzi wrote:
> I wonder if there is any supported property for a Tapestry component 
> that gives unique Ids, for any kind of component, not only form ones?
> 

the requestCycle has a method which generates a unique Id based on a 
key, so you can pass "input" and get back "input133" knowing in the same 
cycle no other component will get the same id.
i think getUniqueId(String), but am not sure.


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