|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
Tree table with check boxHello,
I have a single column in the tree table. But I need to have check box in the same column along with nodes and not in the seperate column. Can anyone tell how to acheive this. |
|
|
Re: Tree table with check boxsakthi vel schrieb:
> Hello, > > I have a single column in the tree table. > But I need to have check box in the same column along with nodes and not in > the seperate column. > Can anyone tell how to acheive this. > > Use a markupcontainer and add both components to it. Then add container as cell. Cheers Per --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Tree table with check boxHello again,
I am getting only the check box and not the tree structure. Instead of markupcontainer i am using panels. Could you telll, how to get the tree structure along with check box in the same column. |
|
|
Re: Tree table with check boxCan you be more specific please.
How did you created the treetable. How the columns. How the panel etc. Code helps to understand your problem. Cheers Per --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Tree table with check boxHello 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-tp26080852p26156645.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Tree table with check boxHello 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: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Tree table with check boxHello 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 |
|
|
Re: Tree table with check boxYou add a single column to your tree. But you overlay the default cell
component by the checkboxpanel. So you don't get all the stuff from parent component (Like link and node icon etc). Check TreeTable.TreeFragment for details. You have two opportunities: 1. If you want to add your checkbox directly beside the tree structure components you have to copy the code from the treetable class 2. If you only want the treestructure in one column (with a link label) and the combobox in the second column then you have to add another column on which you don't overwrite newCell (see below) HTH Per public class HomePage extends WebPage { private final TreeTable trtTest; /** * Constructor that is invoked when page is invoked without a session. * * @param parameters * Page parameters */ public HomePage(final PageParameters parameters) { IColumn columns[] = new IColumn[] { col1(), col2() }; TreeDataProvider treedataProvider = new TreeDataProvider(); trtTest = new TreeTable("trtTest", treedataProvider.getTreeModel(), columns); trtTest.getTreeState().expandAll(); add(trtTest); } private PropertyTreeColumn col1() { return new PropertyTreeColumn(new ColumnLocation(Alignment.MIDDLE, 5, Unit.PROPORTIONAL), "Check", "userObject.name"); } private PropertyTreeColumn col2() { return new PropertyTreeColumn(new ColumnLocation(Alignment.LEFT, 7, Unit.EM), "L2", "userObject.name") { @Override public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) { DefaultMutableTreeNode n = (DefaultMutableTreeNode) node; CheckBoxPanel boxPanel = new CheckBoxPanel(parent.getId(), n .getUserObject()); return boxPanel; } }; } } --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Tree table with check boxHello again,
My requirement is exactly related to the point 1. you specified 1. If you want to add your checkbox directly beside the tree structure components you have to copy the code from the treetable class If you could elaborate a bit, it will be very much useful to try out. |
|
|
Re: Tree table with check boxHello again,
The links and nodes are added in the TreeFragment class. But the TreeFragment is a private inner class in Treetable, could you tell how to use the TreeFragment to acheive this functionality |
| Free embeddable forum powered by Nabble | Forum Help |