Hello again,
Please find the below given code
Page class:
Treetable has been added in the Page class as follows
IColumn columns[] = new IColumn[]
{
new PropertyTreeColumn(new ColumnLocation(Alignment.LEFT,
Unit.PERCENT),"Check","userObject.name")
{
public IRenderable
newCell(javax.swing.tree.TreeNode node, int level)
{
return null;
}
public Component newCell(MarkupContainer
parent,java.lang.String id, javax.swing.tree.TreeNode node, int level)
{
CheckBoxPanel boxPanel = new
CheckBoxPanel(parent.getId(),id);
return boxPanel;
}
},
};
TreeDataProvider treedataProvider = new TreeDataProvider();
TreeTable checkTrees = new
TreeTable("trtTest",treedataProvider.getTreeModel(),columns);
add(checkTrees);
CheckBoxPanel class:
public class CheckBoxPanel extends Panel
{
private CheckBox cbxName;
public CheckBoxPanel(String id, String model)
{
super(id);
setMarkupId(id);
setOutputMarkupId(true);
setOutputMarkupPlaceholderTag(true);
cbxName = new CheckBox("cbxName", new Model());
add(cbxName);
}
}
Data Provider class:
public class TreeDataProvider
{
private DefaultMutableTreeNode dmtRoot;
public TreeDataProvider()
{
dmtRoot = new DefaultMutableTreeNode(new
TreeListVO("Test"));
DefaultMutableTreeNode dmtBase1 = new
DefaultMutableTreeNode(new TreeListVO("Root1"));
DefaultMutableTreeNode dmtChild1 = new
DefaultMutableTreeNode(new TreeListVO("node1"));
dmtBase1.add(dmtChild1);
dmtRoot.add(dmtBase1);
}
public TreeModel getTreeModel()
{
DefaultTreeModel dtmTree = new DefaultTreeModel(dmtRoot);
return dtmTree;
}
}
Model class:
public class TreeListVO
{
private String name;
public TreeListVO(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
--
View this message in context:
http://old.nabble.com/Tree-table-with-check-box-tp26080852p26157749.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]