-
1. Re: How to user nodeface and type in treenode using .xml confinguration
nbelaevski May 23, 2010 7:44 AM (in response to ajaykadiyala)Hi,
Use nodeFace="#{vardata.attributes['type']}".
-
2. Re: How to user nodeface and type in treenode using .xml confinguration
ajaykadiyala May 24, 2010 2:14 AM (in response to nbelaevski)HI Nick Belaevski/Richface users,
Thanks you support ,as per yours suggestions is worked fine.
But I have one more problem. I added a checkbox to leaf node,if you clicked on submit button . I am not able to get the selected keys of leaf node.
--------------Tree.xthml--
<h:commandButton action="#{library.getSelectedMenus}" value="submit" />
<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="#{library.menus}"> // Selected leaf nodes by user
<f:selectItem itemValue=
"#{vardata.attributes['key']}" />
</h:selectManyCheckbox>
<h:outputText value="#{vardata.attributes['time']}" />
</rich:treeNode>
</rich:tree>
-----------------------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>--------------------Libray.java----------------
public class Library {
private TreeNode treeData;
private List menus=null;
public Library()throws Exception
{
menus=new ArrayList();
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;
}public
void
getSelectedMenus()
{
System.
out.println("--------menus "+menus);
// Getting null or getting Last leaf node selected key values,request you to please provided a solutions
);
}
please see the image for more clarity
-
Tree_selectedBox.GIF 22.0 KB
-
-
3. Re: How to user nodeface and type in treenode using .xml confinguration
ilya_shaikovsky May 24, 2010 2:17 AM (in response to ajaykadiyala)you using the same menus object for all selexcts component - that's why you getting always the same last object selection there. map it to model instead like
<h:selectManyCheckbox value="#{vardata.attributes['selection']}">
-
4. Re: How to user nodeface and type in treenode using .xml confinguration
ajaykadiyala May 24, 2010 2:46 AM (in response to ilya_shaikovsky)Hi Ilya Shaikovsky and richfaces user,
Thanks for you quick reply. I was included the same.
<h:selectManyCheckbox value="#{vardata.attributes['selection']}">
<f:selectItem itemValue="#{vardata.attributes['key']}" />
</h:selectManyCheckbox>
How to get/caputured the left node seleted values, when command button clicked by user,please suggest to me.
<h:commandButton action="#{library.getSelectedMenus}" value="submit" />
public
getSelectedMenus()
{
// suggested to me
);
-
5. Re: How to user nodeface and type in treenode using .xml confinguration
ilya_shaikovsky May 24, 2010 2:52 AM (in response to ajaykadiyala)selection already populated to the model when action fired. So you could get the model and check the new states. Also you could define valuChangeListener directly at select tag.. maybe that will be even easier.
-
6. Re: How to user nodeface and type in treenode using .xml confinguration
ajaykadiyala May 24, 2010 3:56 AM (in response to ilya_shaikovsky)Hi Ilya Shaikovsky,
Thanks a lot.
if selection already populated to the model when action fired. So how to get the model and of checked the new states.
without using valuChangeListener at tag level.or you can give me alternative one is also fine for me.
Using
example
Library() //Constructor
{
//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.
}
-
7. Re: How to user nodeface and type in treenode using .xml confinguration
ajaykadiyala May 24, 2010 5:45 AM (in response to ajaykadiyala)Hi All Richfaces Developer and Jboss commity,
Please do the needful help,since I am facing a big issue.it's urgent.
-
8. Re: How to user nodeface and type in treenode using .xml confinguration
nbelaevski May 25, 2010 6:23 AM (in response to ajaykadiyala)Hi,
<h:selectManyCheckbox value="#{vardata.attributes['selection']}">, I need to selected the all checkboxes in the initial construtor of the bean class.
Yes, or create your own implementation of Map that will return true for initial state.