Any ideas about how to get this working????????
vishy_sb wrote: > > Thanks for the quick reply Matej. > > Well in my implementation I am using a CheckBoxTree example discussed in > the forum already > (http://www.nabble.com/Checkbox-tree-component-td13433102.html#a13439520). > and I am adding all the components in the addcomponents() method in the > CheckBoxIconPanel class. However since the HTML mark up that I can have > will always remain the same so I am not able to use different component > for different nodes. The code is shown below: > > ////Java Code for the CheckBoxIconPanel class > protected void addComponents(final IModel model, final BaseTree tree) { > final LimitViewerCheckBoxTree cbTree = > (LimitViewerCheckBoxTree) tree; > LimitViewerCheckBoxTree.ICheckCallback callback = new > LimitViewerCheckBoxTree.ICheckCallback() { > private static final long serialVersionUID = 1L; > > public void onUpdate(AjaxRequestTarget target) { > onNodeCheckUpdated((TreeNode) > model.getObject(), cbTree, target); > } > }; > > IModel dataModel = cbTree.newCheckBoxModel((TreeNode) > model.getObject()); > int level = (Integer) > ((DefaultMutableTreeNode)model.getObject()).getLevel(); > > if(level == 1){ > MarkupContainer cb = null; > cb = cbTree.newCheckBox("checkbox", dataModel, > callback); > ((CheckBox) cb).setVisible(false); > add(cb); > Component component = newContentComponent("content", > tree, model); > add(component); > limitPanel = new LimitPanel("limitPanel"); > add(limitPanel); > limitPanel.setVisible(false); > > InstrumentLimitViewerPanel instrumentLimitViewerPanel = > new > InstrumentLimitViewerPanel("instrumentLimitViewerPanel", limitInputPanel > ,limitViewerForm); > add(instrumentLimitViewerPanel); > instrumentLimitViewerPanel.setVisible(false); > > } > if(level == 2){ > MarkupContainer cb = null; > cb = cbTree.newCheckBox("checkbox", dataModel, > callback); > > add(cb); > Component component = newContentComponent("content", > tree, model); > add(component); > limitPanel = new LimitPanel("limitPanel"); > add(limitPanel); > > InstrumentLimitViewerPanel instrumentLimitViewerPanel = > new > InstrumentLimitViewerPanel("instrumentLimitViewerPanel",limitInputPanel, > limitViewerForm); > add(instrumentLimitViewerPanel); > instrumentLimitViewerPanel.setVisible(false); > > } > if(level == 3){ > MarkupContainer cb = null; > cb = cbTree.newCheckBox("checkbox", dataModel, > callback); > ((CheckBox) cb).setVisible(false); > add(cb); > Component component = newContentComponent("content", > tree, model); > add(component); > component.setVisible(false); > limitPanel = new LimitPanel("limitPanel"); > add(limitPanel); > limitPanel.setVisible(false); > > InstrumentLimitViewerPanel > instrumentLimitViewerPanel = new > InstrumentLimitViewerPanel("instrumentLimitViewerPanel",limitInputPanel, > limitViewerForm); > add(instrumentLimitViewerPanel); > } catch (Exception e) { > e.printStackTrace(); > } > } > } > > // HTML code > > <wicket:panel> > <div> > <table class="icon-panel"> > <tr> > <td class="content"><input type="checkbox" > wicket:id="checkbox"/></td> > <td></td> > <td><div style="margin:10px 0 0 30px" wicket:id="limitPanel"> > </div></td> > </tr> > > </table> > </div> > <div wicket:id="instrumentLimitViewerPanel"></div> > </wicket:panel> > > So I was wondering if it is possible to add different node components if I > want to use the CheckBoxIconPanel or id what you suggested the only way to > get this working... > > > Thanks in advance, > vishy > > Matej Knopp-2 wrote: >> >> You have to use different panel for each Tree item (depending on the >> tree node for that item). If you use BaseTree, implement the >> #newNodeComponent method accordingly. You can look at LinkTree or >> LabelTree for an example of how the implementation can look like. >> >> Or you can use LinkTree, override newNodeComponent like this >> >> @Override >> protected Component newNodeComponent(String id, IModel model) >> { >> return new LinkIconPanel(id, model, LinkTree.this) >> { >> private static final long serialVersionUID = 1L; >> >> @Override >> protected void onNodeLinkClicked(Object node, BaseTree >> tree, >> AjaxRequestTarget target) >> { >> super.onNodeLinkClicked(node, tree, target); >> LinkTree.this.onNodeLinkClicked(node, tree, >> target); >> } >> >> @Override >> protected Component newContentComponent(String >> componentId, >> BaseTree tree, IModel model) >> { >> /* HERE CREATE YOUR OWN PANEL DEPENDING ON THE >> TREE NODE. YOU CAN GET >> THE TREE NODE FOR THIS ROW FROM >> model.getObject() */ >> } >> }; >> } >> >> >> -Matej >> >> On Fri, Aug 1, 2008 at 1:29 AM, vishy_sb <[EMAIL PROTECTED]> >> wrote: >>> >>> http://www.nabble.com/file/p18765641/treeview.jpeg >>> >>> Hi All, >>> >>> As shown in the Image I have a checkbox tree which has nodes that have >>> different components. Each node of the tree has a checkbox, label, a >>> panel >>> which has the 3 TextAreas and another panel which has a listview. In >>> order >>> to get the tree to look like what is shown in the image, I had to set >>> the >>> visibility of these components across different levels of the Tree which >>> means that all these components are present at all the nodes but they >>> are >>> not visible everywhere. Also on top of the tree is another panel(Top >>> Panel) >>> from where values are submitted on pressing the apply button. Now what I >>> wanted to achieve in this interface was to apply the limits entered in >>> the >>> Top Panel to the nodes which are checked (i.e. to the ListView under the >>> checked node). This seems to be a real complex interface to me but there >>> has >>> to be a way to get this to work. The main problem that I am having is >>> that >>> how do I get to the ListView (or ListViews) to which I am trying to make >>> the >>> changes. I might be sounding a little confusing here but I am ready to >>> explain the whole interface in even more detail. >>> >>> Please let me know if anyone has any ideas or even a suggestion to >>> implement >>> this. >>> >>> Also is there a way to add different components to the different nodes >>> in >>> the same Tree?????? >>> >>> >>> Kindly let me. >>> >>> Thanks in advance, >>> vishy >>> -- >>> View this message in context: >>> http://www.nabble.com/Dynamically-Making-changes-to-Tree-Node-tp18765641p18765641.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] >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > -- View this message in context: http://www.nabble.com/Dynamically-Making-changes-to-Tree-Node-tp18765641p18782570.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]