n.setPosition(Position.BOTTOM_CENTER);
n.setDelayMsec(300000);
n.show(Page.getCurrent());
// grid of compoents
GridLayout gl = new GridLayout(4, 5);
gl.setSpacing(true);
layout.addComponent(gl);
// Basic components, caption icon only
Class<?>[] components = { Button.class, CheckBox.class,
DateField.class, NativeButton.class, Link.class, Label.class,
Panel.class, Slider.class, TextArea.class, TextField.class,
Upload.class };
for (Class<?> clazz : components) {
Component c;
try {
c = (Component) clazz.newInstance();
} catch (Exception e) {
e.printStackTrace();
continue;
}
c.setCaption(clazz.getSimpleName());
c.setIcon(icon);
gl.addComponent(c);
}
// TabSheet, caption + tab icons
TabSheet tabs = new TabSheet();
tabs.setCaption("TabSheet");
tabs.setIcon(icon);
tabs.addStyleName("myTabs");
tabs.addTab(new Label("Content 1"), "Tab 1", icon);
tabs.addTab(new Label("Content 2"), "Tab 2", icon);
tabs.setWidth("150px");
gl.addComponent(tabs);
// Accordion, caption + tab icons
Accordion acc = new Accordion();
acc.setCaption("Accordion");
acc.setIcon(icon);
acc.addTab(new Label(), "Section 1", icon);
acc.addTab(new Label(), "Section 2", icon);
gl.addComponent(acc);
// Table, caption + column + row + action icons
Table tbl = new Table("Table");
tbl.setRowHeaderMode(RowHeaderMode.ICON_ONLY);
tbl.setIcon(icon);
tbl.addContainerProperty("Column 1", String.class, "Row", "Column 1",
icon, Align.LEFT);
tbl.addContainerProperty("Column 2", String.class, "Row", "Column 2",
icon, Align.LEFT);
tbl.setItemIcon(tbl.addItem(), icon);
tbl.setItemIcon(tbl.addItem(), icon);
tbl.setItemIcon(tbl.addItem(), icon);
tbl.setPageLength(3);
gl.addComponent(tbl);
tbl.addActionHandler(actionHandler);
// Selects, caption + item icons
Class<?>[] selects = { ComboBox.class, NativeSelect.class,
ListSelect.class, TwinColSelect.class, OptionGroup.class };
for (Class<?> clazz : selects) {
AbstractSelect sel;
try {
sel = (AbstractSelect) clazz.newInstance();
} catch (Exception e) {
e.printStackTrace();
continue;
}
sel.setCaption(clazz.getSimpleName());
sel.setIcon(icon);
sel.addItem("One");
sel.setItemIcon("One", icon);
sel.addItem("Two");
sel.setItemIcon("Two", icon);
gl.addComponent(sel);
}
// MenuBar, caption + item + sub-item icons
MenuBar menu = new MenuBar();
menu.setIcon(icon);
menu.setCaption("MenuBar");
MenuItem mi = menu.addItem("File", icon, null);
MenuItem smi = mi.addItem("Item", icon, null);
smi = mi.addItem("Item", icon, null);
smi = smi.addItem("Item", icon, null);
gl.addComponent(menu);
// Tree, caption + item + subitem + action icons
Tree tree = new Tree("Tree");
tree.addItem("Root");
tree.setItemIcon("Root", icon);
tree.addItem("Leaf");
tree.setItemIcon("Leaf", icon);
tree.setParent("Leaf", "Root");
tree.expandItemsRecursively("Root");
tree.addActionHandler(actionHandler);
gl.addComponent(tree);
// All of FontAwesome
String allIcons = "";
for (FontIcon ic : FontAwesome.values()) {
allIcons += ic.getHtml() + " ";