Look at the jwc and class file for the Any component. Tapestry hooks
up the following parameter with the value of the tag name in the
template...
<parameter name="templateTag" type="java.lang.String" direction="auto"
required="no" default-value="null">
<description>
The tag used to add this component in a template.
</description>
</parameter>
Looking at BaseComponentTemplateLoader.addTemplateBindings(IComponent
component, OpenToken token), the tag name is hooked up in this magical
way if and only if (from the source code comment)....
// if the component defines a templateTag parameter and
// there is no established binding for that parameter,
// add a static binding carrying the template tag
So, if you paste the above parameter declaration into your component
and ***add no accessors into the java file**, the value will be hooked
up.
Ok, how do you get at the value then in the java code? Again look at
the jwc file for Any, there is another parameter, element, which takes
as it's default value the value attached to templateTag, and element
has an abstract accessor getElement() in Any.java.
Just use the two parameters in Any as a pattern and you can have
access to the info you need.
Geoff
On 12/7/05, Harvey, David <[EMAIL PROTECTED]> wrote:
> I'm using tapestry 3.0.3.
>
> I've been a struts/jsp developer for 4+ years but I've only been using
> tapestry for a week or so. I have written a half dozen custom
> components and so far, I really like tapestry.
>
> I cannot figure out how to search the archives at
> http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/ so I
> don't know if this question has been asked (and answered) before.
>
> In my custom component I want to know how to the tag name of the
> original html element.
>
> for example in my html code:
> <img jwcid="@ResolvePaths" alt="help me" id="HELPME"
> src="../../images/topbar_bg.jpg" width="600" height="50" />
>
> In my custom component 'ResolvePaths' I want to know the name of the
> html tag it resides in, in this case it would be 'img'. I cannot locate
> any methods in AbstractComponent or BaseComponent.
>
> What I'm trying to develop is a generic tapestry component that my html
> mockup/prototype person can plug into img or other HTML elements and
> have paths to images, script, stylesheets, etc be resolved without
> manually editing the html prototype/mockup. From my custom component I
> can examine the informal parameters and re-emit the component much as is
> done in the Any component but I cannot seem to determine the original
> html tag name. Having this would make the component quite general.
>
> Thanks in advance,
>
> David Harvey
> Senior Software Engineer, Ingenix
>
>
>
>
>
>
>
>
> "Secure Server" made the following
> annotations on 12/07/2005 07:59:19 PM
> ------------------------------"This e-mail, including attachments, may
> include confidential and/or proprietary information, and may be used only by
> the person or entity to which it is addressed. If the reader of this e-mail
> is not the intended recipient or his or her authorized agent, the reader is
> hereby notified that any dissemination, distribution or copying of this
> e-mail is prohibited. If you have received this e-mail in error, please
> notify the sender by replying to this message and delete this e-mail
> immediately."
> ==============================
>
--
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]