You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Andrew Swift <an...@aswift.me.uk> on 2006/08/15 12:40:02 UTC

Getting an IndexOutOfBoundsException with tomahawk tree component

Hi,

I have tried asking this question on the users list but no one is replying.
Sorry if I have made a mistake trying this list but I am stuck.

Using myfaces and tomahawk both 1.1.5 snapshot. In Webspere 5.1 test
environment.

I am receiving the IndexOutOfBoundsException when I try to change my tree
model while my tree is expanded.
I think it is when the model is shorter than the number of nodes expanded on
the page.

Not sure if this is a bug or there is a way of collapsing the tree before
changing the model.

My page is shown below.
When the user clicks the OK command button then the tree model changes based
on the selectOneMenu.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core " prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>test.jsp</TITLE>
<LINK rel="stylesheet" type="text/css" href="theme/stylesheet.css">
<LINK rel="stylesheet" type="text/css" href="theme/basic.css">
<LINK rel="stylesheet" type="text/css"
    href="theme/honda_equote_styles.css">
</HEAD>
<BODY>
<f:view>
    <f:loadBundle basename="com.honda.hum.pbom.web.messages" var="msgs" />
    <h:form id="form">
        <h:outputText value="Search Revision No" />
        <h:inputText id="searchNo" value="#{treeTable.partNumber}"
            required="true">
            <f:validateLength minimum="8" />
        </h:inputText>
        <h:commandButton value="#{msgs.search}"
            action="#{treeTable.updateLevel1Parts}" styleClass="buttonStyle"
/>
        <h:message for="searchNo" />
        <h:outputText value="#{msgs.partNumber}" />
        <h:selectOneMenu value="#{treeTable.selectedRevision}" >
            <f:selectItems value="#{treeTable.level1Parts }" />
        </h:selectOneMenu>
        <h:commandButton value="#{msgs.ok}"
action="#{treeTable.getStructure}"
            rendered="#{treeTable.selected}" styleClass="buttonStyle" />
        <HR>
        <t:tree id="tree" value="#{treeTable.treeModel}" var="treeItem"
            styleClass="tree" nodeClass="treenode" headerClass="treeHeader"
            footerClass="treeFooter" rowClasses="evenRow, oddRow"
            columnClasses="col1, col2" selectedNodeClass="treenodeSelected"
            expandRoot="false">
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Part Number"
                        style="padding-left: 10px; text-align: left; width:
150px" />
                </f:facet>
                <h:outputText value="#{treeItem.name}" style="padding-left:
10px" />
            </h:column>
            <t:treeColumn>
                <f:facet name="header">
                    <h:outputText value="Level" />
                </f:facet>
                <h:outputText value="#{treeItem.isoCode }" />
            </t:treeColumn>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Description"
                        style="padding-left: 10px; text-align: left; width:
200px" />
                </f:facet>
                <h:outputText value="#{treeItem.description}"
                    style="padding-left: 10px" />
            </h:column>
            <f:facet name="footer">
                <h:outputText value="Footer" />
            </f:facet>
        </t:tree>
    </h:form>

    <P>Place content here.</P>
    <h:outputLink value=" index.faces">
        <h:outputText value="#{msgs.mainIndex}" />
    </h:outputLink>

</f:view>
</BODY>
</HTML>

-- 
View this message in context: http://www.nabble.com/Getting-an-IndexOutOfBoundsException-with-tomahawk-tree-component-tf2108504.html#a5811974
Sent from the My Faces - Dev forum at Nabble.com.