lfnxd

主题: tomahawk与trinidad呈现器冲突问题

    tomahawk与trinidad提供了丰富的控件,但是当默认呈现器设置成org.apache.myfaces.trinidad.core时,tomahawk中的dataScroll不能正常工作。如果不设置默认呈现器,trinidad又不能工作,所以这是个矛盾,需要跟踪代码,使这两个优秀的开源JSF控件集能很好的共存。

    解决方法:在eclipse中导入trinidad-1.0.2的源码,修改包org.apache.myfaces.trinidadinternal.renderkit.htmlBasic中的HtmlCommandLinkRenderer.java。

public class HtmlCommandLinkRenderer extends Renderer
{

  ...
  private Renderer renderer = null;   //增加呈现器接口成员变量

  ....
  //增加encodeBegin函数

  @SuppressWarnings("unchecked")
  @Override
  public void encodeBegin(FacesContext context,
                     UIComponent component) throws IOException
  {
    // The tr:commandLink is not a rendersChildren component,
    // but h:commandLink is.  Hence, the difference in behavior
    renderer = createRenderer(component);
    renderer.encodeBegin(context, component);

    for(UIComponent child : (List<UIComponent>)component.getChildren())
    {
      RenderUtils.encodeRecursive(context, child);
    }
  }

  ...
 

  //修改encodeEnd函数为当前代码
  @SuppressWarnings("unchecked")
  @Override
  public void encodeEnd(FacesContext context,
                     UIComponent component) throws IOException
  {
    // The tr:commandLink is not a rendersChildren component,
    // but h:commandLink is.  Hence, the difference in behavior
    if(renderer==null)
    {
     renderer = createRenderer(component);
     renderer.encodeBegin(context, component);
 
     for(UIComponent child : (List<UIComponent>)component.getChildren())
     {
       RenderUtils.encodeRecursive(context, child);
     }
    }
    renderer.encodeEnd(context, component);
  }

  ...
}

 

posted on 2008-08-07 10:48 云和山的彼端 阅读(354) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2008年8月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

统计

常用链接

留言簿(4)

我参与的团队

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜