Link to home
Start Free TrialLog in
Avatar of bhomass
bhomass

asked on

tapestry question on jwcid

any tapestry experts?

what is this format
         jwcid="table@contrib:Table"
based on?
Avatar of OneOrTwo
OneOrTwo

The jwcid attribute is tapestry-specific. It means that you are defining an instance of a Table component, which comes from the contrib package, and you are giving it the reference id 'table'. You can reference the component from elsewhere (for example to iterate through the rows of the table) using your 'table' id.
Avatar of bhomass

ASKER

I don't think you got my question. I know all about the jwcid itself.

the question is about the FORMAT of "table@contrib:Table". seems like a strange notation to me. how are you suppose to interpret the @ and :?
I think of '@' as 'instance-of' and ':' as a qualifier to avoid name clashes. (I should have said 'library' instead of 'package' in my previous posting.)

So jwcid="table@contrib:Table" reads as "jwcid is 'table', which is an instance of contrib:Table"

I haven't thought about it more than that - it's just a notation.
Avatar of bhomass

ASKER

and what does contrib:Table mean in terms of designated a specific java class?

I know its just a notation, and java is just a language. how would you apply such notation if you don't know the rules?

I am particularly interested in the foundation of this notation. which standard is at its base?
You have to look at the component specification to discover the corresponding java class. If you take a look inside the tapestry-contrib-<version>.jar you find the Java class named in the Table.jwc file:

<component-specification class="org.apache.tapestry.contrib.table.components.Table"
      allow-body="yes" allow-informal-parameters="yes">
...
</component-specification>

You're going to run into difficulties applying a notation if you don't know its syntax and semantics, although you might have some (perhaps limited) success by copying the pattern of some working code.

I doubt that this notation adheres to any standard external to Tapestry. I had a scan of the WebObjects manuals, as the component-based approach of Tapestry is, I believe, loosely derived from WebObjects, but I didn't see anything resembling this notation.
Avatar of bhomass

ASKER

I also already know that this particular jwcid points to the contributed Table.Component class.

here is my problem. I like to create my own components intead of using those included in Tapestry. without knowing how the name convention gets applied, how do I decide what package, class name, and jwcid format to use?

if someone knows the rules, please enlighten me.
Sounds like you are looking for a style guide.

For the class name, use whatever choice of class you would use in any project. This is not affected by the use of Tapestry. For example, many organisations stipulate allowed choices of Java package based on the organisation's URL and departmental or project structure, so this is often in a company style guide.

For the package/library, it depends on how you see the reuse of your libraries. Which parts are reusable and which parts are likely to be reused? How much effort do you want to spend in making sure they are independently deployable? Such issues arise in many contexts - not just in Tapestry. This runs far deeper than a question about a jwcid format! Usually your manager or company strategy will define how much effort to spend here.

What jwcid format to use? Whether to use fully qualified components in the HTML templates, anonymous components, page classes, annotations etc. is all a matter of personal preference. The "trend" (judging by the latest versions of Tapestry) is to pack as much as possible into the Java class via Java 1.5 annotations.
Avatar of bhomass

ASKER

I think you are getting further and further afield as we go on.

Let me try rephrase:

we know that jwcic="table@contrib:Table" maps to org.apache.tapestry.contrib.table.components.Table.

so once I developed a class com.mycompany.myproject.MyClass, what do I put for jwcid to map to this clas?
Your component is defined in a .jwc file
If it is called MyClass.jwc then you make an entry in your .application file to declare the component:

<component-type type="MyClass" specification-path="MyClass.jwc"/>

and refer to the component using @MyClass


Avatar of bhomass

ASKER

ok, now we are hitting it.

what about the library name "contrib" used in contrib:Table. how would I create a cutom lib for my html's to reference?

I have increased the points for the efforts and results shown.
ASKER CERTIFIED SOLUTION
Avatar of OneOrTwo
OneOrTwo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bhomass

ASKER

you truly are an expert on this subject.

Thanks for all the info, which really helps to speed ahead.
Thanks - Glad I was able to help!
Avatar of bhomass

ASKER

if I can ask one more thing. where can I find the references to your answers?
If you're serious about using Tapestry, I recommend 'Enjoying Web Development with Tapestry' by Kent Tong Ka Iok ("Tong's book"). You can buy it from Amazon, or buy a PDF version online. See http://www.agileskills2.org/EWDT/

(I'm not connected in any way with the author - I just think it is a very practical book and much more useful than 'Tapestry in Action', published by Manning)

Other than that, I use the tapestry documentation at http://tapestry.apache.org/ and the Tapestry forums at http://www.tapestryforums.com/
Avatar of bhomass

ASKER

did you get the details concerning the libray tag in the .application file from the tapestry website or from the book you recommended?

It will help me locate the references on the web if they are there at all.
In Tong's book, there is a chapter called 'Creating Custom Components' that should answer your questions (see from p. 155 in the Tapestry 4 edition)

The DTD specs might also be useful: http://tapestry.apache.org/tapestry4/UsersGuide/spec.html