sventon subversion web client - http://www.sventon.org
[show recent changes]
 
  Help
HEAD
Rev: 28237 - http://anonsvn.icesoft.org/repo / icefaces2 / scratchpads / patches / EmnosBuild / icefaces / compat / components / src / main / java / com / icesoft / faces / component / tree / Tree.java
Unified Diff View - Tree.java
/icefaces2/scratchpads/patches/EmnosBuild/icefaces/compat/components/src/main/java/com/icesoft/faces/component/tree/Tree.java @ revision 28236
/icefaces2/scratchpads/patches/EmnosBuild/icefaces/compat/components/src/main/java/com/icesoft/faces/component/tree/Tree.java @ revision 28237
@@ -46,6 +46,7 @@ import javax.faces.event.ActionEvent; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeModel; +import javax.swing.tree.DefaultTreeModel; import java.io.IOException; import java.io.Serializable; @@ -165,7 +166,9 @@     transient private DefaultMutableTreeNode currentNode;     private String nodePath;     private String title; - + + private TreeModel dummyModel = null; +     /**      * default no args constructor      */ @@ -276,8 +279,21 @@      */     public TreeModel getModel() {         ValueBinding vb = getValueBinding("value"); -        return (TreeModel) vb.getValue(getFacesContext()); +        TreeModel model = (TreeModel) vb.getValue(getFacesContext()); +  if (model == null) { +   return getDummyModel(); +  } +        return model;     } + + public TreeModel getDummyModel() { +  if (dummyModel == null) { +   DefaultMutableTreeNode defaultMutableTreeNode = new DefaultMutableTreeNode(); +   IceUserObject iceUserObject = new IceUserObject(defaultMutableTreeNode); +   dummyModel = new DefaultTreeModel(new DefaultMutableTreeNode(iceUserObject)); +  } +  return dummyModel; + }     /**      * @return TreeNode template @@ -1374,6 +1390,8 @@     @Override     public boolean visitTree(VisitContext context,                              VisitCallback callback) { +  if (!isRendered()) +            return false;         if (!isVisitable(context))             return false;


feed icon

sventon 2.5.1