Example usage for com.vaadin.server Responsive makeResponsive

List of usage examples for com.vaadin.server Responsive makeResponsive

Introduction

In this page you can find the example usage for com.vaadin.server Responsive makeResponsive.

Prototype

public static void makeResponsive(Component... components) 

Source Link

Document

Enable responsive width and height range styling for the target component or UI instance.

Usage

From source file:org.opencms.ui.components.CmsAppViewLayout.java

License:Open Source License

/**
 * Constructor.<p>//from  w  w w .j a va2 s.co m
 *
 * @param appId the app id
 */
public CmsAppViewLayout(String appId) {

    m_appId = appId;
    Design.read("CmsAppView.html", this);
    Responsive.makeResponsive(this);
    // setting the width to 100% within the java code is required by the responsive resize listeners
    setWidth("100%");
    m_toolbar.init(m_appId);
}

From source file:org.vaadin.addon.twitter.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    Responsive.makeResponsive(this);
    CssLayout info = new CssLayout();
    info.setStyleName("tw-docs");
    info.addComponent(markdown.get(0));/*from  ww w .  j a  va  2  s .c o m*/

    TabSheet tabSheet = new TabSheet();
    tabSheet.setStyleName("tw-demo-tab");
    tabSheet.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS);
    tabSheet.setSizeFull();
    tabSheet.addTab(new TimelineDemo()).setCaption("Timeline");
    tabSheet.addTab(new TweetDemo()).setCaption("Single Tweet");
    tabSheet.addTab(new ButtonDemo(TweetButton.Type.Follow)).setCaption("Follow Button");
    tabSheet.addTab(new ButtonDemo(TweetButton.Type.Share)).setCaption("Share Button");
    tabSheet.addTab(new ButtonDemo(TweetButton.Type.Hashtag)).setCaption("Hashtag Button");
    tabSheet.addTab(new ButtonDemo(TweetButton.Type.Mention)).setCaption("Mention Button");
    tabSheet.addSelectedTabChangeListener(event -> {
        Component old = info.getComponent(0);
        Component newComp = markdown.get(tabSheet.getTabPosition(tabSheet.getTab(tabSheet.getSelectedTab())));
        info.replaceComponent(old, newComp);
    });
    final MHorizontalLayout layout = new MHorizontalLayout(info, tabSheet).withExpand(info, 4)
            .withExpand(tabSheet, 6).withFullWidth().withFullHeight().withMargin(false).withSpacing(true);
    setContent(new MPanel(layout).withFullWidth().withFullHeight().withStyleName(ValoTheme.PANEL_WELL,
            "root-container"));

}

From source file:org.vaadin.spring.samples.security.ui.login.views.LoginView.java

License:Apache License

private Component buildLoginForm() {
    final VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSizeUndefined();/*from  ww w  .j av a2  s.  c  om*/
    loginPanel.setSpacing(true);
    Responsive.makeResponsive(loginPanel);
    loginPanel.addStyleName("login-panel");

    loginPanel.addComponent(buildLabels());
    loginPanel.addComponent(buildFields());
    loginPanel.addComponent(rememberMe);
    return loginPanel;
}

From source file:tad.grupo7.ccamistadeslargas.LoginView.java

/**
 * Crea el formulario./*from  w w  w.j  a va2s .  c o m*/
 */
private void buildLoginForm() {
    final VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSizeUndefined();
    loginPanel.setSpacing(true);
    Responsive.makeResponsive(loginPanel);
    loginPanel.addStyleName("login-panel");

    loginPanel.addComponent(buildFields());
    addComponent(loginPanel);
    setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
}

From source file:uk.co.intec.keyDatesApp.MainUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    try {//  w  w  w . j a va 2  s .co m
        setRequest(request);

        Responsive.makeResponsive(this);

        addStyleName(ValoTheme.UI_WITH_MENU);

        getPage().setTitle("Key Dates App");

        setStyleName("main-screen");

        final VerticalLayout layout = new VerticalLayout();
        setHeader(new HeaderComponent(this));
        layout.addComponent(getHeader());
        setContent(layout);

        setBody(new VerticalLayout());
        getBody().setMargin(new MarginInfo(false, true, false, true));
        layout.addComponent(getBody());

        setUiNavigator(new Navigator(this, body));
        getUiNavigator().setErrorView(ErrorView.class);

        addNewMenuItem(HomeView.VIEW_NAME, HomeView.VIEW_LABEL, new HomeView());
        addNewMenuItem(MainView.VIEW_NAME, MainView.VIEW_LABEL, new MainView());
        addNewMenuItem(CalendarView.VIEW_NAME, CalendarView.VIEW_LABEL, new CalendarView());
        addNewMenuItem(KeyDateView.VIEW_NAME, KeyDateView.VIEW_LABEL, new KeyDateView());

        if (!GenericDatabaseUtils.doesDbExist() || "Anonymous".equals(GenericDatabaseUtils.getUserName())) {
            getUiNavigator().navigateTo(HomeView.VIEW_NAME);
        }
    } catch (final Exception e) {
        e.printStackTrace();
    }

}