On 2/16/07, Ted Steen <[EMAIL PROTECTED]> wrote:
Also, when the Grid is to be sorted after the "trickyFormat" (which I
want to do) the PropertyConduit which relies on the pages property
will not be valid, as it is not updating the _row field...
That indicates a limitation of the current API. I've already been
thinking that sorting may be something that should shift into the
PropertyModel, perhaps with a new PropertySorter interface:
interface PropertySorter { void sort(List list, boolean ascending); }
2007/2/16, Ted Steen <[EMAIL PROTECTED]>:
> How could I create a synthetic property whose conduit is on the page?
> if I create the PropertyConduit I need to use the MyType as rootClass,
> otherwise I will get a ClassCastException, and from MyType I will not
> be able to access the properties on the page.
>
> 2007/2/16, Howard Lewis Ship <[EMAIL PROTECTED]>:
> > The Grid component has a row parameter, equivalent to the Loop
> > components value parameter (and the same as T4's contrib:Table's row
> > parameter). It is set as each row starts to render, to identify the
> > object that will be rendered. This is primarily so that custom cell
> > renderers will know what they are supposed to render, but you can
> > twist it around a few different ways with T5's Grid.
> >
> > Thus you could have:
> >
> > private MyType _row;
> >
> > public void setRow(MyType row) { _row = row; }
> >
> > public String getThatTrickyFormat()
> > {
> > return _row.getThatTrickyProperty().andDoSomethingToIt();
> > }
> >
> > You could then use the PropertyConduitSource service to create a
> > synthetic property whose conduit is the page's thatTrickyFormat
> > property ... or you could leave the conduit as null, and just provide
> > a cell renderer block tha accesses thatTrickyFormat property.
> >
> > On 2/16/07, Ted Steen <[EMAIL PROTECTED]> wrote:
> > > One thing I am struggling with now is cells with values calculated
> > > from the current row.
> > > For the most part the value of a cell is just
> > > currRowObject.some.value, but sometimes one need to go by some
> > > service, eg. myService.getSomeValue(currRowObject).
> > >
> > > I construct my own BeanModel "bm"
> > > then I do
> > >
> > > bm.add("category", new PropertyConduit() {
> > > .
> > > .
> > > .
> > > public Object get(Object instance) {
> > > EntryDTO entry = (EntryDTO)instance;
> > > return entryService.getCategory(entry);
> > > }
> > > .
> > > .
> > > .
> > >
}).label(messages.get("category")).order(10).editorType("categorycell").sortable(true);
> > >
> > > It feels a little clumsy for all my non-primitives and also, how do I
> > > override how the rendering is done?
> > > If I use <t:parameter name="categoryCell">...</t:parameter> I cannot
> > > get the value of the cell from here (well I could invoke
> > > entryService.getCategory(...) once again...but)
> > > I could override toString() on all my DTOs, but that would force me to
> > > also inject the messages etc. into them and that would break my
> > > layered design.
> > >
> > > Any thoughts?
> > >
> > > 2007/2/15, Howard Lewis Ship <[EMAIL PROTECTED]>:
> > > > Fast is nice! Glad it worked.
> > > >
> > > > Grid represents a number of simplifications over T4's contrib:Table.
> > > > We'll see over time if any of the simplficiations is overly drastic,
> > > > but I think it will do nicely. Not to insult OGNL, but removing all
> > > > that OGNL/reflection/synchronization overhead makes a big difference.
> > > > On my MacBook Pro, I see action requests lasting about 2ms and render
> > > > requests (for complex Grid pages) lasting 25 - 35 ms (seems like the
> > > > millisecond clock on Mac OS is more accurate than under Windows).
> > > >
> > > > This still underlies the need for more performance testing of Tapestry
> > > > (4 + 5), something that typically requires a reasonable and stable
> > > > lab in order to be meaningful.
> > > >
> > > > On 2/15/07, Ted Steen <[EMAIL PROTECTED]> wrote:
> > > > > Made my changes, updated svn.
> > > > > Now it works like a charm!
> > > > >
> > > > > And damn! that Grid component is fast!
> > > > >
> > > > > Thank you Howard!
> > > > >
> > > > >
> > > > > 2007/2/15, Howard Lewis Ship <[EMAIL PROTECTED]>:
> > > > > > To do this, you need to construct the BeanModel yourself, by
injecting
> > > > > > the BeanModelSource service.
> > > > > >
> > > > > > You can then add a new column, say "trashcan".
> > > > > >
> > > > > > model.add("trashcan", null).order(1000).label("Delete ?");
> > > > > >
> > > > > > You can then provide a parameter:
> > > > > >
> > > > > > <t:comp type="Grid" ...>
> > > > > > <t:parameter name="trashcanCell">
> > > > > > ...
> > > > > > </t:parameter>
> > > > > > </t:comp>
> > > > > >
> > > > > > Alas, I forgot to add that version of model.add() where you can pass
> > > > > > in the PropertyConduit.
> > > > > >
> > > > > > So you'll have to wait for me to make a couple of changes ...
> > > > > >
> > > > > > On 2/15/07, Ted Steen <[EMAIL PROTECTED]> wrote:
> > > > > > > Hi!
> > > > > > >
> > > > > > > I'm trying out the new Grid component and I am having some
troubles
> > > > > > > with the flexibility of the row's apperence.
> > > > > > > My model is very different from the view (eg. there should be a
little
> > > > > > > trashcan accociated with some of the rows in order to be able to
> > > > > > > delete that row etc.)
> > > > > > > Are there any plans on letting us customise our own rows? maybe a
> > > > > > > parameter "row" that takes a block or similar?...
> > > > > > >
> > > > > > > /Ted
> > > > > > >
> > > > > > >
---------------------------------------------------------------------
> > > > > > > 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]
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > /ted
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > 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]
> > > >
> > > >
> > >
> > >
> > > --
> > > /ted
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> >
> >
>
>
> --
> /ted
>
--
/ted
---------------------------------------------------------------------
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]