Re: recursive component

2008-06-04 Thread Stefan Selariu
Thanks, I know now where I went wrong.

Best regards,
Stefan

On Wed, 2008-06-04 at 06:16 -0700, Alexis wrote:
> Here's a basic treeview component i use (The backing models contain TreeNode
> objects)
> I made it abstract so the implementors just provide the fragment or panels
> that represent nodes.
> 
> TreeView.java : 
> 
> public abstract class TreeView extends Panel {
> 
> public TreeView(String markupId, final IModel rootNodeModel) {
> super(markupId, rootNodeModel);
> add(new TreeNodeView("node", rootNodeModel));
> }
> 
> protected abstract Component newComponentForTreeNodeDescription(ListItem
> markupContainer, String markupId, TreeNode treeNode); 
> 
> protected abstract Component newComponentForTreeNodeChildren(ListItem
> markupContainer, String markupId, TreeNode treeNode);
> 
> private class TreeNodeView extends ListView {
> 
> public TreeNodeView(String markupId, final IModel treeNodeModel) {
> super(markupId, new LoadableDetachableModel() {
> protected Object load() {
> TreeNode node = (TreeNode)treeNodeModel.getObject();
> List children = node.getChildren();
> return children;
> };
> });
> }
> 
> @Override
> protected void populateItem(ListItem item) {
> TreeNode currentChild = (TreeNode)item.getModelObject();
> item.setOutputMarkupId(true);
> item.add(newComponentForTreeNodeDescription(item, "node_desc",
> currentChild));
> item.add(newComponentForTreeNodeChildren(item, "children",
> currentChild));
> }
> 
> }
> 
> }
> 
> TreeView.html :
> 
> 
>   
>   
>   
>   
>   
>   
> 
> 
> 
> 
> 
> 
> Stefan Selariu-2 wrote:
> > 
> > Hi guys!
> > 
> > I need to make generate something like this dynamically:
> > 
> >  
> >
> > 
> >   
> >    
> >  
> >
> >  # select 
> >   
> >    
> >  
> >
> > 
> >   
> >    
> >   
> > 
> >   
> > 
> >  
> >
> > 
> >   
> >    
> >   
> > 
> >   
> > 
> > 
> > This is a tree for which every node has a caption and children.
> > Can I create a wicket component for the tree node that supports my
> > example?
> > 
> > I need a component that behaves like the Loop but in a recursive way :)
> > 
> > Best regards,
> > Stefan
> > 
> > 
> > -
> > 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]



Re: recursive component

2008-06-04 Thread Stefan Selariu
I'm sorry but reading that didn't help. I was not able to find the
answer for my problem. Maybe I'm to tired.

If I do this:


 -- Loop is used here

 -- this comes from the page 
markup


 -- this comes from the page 
markup





Am I able to create pages like this?


 -- my panel
 -- caption for level1



 -- content for level1
 -- my panel
 -- caption for level2-1


 -- empty content for level2-1


 -- my panel
 -- caption for level2-2


 -- content for level2-2


...








My problem is I don't know how to connect the panel instance with the
right caption and content. Each node caption differs not in the data but
also in the layout. And this is available also for the content.

Thanks,
Stefan

On Wed, 2008-06-04 at 14:35 +0200, Martijn Dashorst wrote:
> Yes. you are wrong.
> 
> Read about Models:
> http://cwiki.apache.org/WICKET/working-with-wicket-models.html
> 
> Martijn
> 
> On Wed, Jun 4, 2008 at 2:29 PM, Stefan Selariu <[EMAIL PROTECTED]> wrote:
> > Thanks for the answers.
> >
> > The only annoying thing is that I have to create a different panel for
> > each node since the captions differ on each level. Or am I wrong?
> >
> > Stefan
> >
> > On Wed, 2008-06-04 at 14:22 +0200, Jan Kriesten wrote:
> >> hi stefan,
> >>
> >> > The think is the markup is required to be like this. The only thing I'd
> >> > like to reduce is the written java code. In short I'd like to create a
> >> > reusable node component that I can configure (with populateCaption() and
> >> > populateChildren() callback methods perhaps) just like the Loop :)
> >>
> >> martijns solution still applies - just make your own panels with the needed
> >> methods?!
> >>
> >> regards, --- jan.
> >>
> >> -
> >> 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]
> >
> >
> 
> 
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: recursive component

2008-06-04 Thread Alexis

Here's a basic treeview component i use (The backing models contain TreeNode
objects)
I made it abstract so the implementors just provide the fragment or panels
that represent nodes.

TreeView.java : 

public abstract class TreeView extends Panel {

public TreeView(String markupId, final IModel rootNodeModel) {
super(markupId, rootNodeModel);
add(new TreeNodeView("node", rootNodeModel));
}

protected abstract Component newComponentForTreeNodeDescription(ListItem
markupContainer, String markupId, TreeNode treeNode); 

protected abstract Component newComponentForTreeNodeChildren(ListItem
markupContainer, String markupId, TreeNode treeNode);

private class TreeNodeView extends ListView {

public TreeNodeView(String markupId, final IModel treeNodeModel) {
super(markupId, new LoadableDetachableModel() {
protected Object load() {
TreeNode node = (TreeNode)treeNodeModel.getObject();
List children = node.getChildren();
return children;
};
});
}

@Override
protected void populateItem(ListItem item) {
TreeNode currentChild = (TreeNode)item.getModelObject();
item.setOutputMarkupId(true);
item.add(newComponentForTreeNodeDescription(item, "node_desc",
currentChild));
item.add(newComponentForTreeNodeChildren(item, "children",
currentChild));
}

}

}

TreeView.html :














Stefan Selariu-2 wrote:
> 
> Hi guys!
> 
> I need to make generate something like this dynamically:
> 
>  
>
> 
>   
>    
>  
>
>  # select 
>   
>    
>  
>
> 
>   
>    
>   
> 
>   
> 
>  
>
> 
>   
>    
>   
> 
>   
> 
> 
> This is a tree for which every node has a caption and children.
> Can I create a wicket component for the tree node that supports my
> example?
> 
> I need a component that behaves like the Loop but in a recursive way :)
> 
> Best regards,
> Stefan
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/recursive-component-tp17645117p17646533.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]



Re: recursive component

2008-06-04 Thread Martijn Dashorst
Yes. you are wrong.

Read about Models:
http://cwiki.apache.org/WICKET/working-with-wicket-models.html

Martijn

On Wed, Jun 4, 2008 at 2:29 PM, Stefan Selariu <[EMAIL PROTECTED]> wrote:
> Thanks for the answers.
>
> The only annoying thing is that I have to create a different panel for
> each node since the captions differ on each level. Or am I wrong?
>
> Stefan
>
> On Wed, 2008-06-04 at 14:22 +0200, Jan Kriesten wrote:
>> hi stefan,
>>
>> > The think is the markup is required to be like this. The only thing I'd
>> > like to reduce is the written java code. In short I'd like to create a
>> > reusable node component that I can configure (with populateCaption() and
>> > populateChildren() callback methods perhaps) just like the Loop :)
>>
>> martijns solution still applies - just make your own panels with the needed
>> methods?!
>>
>> regards, --- jan.
>>
>> -
>> 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]
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: recursive component

2008-06-04 Thread Stefan Selariu
Thanks for the answers.

The only annoying thing is that I have to create a different panel for
each node since the captions differ on each level. Or am I wrong?

Stefan

On Wed, 2008-06-04 at 14:22 +0200, Jan Kriesten wrote:
> hi stefan,
> 
> > The think is the markup is required to be like this. The only thing I'd
> > like to reduce is the written java code. In short I'd like to create a
> > reusable node component that I can configure (with populateCaption() and
> > populateChildren() callback methods perhaps) just like the Loop :)
> 
> martijns solution still applies - just make your own panels with the needed 
> methods?!
> 
> regards, --- jan.
> 
> -
> 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]



Re: recursive component

2008-06-04 Thread Jan Kriesten


hi stefan,


The think is the markup is required to be like this. The only thing I'd
like to reduce is the written java code. In short I'd like to create a
reusable node component that I can configure (with populateCaption() and
populateChildren() callback methods perhaps) just like the Loop :)


martijns solution still applies - just make your own panels with the needed 
methods?!


regards, --- jan.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: recursive component

2008-06-04 Thread Stefan Selariu
Some corrections :)

I don't need to generate wicket markup.
The example is the desirable wicket markup that will support the
dynamical generation.
Each node component is thought as a Loop.

The think is the markup is required to be like this. The only thing I'd
like to reduce is the written java code. In short I'd like to create a
reusable node component that I can configure (with populateCaption() and
populateChildren() callback methods perhaps) just like the Loop :)

The node structure is fixed:


-- caption components --


-- children components --



I hope I was clearer this time :D

Stefan

On Wed, 2008-06-04 at 15:04 +0300, Stefan Selariu wrote:
> Hi guys!
> 
> I need to make generate something like this dynamically:
> 
>  
>
> 
>   
>    
>  
>
> select
>   
>    
>  
>
> 
>   
>    
>   
> 
>   
> 
>  
>
> 
>   
>    
>   
> 
>   
> 
> 
> This is a tree for which every node has a caption and children.
> Can I create a wicket component for the tree node that supports my
> example?
> 
> I need a component that behaves like the Loop but in a recursive way :)
> 
> Best regards,
> Stefan
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: recursive component

2008-06-04 Thread Martijn Dashorst
RecursivePanel extends Panel {
public RecursivePanel() {
if(somecondition) add(new RecursivePanel("recurse"));
else add(new EmptyPanel("recurse"));
}
}





Martijn

On Wed, Jun 4, 2008 at 2:04 PM, Stefan Selariu <[EMAIL PROTECTED]> wrote:
> Hi guys!
>
> I need to make generate something like this dynamically:
>
>  
>   
>
>  
>    
>  
>   
>select
>  
>    
>  
>   
>
>  
>   
>  
>
>  
>
>  
>   
>
>  
>    
>  
>
>  
> 
>
> This is a tree for which every node has a caption and children.
> Can I create a wicket component for the tree node that supports my
> example?
>
> I need a component that behaves like the Loop but in a recursive way :)
>
> Best regards,
> Stefan
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3


recursive component

2008-06-04 Thread Stefan Selariu
Hi guys!

I need to make generate something like this dynamically:

 
   

  
   
 
   
select
  
   
 
   

  
   
  

  

 
   

  
   
  

  


This is a tree for which every node has a caption and children.
Can I create a wicket component for the tree node that supports my
example?

I need a component that behaves like the Loop but in a recursive way :)

Best regards,
Stefan


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]