@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
setLayout(new FlowLayout(10));
ToolBar toolBar = new ToolBar();
Button item1 = new Button("Button w/ Menu");
item1.setIcon(Resources.ICONS.menu_show());
List<Stock> list = TestData.getStocks();
final ListStore<Stock> store = new ListStore<Stock>();
store.add(list);
final ComboBox<Stock> combo = new ComboBox<Stock>();
combo.setFieldLabel("Company");
combo.setDisplayField("name");
combo.setName("name");
combo.setValueField("symbol");
combo.setForceSelection(true);
combo.setStore(store);
combo.setTriggerAction(TriggerAction.ALL);
AdapterMenuItem adapter = new AdapterMenuItem(combo);
adapter.setManageFocus(true);
adapter.setCanActivate(true);
Menu menu = new Menu();
menu.add(adapter);
CheckMenuItem menuItem = new CheckMenuItem("I Like Cats");
menuItem.setChecked(true);
menu.add(menuItem);
menuItem = new CheckMenuItem("I Like Dogs");
menu.add(menuItem);
item1.setMenu(menu);
menu.add(new SeparatorMenuItem());
MenuItem radios = new MenuItem("Radio Options");
menu.add(radios);
Menu radioMenu = new Menu();
CheckMenuItem r = new CheckMenuItem("Blue Theme");
r.setGroup("radios");
r.setChecked(true);
radioMenu.add(r);
r = new CheckMenuItem("Gray Theme");
r.setGroup("radios");
radioMenu.add(r);
radios.setSubMenu(radioMenu);
MenuItem date = new MenuItem("Choose a Date");
date.setIcon(Resources.ICONS.calendar());
menu.add(date);
date.setSubMenu(new DateMenu());
toolBar.add(item1);
toolBar.add(new SeparatorToolItem());
SplitButton splitItem = new SplitButton("Split Button");
splitItem.setIcon(Resources.ICONS.list_items());
menu = new Menu();
menu.add(new MenuItem("<b>Bold</b>"));
menu.add(new MenuItem("<i>Italic</i>"));
menu.add(new MenuItem("<u>Underline</u>"));
splitItem.setMenu(menu);
toolBar.add(splitItem);
toolBar.add(new SeparatorToolItem());
ToggleButton toggle = new ToggleButton("Toggle");
toggle.toggle(true);
toolBar.add(toggle);
toolBar.add(new SeparatorToolItem());
Button scrollerButton = new Button("Scrolling Menu");
Menu scrollMenu = new Menu();
scrollMenu.setMaxHeight(200);
for (int i = 0; i < 40; i++) {
scrollMenu.add(new MenuItem("Item " + i));
}
scrollerButton.setMenu(scrollMenu);
toolBar.add(scrollerButton);
toolBar.add(new SeparatorToolItem());
toolBar.add(new FillToolItem());
ThemeSelector selector = new ThemeSelector();
toolBar.add(selector);
ContentPanel panel = new ContentPanel();
panel.setCollapsible(true);
panel.setFrame(true);
panel.setHeading("ToolBar & Menu Demo");