1 package org.starobjects.wicket.ui.components.widgets.cssmenu;
2
3 import java.util.List;
4
5 import org.apache.wicket.markup.html.WebMarkupContainer;
6 import org.apache.wicket.markup.repeater.RepeatingView;
7 import org.apache.wicket.model.util.ListModel;
8
9
10
11
12 public class CssSubMenuItemsPanel extends CssMenuItemPanelAbstract<CssSubMenuItemsPanel.MyModel> {
13
14 private static final long serialVersionUID = 1L;
15
16 static class MyModel extends ListModel<CssMenuItem>{
17
18 private static final long serialVersionUID = 1L;
19
20 public MyModel(List<CssMenuItem> cssMenuItems) {
21 super(cssMenuItems);
22 }
23 }
24
25
26 public CssSubMenuItemsPanel(String id, List<CssMenuItem> subMenuItems) {
27 super(id, new MyModel(subMenuItems));
28 setRenderBodyOnly(true);
29
30 RepeatingView menuItemRv = new RepeatingView(getId());
31 add(menuItemRv);
32 for (CssMenuItem cssMenuItem : getModel().getObject()) {
33 WebMarkupContainer menuItemMarkup = new WebMarkupContainer(menuItemRv.newChildId());
34 menuItemRv.add(menuItemMarkup);
35
36 addSubMenuItems(menuItemMarkup, cssMenuItem);
37 }
38 }
39
40 }