Tusen tack Peter! Too bad there's so little documentation on Tapestry :(
Peter Svensson wrote:
Oh yes, very :)
The main problem (as I griped about on another list just yesterday) is that
there are only four places to get info on using tables (which perhaps just
about 100% of all tapesry coders use);
1) Ken's book (Which is a complete must) at http://agileskills2.org/EWDT/
2) John Reynolds TapestryTables.war tutorial at
http://weblogs.java.net/blog/johnreynolds/archive/2004/10/index.html
3) The deprecated FormTable description at
http://jakarta.apache.org/tapestry/tapestry-contrib/ComponentReference/FormTable.html
4) The contrib:Table API at
http://jakarta.apache.org/tapestry/tapestry-contrib/apidocs/index.html
That's it. It took me nearly two days to understand that if I roll my own
ITableColumns (no big deal, and rather well documented (in the source code)
in the TapestryTables tutorial) I have do create and add my own Block's
inside it so that they can be overriden in the html or jwc/page file. A
killer!
My aim was to make a simpele table coponent which doesn't need any columsn
at all, but uses introspection to grok what the field names are and such - a
little bit like trails does, but with less gears and functions (In order to
make my own grafts of coming trails functions which I needed atm). And I
managed to do it - works great. It just turns out that one doesn't want
that, because one alsways want column ordering, and - well - that's what I
explicitly didn't build in :-)=
Cheers,
PS
On 3/8/06, Nima Boustanian <[EMAIL PROTECTED]> wrote:
Okay, understood Peter (and thanks!). Sorry about being persistent
though, but aren't there any other ways of doing this?
I haven't seen it in any examples, is it common practice to override
columns?
Peter Svensson wrote:
Uh no :) I think I misunderstood you.
But a table shows only one list at a time, where all properties of the
current object (which will be the row) make up the fields in the row.
If you want to insert fields from another kind of object, it might get
odd,
since there is no natural relation in order between the two lists, unless
you are absolutely certain that the lorder of each list can be trusted
and
make sense.
In that case you can define a column in you table which does not exist as
a
property at all in the objects in the first list, then override that
column
with a "block override" thus;
<div jwcid="@contrib:Table source="ognl:posts" columns="foo, bar, baz">
<div jwcid="[EMAIL PROTECTED]">
<div jwcid="ognl:renderbaz">
</div>
</div>
But then you would have to keep track of the row as well.
Gotta run!
cHEERS,
ps
On 3/8/06, Nima Boustanian <[EMAIL PROTECTED]> wrote:
Peter Svensson wrote:
Well either you could use two tables, or you could have a third method
mix
the two.
Don't you just want to have one or two of the columns in the first
table
show something from the other list?
The way I would do that is to just add a property for the Post object
that
refers to a specific Person object.
Then you could add a couple of columns in your columns="" binding that
actually refers to properties in person, like;
columns="columns="listOfPosts:Title:title, personName:Name:
myPerson.name"
where you add in Post.java;
Person myPerson;
public Person getMyPerson()
{
return myPerson;
}
anbd of course you have a getName() method on person. Would that
work??
Cheers,
PS
On 3/8/06, Nima Boustanian <[EMAIL PROTECTED]> wrote:
Hey all
How do I output data from multiple sources into one contrib:Table?
What I do at the moment is:
<table jwcid="[EMAIL PROTECTED]:Table"
id="conversationsPlaceHolder" source="ognl:posts"
columns="listOfPosts:Title:title,
listOfPosts:Created:createdDate"
class="postTable" cellpadding="2"
cellspacing="2" width="100%">
Where the data source for source="ognl:posts" is
public List getPosts() {
return getPostManager().getPosts();
}
The above example works fine, but what if I have another method which
returns
public List getPerson() {
return
getPersonManager().getPersons();
}
How can I use both sources in one table? If this isn't possible, are
there any other components that should be used instead?
Thanks!
Btw - if there are other newbies out there interested in Tapestry
components, check out this site I stumbled across recently,
it can come in handy: http://xdoclet.codehaus.org/TapestryTags
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hmm.. not quite sure if I follow you Peter, what I have now is:
public abstract class ConversationsPlaceHolder extends BaseComponent {
@InjectObject("spring:tagManager")
public abstract TagManager getTagManager();
@InjectObject("spring:postManager")
public abstract PostManager getPostManager();
public List getPostTags() {
return getTagManager().getTags();
}
public List getPosts() {
return getPostManager().getPosts();
}
Both methods are in the same class... are you saying that I should have
a third method which mixes getPostTags and getPosts?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]