Project

General

Profile

« Previous | Next » 

Revision c850e7a9

Added by Andreas Kohlbecker over 5 years ago

attempt to create a responsive layout with menu

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/themes/valo/ValoMenuLayout.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.themes.valo;
10 10

  
11
import com.vaadin.server.FontAwesome;
12
import com.vaadin.ui.Button;
13
import com.vaadin.ui.Button.ClickEvent;
14
import com.vaadin.ui.Button.ClickListener;
11 15
import com.vaadin.ui.Component;
12 16
import com.vaadin.ui.ComponentContainer;
13 17
import com.vaadin.ui.CssLayout;
......
49 53
        menuArea.addComponent(menu);
50 54
    }
51 55

  
56
    protected void init() {
57

  
58
        final CssLayout menu = new CssLayout();
59
        Button showMenu = new Button("Menu", new ClickListener() {
60
            @Override
61
            public void buttonClick(ClickEvent event) {
62
                if (menu.getStyleName().contains("valo-menu-visible")) {
63
                    menu.removeStyleName("valo-menu-visible");
64
                } else {
65
                    menu.addStyleName("valo-menu-visible");
66
                }
67
            }
68
        });
69
        showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
70
        showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
71
        showMenu.addStyleName("valo-menu-toggle");
72
        showMenu.setIcon(FontAwesome.LIST);
73
        menu.addComponent(showMenu);
74

  
75
    }
76

  
52 77
}

Also available in: Unified diff