Currently, I "get" my component to display from a "holder" page that has all of
my components inside of it (about 150). Then on the "Frame" page I tell it
which component to display, it is the one that matches the current state. My
Frame page has a component:
<span jwcid="@common:CardRenderer"/>
This one "renders" the component that corresponds to the current state. The
CardRenderer is implemented as:
public abstract class CardRenderer
extends AbstractComponent
{
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
Tasklet tasklet = ((Visit)getPage().getVisit()).getCurrentTasklet();
TaskletState ts = (TaskletState)tasklet.getCurrentState();
String pageForCard = ts.getPageName();
IPage cardPage = cycle.getPage(pageForCard);
String cardName = tasklet.getCurrentState().getStateName();
BaseComponent component =
(BaseComponent)cardPage.getComponent(cardName);
if (component instanceof PageRenderListener)
{
IPage page = component.getPage();
page.beginPageRender();
}
component.render(writer, cycle);
}
}
So, as long as I can do something similar in T5 I can convert. If not, I have
to re-think T5 or how to implement it.
My real question is how do I, in a T5 manner, access a validation? In T3, it
is implemented in a .jwc and so until it is rendered it doesn't exist with data.
thanks,
Mark
Mark J. Stang
Senior Engineer/Architect
office: +1 303.468.2900
mobile: +1 303.507.2833
Ping Identity
-----Original Message-----
From: Howard Lewis Ship [mailto:[EMAIL PROTECTED]
Sent: Mon 1/29/2007 10:59 AM
To: Tapestry development
Subject: Re: Programmitically calling validations in T5 (was RE: T5:)
So the real issue is how do you wire together the connection and the
view (the Tapestry component). It's very hard for me to say how this
scheme will change during an upgrade from T3 to T5.
On 1/29/07, Mark Stang <[EMAIL PROTECTED]> wrote:
> Howard,
> The API is a Composite Pattern of State Machines. A connection is loaded
> from an XML file. At that point it is passed to the top level state machine.
> Each state populates itself and if necessary it creates child state machines
> and they populate themselves. Each State has an associated View which is a
> Tapestry Component. As the user progresses through the GUI/State Machines,
> the States display themselves using their Tapestry Component. There is a
> Tapestry Page called Frame that displays the current Tapestry Component.
>
> When I load a connection, I call the top level error checking method and it
> walks the composite pattern looking for any errors. We pass along a
> ValidationDelegate which gets populated:
>
> public void appendErrors(ValidationDelegate delegate, BaseComponent component)
>
> If an error is found:
> delegate.setFormComponent(null);
> delegate.record(getMessage("Connection_id_in_use"),
> ValidationConstraint.REQUIRED);
>
> When we are done, we have a list of errors all through the connection. We
> then walk down to where the error occurred and display the component and the
> errors found.
>
> The problem with Validators, at least in 3.x is I have no way execute them as
> they are part of a component at the .jwc level and not the .java level.
>
> HTH,
>
> regards,
>
> Mark
>
> Mark J. Stang
> Senior Engineer/Architect
> office: +1 303.468.2900
> mobile: +1 303.507.2833
> Ping Identity
>
>
>
> -----Original Message-----
> From: Howard Lewis Ship [mailto:[EMAIL PROTECTED]
> Sent: Mon 1/29/2007 10:20 AM
> To: Tapestry development
> Subject: Re: T5:
>
> What does the API for a connection look like?
>
> So ... you want to iterate over all the pages of the applilcation, and
> over all the components of those pages, looking for a specific type of
> component?
>
> Interestingly, that's now much more possible than in T4. The caseless
> URL stuff works by building a master index of all the page and
> component classes at startup, this could give us the ability to
> identify the names of all the pages (or anyway, all the potential
> pages).
>
> I'd appreciate more information, however. If this can be identified as
> a valid and universal use case, it may be possible to let the
> framework do the heavy lifting, by providing a way to annotate the
> methods of the components that need to be referenced.
>
> One of my many goals for T5 is to ensure that Tapestry doesn't get in your
> way.
>
> On 1/29/07, Mark Stang <[EMAIL PROTECTED]> wrote:
> > Howard, et. al.,
> > I am not quite sure how to request this. In Tapestry 3.0x, I don't use the
> > Tapestry Validation. I create what we call a connection. At times, I need
> > to, programmatically, check the connection for errors. I do this by asking
> > all of the parts of a component if they have any errors. The problem with
> > validators has been that they only get called by Tapestry. How could I
> > tell Tapestry to walk all of my pages/components and validate them? Which
> > brings up the issue of they don't exist except in pools until they are
> > displayed. So, the only way to "activate" them is to display every page
> > and have it rendered.
> >
> > Thoughts?
> >
> > thanks,
> >
> > Mark
> >
> > Mark J. Stang
> > Senior Engineer/Architect
> > office: +1 303.468.2900
> > mobile: +1 303.507.2833
> > Ping Identity
> >
> >
> >
> > -----Original Message-----
> > From: Howard Lewis Ship [mailto:[EMAIL PROTECTED]
> > Sent: Sun 1/28/2007 10:18 PM
> > To: Tapestry development
> > Subject: Re: T5:
> >
> > On 1/28/07, Ted Steen <[EMAIL PROTECTED]> wrote:
> > > It is really nice to be able to do input validation declarative for
> > > the simple, and most common case, and in onValidate() programmatically
> > > perform the more complex validation.
> > >
> >
> > And that is the intention!
> >
> > Also, the ability to just ask the Form to record errors simplifies the
> > code signficantly. You almost never need to think about the
> > ValidationTracker object (which is a persistent field of the Form
> > component).
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work. http://howardlewisship.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work. http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]