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 <[EMAIL PROTECTED]> 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, [EMAIL PROTECTED]
// 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to