Solved

tapestry question on jwcid

Posted on 2006-10-29
17
551 Views
Last Modified: 2013-11-24
any tapestry experts?

what is this format
         jwcid="table@contrib:Table"
based on?
0
Comment
Question by:bhomass
  • 9
  • 8
17 Comments
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17832371
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.
0
 

Author Comment

by:bhomass
ID: 17835365
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 :?
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17835601
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.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:bhomass
ID: 17835684
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?
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17837463
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.
0
 

Author Comment

by:bhomass
ID: 17837621
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.
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17838700
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.
0
 

Author Comment

by:bhomass
ID: 17838995
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?
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17840744
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


0
 

Author Comment

by:bhomass
ID: 17843870
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.
0
 
LVL 1

Accepted Solution

by:
OneOrTwo earned 100 total points
ID: 17844924
A custom library is just another JAR file. The JAR file contains a .library file that has a library-specification:

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

The library is then referenced from your .application file:

<library id="myLib" specification-path="/com/foo/components/MyComponents.library"/>

Here, the specification-path is the path to the library specification within the JAR file.
Once you have given the library the id "myLib", you should refer to components from that library using that prefix, as in @myLib:MyClass
0
 

Author Comment

by:bhomass
ID: 17846225
you truly are an expert on this subject.

Thanks for all the info, which really helps to speed ahead.
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17848324
Thanks - Glad I was able to help!
0
 

Author Comment

by:bhomass
ID: 17859696
if I can ask one more thing. where can I find the references to your answers?
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17865677
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/
0
 

Author Comment

by:bhomass
ID: 17868065
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.
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17868207
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
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 45
Java JRE greater than 1.6 5 63
map related example 6 49
iterator/ListIterator approach 17 28
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question