tags:

views:

94

answers:

0

Hi, How to set the initial the leaf node values.

-----------------------Stations.xml
<?xml version="1.0"?>
<station name="RichRadioStation" type="stationName">
<feed date="yesterday" type="date">
   <song time="09:00" type="time" key="RichRadioStation_yesterday_09:00"> AAAAAAAAAAAA</song>
   <song time="10:03" type="time" key="RichRadioStation_yesterday_10:03"> BBBBBBBBBBBB</song>
   <song time="11:06" type="time" key="RichRadioStation_yesterday_11:06"> CCCCCCCCCC</song>
   <song time="12:10" type="time" key="RichRadioStation_yesterday_12:10"> DDDDDDDDDDDD</song>
   <song time="01:15" type="time" key="RichRadioStation_yesterday_01:15"> EEEEEEEEEEEEEE</song>
  </feed>
  <feed date="today" type="date">
   <song time="07:00" type="time" key="KickRadio_today_07:00"> Hall  Oates - Kiss On My List</song>
   <song time="07:03" type="time" key="KickRadio_today_07:03"> David Bowie - Let's Dance</song>
   <song time="07:06" type="time" key="KickRadio_today_07:06"> Lyn Collins - Think (About It)</song>
   <song time="07:10" type="time" key="KickRadio_today_07:10"> Kim Carnes - Bette Davis Eyes</song>
   <song time="07:15" type="time" key="KickRadio_today_07:15"> KC  the Sunshine Band - Give It Up</song>
  </feed>
</station>

<rich:tree id="treeXML" value="#{library.treeData}" var="vardata" nodeFace="#{vardata.attributes['type']}" switchType="ajax">
       <rich:treeNode type="stationName">
          <h:outputText value="#{vardata.attributes['name']}" />
       </rich:treeNode>
     <rich:treeNode type="date">
          <h:outputText value="#{vardata.attributes['date']}" />
      </rich:treeNode>
      <rich:treeNode type="time">
          <h:selectManyCheckbox value="#{vardata.attributes['selection']}">
//inital check values 
                 <f:selectItem itemValue="#{vardata.attributes['key']}" />
          </h:selectManyCheckbox>
              <h:outputText value="#{vardata.attributes['time']}" />
      </rich:treeNode>
</rich:tree>


--------------------Libray.java----------------
public class Library {
private TreeNode treeData;
private List menus=null;
public Library()throws Exception
  {
   menus=new ArrayList(); 
          //it's initial selection of the check box
          vardata.attributes.selection("---key1---);
          vardata.attributes.selection("---key2---);
          vardata.attributes.selection("---keyn---);
         yoursuggestedcode.attribute.selection("key");
        //I need your suggestion code.
   FacesContext context = FacesContext.getCurrentInstance();
   treeData = XmlTreeDataBuilder.build(new InputSource(getClass().getResourceAsStream("/Stations.xml")));
  }



public TreeNode getTreeData() {
  return treeData;
}
public void setTreeData(TreeNode treeData) {
  this.treeData = treeData;
}
public List getMenus() {
  return menus;
}
public void setMenus(List menus) {
  this.menus = menus;
}