[
https://issues.apache.org/jira/browse/TOMAHAWK-94?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12515036
]
Joshua Wojcik commented on TOMAHAWK-94:
---------------------------------------
I am using Tomahawk v. 1.1.6 with myfaces 1.2 and was having an issue with the
patched code being able to find the table facets.
The error I'm getting is:
java.lang.IllegalArgumentException: Unable to locate facet with the name:
business
at
org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeCurrentNode(HtmlTreeRenderer.java:326)
at
com.hubspan.portal.jsf.component.HtmlTree2TableRenderer.renderColumnBody(HtmlTree2TableRenderer.java:260)
at
com.hubspan.portal.jsf.component.HtmlTree2TableRenderer.encodeColumnChild(HtmlTree2TableRenderer.java:225)
at
com.hubspan.portal.jsf.component.HtmlTree2TableRenderer.beforeNodeEncode(HtmlTree2TableRenderer.java:194)
at
org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeTree(HtmlTreeRenderer.java:257)
at
org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeChildren(HtmlTreeRenderer.java:206)
at
com.hubspan.portal.jsf.component.HtmlTree2TableRenderer.encodeChildren(HtmlTree2TableRenderer.java:397)
at
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:414)
at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:400)
The problem comes from this snippet of code:
protected void renderColumnBody(FacesContext facesContext,
ResponseWriter writer, HtmlTree tree, UIComponent component,
Iterator columnStyleIterator) throws IOException {
//JSFUtils.resetAllIds(component, facesContext);
component.setParent(null);
component.getClientId(facesContext);
writer.startElement(HTML.TD_ELEM, component);
if (columnStyleIterator.hasNext()) {
writer.writeAttribute(HTML.CLASS_ATTR, columnStyleIterator.next(), null);
}
if (component instanceof HtmlTreeColumn) {
super.beforeNodeEncode(facesContext, writer, tree);
super.encodeCurrentNode(facesContext, writer, tree);
Which in turn calls:
protected void encodeCurrentNode(FacesContext context, ResponseWriter out,
HtmlTree tree)
throws IOException
{
TreeNode node = tree.getNode();
// set configurable values
boolean showRootNode = tree.isShowRootNode();
boolean showNav = tree.isShowNav();
boolean showLines = tree.isShowLines();
boolean clientSideToggle = tree.isClientSideToggle();
if (clientSideToggle)
{
// we must show the nav icons if client side toggle is enabled
(regardless of what user says)
showNav = true;
}
UIComponent nodeTypeFacet = tree.getFacet(node.getType()); // Problem
is here, the tree has no facets.
UIComponent nodeImgFacet = null;
if (nodeTypeFacet == null)
{
throw new IllegalArgumentException("Unable to locate facet with the
name: " + node.getType());
}
This is my JSP code:
<hs:tree2Table
id="businessTreeTable"
value="#{myOrganizationViewBean.treeModel}"
var="node" varNodeToggler="t" clientSideToggle="false"
binding="#{myOrganizationViewBean.uiBusinessTree}"
styleClass="standard_table">
<t:treeColumn>
<f:facet name="header">
<t:outputText
value="#{msgs.Hubspan_Entity_MyOrganization_CompanyName_Label}"/>
</f:facet>
<f:facet name="business">
<h:panelGroup>
<h:panelGroup rendered="#{t.nodeSelected}">
<h:commandLink immediate="true"
styleClass="bullet"
action="#{myOrganizationViewBean.viewBusinessDetailAction}">
<h:outputText
value="#{node.description}"
styleClass="nodeBusiness"
style="COLOR: #E0821E;
white-space: nowrap"/>
<f:param name="businessId"
value="#{node.identifier}" />
</h:commandLink>
<h:outputText value="
(#{node.childCount})"
styleClass="childCount"
rendered="#{!empty node.children}" />
</h:panelGroup>
<h:panelGroup rendered="#{!t.nodeSelected}">
<h:commandLink immediate="true"
actionListener="#{myOrganizationViewBean.setNodeSelected}">
<h:outputText
value="#{node.description}"
styleClass="nodeBusiness"
style="white-space: nowrap"/>
<f:param name="businessId"
value="#{node.identifier}" />
</h:commandLink>
<h:outputText value="
(#{node.childCount})"
styleClass="childCount"
rendered="#{!empty node.children}" />
</h:panelGroup>
</h:panelGroup>
</f:facet>
</t:treeColumn>
<t:column>
<f:facet name="header">
<t:outputText
value="#{msgs.Hubspan_Entity_MyOrganization_TableHeader_Options}"/>
</f:facet>
<f:facet name="business">
<t:panelGrid columns="4">
<t:commandButton id="viewBusinessButton"
styleClass="portlet-form-button"
action="#{myOrganizationViewBean.viewBusinessDetailAction}" type="submit"
immediate="true"
value="#{msgs.Hubspan_Common_Button_Label_View}"/>
</t:panelGrid>
</f:facet>
</t:column>
</hs:tree2Table>
> tree2 should work with treeColumn
> ---------------------------------
>
> Key: TOMAHAWK-94
> URL: https://issues.apache.org/jira/browse/TOMAHAWK-94
> Project: MyFaces Tomahawk
> Issue Type: Bug
> Components: Tree2
> Environment: n/a
> Reporter: Bill Schneider
> Assignee: Martin Marinschek
> Attachments: HtmlTableTree.java, HtmlTree2TableRenderer.java,
> Tree2TableTag.java
>
>
> since tree is deprecated, there seems to be a lot of demand for treeColumn to
> work with tree2. searching the mailing list archives turns up a bunch of
> messages from a few months ago but nothing all that recent.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.