You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jan Vissers <Ja...@cumquat.nl> on 2008/03/26 21:14:19 UTC
T5 (5.0.11) - ready for production deployment
Hi,
I have an opportunity to use T5 (5.0.11) in an assignment. My question is;
is it safe for me to do so? The application is quite simple in that not
many UI components/forms have to be created. There will be a requirement
to have google suggest like functionality, along with a small other Ajax
component. The deployment platform will be tomcat.
What do you think - 'is it safe' ?
Thanks for any feedback,
-J.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 (5.0.11) - ready for production deployment
Posted by Ben Acker <be...@gmail.com>.
I have a 5.0.10 application running as a simple CRUD app @ my
employment and it's running fine.
-Ben
On Mar 26, 2008, at 1:14 PM, Jan Vissers wrote:
> Hi,
>
> I have an opportunity to use T5 (5.0.11) in an assignment. My
> question is;
> is it safe for me to do so? The application is quite simple in that
> not
> many UI components/forms have to be created. There will be a
> requirement
> to have google suggest like functionality, along with a small other
> Ajax
> component. The deployment platform will be tomcat.
>
> What do you think - 'is it safe' ?
>
> Thanks for any feedback,
> -J.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 (5.0.11) - ready for production deployment
Posted by Donyee <xy...@gmail.com>.
I had developed a crud system using tapestry-5-0-5, it works fine!
and i will upgrade to the latest version.
2008/3/27, Martin Grotzke <ma...@javakaffee.de>:
>
> Hi,
>
> we also have a production app running T5 http://www.smatch.com, very
> stable, up and running.
>
> Cheers,
>
> Martin
>
>
>
> On Wed, 2008-03-26 at 21:14 +0100, Jan Vissers wrote:
> > Hi,
> >
> > I have an opportunity to use T5 (5.0.11) in an assignment. My question
> is;
> > is it safe for me to do so? The application is quite simple in that not
> > many UI components/forms have to be created. There will be a requirement
> > to have google suggest like functionality, along with a small other Ajax
> > component. The deployment platform will be tomcat.
> >
> > What do you think - 'is it safe' ?
> >
> > Thanks for any feedback,
> > -J.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
>
--
Yet Another Java EE Developer!
Re: T5, newbie: [Solved] Component parameter passing problems
Posted by Alec Leamas <le...@gmail.com>.
Thanks to Josh this problem has been solved. The culprit was how I
invoked the components. I was using <t:Layout rows="${rows}" ... />
I should use <t:Layout rows="prop:rows" ... />
Thanks for all help! And a special thank to Josh!
--Alec
Davor Hrg wrote:
> how is getRows declared in your page class ?
>
>
>> OK, thanks...
>>
>> In my page, I have <t:myComponent columns="prop:columns"
>> rows="prop:rows"/>
>>
>> The columns argument, a List<String> is just fine.
>> The rows argument, a List<MyMap> is the problem.
>>
>> The page has a List<MyMap> getRows() which is verified.
>>
>> Looking in MyComponent.java, I have
>>
>> @Parameter
>> private List<MyMap> rows;
>>
>> @Parameter
>> private List<String> columns;
>>
>> public String getSomethingStrange()
>> {
>> return rows.get(0).get( "mail" );
>> }
>>
>> The latter getter fails. The debug info is from a breakpoint inside this
>> method. The error I get is a classcast error "java.lang.String cannot be
>> cast to ...MyMap" If I change the index to 1, there an error "Caused
>> by: Index: 1, Size: 1" i. e., index out of bounds.
>>
>> Davor Hrg wrote:
>>
>>> Tapestry support for Java generics is very limited,
>>> you need a value encoder to make this work,
>>>
>>> also, add more details on who calls what... so more is known
>>> of the problem you are trying to solve.
>>>
>>>
>>> Davor Hrg
>>>
>>> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
>>>
>> wrote:
>>
>>>> I have problems passing my own datatype(s) to my own component. The
>>>> component takes two parameters, one List<String> and one List<MyMap>.
>>>> MyMap is declared as MyMap extends TreeMap {...}.
>>>>
>>>> The first parameter, a list of strings arrives safely to my component.
>>>> However, the other one, seems to be mixed up: when I try to access an
>>>> element in my List<MyMap>, it turns out that Tapestry (nothing else
>>>> involved) have filled this list with String items, not the expected
>>>> MyMap items. In the end, there is a class cast exception when trying to
>>>> access the MyMap items as Maps.
>>>>
>>>> In the Eclipse debugger, it seems that the value of the List<MyMap>
>>>> instance variable is a single string holding what looks like the
>>>> serialized value of my List<MyMap> list. The start is
>>>> "[{key=value,key=value...
>>>>
>>>> I've tried to contribute coercions between MyMap<->Map, but this desn't
>>>> seem to help (?).
>>>>
>>>> Basically, I'm stucked unless I write everything in several big pages
>>>> with duplicated code. Don't really want to do that. :-(
>>>>
>>>> Any hints out there?
>>>>
>>>> --alec
>>>>
>>>> PS Version: 5.0.11 DS
>>>>
>>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems
Posted by Josh Canfield <jo...@thedailytube.com>.
There is no conversion when passing parameters between components. I'm
pretty confident that the fact you are using generics here is
irrelevant. When you access the @Parameter for the first time Tapestry
calls the getter from the page, and the object returned is the object
that you are using in the component.
I've created a small example app with one component that takes both a
List<String> and a List<MyMap> (which I extended from TreeMap) and it
passes data between the page and component fine.
Have you set a breakpoint in the getter method on the page and
inspected the map? My guess is that it's corrupt before it's every
assigned to the local variable in your component.
Josh
On Tue, Apr 1, 2008 at 11:42 AM, Alec Leamas <le...@gmail.com> wrote:
> Thanks for taking time to answer :-)
>
> I first had all of this working for a single page. *After* that, I
> started a refactoring effort to be able to share some parts of the code
> with other pages. That is, I'm moving out some working code from the
> page (java + template) to a component. All of this seems very straight
> forward, besides the fact that the two parameters behaves so
> differently. Bottom line: the code runs OK when used in single page, but
> there are problems factoring out a component.
>
> Part of this is the feeling: the parameter passing works in one case
> and not in the other. This makes me unhappy. I want to understand
> what's possible and not w r to parameter passing, and this seems to be a
> little unclear to me. Davor Hrg indicated that there might be some
> problems w generics, so I guess this is not that simple(?). And although
> I've read what I found about coercion, I wouldn't say I understand this
> fully. I *am* that stupid, have to live with it ;-)
>
> The reasons to extend Map is perhaps outside the scope of this
> discussion, although I'm of course ready to go into it this would make
> things more clear.
>
> Maybe this boils down to a simple question before diving into more code:
> is Tapestry expected to handle my two parameters of type List<String>
> and List<MyMap> in the same way? Or is there s difference between a
> List of a "well-known" type and List containing a user defined type?
>
> --Alec
>
>
> Jonathan Barker wrote:
> >
> > This is really sounding like something unrelated to Tapestry, and there
> > isn't enough code presented to tell.
> >
> > Do you have proof that your code works outside of Tapestry? Why, and how,
> > did you EXTEND TreeMap? Do you have a unit test to prove that your MyMap
> > works?
> >
> > If you can present a non-Tapestry test that works, and corresponding
> > Tapestry test that doesn't, then I think you'll find an answer quickly.
> >
> > Jonathan
> >
> >
> >
> >
> >> -----Original Message-----
> >> From: Alec Leamas [mailto:leamas.alec@gmail.com]
> >> Sent: Tuesday, April 01, 2008 8:37 AM
> >> To: Tapestry users
> >> Subject: Re: T5, newbie: Component parameter passing problems
> >>
> >> public List<MyMap> getRows() {...}
> >>
> >> Davor Hrg wrote:
> >>
> >>> how is getRows declared in your page class ?
> >>>
> >>>
> >>>
> >>>
> >>> On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin <Mi...@kolmodin.net>
> >>> wrote:
> >>>
> >>>
> >>>
> >>>> OK, thanks...
> >>>>
> >>>> In my page, I have <t:myComponent columns="prop:columns"
> >>>> rows="prop:rows"/>
> >>>>
> >>>> The columns argument, a List<String> is just fine.
> >>>> The rows argument, a List<MyMap> is the problem.
> >>>>
> >>>> The page has a List<MyMap> getRows() which is verified.
> >>>>
> >>>> Looking in MyComponent.java, I have
> >>>>
> >>>> @Parameter
> >>>> private List<MyMap> rows;
> >>>>
> >>>> @Parameter
> >>>> private List<String> columns;
> >>>>
> >>>> public String getSomethingStrange()
> >>>> {
> >>>> return rows.get(0).get( "mail" );
> >>>> }
> >>>>
> >>>> The latter getter fails. The debug info is from a breakpoint inside
> >>>>
> >> this
> >>
> >>>> method. The error I get is a classcast error "java.lang.String cannot
> >>>>
> >> be
> >>
> >>>> cast to ...MyMap" If I change the index to 1, there an error "Caused
> >>>> by: Index: 1, Size: 1" i. e., index out of bounds.
> >>>>
> >>>> Davor Hrg wrote:
> >>>>
> >>>>
> >>>>> Tapestry support for Java generics is very limited,
> >>>>> you need a value encoder to make this work,
> >>>>>
> >>>>> also, add more details on who calls what... so more is known
> >>>>> of the problem you are trying to solve.
> >>>>>
> >>>>>
> >>>>> Davor Hrg
> >>>>>
> >>>>> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
> >>>>>
> >>>>>
> >>>> wrote:
> >>>>
> >>>>
> >>>>>> I have problems passing my own datatype(s) to my own component. The
> >>>>>> component takes two parameters, one List<String> and one List<MyMap>.
> >>>>>> MyMap is declared as MyMap extends TreeMap {...}.
> >>>>>>
> >>>>>> The first parameter, a list of strings arrives safely to my
> >>>>>>
> >> component.
> >>
> >>>>>> However, the other one, seems to be mixed up: when I try to access an
> >>>>>> element in my List<MyMap>, it turns out that Tapestry (nothing else
> >>>>>> involved) have filled this list with String items, not the expected
> >>>>>> MyMap items. In the end, there is a class cast exception when trying
> >>>>>>
> >> to
> >>
> >>>>>> access the MyMap items as Maps.
> >>>>>>
> >>>>>> In the Eclipse debugger, it seems that the value of the List<MyMap>
> >>>>>> instance variable is a single string holding what looks like the
> >>>>>> serialized value of my List<MyMap> list. The start is
> >>>>>> "[{key=value,key=value...
> >>>>>>
> >>>>>> I've tried to contribute coercions between MyMap<->Map, but this
> >>>>>>
> >> desn't
> >>
> >>>>>> seem to help (?).
> >>>>>>
> >>>>>> Basically, I'm stucked unless I write everything in several big pages
> >>>>>> with duplicated code. Don't really want to do that. :-(
> >>>>>>
> >>>>>> Any hints out there?
> >>>>>>
> >>>>>> --alec
> >>>>>>
> >>>>>> PS Version: 5.0.11 DS
> >>>>>>
> >>>>>> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>> --
> >>>> -----------------------------------------------------------------------
> >>>>
> >> ---
> >>
> >>>> Michael Kolmodin Fredsgatan 2
> >>>> Phone: +46 920 269413 S-972 35 Lulea
> >>>> Mobile +46 70 551 6507 Sweden
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems
Posted by Alec Leamas <le...@gmail.com>.
Thanks for taking time to answer :-)
I first had all of this working for a single page. *After* that, I
started a refactoring effort to be able to share some parts of the code
with other pages. That is, I'm moving out some working code from the
page (java + template) to a component. All of this seems very straight
forward, besides the fact that the two parameters behaves so
differently. Bottom line: the code runs OK when used in single page, but
there are problems factoring out a component.
Part of this is the feeling: the parameter passing works in one case
and not in the other. This makes me unhappy. I want to understand
what's possible and not w r to parameter passing, and this seems to be a
little unclear to me. Davor Hrg indicated that there might be some
problems w generics, so I guess this is not that simple(?). And although
I've read what I found about coercion, I wouldn't say I understand this
fully. I *am* that stupid, have to live with it ;-)
The reasons to extend Map is perhaps outside the scope of this
discussion, although I'm of course ready to go into it this would make
things more clear.
Maybe this boils down to a simple question before diving into more code:
is Tapestry expected to handle my two parameters of type List<String>
and List<MyMap> in the same way? Or is there s difference between a
List of a "well-known" type and List containing a user defined type?
--Alec
Jonathan Barker wrote:
>
> This is really sounding like something unrelated to Tapestry, and there
> isn't enough code presented to tell.
>
> Do you have proof that your code works outside of Tapestry? Why, and how,
> did you EXTEND TreeMap? Do you have a unit test to prove that your MyMap
> works?
>
> If you can present a non-Tapestry test that works, and corresponding
> Tapestry test that doesn't, then I think you'll find an answer quickly.
>
> Jonathan
>
>
>
>
>> -----Original Message-----
>> From: Alec Leamas [mailto:leamas.alec@gmail.com]
>> Sent: Tuesday, April 01, 2008 8:37 AM
>> To: Tapestry users
>> Subject: Re: T5, newbie: Component parameter passing problems
>>
>> public List<MyMap> getRows() {...}
>>
>> Davor Hrg wrote:
>>
>>> how is getRows declared in your page class ?
>>>
>>>
>>>
>>>
>>> On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin <Mi...@kolmodin.net>
>>> wrote:
>>>
>>>
>>>
>>>> OK, thanks...
>>>>
>>>> In my page, I have <t:myComponent columns="prop:columns"
>>>> rows="prop:rows"/>
>>>>
>>>> The columns argument, a List<String> is just fine.
>>>> The rows argument, a List<MyMap> is the problem.
>>>>
>>>> The page has a List<MyMap> getRows() which is verified.
>>>>
>>>> Looking in MyComponent.java, I have
>>>>
>>>> @Parameter
>>>> private List<MyMap> rows;
>>>>
>>>> @Parameter
>>>> private List<String> columns;
>>>>
>>>> public String getSomethingStrange()
>>>> {
>>>> return rows.get(0).get( "mail" );
>>>> }
>>>>
>>>> The latter getter fails. The debug info is from a breakpoint inside
>>>>
>> this
>>
>>>> method. The error I get is a classcast error "java.lang.String cannot
>>>>
>> be
>>
>>>> cast to ...MyMap" If I change the index to 1, there an error "Caused
>>>> by: Index: 1, Size: 1" i. e., index out of bounds.
>>>>
>>>> Davor Hrg wrote:
>>>>
>>>>
>>>>> Tapestry support for Java generics is very limited,
>>>>> you need a value encoder to make this work,
>>>>>
>>>>> also, add more details on who calls what... so more is known
>>>>> of the problem you are trying to solve.
>>>>>
>>>>>
>>>>> Davor Hrg
>>>>>
>>>>> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
>>>>>
>>>>>
>>>> wrote:
>>>>
>>>>
>>>>>> I have problems passing my own datatype(s) to my own component. The
>>>>>> component takes two parameters, one List<String> and one List<MyMap>.
>>>>>> MyMap is declared as MyMap extends TreeMap {...}.
>>>>>>
>>>>>> The first parameter, a list of strings arrives safely to my
>>>>>>
>> component.
>>
>>>>>> However, the other one, seems to be mixed up: when I try to access an
>>>>>> element in my List<MyMap>, it turns out that Tapestry (nothing else
>>>>>> involved) have filled this list with String items, not the expected
>>>>>> MyMap items. In the end, there is a class cast exception when trying
>>>>>>
>> to
>>
>>>>>> access the MyMap items as Maps.
>>>>>>
>>>>>> In the Eclipse debugger, it seems that the value of the List<MyMap>
>>>>>> instance variable is a single string holding what looks like the
>>>>>> serialized value of my List<MyMap> list. The start is
>>>>>> "[{key=value,key=value...
>>>>>>
>>>>>> I've tried to contribute coercions between MyMap<->Map, but this
>>>>>>
>> desn't
>>
>>>>>> seem to help (?).
>>>>>>
>>>>>> Basically, I'm stucked unless I write everything in several big pages
>>>>>> with duplicated code. Don't really want to do that. :-(
>>>>>>
>>>>>> Any hints out there?
>>>>>>
>>>>>> --alec
>>>>>>
>>>>>> PS Version: 5.0.11 DS
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>> --
>>>> -----------------------------------------------------------------------
>>>>
>> ---
>>
>>>> Michael Kolmodin Fredsgatan 2
>>>> Phone: +46 920 269413 S-972 35 Lulea
>>>> Mobile +46 70 551 6507 Sweden
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems (#2)
Posted by Alec Leamas <le...@gmail.com>.
I actually got the same idea, just after pushing the send button. It's
quite a task, though, to carve this out. But it's certainly my job.
I'll make a try.
In the meanwhile: an observation. Looking at the breakpoint in
BugPage.getListsource () I can see the call stack. At the top is
Layout._$read_parameter_listSource() line: not available
InternalComponentResourcesImpl.readParameter(String, String) line: 248
InternalComponentResourcesImpl.readParameter(String, Class<T>) line: 233
To my understanding, this means that for some reason is indeed the
listSource parameters coerced to a String; this is what
readParameter(String, String) as all about?!
Stay tuned, I'll come be back w something compilable. Thanks for your time!
--alec
Josh Canfield wrote:
> Hey Alec,
>
> I was hoping for something a little more minimal, but still
> complete/compilable. :)
>
> I still can't reproduce the problem, but maybe @Persist on your report
> property is the culprit? Try it with out that. That's a shot in the
> dark though, so if that doesn't help I think I'll need something
> broken that I can actually run through a debugger to go any deeper.
>
> Josh
>
> On Wed, Apr 2, 2008 at 11:38 AM, Alec Leamas <le...@gmail.com> wrote:
>
>> Josh Canfield wrote:
>>
>>> Hey Alec,
>>>
>>> Looking at small excerpts from a large file leaves too much to the
>>> imagination. Can you create a minimal but complete page and component
>>> that reproduces the problem?
>>>
>>>
>>>
>> Yes, I should have done it long time ago, I know. Below is the complete
>> example, removing all old stuff trailing around. Here comes:
>>
>> - What's rendered (ascii)
>> - BugPage{.tml|.java}
>> - Layout{.tml,|java}
>> - ReportSize{.tml,.java}
>>
>> As you can see, the ReportSize component works whereas the Layout doesn't.
>> For the moment, I presume that the situation still is such that the problem
>> is about the listSource parameter, while the columns is fine.
>>
>> Debugger says same thing: the value returned from BugPage.getListsource() is
>> a List<IRow> w 500 items. The value stored as @Parameter listSource in
>> Layout is a SingletonList containing the serialized value of the 500 item
>> list. This is returned by getListSource() in Layout as-is.
>>
>> Note that I've cut away lot's of stuff from BugPage. Layout.java is as-is
>> (for now).
>>
>> --------------------------- rendered -------------------------------
>>
>> Orvar:1 // ${orvar}() in Layout reports size of singleton.
>>
>> YALT LDAP Report
>> Report for (mail=*), size: 500, aaliamb@u.washington.edu
>> // ReportSize works just fine.
>>
>> -------------------------- BugPage ---------------------------
>>
>>
>> <t:layout connectionUrl="${prop:connection.url}"
>> listSource="${prop:listSource}"
>> columns="${literal:cn,orvar}"
>>
>> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>> <head>
>> <title>Search</title>
>> </head>
>> <body class="tables">
>> <h1>YALT LDAP Report</h1>
>> Report for ${pattern}, size:
>> <t:reportsize report="prop:report" rows="prop:report.list" />
>> </body>
>>
>> </t:layout>
>>
>>
>> package net.kln.yalt.pages;
>>
>> import java.util.List;
>>
>> import javax.naming.NameNotFoundException;
>> import javax.naming.NamingException;
>>
>> import net.kln.yalt.aso.User;
>> import net.kln.yalt.data.ConnectionData;
>> import net.kln.yalt.report.AttributeList;
>> import net.kln.yalt.report.ILdapReportService;
>> import net.kln.yalt.report.IRow;
>> import net.kln.yalt.report.LdapReport;
>> import net.kln.yalt.report.LdapSchema;
>> import net.kln.yalt.report.Report;
>>
>> import org.apache.tapestry.annotations.Persist;
>> import org.apache.tapestry.ioc.annotations.Inject;
>> import org.slf4j.Logger;
>>
>> public class BugPage
>>
>> {
>> @Inject
>> private Logger log;
>>
>> @Inject
>> private ILdapReportService reportService;
>>
>> @Persist
>> private AttributeList attributeList;
>>
>> @Persist
>> private String pattern;
>>
>>
>> @Persist
>> private LdapReport report;
>>
>> @Persist
>> private User user;
>>
>> @Persist
>> private ConnectionData connection;
>>
>>
>> /** Initiate report to present a search result. */
>> public BugPage init( ConnectionData conn, User user, String pattern)
>>
>> {
>> try {
>> this.connection = conn;
>> this.user = user;
>> this.pattern = pattern;
>> report = reportService.getLdapReport( user);
>> attributeList = new AttributeList( user);
>> return this;
>> }
>> catch( Exception e) {
>> throw new RuntimeException( "Error creating report", e);
>> }
>> }
>>
>> public Object onActivate() throws NamingException
>> {
>> if( report.size() > 0 )
>> return null;
>> boolean searchOK = false;
>> try {
>> report.setReturnedAttributes( attributeList.getColumns());
>> report.patternSearch( pattern);
>> if( report.size() == 0)
>> throw new NameNotFoundException();
>>
>> else
>> searchOK = true;
>> }
>> catch( Exception e ) {}
>> finally {
>> if( searchOK)
>> {
>> log.debug( "Search done, matches: " + report.size());
>> LdapSchema schema = new LdapSchema( user.getDirContext());
>> if( schema.getAttributes() == null)
>> {
>> return null;
>> }
>> }
>> }
>> return null;
>>
>> }
>>
>> public Report getReport()
>> {
>> List<IRow> list = report.getList();
>> return report;
>> }
>>
>> public List<IRow> getListSource()
>> {
>> List<IRow> list = report.getList();
>> int size = list.size();
>> return list;
>> }
>>
>> public int getReportSize() { return report.size(); }
>>
>> public String getPattern() { return pattern; }
>>
>> public void setPattern(String pattern) { this.pattern = pattern; }
>>
>> public void setReport(LdapReport report) { this.report = report; }
>>
>> public User getUser() { return user; }
>>
>> public void setUser(User user) { this.user = user; }
>>
>> public ConnectionData getConnection() { return connection; }
>>
>> public void setConnection( ConnectionData connection)
>> {
>> this.connection = connection;
>> }
>> }
>> -------------------------- Layout -------------------------------------
>>
>> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>> <head>
>> <title>YALT</title>
>> </head>
>> <body>
>> <div class="connection">
>> <t:if test="connected" else="block:notConnected">
>> <img src="${connectIcon}"
>> title="${prop:connectionTooltip}"/>
>> </t:if>
>> <t:block id="notConnected">
>> <img src="${disconnectIcon}"
>> title="${message:disconnectedTooltip}"/>
>> </t:block>
>> </div>
>>
>> <t:if test="listsVisible">
>> Orvar:${orvar}
>> </t:if>
>>
>> <t:pagelink page="start">
>> <img src="icons/yalt.gif" class="yaltIcon"/>
>> </t:pagelink>
>> <div class="flags"> <t:selectLocale/></div>
>>
>> <t:body/>
>>
>> </body>
>> </html>
>>
>> ---------------------------- Layout.java ----------------------------
>>
>> package net.kln.yalt.components;
>>
>> import java.util.List;
>>
>> import net.kln.yalt.report.IRow;
>>
>> import org.apache.tapestry.Asset;
>> import org.apache.tapestry.annotations.IncludeStylesheet;
>> import org.apache.tapestry.annotations.Parameter;
>> import org.apache.tapestry.annotations.Path;
>> import org.apache.tapestry.ioc.Messages;
>> import org.apache.tapestry.ioc.annotations.Inject;
>>
>>
>> @IncludeStylesheet("context:css/yalt.css")
>> public class Layout
>> {
>> @Parameter( "false")
>> private String connectionUrl;
>>
>> @Parameter
>> private List<IRow> listSource;
>>
>>
>> @Parameter
>> private List<String> columns;
>>
>> @Inject
>> private Messages messages;
>>
>> @Inject
>> @Path( "context:icons/connect_no.png")
>> private Asset disconnectIcon;
>>
>> @Inject
>> @Path( "context:icons/connect_established.png")
>> private Asset connectIcon;
>>
>> @Inject
>> @Path( "context:icons/yalt.svg")
>> private Asset yaltIcon;
>>
>> public Asset getYaltIcon()
>> {
>> return yaltIcon;
>> }
>>
>> public boolean isConnected()
>> {
>> return connectionUrl != null && !connectionUrl.equals( "false");
>> }
>>
>> public Asset getDisconnectIcon()
>> {
>> return disconnectIcon;
>> }
>>
>> public Asset getConnectIcon()
>> {
>> return connectIcon;
>> }
>>
>> public boolean isListsVisible()
>> {
>> return listSource != null;
>> }
>>
>> public String getConnectionTooltip()
>> {
>> return messages.format( "connectionTooltip",
>> connectionUrl.replace( "%20", " "));
>> }
>>
>> public List<String> getColumns()
>> {
>> return columns;
>> }
>>
>> public List<IRow> getListSource()
>> {
>>
>> return listSource;
>> }
>>
>> public String getOrvar()
>> {
>> return "" + listSource.size();
>> }
>> }
>> ----------------------------- ReportSize -------------------------
>>
>>
>> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>> ${reportSize}, ${firstMail}
>> </t:container>
>>
>>
>> package net.kln.yalt.components;
>>
>> import java.util.List;
>>
>> import net.kln.yalt.report.IRow;
>> import net.kln.yalt.report.Report;
>>
>> import org.apache.tapestry.annotations.Parameter;
>>
>>
>> public class ReportSize
>> {
>> @Parameter
>> private Report report;
>>
>> @Parameter
>> private List<IRow> rows;
>>
>> public Integer getReportSize() { return report.size(); }
>> public String getFirstMail()
>> {
>> return rows.get( 0).getColumnValue( "mail");
>> }
>> }
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems (#2)
Posted by Josh Canfield <jo...@thedailytube.com>.
Hey Alec,
I was hoping for something a little more minimal, but still
complete/compilable. :)
I still can't reproduce the problem, but maybe @Persist on your report
property is the culprit? Try it with out that. That's a shot in the
dark though, so if that doesn't help I think I'll need something
broken that I can actually run through a debugger to go any deeper.
Josh
On Wed, Apr 2, 2008 at 11:38 AM, Alec Leamas <le...@gmail.com> wrote:
> Josh Canfield wrote:
> > Hey Alec,
> >
> > Looking at small excerpts from a large file leaves too much to the
> > imagination. Can you create a minimal but complete page and component
> > that reproduces the problem?
> >
> >
>
> Yes, I should have done it long time ago, I know. Below is the complete
> example, removing all old stuff trailing around. Here comes:
>
> - What's rendered (ascii)
> - BugPage{.tml|.java}
> - Layout{.tml,|java}
> - ReportSize{.tml,.java}
>
> As you can see, the ReportSize component works whereas the Layout doesn't.
> For the moment, I presume that the situation still is such that the problem
> is about the listSource parameter, while the columns is fine.
>
> Debugger says same thing: the value returned from BugPage.getListsource() is
> a List<IRow> w 500 items. The value stored as @Parameter listSource in
> Layout is a SingletonList containing the serialized value of the 500 item
> list. This is returned by getListSource() in Layout as-is.
>
> Note that I've cut away lot's of stuff from BugPage. Layout.java is as-is
> (for now).
>
> --------------------------- rendered -------------------------------
>
> Orvar:1 // ${orvar}() in Layout reports size of singleton.
>
> YALT LDAP Report
> Report for (mail=*), size: 500, aaliamb@u.washington.edu
> // ReportSize works just fine.
>
> -------------------------- BugPage ---------------------------
>
>
> <t:layout connectionUrl="${prop:connection.url}"
> listSource="${prop:listSource}"
> columns="${literal:cn,orvar}"
>
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
> <title>Search</title>
> </head>
> <body class="tables">
> <h1>YALT LDAP Report</h1>
> Report for ${pattern}, size:
> <t:reportsize report="prop:report" rows="prop:report.list" />
> </body>
>
> </t:layout>
>
>
> package net.kln.yalt.pages;
>
> import java.util.List;
>
> import javax.naming.NameNotFoundException;
> import javax.naming.NamingException;
>
> import net.kln.yalt.aso.User;
> import net.kln.yalt.data.ConnectionData;
> import net.kln.yalt.report.AttributeList;
> import net.kln.yalt.report.ILdapReportService;
> import net.kln.yalt.report.IRow;
> import net.kln.yalt.report.LdapReport;
> import net.kln.yalt.report.LdapSchema;
> import net.kln.yalt.report.Report;
>
> import org.apache.tapestry.annotations.Persist;
> import org.apache.tapestry.ioc.annotations.Inject;
> import org.slf4j.Logger;
>
> public class BugPage
>
> {
> @Inject
> private Logger log;
>
> @Inject
> private ILdapReportService reportService;
>
> @Persist
> private AttributeList attributeList;
>
> @Persist
> private String pattern;
>
>
> @Persist
> private LdapReport report;
>
> @Persist
> private User user;
>
> @Persist
> private ConnectionData connection;
>
>
> /** Initiate report to present a search result. */
> public BugPage init( ConnectionData conn, User user, String pattern)
>
> {
> try {
> this.connection = conn;
> this.user = user;
> this.pattern = pattern;
> report = reportService.getLdapReport( user);
> attributeList = new AttributeList( user);
> return this;
> }
> catch( Exception e) {
> throw new RuntimeException( "Error creating report", e);
> }
> }
>
> public Object onActivate() throws NamingException
> {
> if( report.size() > 0 )
> return null;
> boolean searchOK = false;
> try {
> report.setReturnedAttributes( attributeList.getColumns());
> report.patternSearch( pattern);
> if( report.size() == 0)
> throw new NameNotFoundException();
>
> else
> searchOK = true;
> }
> catch( Exception e ) {}
> finally {
> if( searchOK)
> {
> log.debug( "Search done, matches: " + report.size());
> LdapSchema schema = new LdapSchema( user.getDirContext());
> if( schema.getAttributes() == null)
> {
> return null;
> }
> }
> }
> return null;
>
> }
>
> public Report getReport()
> {
> List<IRow> list = report.getList();
> return report;
> }
>
> public List<IRow> getListSource()
> {
> List<IRow> list = report.getList();
> int size = list.size();
> return list;
> }
>
> public int getReportSize() { return report.size(); }
>
> public String getPattern() { return pattern; }
>
> public void setPattern(String pattern) { this.pattern = pattern; }
>
> public void setReport(LdapReport report) { this.report = report; }
>
> public User getUser() { return user; }
>
> public void setUser(User user) { this.user = user; }
>
> public ConnectionData getConnection() { return connection; }
>
> public void setConnection( ConnectionData connection)
> {
> this.connection = connection;
> }
> }
> -------------------------- Layout -------------------------------------
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
> <title>YALT</title>
> </head>
> <body>
> <div class="connection">
> <t:if test="connected" else="block:notConnected">
> <img src="${connectIcon}"
> title="${prop:connectionTooltip}"/>
> </t:if>
> <t:block id="notConnected">
> <img src="${disconnectIcon}"
> title="${message:disconnectedTooltip}"/>
> </t:block>
> </div>
>
> <t:if test="listsVisible">
> Orvar:${orvar}
> </t:if>
>
> <t:pagelink page="start">
> <img src="icons/yalt.gif" class="yaltIcon"/>
> </t:pagelink>
> <div class="flags"> <t:selectLocale/></div>
>
> <t:body/>
>
> </body>
> </html>
>
> ---------------------------- Layout.java ----------------------------
>
> package net.kln.yalt.components;
>
> import java.util.List;
>
> import net.kln.yalt.report.IRow;
>
> import org.apache.tapestry.Asset;
> import org.apache.tapestry.annotations.IncludeStylesheet;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.annotations.Path;
> import org.apache.tapestry.ioc.Messages;
> import org.apache.tapestry.ioc.annotations.Inject;
>
>
> @IncludeStylesheet("context:css/yalt.css")
> public class Layout
> {
> @Parameter( "false")
> private String connectionUrl;
>
> @Parameter
> private List<IRow> listSource;
>
>
> @Parameter
> private List<String> columns;
>
> @Inject
> private Messages messages;
>
> @Inject
> @Path( "context:icons/connect_no.png")
> private Asset disconnectIcon;
>
> @Inject
> @Path( "context:icons/connect_established.png")
> private Asset connectIcon;
>
> @Inject
> @Path( "context:icons/yalt.svg")
> private Asset yaltIcon;
>
> public Asset getYaltIcon()
> {
> return yaltIcon;
> }
>
> public boolean isConnected()
> {
> return connectionUrl != null && !connectionUrl.equals( "false");
> }
>
> public Asset getDisconnectIcon()
> {
> return disconnectIcon;
> }
>
> public Asset getConnectIcon()
> {
> return connectIcon;
> }
>
> public boolean isListsVisible()
> {
> return listSource != null;
> }
>
> public String getConnectionTooltip()
> {
> return messages.format( "connectionTooltip",
> connectionUrl.replace( "%20", " "));
> }
>
> public List<String> getColumns()
> {
> return columns;
> }
>
> public List<IRow> getListSource()
> {
>
> return listSource;
> }
>
> public String getOrvar()
> {
> return "" + listSource.size();
> }
> }
> ----------------------------- ReportSize -------------------------
>
>
> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> ${reportSize}, ${firstMail}
> </t:container>
>
>
> package net.kln.yalt.components;
>
> import java.util.List;
>
> import net.kln.yalt.report.IRow;
> import net.kln.yalt.report.Report;
>
> import org.apache.tapestry.annotations.Parameter;
>
>
> public class ReportSize
> {
> @Parameter
> private Report report;
>
> @Parameter
> private List<IRow> rows;
>
> public Integer getReportSize() { return report.size(); }
> public String getFirstMail()
> {
> return rows.get( 0).getColumnValue( "mail");
> }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems (ยค3)
Posted by Alec Leamas <le...@bredband.net>.
Hm... looking more into your example.... As I understand it, your
example and my ReportSize component are really similar and both do
indeed work demonstrating that *is* possible to pass the arguments. So
it is something with the Layout component...
Feeling dumb, need a better brain.
--alec
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems (#3)
Posted by Alec Leamas <le...@gmail.com>.
Hm... looking more on your example... Seems that yoyr example and my
ReportSize component are similar and both do indeed work. So it's
something with the Layout component...
--alec
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems (#2)
Posted by Alec Leamas <le...@gmail.com>.
Josh Canfield wrote:
> Hey Alec,
>
> Looking at small excerpts from a large file leaves too much to the
> imagination. Can you create a minimal but complete page and component
> that reproduces the problem?
>
Yes, I should have done it long time ago, I know. Below is the complete
example, removing all old stuff trailing around. Here comes:
- What's rendered (ascii)
- BugPage{.tml|.java}
- Layout{.tml,|java}
- ReportSize{.tml,.java}
As you can see, the ReportSize component works whereas the Layout
doesn't. For the moment, I presume that the situation still is such
that the problem is about the listSource parameter, while the columns is
fine.
Debugger says same thing: the value returned from
BugPage.getListsource() is a List<IRow> w 500 items. The value stored as
@Parameter listSource in Layout is a SingletonList containing the
serialized value of the 500 item list. This is returned by
getListSource() in Layout as-is.
Note that I've cut away lot's of stuff from BugPage. Layout.java is
as-is (for now).
--------------------------- rendered -------------------------------
Orvar:1 // ${orvar}() in Layout reports size of singleton.
YALT LDAP Report
Report for (mail=*), size: 500, aaliamb@u.washington.edu
// ReportSize works just fine.
-------------------------- BugPage ---------------------------
<t:layout connectionUrl="${prop:connection.url}"
listSource="${prop:listSource}"
columns="${literal:cn,orvar}"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>Search</title>
</head>
<body class="tables">
<h1>YALT LDAP Report</h1>
Report for ${pattern}, size:
<t:reportsize report="prop:report" rows="prop:report.list" />
</body>
</t:layout>
package net.kln.yalt.pages;
import java.util.List;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
import net.kln.yalt.aso.User;
import net.kln.yalt.data.ConnectionData;
import net.kln.yalt.report.AttributeList;
import net.kln.yalt.report.ILdapReportService;
import net.kln.yalt.report.IRow;
import net.kln.yalt.report.LdapReport;
import net.kln.yalt.report.LdapSchema;
import net.kln.yalt.report.Report;
import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.ioc.annotations.Inject;
import org.slf4j.Logger;
public class BugPage
{
@Inject
private Logger log;
@Inject
private ILdapReportService reportService;
@Persist
private AttributeList attributeList;
@Persist
private String pattern;
@Persist
private LdapReport report;
@Persist
private User user;
@Persist
private ConnectionData connection;
/** Initiate report to present a search result. */
public BugPage init( ConnectionData conn, User user, String pattern)
{
try {
this.connection = conn;
this.user = user;
this.pattern = pattern;
report = reportService.getLdapReport( user);
attributeList = new AttributeList( user);
return this;
}
catch( Exception e) {
throw new RuntimeException( "Error creating report", e);
}
}
public Object onActivate() throws NamingException
{
if( report.size() > 0 )
return null;
boolean searchOK = false;
try {
report.setReturnedAttributes( attributeList.getColumns());
report.patternSearch( pattern);
if( report.size() == 0)
throw new NameNotFoundException();
else
searchOK = true;
}
catch( Exception e ) {}
finally {
if( searchOK)
{
log.debug( "Search done, matches: " + report.size());
LdapSchema schema = new LdapSchema( user.getDirContext());
if( schema.getAttributes() == null)
{
return null;
}
}
}
return null;
}
public Report getReport()
{
List<IRow> list = report.getList();
return report;
}
public List<IRow> getListSource()
{
List<IRow> list = report.getList();
int size = list.size();
return list;
}
public int getReportSize() { return report.size(); }
public String getPattern() { return pattern; }
public void setPattern(String pattern) { this.pattern = pattern; }
public void setReport(LdapReport report) { this.report = report; }
public User getUser() { return user; }
public void setUser(User user) { this.user = user; }
public ConnectionData getConnection() { return connection; }
public void setConnection( ConnectionData connection)
{
this.connection = connection;
}
}
-------------------------- Layout -------------------------------------
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>YALT</title>
</head>
<body>
<div class="connection">
<t:if test="connected" else="block:notConnected">
<img src="${connectIcon}"
title="${prop:connectionTooltip}"/>
</t:if>
<t:block id="notConnected">
<img src="${disconnectIcon}"
title="${message:disconnectedTooltip}"/>
</t:block>
</div>
<t:if test="listsVisible">
Orvar:${orvar}
</t:if>
<t:pagelink page="start">
<img src="icons/yalt.gif" class="yaltIcon"/>
</t:pagelink>
<div class="flags"> <t:selectLocale/></div>
<t:body/>
</body>
</html>
---------------------------- Layout.java ----------------------------
package net.kln.yalt.components;
import java.util.List;
import net.kln.yalt.report.IRow;
import org.apache.tapestry.Asset;
import org.apache.tapestry.annotations.IncludeStylesheet;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.annotations.Path;
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.annotations.Inject;
@IncludeStylesheet("context:css/yalt.css")
public class Layout
{
@Parameter( "false")
private String connectionUrl;
@Parameter
private List<IRow> listSource;
@Parameter
private List<String> columns;
@Inject
private Messages messages;
@Inject
@Path( "context:icons/connect_no.png")
private Asset disconnectIcon;
@Inject
@Path( "context:icons/connect_established.png")
private Asset connectIcon;
@Inject
@Path( "context:icons/yalt.svg")
private Asset yaltIcon;
public Asset getYaltIcon()
{
return yaltIcon;
}
public boolean isConnected()
{
return connectionUrl != null && !connectionUrl.equals( "false");
}
public Asset getDisconnectIcon()
{
return disconnectIcon;
}
public Asset getConnectIcon()
{
return connectIcon;
}
public boolean isListsVisible()
{
return listSource != null;
}
public String getConnectionTooltip()
{
return messages.format( "connectionTooltip",
connectionUrl.replace( "%20", " "));
}
public List<String> getColumns()
{
return columns;
}
public List<IRow> getListSource()
{
return listSource;
}
public String getOrvar()
{
return "" + listSource.size();
}
}
----------------------------- ReportSize -------------------------
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
${reportSize}, ${firstMail}
</t:container>
package net.kln.yalt.components;
import java.util.List;
import net.kln.yalt.report.IRow;
import net.kln.yalt.report.Report;
import org.apache.tapestry.annotations.Parameter;
public class ReportSize
{
@Parameter
private Report report;
@Parameter
private List<IRow> rows;
public Integer getReportSize() { return report.size(); }
public String getFirstMail()
{
return rows.get( 0).getColumnValue( "mail");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems (#2)
Posted by Josh Canfield <jo...@thedailytube.com>.
Hey Alec,
Looking at small excerpts from a large file leaves too much to the
imagination. Can you create a minimal but complete page and component
that reproduces the problem?
It feels like there is a bad return type or something on one of the
methods in the chain, so having a complete non-working example would
make it easier to debug.
Here is my working example, I tried to make it close to what you are doing.
****************** myapp.pages.Start.java:
public class Start
{
public List<String> getStrings() {
List<String> strings = new ArrayList<String>();
strings.add("Hello");
strings.add("Goodbye");
return strings;
}
@SuppressWarnings("unchecked")
public List<MyMap> getMaps() {
List<MyMap> maps = new ArrayList<MyMap>();
MyMap map = new MyMap();
map.put(0, "Zero");
map.put(1, "One");
maps.add(map);
map = new MyMap();
map.put("horse", "buck");
map.put("goose", "egg");
maps.add(map);
return maps;
}
public String getSomethingStrange() {
return (String)getMaps().get(0).get(1);
}
}
****************** myapp.pages.Start.tml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<t:layout t:strings="prop:strings" t:maps="prop:maps"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
This is the body
</t:layout>
******************** myapp.components.Layout.java
public class Layout {
@Parameter
private List<String> _strings;
@Parameter
private List<MyMap> _maps;
public String getSomethingStrange() {
return (String)_maps.get(0).get(1);
}
public List<String> getStrings() {
return _strings;
}
public void setStrings(List<String> strings) {
_strings = strings;
}
public List<MyMap> getMaps() {
return _maps;
}
public void setMaps(List<MyMap> maps) {
_maps = maps;
}
}
******************** myapp.components.Layout.tml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<body>
<p>Strange: ${somethingStrange}</p>
<div style="border: thin red solid;"><t:body /></div>
</body>
</html>
******************** MyMap.java (for completeness...)
package joshcan.test;
import java.util.TreeMap;
@SuppressWarnings("unchecked")
public class MyMap extends TreeMap {
@Override
public Object get(Object key) {
Object o = super.get(key);
return "my" + o.toString();
}
}
************* Rendered output (hand formatted for readability)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="/assets/tapestry/default.css" rel="stylesheet" type="text/css">
</head>
<body>
<p>Strange: myOne</p>
<div style="border: thin red solid;">This is the body</div>
</body>
</html>
Hope that helps,
Josh
--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems (#2)
Posted by Alec Leamas <le...@gmail.com>.
More and more mysterious... The relevant getters in the page is
getListSource() and getReport(), enclosing excerpts from page below.
The problems seems to be related to getListSource(). The call chain as
I understand it:
- ${orvar} in layout.tmpl is fetching data data from Layout.getOrvar();
- Layout.getOrvar() gets data from Layout.@Parameter listSource.
- Layout.@Parameter listSource gets data from reportPage.getListSource();
Breakpoint in ReportPage.getListSource() shows that the returned list is
perfectly OK (size 500).
Breakpoint in Layout.getOrvar reveals that listSource is a
Collections$SingletonList. (?!)
The value from Layout.getOrvar() (sorry for Swedish foobar name) is 1 i.
e., the size of the Singleton list.
So: somewhere on the way from the page getter getListource() to the
component parameter listSource the value is converted from a List<IRow>
to a SingletonList holding the serialized value of original list. For
me, it looks like the coercion is involved, but I just can't understand
why. I really wish I understood more...
Cheers,
--alec
Page code:
...
@Inject
private Logger log;
@Inject
private Messages messages;
@Inject
private ILdapReportService reportService;
...
@Persist
private LdapReport report;
...
@Persist
private User user;
...
/** Initiate report to present a search result. */
public ReportPage init( ConnectionData conn, User user, String pattern)
{
try
{
this.connection = conn;
this.user = user;
this.pattern = pattern;
if( pageSize == null)
pageSize = 25; // DEFAULT_PAGESIZE;
pageStart = 0;
report = reportService.getLdapReport( user);
attributeList = new AttributeList( user);
return this;
}
catch( Exception e)
{
throw new RuntimeException( "Error creating report", e);
}
}
...
public Report getReport()
{
List<IRow> list = report.getList(); //TODO Revert
return report;
}
public List<IRow> getListSource()
{
List<IRow> list = report.getList(); //TODO Revert
int size = list.size();
return list;
}
----------------------------------------------- Page template
(excerpt.)-----------------
<t:layout connectionUrl="${prop:connection.url}"
listSource="${prop:listSource}"
columns="${prop:attributeList.columns}"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>Search</title>
</head>
<body class="tables">
<h1>YALT LDAP Report</h1>
Report for ${pattern}, size: <t:reportsize
report="prop:report" rows="prop:report.list" />
.......
---------------------------------------- Layout template (excerpt,
displays "Orvar: 1" -------------------------
<t:if test="listsVisible">
Orvar:${orvar}
</t:if>
------------------------------------ ReportSize test template (OK)
--------------------------------------
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
${reportSize}, ${firstMail}
</t:container>
--------------------------------------------------------------------------------------------------
Jonathan Barker wrote:
> Sorry for the delay - meetings all day.
>
> Josh Canfield made a suggestion regarding setting a breakpoint. I would
> echo that, and make sure that you try the same code in the page class.
>
> You've shared the component code. Can you share the relevant page code?
> (Declaration, initialization, getters and setters...)
>
> Jonathan
>
>
>> -----Original Message-----
>> From: Alec Leamas [mailto:leamas.alec@gmail.com]
>> Sent: Tuesday, April 01, 2008 5:27 PM
>> To: Tapestry users
>> Subject: Re: T5, newbie: Component parameter passing problems (#2)
>>
>> My problem is not just with lists: If I use a custom type as parameter
>> instead of my List<MyMap> parameter I get the error: "Could not find a
>> coercion from type java.lang.String to type net.kln.yalt.report.Report"
>> where the Report is my custom type.
>>
>> This is strange. I "have* been able to transfer the Report to a very
>> simple test component. Enclosing my "real" component, which doesn't seem
>> to accept parameter + the test component which accepts it.
>>
>> So now I have five cases of parameter passing, with two components. Both
>> components are invoked from the same template, and uses the same getters
>> to provide the data. Results:
>>
>> - List<String> : works OK in all cases.
>> - List<MyMap>: the parameter passed seems to be wrong, a single string
>> instead of a List<> when sent to class below.
>> - Report: Exception "Could not find coercion from String to Report"
>> when sent to class below.
>> - Report: works OK when sent to test component (4 lines).
>> - List<MyMap>: work ok when sent to test component
>>
>> A little confused, I am. Part of this has been discussed earlier, no
>> visible solution though
>> (http://article.gmane.org/gmane.comp.java.tapestry.user/55319).
>>
>> --alec
>>
>>
>> -------- Suspected class, does not accept parameters OK?
>> -----------------------
>> package net.kln.yalt.components;
>> import "stuff"
>> @IncludeStylesheet("context:css/yalt.css")
>> public class Layout
>> {
>> @Parameter( "false")
>> private String connectionUrl;
>>
>> @Parameter
>> // private List<IRow> listSource;
>> private Report listSource;
>>
>> @Parameter
>> private List<String> columns;
>>
>> @Inject
>> private Messages messages;
>>
>> @Inject
>> @Path( "context:icons/connect_no.png")
>> private Asset disconnectIcon;
>>
>> @Inject
>> @Path( "context:icons/connect_established.png")
>> private Asset connectIcon;
>>
>> @Inject
>> @Path( "context:icons/yalt.svg")
>> private Asset yaltIcon;
>>
>> public Asset getYaltIcon() { return yaltIcon; }
>>
>> public boolean isConnected()
>> {
>> return connectionUrl != null && !connectionUrl.equals( "false");
>> }
>>
>> public Asset getDisconnectIcon() { return disconnectIcon; }
>>
>> public Asset getConnectIcon() { return connectIcon; }
>>
>> public boolean isListsVisible() { return listSource != null; }
>>
>> public String getConnectionTooltip()
>> {
>> return messages.format( "connectionTooltip",
>> connectionUrl.replace( "%20", " "));
>> }
>>
>> public List<String> getColumns() { return columns; }
>>
>> // public List<IRow> getListSource() TODO revert
>> public Report getListSource() { return listSource; }
>> public String getOrvar() { return "" + listSource.size() } // Test
>> code!
>> }
>>
>> --------------------------------- test component, seems to work
>> -----------------------------
>> public class ReportSize
>> {
>> @Parameter
>> private Report report;
>>
>> @Parameter
>> private List<IRow> rows;
>>
>> public Integer getReportSize() { return report.size(); }
>> public String getFirstMail()
>> {
>> return rows.get( 0).getColumnValue( "mail");
>> }
>> }
>>
>>
>> onathan Barker wrote:
>>
>>> This is really sounding like something unrelated to Tapestry, and there
>>> isn't enough code presented to tell.
>>>
>>> Do you have proof that your code works outside of Tapestry? Why, and
>>>
>> how,
>>
>>> did you EXTEND TreeMap? Do you have a unit test to prove that your
>>>
>> MyMap
>>
>>> works?
>>>
>>> If you can present a non-Tapestry test that works, and corresponding
>>> Tapestry test that doesn't, then I think you'll find an answer quickly.
>>>
>>> Jonathan
>>>
>>>
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Alec Leamas [mailto:leamas.alec@gmail.com]
>>>> Sent: Tuesday, April 01, 2008 8:37 AM
>>>> To: Tapestry users
>>>> Subject: Re: T5, newbie: Component parameter passing problems
>>>>
>>>> public List<MyMap> getRows() {...}
>>>>
>>>> Davor Hrg wrote:
>>>>
>>>>
>>>>> how is getRows declared in your page class ?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin
>>>>>
>> <Mi...@kolmodin.net>
>>
>>>>> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> OK, thanks...
>>>>>>
>>>>>> In my page, I have <t:myComponent columns="prop:columns"
>>>>>> rows="prop:rows"/>
>>>>>>
>>>>>> The columns argument, a List<String> is just fine.
>>>>>> The rows argument, a List<MyMap> is the problem.
>>>>>>
>>>>>> The page has a List<MyMap> getRows() which is verified.
>>>>>>
>>>>>> Looking in MyComponent.java, I have
>>>>>>
>>>>>> @Parameter
>>>>>> private List<MyMap> rows;
>>>>>>
>>>>>> @Parameter
>>>>>> private List<String> columns;
>>>>>>
>>>>>> public String getSomethingStrange()
>>>>>> {
>>>>>> return rows.get(0).get( "mail" );
>>>>>> }
>>>>>>
>>>>>> The latter getter fails. The debug info is from a breakpoint inside
>>>>>>
>>>>>>
>>>> this
>>>>
>>>>
>>>>>> method. The error I get is a classcast error "java.lang.String cannot
>>>>>>
>>>>>>
>>>> be
>>>>
>>>>
>>>>>> cast to ...MyMap" If I change the index to 1, there an error "Caused
>>>>>> by: Index: 1, Size: 1" i. e., index out of bounds.
>>>>>>
>>>>>> Davor Hrg wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Tapestry support for Java generics is very limited,
>>>>>>> you need a value encoder to make this work,
>>>>>>>
>>>>>>> also, add more details on who calls what... so more is known
>>>>>>> of the problem you are trying to solve.
>>>>>>>
>>>>>>>
>>>>>>> Davor Hrg
>>>>>>>
>>>>>>> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> I have problems passing my own datatype(s) to my own component. The
>>>>>>>> component takes two parameters, one List<String> and one
>>>>>>>>
>> List<MyMap>.
>>
>>>>>>>> MyMap is declared as MyMap extends TreeMap {...}.
>>>>>>>>
>>>>>>>> The first parameter, a list of strings arrives safely to my
>>>>>>>>
>>>>>>>>
>>>> component.
>>>>
>>>>
>>>>>>>> However, the other one, seems to be mixed up: when I try to access
>>>>>>>>
>> an
>>
>>>>>>>> element in my List<MyMap>, it turns out that Tapestry (nothing else
>>>>>>>> involved) have filled this list with String items, not the
>>>>>>>>
>> expected
>>
>>>>>>>> MyMap items. In the end, there is a class cast exception when
>>>>>>>>
>> trying
>>
>>>> to
>>>>
>>>>
>>>>>>>> access the MyMap items as Maps.
>>>>>>>>
>>>>>>>> In the Eclipse debugger, it seems that the value of the List<MyMap>
>>>>>>>> instance variable is a single string holding what looks like the
>>>>>>>> serialized value of my List<MyMap> list. The start is
>>>>>>>> "[{key=value,key=value...
>>>>>>>>
>>>>>>>> I've tried to contribute coercions between MyMap<->Map, but this
>>>>>>>>
>>>>>>>>
>>>> desn't
>>>>
>>>>
>>>>>>>> seem to help (?).
>>>>>>>>
>>>>>>>> Basically, I'm stucked unless I write everything in several big
>>>>>>>>
>> pages
>>
>>>>>>>> with duplicated code. Don't really want to do that. :-(
>>>>>>>>
>>>>>>>> Any hints out there?
>>>>>>>>
>>>>>>>> --alec
>>>>>>>>
>>>>>>>> PS Version: 5.0.11 DS
>>>>>>>>
>>>>>>>> -------------------------------------------------------------------
>>>>>>>>
>> --
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems (#2)
Posted by Alec Leamas <le...@gmail.com>.
"Sorry for the delay". I'm amazed over the help I get, and you
shouldn't really have to say "Sorry". But I need to say "Thanks"!
I read Josh's answer as "No, Tapestry should really treat all
parameters be it List<String>, List<MyMap> or MyObject the same". (?)
I'm on CET, and will come back into this later, I also have some other
things to do for the moment. I feel much more confident now after the
explanation how the parameter value is accessed from the page source.
--alec
PS: I have really no problems sharing anything. What's limiting me it's
just a a wish not to take anybodys time with large chunks of irrelevant
code. DS
Jonathan Barker wrote:
> Sorry for the delay - meetings all day.
>
> Josh Canfield made a suggestion regarding setting a breakpoint. I would
> echo that, and make sure that you try the same code in the page class.
>
> You've shared the component code. Can you share the relevant page code?
> (Declaration, initialization, getters and setters...)
>
> Jonathan
>
>
>> -----Original Message-----
>> From: Alec Leamas [mailto:leamas.alec@gmail.com]
>> Sent: Tuesday, April 01, 2008 5:27 PM
>> To: Tapestry users
>> Subject: Re: T5, newbie: Component parameter passing problems (#2)
>>
>> My problem is not just with lists: If I use a custom type as parameter
>> instead of my List<MyMap> parameter I get the error: "Could not find a
>> coercion from type java.lang.String to type net.kln.yalt.report.Report"
>> where the Report is my custom type.
>>
>> This is strange. I "have* been able to transfer the Report to a very
>> simple test component. Enclosing my "real" component, which doesn't seem
>> to accept parameter + the test component which accepts it.
>>
>> So now I have five cases of parameter passing, with two components. Both
>> components are invoked from the same template, and uses the same getters
>> to provide the data. Results:
>>
>> - List<String> : works OK in all cases.
>> - List<MyMap>: the parameter passed seems to be wrong, a single string
>> instead of a List<> when sent to class below.
>> - Report: Exception "Could not find coercion from String to Report"
>> when sent to class below.
>> - Report: works OK when sent to test component (4 lines).
>> - List<MyMap>: work ok when sent to test component
>>
>> A little confused, I am. Part of this has been discussed earlier, no
>> visible solution though
>> (http://article.gmane.org/gmane.comp.java.tapestry.user/55319).
>>
>> --alec
>>
>>
>> -------- Suspected class, does not accept parameters OK?
>> -----------------------
>> package net.kln.yalt.components;
>> import "stuff"
>> @IncludeStylesheet("context:css/yalt.css")
>> public class Layout
>> {
>> @Parameter( "false")
>> private String connectionUrl;
>>
>> @Parameter
>> // private List<IRow> listSource;
>> private Report listSource;
>>
>> @Parameter
>> private List<String> columns;
>>
>> @Inject
>> private Messages messages;
>>
>> @Inject
>> @Path( "context:icons/connect_no.png")
>> private Asset disconnectIcon;
>>
>> @Inject
>> @Path( "context:icons/connect_established.png")
>> private Asset connectIcon;
>>
>> @Inject
>> @Path( "context:icons/yalt.svg")
>> private Asset yaltIcon;
>>
>> public Asset getYaltIcon() { return yaltIcon; }
>>
>> public boolean isConnected()
>> {
>> return connectionUrl != null && !connectionUrl.equals( "false");
>> }
>>
>> public Asset getDisconnectIcon() { return disconnectIcon; }
>>
>> public Asset getConnectIcon() { return connectIcon; }
>>
>> public boolean isListsVisible() { return listSource != null; }
>>
>> public String getConnectionTooltip()
>> {
>> return messages.format( "connectionTooltip",
>> connectionUrl.replace( "%20", " "));
>> }
>>
>> public List<String> getColumns() { return columns; }
>>
>> // public List<IRow> getListSource() TODO revert
>> public Report getListSource() { return listSource; }
>> public String getOrvar() { return "" + listSource.size() } // Test
>> code!
>> }
>>
>> --------------------------------- test component, seems to work
>> -----------------------------
>> public class ReportSize
>> {
>> @Parameter
>> private Report report;
>>
>> @Parameter
>> private List<IRow> rows;
>>
>> public Integer getReportSize() { return report.size(); }
>> public String getFirstMail()
>> {
>> return rows.get( 0).getColumnValue( "mail");
>> }
>> }
>>
>>
>> onathan Barker wrote:
>>
>>> This is really sounding like something unrelated to Tapestry, and there
>>> isn't enough code presented to tell.
>>>
>>> Do you have proof that your code works outside of Tapestry? Why, and
>>>
>> how,
>>
>>> did you EXTEND TreeMap? Do you have a unit test to prove that your
>>>
>> MyMap
>>
>>> works?
>>>
>>> If you can present a non-Tapestry test that works, and corresponding
>>> Tapestry test that doesn't, then I think you'll find an answer quickly.
>>>
>>> Jonathan
>>>
>>>
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Alec Leamas [mailto:leamas.alec@gmail.com]
>>>> Sent: Tuesday, April 01, 2008 8:37 AM
>>>> To: Tapestry users
>>>> Subject: Re: T5, newbie: Component parameter passing problems
>>>>
>>>> public List<MyMap> getRows() {...}
>>>>
>>>> Davor Hrg wrote:
>>>>
>>>>
>>>>> how is getRows declared in your page class ?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin
>>>>>
>> <Mi...@kolmodin.net>
>>
>>>>> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> OK, thanks...
>>>>>>
>>>>>> In my page, I have <t:myComponent columns="prop:columns"
>>>>>> rows="prop:rows"/>
>>>>>>
>>>>>> The columns argument, a List<String> is just fine.
>>>>>> The rows argument, a List<MyMap> is the problem.
>>>>>>
>>>>>> The page has a List<MyMap> getRows() which is verified.
>>>>>>
>>>>>> Looking in MyComponent.java, I have
>>>>>>
>>>>>> @Parameter
>>>>>> private List<MyMap> rows;
>>>>>>
>>>>>> @Parameter
>>>>>> private List<String> columns;
>>>>>>
>>>>>> public String getSomethingStrange()
>>>>>> {
>>>>>> return rows.get(0).get( "mail" );
>>>>>> }
>>>>>>
>>>>>> The latter getter fails. The debug info is from a breakpoint inside
>>>>>>
>>>>>>
>>>> this
>>>>
>>>>
>>>>>> method. The error I get is a classcast error "java.lang.String cannot
>>>>>>
>>>>>>
>>>> be
>>>>
>>>>
>>>>>> cast to ...MyMap" If I change the index to 1, there an error "Caused
>>>>>> by: Index: 1, Size: 1" i. e., index out of bounds.
>>>>>>
>>>>>> Davor Hrg wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Tapestry support for Java generics is very limited,
>>>>>>> you need a value encoder to make this work,
>>>>>>>
>>>>>>> also, add more details on who calls what... so more is known
>>>>>>> of the problem you are trying to solve.
>>>>>>>
>>>>>>>
>>>>>>> Davor Hrg
>>>>>>>
>>>>>>> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>> I have problems passing my own datatype(s) to my own component. The
>>>>>>>> component takes two parameters, one List<String> and one
>>>>>>>>
>> List<MyMap>.
>>
>>>>>>>> MyMap is declared as MyMap extends TreeMap {...}.
>>>>>>>>
>>>>>>>> The first parameter, a list of strings arrives safely to my
>>>>>>>>
>>>>>>>>
>>>> component.
>>>>
>>>>
>>>>>>>> However, the other one, seems to be mixed up: when I try to access
>>>>>>>>
>> an
>>
>>>>>>>> element in my List<MyMap>, it turns out that Tapestry (nothing else
>>>>>>>> involved) have filled this list with String items, not the
>>>>>>>>
>> expected
>>
>>>>>>>> MyMap items. In the end, there is a class cast exception when
>>>>>>>>
>> trying
>>
>>>> to
>>>>
>>>>
>>>>>>>> access the MyMap items as Maps.
>>>>>>>>
>>>>>>>> In the Eclipse debugger, it seems that the value of the List<MyMap>
>>>>>>>> instance variable is a single string holding what looks like the
>>>>>>>> serialized value of my List<MyMap> list. The start is
>>>>>>>> "[{key=value,key=value...
>>>>>>>>
>>>>>>>> I've tried to contribute coercions between MyMap<->Map, but this
>>>>>>>>
>>>>>>>>
>>>> desn't
>>>>
>>>>
>>>>>>>> seem to help (?).
>>>>>>>>
>>>>>>>> Basically, I'm stucked unless I write everything in several big
>>>>>>>>
>> pages
>>
>>>>>>>> with duplicated code. Don't really want to do that. :-(
>>>>>>>>
>>>>>>>> Any hints out there?
>>>>>>>>
>>>>>>>> --alec
>>>>>>>>
>>>>>>>> PS Version: 5.0.11 DS
>>>>>>>>
>>>>>>>> -------------------------------------------------------------------
>>>>>>>>
>> --
>>
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: T5, newbie: Component parameter passing problems (#2)
Posted by Jonathan Barker <jo...@gmail.com>.
Sorry for the delay - meetings all day.
Josh Canfield made a suggestion regarding setting a breakpoint. I would
echo that, and make sure that you try the same code in the page class.
You've shared the component code. Can you share the relevant page code?
(Declaration, initialization, getters and setters...)
Jonathan
> -----Original Message-----
> From: Alec Leamas [mailto:leamas.alec@gmail.com]
> Sent: Tuesday, April 01, 2008 5:27 PM
> To: Tapestry users
> Subject: Re: T5, newbie: Component parameter passing problems (#2)
>
> My problem is not just with lists: If I use a custom type as parameter
> instead of my List<MyMap> parameter I get the error: "Could not find a
> coercion from type java.lang.String to type net.kln.yalt.report.Report"
> where the Report is my custom type.
>
> This is strange. I "have* been able to transfer the Report to a very
> simple test component. Enclosing my "real" component, which doesn't seem
> to accept parameter + the test component which accepts it.
>
> So now I have five cases of parameter passing, with two components. Both
> components are invoked from the same template, and uses the same getters
> to provide the data. Results:
>
> - List<String> : works OK in all cases.
> - List<MyMap>: the parameter passed seems to be wrong, a single string
> instead of a List<> when sent to class below.
> - Report: Exception "Could not find coercion from String to Report"
> when sent to class below.
> - Report: works OK when sent to test component (4 lines).
> - List<MyMap>: work ok when sent to test component
>
> A little confused, I am. Part of this has been discussed earlier, no
> visible solution though
> (http://article.gmane.org/gmane.comp.java.tapestry.user/55319).
>
> --alec
>
>
> -------- Suspected class, does not accept parameters OK?
> -----------------------
> package net.kln.yalt.components;
> import "stuff"
> @IncludeStylesheet("context:css/yalt.css")
> public class Layout
> {
> @Parameter( "false")
> private String connectionUrl;
>
> @Parameter
> // private List<IRow> listSource;
> private Report listSource;
>
> @Parameter
> private List<String> columns;
>
> @Inject
> private Messages messages;
>
> @Inject
> @Path( "context:icons/connect_no.png")
> private Asset disconnectIcon;
>
> @Inject
> @Path( "context:icons/connect_established.png")
> private Asset connectIcon;
>
> @Inject
> @Path( "context:icons/yalt.svg")
> private Asset yaltIcon;
>
> public Asset getYaltIcon() { return yaltIcon; }
>
> public boolean isConnected()
> {
> return connectionUrl != null && !connectionUrl.equals( "false");
> }
>
> public Asset getDisconnectIcon() { return disconnectIcon; }
>
> public Asset getConnectIcon() { return connectIcon; }
>
> public boolean isListsVisible() { return listSource != null; }
>
> public String getConnectionTooltip()
> {
> return messages.format( "connectionTooltip",
> connectionUrl.replace( "%20", " "));
> }
>
> public List<String> getColumns() { return columns; }
>
> // public List<IRow> getListSource() TODO revert
> public Report getListSource() { return listSource; }
> public String getOrvar() { return "" + listSource.size() } // Test
> code!
> }
>
> --------------------------------- test component, seems to work
> -----------------------------
> public class ReportSize
> {
> @Parameter
> private Report report;
>
> @Parameter
> private List<IRow> rows;
>
> public Integer getReportSize() { return report.size(); }
> public String getFirstMail()
> {
> return rows.get( 0).getColumnValue( "mail");
> }
> }
>
>
> onathan Barker wrote:
> >
> > This is really sounding like something unrelated to Tapestry, and there
> > isn't enough code presented to tell.
> >
> > Do you have proof that your code works outside of Tapestry? Why, and
> how,
> > did you EXTEND TreeMap? Do you have a unit test to prove that your
> MyMap
> > works?
> >
> > If you can present a non-Tapestry test that works, and corresponding
> > Tapestry test that doesn't, then I think you'll find an answer quickly.
> >
> > Jonathan
> >
> >
> >
> >
> >> -----Original Message-----
> >> From: Alec Leamas [mailto:leamas.alec@gmail.com]
> >> Sent: Tuesday, April 01, 2008 8:37 AM
> >> To: Tapestry users
> >> Subject: Re: T5, newbie: Component parameter passing problems
> >>
> >> public List<MyMap> getRows() {...}
> >>
> >> Davor Hrg wrote:
> >>
> >>> how is getRows declared in your page class ?
> >>>
> >>>
> >>>
> >>>
> >>> On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin
> <Mi...@kolmodin.net>
> >>> wrote:
> >>>
> >>>
> >>>
> >>>> OK, thanks...
> >>>>
> >>>> In my page, I have <t:myComponent columns="prop:columns"
> >>>> rows="prop:rows"/>
> >>>>
> >>>> The columns argument, a List<String> is just fine.
> >>>> The rows argument, a List<MyMap> is the problem.
> >>>>
> >>>> The page has a List<MyMap> getRows() which is verified.
> >>>>
> >>>> Looking in MyComponent.java, I have
> >>>>
> >>>> @Parameter
> >>>> private List<MyMap> rows;
> >>>>
> >>>> @Parameter
> >>>> private List<String> columns;
> >>>>
> >>>> public String getSomethingStrange()
> >>>> {
> >>>> return rows.get(0).get( "mail" );
> >>>> }
> >>>>
> >>>> The latter getter fails. The debug info is from a breakpoint inside
> >>>>
> >> this
> >>
> >>>> method. The error I get is a classcast error "java.lang.String cannot
> >>>>
> >> be
> >>
> >>>> cast to ...MyMap" If I change the index to 1, there an error "Caused
> >>>> by: Index: 1, Size: 1" i. e., index out of bounds.
> >>>>
> >>>> Davor Hrg wrote:
> >>>>
> >>>>
> >>>>> Tapestry support for Java generics is very limited,
> >>>>> you need a value encoder to make this work,
> >>>>>
> >>>>> also, add more details on who calls what... so more is known
> >>>>> of the problem you are trying to solve.
> >>>>>
> >>>>>
> >>>>> Davor Hrg
> >>>>>
> >>>>> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
> >>>>>
> >>>>>
> >>>> wrote:
> >>>>
> >>>>
> >>>>>> I have problems passing my own datatype(s) to my own component. The
> >>>>>> component takes two parameters, one List<String> and one
> List<MyMap>.
> >>>>>> MyMap is declared as MyMap extends TreeMap {...}.
> >>>>>>
> >>>>>> The first parameter, a list of strings arrives safely to my
> >>>>>>
> >> component.
> >>
> >>>>>> However, the other one, seems to be mixed up: when I try to access
> an
> >>>>>> element in my List<MyMap>, it turns out that Tapestry (nothing else
> >>>>>> involved) have filled this list with String items, not the
> expected
> >>>>>> MyMap items. In the end, there is a class cast exception when
> trying
> >>>>>>
> >> to
> >>
> >>>>>> access the MyMap items as Maps.
> >>>>>>
> >>>>>> In the Eclipse debugger, it seems that the value of the List<MyMap>
> >>>>>> instance variable is a single string holding what looks like the
> >>>>>> serialized value of my List<MyMap> list. The start is
> >>>>>> "[{key=value,key=value...
> >>>>>>
> >>>>>> I've tried to contribute coercions between MyMap<->Map, but this
> >>>>>>
> >> desn't
> >>
> >>>>>> seem to help (?).
> >>>>>>
> >>>>>> Basically, I'm stucked unless I write everything in several big
> pages
> >>>>>> with duplicated code. Don't really want to do that. :-(
> >>>>>>
> >>>>>> Any hints out there?
> >>>>>>
> >>>>>> --alec
> >>>>>>
> >>>>>> PS Version: 5.0.11 DS
> >>>>>>
> >>>>>> -------------------------------------------------------------------
> --
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems (#2)
Posted by Alec Leamas <le...@gmail.com>.
My problem is not just with lists: If I use a custom type as parameter
instead of my List<MyMap> parameter I get the error: "Could not find a
coercion from type java.lang.String to type net.kln.yalt.report.Report"
where the Report is my custom type.
This is strange. I "have* been able to transfer the Report to a very
simple test component. Enclosing my "real" component, which doesn't seem
to accept parameter + the test component which accepts it.
So now I have five cases of parameter passing, with two components. Both
components are invoked from the same template, and uses the same getters
to provide the data. Results:
- List<String> : works OK in all cases.
- List<MyMap>: the parameter passed seems to be wrong, a single string
instead of a List<> when sent to class below.
- Report: Exception "Could not find coercion from String to Report"
when sent to class below.
- Report: works OK when sent to test component (4 lines).
- List<MyMap>: work ok when sent to test component
A little confused, I am. Part of this has been discussed earlier, no
visible solution though
(http://article.gmane.org/gmane.comp.java.tapestry.user/55319).
--alec
-------- Suspected class, does not accept parameters OK?
-----------------------
package net.kln.yalt.components;
import "stuff"
@IncludeStylesheet("context:css/yalt.css")
public class Layout
{
@Parameter( "false")
private String connectionUrl;
@Parameter
// private List<IRow> listSource;
private Report listSource;
@Parameter
private List<String> columns;
@Inject
private Messages messages;
@Inject
@Path( "context:icons/connect_no.png")
private Asset disconnectIcon;
@Inject
@Path( "context:icons/connect_established.png")
private Asset connectIcon;
@Inject
@Path( "context:icons/yalt.svg")
private Asset yaltIcon;
public Asset getYaltIcon() { return yaltIcon; }
public boolean isConnected()
{
return connectionUrl != null && !connectionUrl.equals( "false");
}
public Asset getDisconnectIcon() { return disconnectIcon; }
public Asset getConnectIcon() { return connectIcon; }
public boolean isListsVisible() { return listSource != null; }
public String getConnectionTooltip()
{
return messages.format( "connectionTooltip",
connectionUrl.replace( "%20", " "));
}
public List<String> getColumns() { return columns; }
// public List<IRow> getListSource() TODO revert
public Report getListSource() { return listSource; }
public String getOrvar() { return "" + listSource.size() } // Test
code!
}
--------------------------------- test component, seems to work
-----------------------------
public class ReportSize
{
@Parameter
private Report report;
@Parameter
private List<IRow> rows;
public Integer getReportSize() { return report.size(); }
public String getFirstMail()
{
return rows.get( 0).getColumnValue( "mail");
}
}
onathan Barker wrote:
>
> This is really sounding like something unrelated to Tapestry, and there
> isn't enough code presented to tell.
>
> Do you have proof that your code works outside of Tapestry? Why, and how,
> did you EXTEND TreeMap? Do you have a unit test to prove that your MyMap
> works?
>
> If you can present a non-Tapestry test that works, and corresponding
> Tapestry test that doesn't, then I think you'll find an answer quickly.
>
> Jonathan
>
>
>
>
>> -----Original Message-----
>> From: Alec Leamas [mailto:leamas.alec@gmail.com]
>> Sent: Tuesday, April 01, 2008 8:37 AM
>> To: Tapestry users
>> Subject: Re: T5, newbie: Component parameter passing problems
>>
>> public List<MyMap> getRows() {...}
>>
>> Davor Hrg wrote:
>>
>>> how is getRows declared in your page class ?
>>>
>>>
>>>
>>>
>>> On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin <Mi...@kolmodin.net>
>>> wrote:
>>>
>>>
>>>
>>>> OK, thanks...
>>>>
>>>> In my page, I have <t:myComponent columns="prop:columns"
>>>> rows="prop:rows"/>
>>>>
>>>> The columns argument, a List<String> is just fine.
>>>> The rows argument, a List<MyMap> is the problem.
>>>>
>>>> The page has a List<MyMap> getRows() which is verified.
>>>>
>>>> Looking in MyComponent.java, I have
>>>>
>>>> @Parameter
>>>> private List<MyMap> rows;
>>>>
>>>> @Parameter
>>>> private List<String> columns;
>>>>
>>>> public String getSomethingStrange()
>>>> {
>>>> return rows.get(0).get( "mail" );
>>>> }
>>>>
>>>> The latter getter fails. The debug info is from a breakpoint inside
>>>>
>> this
>>
>>>> method. The error I get is a classcast error "java.lang.String cannot
>>>>
>> be
>>
>>>> cast to ...MyMap" If I change the index to 1, there an error "Caused
>>>> by: Index: 1, Size: 1" i. e., index out of bounds.
>>>>
>>>> Davor Hrg wrote:
>>>>
>>>>
>>>>> Tapestry support for Java generics is very limited,
>>>>> you need a value encoder to make this work,
>>>>>
>>>>> also, add more details on who calls what... so more is known
>>>>> of the problem you are trying to solve.
>>>>>
>>>>>
>>>>> Davor Hrg
>>>>>
>>>>> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
>>>>>
>>>>>
>>>> wrote:
>>>>
>>>>
>>>>>> I have problems passing my own datatype(s) to my own component. The
>>>>>> component takes two parameters, one List<String> and one List<MyMap>.
>>>>>> MyMap is declared as MyMap extends TreeMap {...}.
>>>>>>
>>>>>> The first parameter, a list of strings arrives safely to my
>>>>>>
>> component.
>>
>>>>>> However, the other one, seems to be mixed up: when I try to access an
>>>>>> element in my List<MyMap>, it turns out that Tapestry (nothing else
>>>>>> involved) have filled this list with String items, not the expected
>>>>>> MyMap items. In the end, there is a class cast exception when trying
>>>>>>
>> to
>>
>>>>>> access the MyMap items as Maps.
>>>>>>
>>>>>> In the Eclipse debugger, it seems that the value of the List<MyMap>
>>>>>> instance variable is a single string holding what looks like the
>>>>>> serialized value of my List<MyMap> list. The start is
>>>>>> "[{key=value,key=value...
>>>>>>
>>>>>> I've tried to contribute coercions between MyMap<->Map, but this
>>>>>>
>> desn't
>>
>>>>>> seem to help (?).
>>>>>>
>>>>>> Basically, I'm stucked unless I write everything in several big pages
>>>>>> with duplicated code. Don't really want to do that. :-(
>>>>>>
>>>>>> Any hints out there?
>>>>>>
>>>>>> --alec
>>>>>>
>>>>>> PS Version: 5.0.11 DS
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: T5, newbie: Component parameter passing problems
Posted by Jonathan Barker <jo...@gmail.com>.
This is really sounding like something unrelated to Tapestry, and there
isn't enough code presented to tell.
Do you have proof that your code works outside of Tapestry? Why, and how,
did you EXTEND TreeMap? Do you have a unit test to prove that your MyMap
works?
If you can present a non-Tapestry test that works, and corresponding
Tapestry test that doesn't, then I think you'll find an answer quickly.
Jonathan
> -----Original Message-----
> From: Alec Leamas [mailto:leamas.alec@gmail.com]
> Sent: Tuesday, April 01, 2008 8:37 AM
> To: Tapestry users
> Subject: Re: T5, newbie: Component parameter passing problems
>
> public List<MyMap> getRows() {...}
>
> Davor Hrg wrote:
> > how is getRows declared in your page class ?
> >
> >
> >
> >
> > On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin <Mi...@kolmodin.net>
> > wrote:
> >
> >
> >> OK, thanks...
> >>
> >> In my page, I have <t:myComponent columns="prop:columns"
> >> rows="prop:rows"/>
> >>
> >> The columns argument, a List<String> is just fine.
> >> The rows argument, a List<MyMap> is the problem.
> >>
> >> The page has a List<MyMap> getRows() which is verified.
> >>
> >> Looking in MyComponent.java, I have
> >>
> >> @Parameter
> >> private List<MyMap> rows;
> >>
> >> @Parameter
> >> private List<String> columns;
> >>
> >> public String getSomethingStrange()
> >> {
> >> return rows.get(0).get( "mail" );
> >> }
> >>
> >> The latter getter fails. The debug info is from a breakpoint inside
> this
> >> method. The error I get is a classcast error "java.lang.String cannot
> be
> >> cast to ...MyMap" If I change the index to 1, there an error "Caused
> >> by: Index: 1, Size: 1" i. e., index out of bounds.
> >>
> >> Davor Hrg wrote:
> >>
> >>> Tapestry support for Java generics is very limited,
> >>> you need a value encoder to make this work,
> >>>
> >>> also, add more details on who calls what... so more is known
> >>> of the problem you are trying to solve.
> >>>
> >>>
> >>> Davor Hrg
> >>>
> >>> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
> >>>
> >> wrote:
> >>
> >>>> I have problems passing my own datatype(s) to my own component. The
> >>>> component takes two parameters, one List<String> and one List<MyMap>.
> >>>> MyMap is declared as MyMap extends TreeMap {...}.
> >>>>
> >>>> The first parameter, a list of strings arrives safely to my
> component.
> >>>> However, the other one, seems to be mixed up: when I try to access an
> >>>> element in my List<MyMap>, it turns out that Tapestry (nothing else
> >>>> involved) have filled this list with String items, not the expected
> >>>> MyMap items. In the end, there is a class cast exception when trying
> to
> >>>> access the MyMap items as Maps.
> >>>>
> >>>> In the Eclipse debugger, it seems that the value of the List<MyMap>
> >>>> instance variable is a single string holding what looks like the
> >>>> serialized value of my List<MyMap> list. The start is
> >>>> "[{key=value,key=value...
> >>>>
> >>>> I've tried to contribute coercions between MyMap<->Map, but this
> desn't
> >>>> seem to help (?).
> >>>>
> >>>> Basically, I'm stucked unless I write everything in several big pages
> >>>> with duplicated code. Don't really want to do that. :-(
> >>>>
> >>>> Any hints out there?
> >>>>
> >>>> --alec
> >>>>
> >>>> PS Version: 5.0.11 DS
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>>
> >> --
> >> -----------------------------------------------------------------------
> ---
> >> Michael Kolmodin Fredsgatan 2
> >> Phone: +46 920 269413 S-972 35 Lulea
> >> Mobile +46 70 551 6507 Sweden
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems
Posted by Alec Leamas <le...@gmail.com>.
public List<MyMap> getRows() {...}
Davor Hrg wrote:
> how is getRows declared in your page class ?
>
>
>
>
> On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin <Mi...@kolmodin.net>
> wrote:
>
>
>> OK, thanks...
>>
>> In my page, I have <t:myComponent columns="prop:columns"
>> rows="prop:rows"/>
>>
>> The columns argument, a List<String> is just fine.
>> The rows argument, a List<MyMap> is the problem.
>>
>> The page has a List<MyMap> getRows() which is verified.
>>
>> Looking in MyComponent.java, I have
>>
>> @Parameter
>> private List<MyMap> rows;
>>
>> @Parameter
>> private List<String> columns;
>>
>> public String getSomethingStrange()
>> {
>> return rows.get(0).get( "mail" );
>> }
>>
>> The latter getter fails. The debug info is from a breakpoint inside this
>> method. The error I get is a classcast error "java.lang.String cannot be
>> cast to ...MyMap" If I change the index to 1, there an error "Caused
>> by: Index: 1, Size: 1" i. e., index out of bounds.
>>
>> Davor Hrg wrote:
>>
>>> Tapestry support for Java generics is very limited,
>>> you need a value encoder to make this work,
>>>
>>> also, add more details on who calls what... so more is known
>>> of the problem you are trying to solve.
>>>
>>>
>>> Davor Hrg
>>>
>>> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
>>>
>> wrote:
>>
>>>> I have problems passing my own datatype(s) to my own component. The
>>>> component takes two parameters, one List<String> and one List<MyMap>.
>>>> MyMap is declared as MyMap extends TreeMap {...}.
>>>>
>>>> The first parameter, a list of strings arrives safely to my component.
>>>> However, the other one, seems to be mixed up: when I try to access an
>>>> element in my List<MyMap>, it turns out that Tapestry (nothing else
>>>> involved) have filled this list with String items, not the expected
>>>> MyMap items. In the end, there is a class cast exception when trying to
>>>> access the MyMap items as Maps.
>>>>
>>>> In the Eclipse debugger, it seems that the value of the List<MyMap>
>>>> instance variable is a single string holding what looks like the
>>>> serialized value of my List<MyMap> list. The start is
>>>> "[{key=value,key=value...
>>>>
>>>> I've tried to contribute coercions between MyMap<->Map, but this desn't
>>>> seem to help (?).
>>>>
>>>> Basically, I'm stucked unless I write everything in several big pages
>>>> with duplicated code. Don't really want to do that. :-(
>>>>
>>>> Any hints out there?
>>>>
>>>> --alec
>>>>
>>>> PS Version: 5.0.11 DS
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>> --
>> --------------------------------------------------------------------------
>> Michael Kolmodin Fredsgatan 2
>> Phone: +46 920 269413 S-972 35 Lulea
>> Mobile +46 70 551 6507 Sweden
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems
Posted by Davor Hrg <hr...@gmail.com>.
how is getRows declared in your page class ?
On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin <Mi...@kolmodin.net>
wrote:
> OK, thanks...
>
> In my page, I have <t:myComponent columns="prop:columns"
> rows="prop:rows"/>
>
> The columns argument, a List<String> is just fine.
> The rows argument, a List<MyMap> is the problem.
>
> The page has a List<MyMap> getRows() which is verified.
>
> Looking in MyComponent.java, I have
>
> @Parameter
> private List<MyMap> rows;
>
> @Parameter
> private List<String> columns;
>
> public String getSomethingStrange()
> {
> return rows.get(0).get( "mail" );
> }
>
> The latter getter fails. The debug info is from a breakpoint inside this
> method. The error I get is a classcast error "java.lang.String cannot be
> cast to ...MyMap" If I change the index to 1, there an error "Caused
> by: Index: 1, Size: 1" i. e., index out of bounds.
>
> Davor Hrg wrote:
> > Tapestry support for Java generics is very limited,
> > you need a value encoder to make this work,
> >
> > also, add more details on who calls what... so more is known
> > of the problem you are trying to solve.
> >
> >
> > Davor Hrg
> >
> > On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com>
> wrote:
> >
> >> I have problems passing my own datatype(s) to my own component. The
> >> component takes two parameters, one List<String> and one List<MyMap>.
> >> MyMap is declared as MyMap extends TreeMap {...}.
> >>
> >> The first parameter, a list of strings arrives safely to my component.
> >> However, the other one, seems to be mixed up: when I try to access an
> >> element in my List<MyMap>, it turns out that Tapestry (nothing else
> >> involved) have filled this list with String items, not the expected
> >> MyMap items. In the end, there is a class cast exception when trying to
> >> access the MyMap items as Maps.
> >>
> >> In the Eclipse debugger, it seems that the value of the List<MyMap>
> >> instance variable is a single string holding what looks like the
> >> serialized value of my List<MyMap> list. The start is
> >> "[{key=value,key=value...
> >>
> >> I've tried to contribute coercions between MyMap<->Map, but this desn't
> >> seem to help (?).
> >>
> >> Basically, I'm stucked unless I write everything in several big pages
> >> with duplicated code. Don't really want to do that. :-(
> >>
> >> Any hints out there?
> >>
> >> --alec
> >>
> >> PS Version: 5.0.11 DS
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
>
>
> --
> --------------------------------------------------------------------------
> Michael Kolmodin Fredsgatan 2
> Phone: +46 920 269413 S-972 35 Lulea
> Mobile +46 70 551 6507 Sweden
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: T5, newbie: Component parameter passing problems
Posted by Michael Kolmodin <Mi...@kolmodin.net>.
OK, thanks...
In my page, I have <t:myComponent columns="prop:columns" rows="prop:rows"/>
The columns argument, a List<String> is just fine.
The rows argument, a List<MyMap> is the problem.
The page has a List<MyMap> getRows() which is verified.
Looking in MyComponent.java, I have
@Parameter
private List<MyMap> rows;
@Parameter
private List<String> columns;
public String getSomethingStrange()
{
return rows.get(0).get( "mail" );
}
The latter getter fails. The debug info is from a breakpoint inside this
method. The error I get is a classcast error "java.lang.String cannot be
cast to ...MyMap" If I change the index to 1, there an error "Caused
by: Index: 1, Size: 1" i. e., index out of bounds.
Davor Hrg wrote:
> Tapestry support for Java generics is very limited,
> you need a value encoder to make this work,
>
> also, add more details on who calls what... so more is known
> of the problem you are trying to solve.
>
>
> Davor Hrg
>
> On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com> wrote:
>
>> I have problems passing my own datatype(s) to my own component. The
>> component takes two parameters, one List<String> and one List<MyMap>.
>> MyMap is declared as MyMap extends TreeMap {...}.
>>
>> The first parameter, a list of strings arrives safely to my component.
>> However, the other one, seems to be mixed up: when I try to access an
>> element in my List<MyMap>, it turns out that Tapestry (nothing else
>> involved) have filled this list with String items, not the expected
>> MyMap items. In the end, there is a class cast exception when trying to
>> access the MyMap items as Maps.
>>
>> In the Eclipse debugger, it seems that the value of the List<MyMap>
>> instance variable is a single string holding what looks like the
>> serialized value of my List<MyMap> list. The start is
>> "[{key=value,key=value...
>>
>> I've tried to contribute coercions between MyMap<->Map, but this desn't
>> seem to help (?).
>>
>> Basically, I'm stucked unless I write everything in several big pages
>> with duplicated code. Don't really want to do that. :-(
>>
>> Any hints out there?
>>
>> --alec
>>
>> PS Version: 5.0.11 DS
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
--
--------------------------------------------------------------------------
Michael Kolmodin Fredsgatan 2
Phone: +46 920 269413 S-972 35 Lulea
Mobile +46 70 551 6507 Sweden
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5, newbie: Component parameter passing problems
Posted by Davor Hrg <hr...@gmail.com>.
Tapestry support for Java generics is very limited,
you need a value encoder to make this work,
also, add more details on who calls what... so more is known
of the problem you are trying to solve.
Davor Hrg
On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <le...@gmail.com> wrote:
> I have problems passing my own datatype(s) to my own component. The
> component takes two parameters, one List<String> and one List<MyMap>.
> MyMap is declared as MyMap extends TreeMap {...}.
>
> The first parameter, a list of strings arrives safely to my component.
> However, the other one, seems to be mixed up: when I try to access an
> element in my List<MyMap>, it turns out that Tapestry (nothing else
> involved) have filled this list with String items, not the expected
> MyMap items. In the end, there is a class cast exception when trying to
> access the MyMap items as Maps.
>
> In the Eclipse debugger, it seems that the value of the List<MyMap>
> instance variable is a single string holding what looks like the
> serialized value of my List<MyMap> list. The start is
> "[{key=value,key=value...
>
> I've tried to contribute coercions between MyMap<->Map, but this desn't
> seem to help (?).
>
> Basically, I'm stucked unless I write everything in several big pages
> with duplicated code. Don't really want to do that. :-(
>
> Any hints out there?
>
> --alec
>
> PS Version: 5.0.11 DS
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
T5, newbie: Component parameter passing problems
Posted by Alec Leamas <le...@gmail.com>.
I have problems passing my own datatype(s) to my own component. The
component takes two parameters, one List<String> and one List<MyMap>.
MyMap is declared as MyMap extends TreeMap {...}.
The first parameter, a list of strings arrives safely to my component.
However, the other one, seems to be mixed up: when I try to access an
element in my List<MyMap>, it turns out that Tapestry (nothing else
involved) have filled this list with String items, not the expected
MyMap items. In the end, there is a class cast exception when trying to
access the MyMap items as Maps.
In the Eclipse debugger, it seems that the value of the List<MyMap>
instance variable is a single string holding what looks like the
serialized value of my List<MyMap> list. The start is
"[{key=value,key=value...
I've tried to contribute coercions between MyMap<->Map, but this desn't
seem to help (?).
Basically, I'm stucked unless I write everything in several big pages
with duplicated code. Don't really want to do that. :-(
Any hints out there?
--alec
PS Version: 5.0.11 DS
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 (5.0.11) - ready for production deployment
Posted by Martin Grotzke <ma...@javakaffee.de>.
Hi,
we also have a production app running T5 http://www.smatch.com, very
stable, up and running.
Cheers,
Martin
On Wed, 2008-03-26 at 21:14 +0100, Jan Vissers wrote:
> Hi,
>
> I have an opportunity to use T5 (5.0.11) in an assignment. My question is;
> is it safe for me to do so? The application is quite simple in that not
> many UI components/forms have to be created. There will be a requirement
> to have google suggest like functionality, along with a small other Ajax
> component. The deployment platform will be tomcat.
>
> What do you think - 'is it safe' ?
>
> Thanks for any feedback,
> -J.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
Re: T5 (5.0.11) - ready for production deployment
Posted by Robert Zeigler <ro...@scazdl.org>.
I'd have to agree.
I've been working on a T3 app a bit this week. It's one I haven't
touched in awhile.
It was pleasantly nice to work on... but I found myself itching to
upgrade the app to T5, because T5 is more fun. :)
Robert
On Mar 27, 2008, at 3/277:35 PM , Howard Lewis Ship wrote:
> "Fun" is one of my favorite adjectives for Tapestry.
>
> On Thu, Mar 27, 2008 at 5:20 PM, Josh Canfield
> <jo...@thedailytube.com> wrote:
>>> There is another public website, thedailytube.com, developed with T5
>>> by some member of this list I can't recall his name. :P
>>
>> That'd be me :)
>>
>> The site went up with 5.0.5, and currently on 5.0.10.
>>
>> Tapestry 5 is rendering everything, the site, the RSS feeds, the
>> content for the email newsletters and the CMS that runs the backend.
>> It's been a fun framework to develop in.
>>
>> Josh
>>
>>
>>
>> On Thu, Mar 27, 2008 at 3:19 PM, Thiago HP <th...@gmail.com>
>> wrote:
>>> In the company I worked for until two weeks ago, I developed an
>>> internal application with T5 and it's already in production. That
>>> was
>>> a very successful experience, so the same company is now developing
>>> another one in T5.
>>>
>>> There is another public website, thedailytube.com, developed with T5
>>> by some member of this list I can't recall his name. :P
>>>
>>> --
>>> Thiago
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> --
>> TheDailyTube.com. Sign up and get the best new videos on the internet
>> delivered fresh to your inbox.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 (5.0.11) - ready for production deployment
Posted by Koka Kiknadze <22...@gmail.com>.
On Fri, Mar 28, 2008 at 5:48 PM, Jonathan Barker <
jonathan.theitguy@gmail.com> wrote:
> Rob,
>
> I can't resist...
>
>
Please, do resist. Imo thats the only way to handle it...
http://article.gmane.org/gmane.comp.java.tapestry.user/59910
RE: T5 (5.0.11) - ready for production deployment
Posted by Jonathan Barker <jo...@gmail.com>.
Rob,
I can't resist...
Your "over-engineerd" comment was under-engineered. Howard would have
surely added in the required number of e's in the word. Then it would be
properly-engineered :-)
As for volatile... you do know that T5 was just voted BETA last week, right?
ALPHA software is generally pretty volatile.
Say, you never did reply to my posting in another thread. I was looking
forward to your response.
Jonathan
> -----Original Message-----
> From: Rob Smeets [mailto:rb.smeets@gmail.com]
> Sent: Friday, March 28, 2008 5:35 AM
> To: Tapestry users
> Subject: Re: T5 (5.0.11) - ready for production deployment
>
> Howard,
>
> I have 2 favorite adjectives about Tapestry 5: Over-engineerd and
> Volatile!!
>
> Best wishes,
>
> Rob
>
> On Fri, Mar 28, 2008 at 1:35 AM, Howard Lewis Ship <hl...@gmail.com>
> wrote:
>
> > "Fun" is one of my favorite adjectives for Tapestry.
> >
> > On Thu, Mar 27, 2008 at 5:20 PM, Josh Canfield <jo...@thedailytube.com>
> > wrote:
> > > > There is another public website, thedailytube.com, developed with T5
> > > > by some member of this list I can't recall his name. :P
> > >
> > > That'd be me :)
> > >
> > > The site went up with 5.0.5, and currently on 5.0.10.
> > >
> > > Tapestry 5 is rendering everything, the site, the RSS feeds, the
> > > content for the email newsletters and the CMS that runs the backend.
> > > It's been a fun framework to develop in.
> > >
> > > Josh
> > >
> > >
> > >
> > > On Thu, Mar 27, 2008 at 3:19 PM, Thiago HP <th...@gmail.com>
> wrote:
> > > > In the company I worked for until two weeks ago, I developed an
> > > > internal application with T5 and it's already in production. That
> was
> > > > a very successful experience, so the same company is now developing
> > > > another one in T5.
> > > >
> > > > There is another public website, thedailytube.com, developed with
> T5
> > > > by some member of this list I can't recall his name. :P
> > > >
> > > > --
> > > > Thiago
> > > >
> > > >
> > > > -------------------------------------------------------------------
> --
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > --
> > > TheDailyTube.com. Sign up and get the best new videos on the internet
> > > delivered fresh to your inbox.
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> >
> > --
> > Howard M. Lewis Ship
> >
> > Creator Apache Tapestry and Apache HiveMind
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 (5.0.11) - ready for production deployment
Posted by Rob Smeets <rb...@gmail.com>.
Howard,
I have 2 favorite adjectives about Tapestry 5: Over-engineerd and Volatile!!
Best wishes,
Rob
On Fri, Mar 28, 2008 at 1:35 AM, Howard Lewis Ship <hl...@gmail.com> wrote:
> "Fun" is one of my favorite adjectives for Tapestry.
>
> On Thu, Mar 27, 2008 at 5:20 PM, Josh Canfield <jo...@thedailytube.com>
> wrote:
> > > There is another public website, thedailytube.com, developed with T5
> > > by some member of this list I can't recall his name. :P
> >
> > That'd be me :)
> >
> > The site went up with 5.0.5, and currently on 5.0.10.
> >
> > Tapestry 5 is rendering everything, the site, the RSS feeds, the
> > content for the email newsletters and the CMS that runs the backend.
> > It's been a fun framework to develop in.
> >
> > Josh
> >
> >
> >
> > On Thu, Mar 27, 2008 at 3:19 PM, Thiago HP <th...@gmail.com> wrote:
> > > In the company I worked for until two weeks ago, I developed an
> > > internal application with T5 and it's already in production. That was
> > > a very successful experience, so the same company is now developing
> > > another one in T5.
> > >
> > > There is another public website, thedailytube.com, developed with T5
> > > by some member of this list I can't recall his name. :P
> > >
> > > --
> > > Thiago
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: T5 (5.0.11) - ready for production deployment
Posted by Howard Lewis Ship <hl...@gmail.com>.
"Fun" is one of my favorite adjectives for Tapestry.
On Thu, Mar 27, 2008 at 5:20 PM, Josh Canfield <jo...@thedailytube.com> wrote:
> > There is another public website, thedailytube.com, developed with T5
> > by some member of this list I can't recall his name. :P
>
> That'd be me :)
>
> The site went up with 5.0.5, and currently on 5.0.10.
>
> Tapestry 5 is rendering everything, the site, the RSS feeds, the
> content for the email newsletters and the CMS that runs the backend.
> It's been a fun framework to develop in.
>
> Josh
>
>
>
> On Thu, Mar 27, 2008 at 3:19 PM, Thiago HP <th...@gmail.com> wrote:
> > In the company I worked for until two weeks ago, I developed an
> > internal application with T5 and it's already in production. That was
> > a very successful experience, so the same company is now developing
> > another one in T5.
> >
> > There is another public website, thedailytube.com, developed with T5
> > by some member of this list I can't recall his name. :P
> >
> > --
> > Thiago
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 (5.0.11) - ready for production deployment
Posted by Josh Canfield <jo...@thedailytube.com>.
> There is another public website, thedailytube.com, developed with T5
> by some member of this list I can't recall his name. :P
That'd be me :)
The site went up with 5.0.5, and currently on 5.0.10.
Tapestry 5 is rendering everything, the site, the RSS feeds, the
content for the email newsletters and the CMS that runs the backend.
It's been a fun framework to develop in.
Josh
On Thu, Mar 27, 2008 at 3:19 PM, Thiago HP <th...@gmail.com> wrote:
> In the company I worked for until two weeks ago, I developed an
> internal application with T5 and it's already in production. That was
> a very successful experience, so the same company is now developing
> another one in T5.
>
> There is another public website, thedailytube.com, developed with T5
> by some member of this list I can't recall his name. :P
>
> --
> Thiago
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 (5.0.11) - ready for production deployment
Posted by Thiago HP <th...@gmail.com>.
In the company I worked for until two weeks ago, I developed an
internal application with T5 and it's already in production. That was
a very successful experience, so the same company is now developing
another one in T5.
There is another public website, thedailytube.com, developed with T5
by some member of this list I can't recall his name. :P
--
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 (5.0.11) - ready for production deployment
Posted by Robert Zeigler <ro...@scazdl.org>.
Caveat: I'm not using any of the ajax features (yet)
But I have a "critical" app in production right now on 5.0.11, and
it's running very nicely.
Even the occasional NPE I was seeing before (see https://issues.apache.org/jira/browse/TAPESTRY-2037)
appears to be completely "worked around" in the core. It's been rock
solid, and wonderful to work with.
Robert
On Mar 26, 2008, at 3/263:14 PM , Jan Vissers wrote:
> Hi,
>
> I have an opportunity to use T5 (5.0.11) in an assignment. My
> question is;
> is it safe for me to do so? The application is quite simple in that
> not
> many UI components/forms have to be created. There will be a
> requirement
> to have google suggest like functionality, along with a small other
> Ajax
> component. The deployment platform will be tomcat.
>
> What do you think - 'is it safe' ?
>
> Thanks for any feedback,
> -J.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org