wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vela <vela....@gmail.com>
Subject Re: Tree table with check box
Date Tue, 03 Nov 2009 13:25:58 GMT

Hello again,

Please find the code below


In Page class:


		IColumn columns[] = new IColumn[] 
		{
			new  PropertyTreeColumn(new ColumnLocation(Alignment.LEFT, 100,
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();
		trtTest = new
TreeTable("trtTest",treedataProvider.getTreeModel(),columns);
		trtTest.getTreeState().expandAll();
		
		add(trtTest); 



In Check box panel class:


public class CheckBoxPanel extends Panel
{
	private CheckBox cbxName;
	private Label lblName;
	private Link lnkName;
	
	public CheckBoxPanel(String id, String model) 
	{
		super(id);
		setMarkupId(id);
		setOutputMarkupId(true);
		setOutputMarkupPlaceholderTag(true);
		
		
		cbxName = new CheckBox("cbxName", new AbstractCheckBoxModel());
		add(cbxName);
       }
}



Tree Data Provider class:


public class TreeDataProvider 
{
	private DefaultMutableTreeNode dmtRoot;
	public TreeDataProvider()
	{
		dmtRoot = new DefaultMutableTreeNode(new TreeListVO("Test"));
		
		DefaultMutableTreeNode dmtBase1 = new DefaultMutableTreeNode(new
TreeListVO("Sakthi"));
		DefaultMutableTreeNode dmtChild1 = new DefaultMutableTreeNode(new
TreeListVO("Computer"));
		dmtBase1.add(dmtChild1);
		dmtRoot.add(dmtBase1);
	}
	
	public TreeModel getTreeModel()
	{
		DefaultTreeModel dtmTree = new DefaultTreeModel(dmtRoot);
		return dtmTree;
	}
}




In Model class:


public class TreeListVO 
{
	private String name;
		
	public TreeListVO(String name) 
	{
		this.name = name;
	}

	public String getName() 
	{
		return name;
	}
}



CheckBoxPanel & Page class have correspoding html file








-- 
View this message in context: http://old.nabble.com/Tree-table-with-check-box-tp26080852p26160113.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message