[jboss-user] [JBoss Seam] - Re: Very strange exception
gus888
do-not-reply at jboss.com
Sun Nov 5 11:20:32 EST 2006
I guess that the exception listed in first thread was from Tomahawk tree2 component. When using tree2 with facelets, it needs a Tree2TagHandler. The code is listed as follows(from myfaces wiki), but I haven't got chance to test it.
import java.util.Map;
|
| import javax.faces.component.UIComponent;
|
| import org.apache.myfaces.custom.tree2.HtmlTree;
| import org.apache.myfaces.renderkit.JSFAttr;
|
| import com.sun.facelets.FaceletContext;
| import com.sun.facelets.tag.MetaRuleset;
| import com.sun.facelets.tag.jsf.ComponentConfig;
| import com.sun.facelets.tag.jsf.ComponentHandler;
|
| public class Tree2TagHandler
| extends ComponentHandler
| {
| public Tree2TagHandler(ComponentConfig cfg)
| {
| super(cfg);
| }
|
| @Override
| @SuppressWarnings("unchecked")
| protected void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent)
| {
| super.onComponentCreated(ctx, c, parent);
|
| HtmlTree component = (HtmlTree)c;
|
| Map attrs = component.getAttributes();
| ensureBoolean(attrs, JSFAttr.SHOW_NAV);
| ensureBoolean(attrs, JSFAttr.SHOW_LINES);
| ensureBoolean(attrs, JSFAttr.CLIENT_SIDE_TOGGLE);
| ensureBoolean(attrs, JSFAttr.SHOW_ROOT_NODE);
| ensureBoolean(attrs, JSFAttr.PRESERVE_TOGGLE);
| }
|
| @SuppressWarnings("unchecked")
| private void ensureBoolean(Map attributes, String attrName)
| {
| Object value = attributes.get(attrName);
| if (value == null || !(value instanceof String)) return;
| attributes.put(attrName, Boolean.valueOf((String)value));
| }
|
| @Override
| protected MetaRuleset createMetaRuleset(Class type)
| {
| return super.createMetaRuleset(type)
| .alias("showNav", JSFAttr.SHOW_NAV)
| .alias("showLines", JSFAttr.SHOW_LINES)
| .alias("clientSideToggle", JSFAttr.CLIENT_SIDE_TOGGLE)
| .alias("showRootNode", JSFAttr.SHOW_ROOT_NODE)
| .alias("preserveToggle", JSFAttr.PRESERVE_TOGGLE);
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983303#3983303
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983303
More information about the jboss-user
mailing list