I'm just getting started with Tacos and I'm trying to get a fairly
simple Tree working, but I've hit an issue I can't solve.

I have the tree rendering and working correctly, and though I haven't
figure out styles yet, it is at least working. But when I went to
configure it to do something server-side when the user clicks an
element in the tree, I get an error message.

The error message is this.

Failure invoking listener method 'public void
net.sf.tacos.ajax.components.tree.Tree.contentExpansion(org.apache.tapestry.IRequestCycle)'
on [EMAIL PROTECTED]/tree]: 0

java.lang.ArrayIndexOutOfBoundsException
0
Stack Trace:

    * net.sf.tacos.ajax.components.tree.Tree.expansion(Tree.java:143)
    * net.sf.tacos.ajax.components.tree.Tree.contentExpansion(Tree.java:160)
    * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    * 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    * 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    * java.lang.reflect.Method.invoke(Method.java:585)
    * 
org.apache.tapestry.listener.ListenerMethodInvokerImpl.invokeTargetMethod(ListenerMethodInvokerImpl.java:214)
    * 
org.apache.tapestry.listener.ListenerMethodInvokerImpl.invokeListenerMethod(ListenerMethodInvokerImpl.java:155)
    * 
org.apache.tapestry.listener.ListenerMethodInvokerImpl.searchAndInvoke(ListenerMethodInvokerImpl.java:124)
    * 
org.apache.tapestry.listener.ListenerMethodInvokerImpl.invokeListenerMethod(ListenerMethodInvokerImpl.java:69)
    * 
org.apache.tapestry.listener.SyntheticListener.actionTriggered(SyntheticListener.java:51)
    * 
org.apache.tapestry.listener.ListenerInvokerTerminator.invokeListener(ListenerInvokerTerminator.java:51)
    * 
$ListenerInvoker_10deb79afec.invokeListener($ListenerInvoker_10deb79afec.java)
    * 
$ListenerInvoker_10deb79afeb.invokeListener($ListenerInvoker_10deb79afeb.java)
    * org.apache.tapestry.link.DirectLink.trigger(DirectLink.java:105)
    * 
net.sf.tacos.ajax.impl.AjaxDirectServiceImpl.triggerComponent(AjaxDirectServiceImpl.java:341)
    * 
net.sf.tacos.ajax.impl.AjaxDirectServiceImpl.service(AjaxDirectServiceImpl.java:202)
    * 
$AjaxDirectService_10deb79b03d.service($AjaxDirectService_10deb79b03d.java)
    * 
org.apache.tapestry.services.impl.EngineServiceInnerProxy.service(EngineServiceInnerProxy.java:77)
    * 
org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66)
    * org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:248)
    * 
org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
    * 
$WebRequestServicer_10deb79b01f.service($WebRequestServicer_10deb79b01f.java)
    * 
$WebRequestServicer_10deb79b01b.service($WebRequestServicer_10deb79b01b.java)
    * 
org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56)
    * 
$ServletRequestServicer_10deb79b001.service($ServletRequestServicer_10deb79b001.java)
    * 
org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
    * 
$ServletRequestServicerFilter_10deb79affd.service($ServletRequestServicerFilter_10deb79affd.java)
    * 
$ServletRequestServicer_10deb79b003.service($ServletRequestServicer_10deb79b003.java)
    * 
org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
    * 
$ServletRequestServicerFilter_10deb79affb.service($ServletRequestServicerFilter_10deb79affb.java)
    * 
$ServletRequestServicer_10deb79b003.service($ServletRequestServicer_10deb79b003.java)
    * 
org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
    * 
$ServletRequestServicerFilter_10deb79afff.service($ServletRequestServicerFilter_10deb79afff.java)
    * 
$ServletRequestServicer_10deb79b003.service($ServletRequestServicer_10deb79b003.java)
    * 
$ServletRequestServicer_10deb79aff5.service($ServletRequestServicer_10deb79aff5.java)
    * 
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123)
    * org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79)
    * javax.servlet.http.HttpServlet.service(HttpServlet.java:596)
    * javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    * org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
    * 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:475)
    * org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
    * org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
    * 
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:635)
    * org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
    * org.mortbay.http.HttpServer.service(HttpServer.java:954)
    * org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
    * org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
    * org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
    * org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
    * org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
    * org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)


The code is fairly simple and is modeled closely after the examples
from the Tacos demo.

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

Home.html:

<html>
<head></head>

<script type="text/javascript">
        djConfig = { isDebug: false,
    baseRelativePath: "js/dojo/",
    preventBackButtonFix: false };
</script>
<script type="text/javascript" src="js/dojo/dojo.js"></script>

<body jwcid="@Body" title="Simple Tree">


        <div jwcid="tree" id="tree" style="overflow: auto; width: auto; height: 
auto;">
            <span jwcid="nodeLink">     
                <span jwcid="@Insert" value="ognl:item.name"/>
                </span>
        </div>

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

Home.page:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>

<page-specification class="mytacos.page.HomePage">
        
    <description>Tree Demo</description>

        <property name="item" />

        <property name="selectedItem" persist="session"/>

        <bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>
                
        <component id="nodeLink" type="tacos:AjaxDirectLink">
                <binding name="listener"
                value="ognl:components.tree.listeners.contentExpansion"/>
       <binding name="updateComponents"
                 value="ognl:{item.name, 'selectedItem' }"/>
        </component>

        <component id="tree" type="tacos:Tree">
                <binding name="contentProvider" value="new
mytacos.tree.SimpleTreeContentProvider()"/>
                <binding name="value" value="item"/>
        <binding name="linkListener" value="listener:select"/>
        </component>

</page-specification>


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

HomePage.java: (ideally the select() method would execute whenever the
tree is clicked).

package mytacos.page;

import mytacos.tree.Item;
import net.sf.tacos.ajax.AjaxWebRequest;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;

public abstract class HomePage extends BasePage
{
  public abstract Item getSelectedItem();
  public abstract void setSelectedItem(Item item);
  /** Injected ajax request */
  public abstract AjaxWebRequest getAjaxWebRequest();

  public void select(IRequestCycle cycle)
  {

      System.out.println("select");

      for(int i=0; i < cycle.getListenerParameters().length; i++)
      {
        System.out.println(cycle.getListenerParameters()[i]);
      }

  }

}

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel

Reply via email to