开发者

Tomahawk tree2 component spacing

Is there any way to change left-margins for the nodes? Tree2 renders those margins with columns such as:

<td height="100%" width="19" style=""><img height="18" border开发者_Go百科="0" width="19" src="/vwwinner/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/12806587/tree2.HtmlTreeRenderer/images/spacer.gif" alt="spacer"></td>

19 px width is too big for me, so I'd be glad to find out how to change this value.


You can always override the width value with css.

td { width: 100px; }

It should be possible to specify styleClass for the treeNode.

In any case the width attribute on the td element is deprecated and css should be used instead.


Well, for unknown reasons that value was hardcoded in t:tree2 renderer class (HtmlTreeRenderer):

protected void encodeCurrentNode(...) {
        .....
        out.writeAttribute(HTML.WIDTH_ATTR, "19", null);
        out.writeAttribute(HTML.HEIGHT_ATTR, "100%", null);
        ...
}

So I just extended that class, overrided encodeCurrentNode() method and registered my renderer in faces-config.xml:

<render-kit>
  <render-kit-id>HTML_BASIC</render-kit-id>
  <renderer>
      <component-family>org.apache.myfaces.HtmlTree2 </component-family>
    <renderer-type>
        org.apache.myfaces.HtmlTree2 
    </renderer-type>
    <renderer-class>
        com.myapp.MyHtmlTreeRenderer
    </renderer-class>
 </renderer>
</render-kit>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜