Example usage for com.vaadin.ui CssLayout isVisible

List of usage examples for com.vaadin.ui CssLayout isVisible

Introduction

In this page you can find the example usage for com.vaadin.ui CssLayout isVisible.

Prototype

@Override
    public boolean isVisible() 

Source Link

Usage

From source file:pl.exsio.frameset.vaadin.navigation.menu.CssButtonsMenu.java

License:Open Source License

private void build(MenuItem menu, final int level, ComponentContainer container) {
    for (final MenuItem item : menu.getChildren()) {
        Button b = new NativeButton(t(item.getLabel()));
        b.addStyleName("menu-item-" + item.getFrame().getKey());
        b.setIcon(((VaadinFrame) item.getFrame()).getIcon());
        b.addClickListener(new Button.ClickListener() {
            @Override//  ww  w  . jav  a  2  s . c om
            public void buttonClick(Button.ClickEvent event) {
                ((FramesetUI) getUI()).getFramesetNavigator().navigateTo(item.getFrame());
                if (item.getChildren().size() > 0) {
                    CssLayout submenu = (CssLayout) item.getParam("submenu");
                    submenu.setVisible(!submenu.isVisible());
                }
            }
        });
        this.buttons.add(b);
        container.addComponent(b);
        item.addParam("button", b);
        item.addParam("container", container);
        if (item.getChildren().size() > 0) {
            CssLayout subContainer = new CssLayout() {
                {
                    addStyleName("sub-menu");
                    addStyleName("menu-level-" + level);
                    setVisible(false);
                }
            };

            this.build(item, level + 1, subContainer);
            container.addComponent(subContainer);

            item.addParam("submenu", subContainer);
        }
    }
}