You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by vishy_sb <sh...@gmail.com> on 2008/08/01 01:29:50 UTC

Dynamically Making changes to Tree Node

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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dynamically Making changes to Tree Node

Posted by vishy_sb <sh...@gmail.com>.
Hey Matej,

I have been able to implement the tree with the solution that you provided
and I am using the separate panels for each node. However I have a new error
that has come up. Can you please look at this thread whenever you have some
time that I have posted here:

http://www.nabble.com/Modal-Window-not-displayed-td18856011.html 

Thanks,
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 <sh...@gmail.com>
> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamically-Making-changes-to-Tree-Node-tp18765641p18859160.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


Re: Dynamically Making changes to Tree Node

Posted by vishy_sb <sh...@gmail.com>.
Hi there, 

Well it seems that the tree is not working again...
Here is the code: 
Inside the Tree I am overriding the newNodeComponentMethod() like this:

//Java Code

@Override
	protected Component newNodeComponent(String id, IModel model) {
		Component nodeComp = null;
		int level = ((DefaultMutableTreeNode) model.getObject()).getLevel();
		if (level == 1) {

			nodeComp = new ExchangeNodePanel(id, model,
LimitViewerCheckBoxTree.this);
			

		}
		if (level == 2) {

			nodeComp = new LimitViewerCheckBoxIconPanel(id, model,
					LimitViewerCheckBoxTree.this, this.limitViewerForm) {
				private static final long serialVersionUID = 1L;

				protected void onNodeCheckUpdated(TreeNode node,
						LimitViewerCheckBoxTree tree, AjaxRequestTarget target) {
					super.onNodeCheckUpdated(node, tree, target);
					LimitViewerCheckBoxTree.this.onNodeCheckUpdated(node, tree,
							target);
				}
			};
		}
		if (level == 3) {
			try {
				nodeComp = new InstrumentLimitViewerPanel(id, this.limitViewerForm);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return nodeComp;
	}

and then then the ExchangeNodePanel code is given below:


//Java code
public class ExchangeNodePanel extends LabelIconPanel {

	private static Logger logger =
Logger.getLogger(ExchangeNodePanel.class.getName());
	
	public ExchangeNodePanel(String id, IModel model,LimitViewerCheckBoxTree
tree) {
		super(id, model, tree);

	}
	
	@Override
	protected Component newContentComponent(String componentId, 
			BaseTree tree, IModel model){
		{

		return new Label("exchangeName");
			
		};
}

However the value of the label is not displayed and it is always empty. But
when I define the ExchangeNodePanel class as shown below it works:

public class ExchangeNodePanel extends LabelIconPanel {

	private static Logger logger =
Logger.getLogger(ExchangeNodePanel.class.getName());
	
	public ExchangeNodePanel(String id, IModel model,LimitViewerCheckBoxTree
tree) {
		super(id, model, tree);

	}
protected void addComponents(final IModel model, final BaseTree tree) {
	Component exchangeName = newContentComponent("exchangeName", tree, model);
	add(exchangeName);
}
}

Any idea why this is happening.

Thanks in advance,
vishy
-- 
View this message in context: http://www.nabble.com/Dynamically-Making-changes-to-Tree-Node-tp18765641p18814983.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


Re: Dynamically Making changes to Tree Node

Posted by vishy_sb <sh...@gmail.com>.
Thanks for that man... well I was able to get something to work from
that.....however I will give a full throttle try tomorrow...will be heading
towards the forums again incase i get any problems....

vishy


Korbinian Bachl - privat wrote:
> 
> He is a core dev - just listen to him :P
> 
> ok, simple treeNode would be:
> 
> <wicket:panel>
> 	IM A NODE
> 	<div wicket:id="content">-</div>
> </wicket:pane>
> 
> and Java:
> 
> class TreeNode extends Panel {
> 
> 	public TreeNode(String id, AnyOtherPossibleThingsYouNeed o) {
> 		
> 		if(IWantADeeperNodeFromHere) {
> 			add(new TreeNode("content"));
> 		}
> 		else {
> 			add(TheContenYouWantPanel("content"));
> 		}
> 	}
> 
> }
> 
> 
> as long as your IWantDeeperNodeFromHere is true you get a tree based 
> upon this:
> 
> IM A NODE
> <div>
> 	IM A NODE
> 	<div>
> 		IM A NODE
> 		<div>
> 		   TheContentYouWant
> 		</div>
> 	</div>
> </div>
> 
> (case of 3 Nodes you get 3 stacked divs - place whatever you like; 
> Wicket is all about OO so inheriting itself and recursive calls are no 
> problem at all.
> 
> Best,
> 
> Korbinian
> 
> vishy_sb schrieb:
>> I am sorry that I have been really bothering you here but I just need to
>> get
>> this working asap.
>> 
>> so from your reply are you suggesting that I should have a tree structure
>> like this:
>> 
>> ----Panel1
>>      ----------Panel2
>>                  ----------Panel3
>> 
>> with an HTML markup like:
>> 
>> <body>
>>      <wicket-panel>
>>          <div wicket:id="tree"></div>
>>     </wicket-panel>
>> </body>
>> 
>> But when I am going to add the components to the tree, don't you think it
>> would look for the those panels in the mark up. So how do I put the
>> panels
>> in the mark up??? Will something like this work:
>> 
>> <body>
>>      <wicket-panel>
>>          <div wicket:id="tree"></div>
>>          <div wicket:id="Panel1"></div>
>>  
>>          <div wicket:id="Panel2"></div>
>>     
>>          <div wicket:id="Panel3"></div>
>>     </wicket-panel>
>> </body>
>> 
>> 
>> vishy
>> 
>> 
>> 
>> Matej Knopp-2 wrote:
>>> You need to use panels. Every panel can have different markup. So you
>>> will have a panel for every node type.
>>>
>>> -Matej
>>>
>>> On Fri, Aug 1, 2008 at 11:03 PM, vishy_sb <sh...@gmail.com>
>>> wrote:
>>>> 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 <sh...@gmail.com>
>>>>>> 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: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>> --
>>>> 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: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamically-Making-changes-to-Tree-Node-tp18765641p18786973.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


Re: Dynamically Making changes to Tree Node

Posted by Korbinian Bachl - privat <ko...@whiskyworld.de>.
He is a core dev - just listen to him :P

ok, simple treeNode would be:

<wicket:panel>
	IM A NODE
	<div wicket:id="content">-</div>
</wicket:pane>

and Java:

class TreeNode extends Panel {

	public TreeNode(String id, AnyOtherPossibleThingsYouNeed o) {
		
		if(IWantADeeperNodeFromHere) {
			add(new TreeNode("content"));
		}
		else {
			add(TheContenYouWantPanel("content"));
		}
	}

}


as long as your IWantDeeperNodeFromHere is true you get a tree based 
upon this:

IM A NODE
<div>
	IM A NODE
	<div>
		IM A NODE
		<div>
		   TheContentYouWant
		</div>
	</div>
</div>

(case of 3 Nodes you get 3 stacked divs - place whatever you like; 
Wicket is all about OO so inheriting itself and recursive calls are no 
problem at all.

Best,

Korbinian

vishy_sb schrieb:
> I am sorry that I have been really bothering you here but I just need to get
> this working asap.
> 
> so from your reply are you suggesting that I should have a tree structure
> like this:
> 
> ----Panel1
>      ----------Panel2
>                  ----------Panel3
> 
> with an HTML markup like:
> 
> <body>
>      <wicket-panel>
>          <div wicket:id="tree"></div>
>     </wicket-panel>
> </body>
> 
> But when I am going to add the components to the tree, don't you think it
> would look for the those panels in the mark up. So how do I put the panels
> in the mark up??? Will something like this work:
> 
> <body>
>      <wicket-panel>
>          <div wicket:id="tree"></div>
>          <div wicket:id="Panel1"></div>
>  
>          <div wicket:id="Panel2"></div>
>     
>          <div wicket:id="Panel3"></div>
>     </wicket-panel>
> </body>
> 
> 
> vishy
> 
> 
> 
> Matej Knopp-2 wrote:
>> You need to use panels. Every panel can have different markup. So you
>> will have a panel for every node type.
>>
>> -Matej
>>
>> On Fri, Aug 1, 2008 at 11:03 PM, vishy_sb <sh...@gmail.com>
>> wrote:
>>> 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 <sh...@gmail.com>
>>>>> 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: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>> --
>>> 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: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
> 

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


Re: Dynamically Making changes to Tree Node

Posted by vishy_sb <sh...@gmail.com>.
I am sorry that I have been really bothering you here but I just need to get
this working asap.

so from your reply are you suggesting that I should have a tree structure
like this:

----Panel1
     ----------Panel2
                 ----------Panel3

with an HTML markup like:

<body>
     <wicket-panel>
         <div wicket:id="tree"></div>
    </wicket-panel>
</body>

But when I am going to add the components to the tree, don't you think it
would look for the those panels in the mark up. So how do I put the panels
in the mark up??? Will something like this work:

<body>
     <wicket-panel>
         <div wicket:id="tree"></div>
         <div wicket:id="Panel1"></div>
 
         <div wicket:id="Panel2"></div>
    
         <div wicket:id="Panel3"></div>
    </wicket-panel>
</body>


vishy



Matej Knopp-2 wrote:
> 
> You need to use panels. Every panel can have different markup. So you
> will have a panel for every node type.
> 
> -Matej
> 
> On Fri, Aug 1, 2008 at 11:03 PM, vishy_sb <sh...@gmail.com>
> wrote:
>>
>> 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 <sh...@gmail.com>
>>>> 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: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamically-Making-changes-to-Tree-Node-tp18765641p18783181.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


Re: Dynamically Making changes to Tree Node

Posted by vishy_sb <sh...@gmail.com>.
I am sorry that I have been really bothering you here but I just need to get
this working asap.

so from your reply are you suggesting that I should have a tree structure
like this:

----Panel1
     ----------Panel2
                 ----------Panel3

with an HTML markup like:

<body>
     <wicket-panel>
         <div wicket:id="tree"></div>
    </wicket-panel>
</body>

But when I am going to add the components to the tree, don't you think it
would look for the those panels in the mark up. So how do I put the panels
in the mark up??? Will something like this work:

<body>
     <wicket-panel>
         <div wicket:id="tree"></div>
         <div wicket:id="Panel1"></div>
 
         <div wicket:id="Panel2"></div>
    
         <div wicket:id="Panel3"></div>
    </wicket-panel>
</body>


vishy



Matej Knopp-2 wrote:
> 
> You need to use panels. Every panel can have different markup. So you
> will have a panel for every node type.
> 
> -Matej
> 
> On Fri, Aug 1, 2008 at 11:03 PM, vishy_sb <sh...@gmail.com>
> wrote:
>>
>> 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 <sh...@gmail.com>
>>>> 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: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamically-Making-changes-to-Tree-Node-tp18765641p18783175.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


Re: Dynamically Making changes to Tree Node

Posted by Matej Knopp <ma...@gmail.com>.
You need to use panels. Every panel can have different markup. So you
will have a panel for every node type.

-Matej

On Fri, Aug 1, 2008 at 11:03 PM, vishy_sb <sh...@gmail.com> wrote:
>
> 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 <sh...@gmail.com>
>>> 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: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
>
> --
> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Dynamically Making changes to Tree Node

Posted by vishy_sb <sh...@gmail.com>.
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 <sh...@gmail.com>
>> 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: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dynamically Making changes to Tree Node

Posted by vishy_sb <sh...@gmail.com>.
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 <sh...@gmail.com>
> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamically-Making-changes-to-Tree-Node-tp18765641p18766409.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


Re: Dynamically Making changes to Tree Node

Posted by Matej Knopp <ma...@gmail.com>.
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 <sh...@gmail.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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