Short version of my question:

What is the best way to setup things from the context in a component.
I tried using:

Object onActivate(EventContext context) {
    // Do stuff with context
}

But onActivate doesn't seem to get called on a component on a page. Is
there a different method to get the context from within a component on
a page?



--------------------------



Longer version of what I'm trying to accomplish, just in case I'm
overlooking some built in functionality:

I have an app that needs to display paginated data for several
different pages.  So lets say we have pages named:

/tag
/author
/category

They may be called like this:

/tag/foo/1 (the first page of a list of items assigned tag foo)
/author/25/1 (list of items authored by author with id 25)
/category/15/1 (list of items assigned to category with id 15)

The first item in the context is the ID of the author, tag or category
and the second is the page to display.

My goal was to create a pagination component that could be used on any
of these pages.  So I was going to use onActivate on the page to get
the first context item (the id) and onActivate in the component to get
the second context (the page number).  The page would handle the db
lookup and simply pass a list of all possible items to the component.
So the page would be responsible for getting the right list of items,
but all the logic for what objects to display on a particular page
would be in the component.

The two problems I've run into:

1. I can't seem to get the EventContext from within the component as
onActivate doesn't appear to be called on the component.  I could get
it in the page and simply pass it to the component, but then I have
pagination code in the page which is  what I was trying to avoid.

2. The component still needs to know page it is on and has to grab the
first context item in order to render the links to the other pages
using a page link. What I want is something that says: "Give me a link
to the current page and let me just change the last context item to
build a new page link."

Thanks for any suggestions.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to