Example usage for com.vaadin.ui HorizontalLayout setHeight

List of usage examples for com.vaadin.ui HorizontalLayout setHeight

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setHeight.

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

From source file:nl.amc.biolab.nsg.display.VaadinTestApplication.java

License:Open Source License

@Override
public void onRequestStart(PortletRequest request, PortletResponse response) {
    this.portletSession = request.getPortletSession();

    //        final Object phase = request.getAttribute("javax.portlet.lifecycle_phase");

    //        logger.debug("Lifecycle phase is: " + phase);

    if (getUser() == null) {
        logger.debug("User is null, so checking theme display.");

        PermissionChecker permissionChecker = null;
        ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

        if (themeDisplay != null) {
            permissionChecker = themeDisplay.getPermissionChecker();
        }//  www .j a va  2 s.c  om

        if (permissionChecker == null || !permissionChecker.isSignedIn()) {
            setUser(null);

            return;
        }

        setUser(themeDisplay.getUser());
    }

    //        logger.debug("Setting the URL and page.");

    if (PortalUtil.getCurrentURL(request).contains(PROJECTS_URL)) {
        this.page = PROJECTS;
    } else if (PortalUtil.getCurrentURL(request).contains(DATA_URL)) {
        this.page = DATA;
    } else if (PortalUtil.getCurrentURL(request).contains(PROCESSING_URL)) {
        this.page = PROCESSING;
    }

    if (getUser() != null && getUserDataService() != null) {
        if (!(PortalUtil.getCurrentURL(request).contains(PROJECTS_URL)
                || PortalUtil.getCurrentURL(request).contains(DATA_URL)
                || PortalUtil.getCurrentURL(request).contains(PROCESSING_URL))) {
            return;
        }

        try {
            if (portletSession.getAttribute(SESS_PROJECT, PortletSession.APPLICATION_SCOPE) != null) {
                final Long projectId = (Long) portletSession.getAttribute(SESS_PROJECT,
                        PortletSession.APPLICATION_SCOPE);
                getUserDataService().setProjectDbId(projectId);
                //                    logger.debug("Selected Project is: " + projectId);
            }

            if (portletSession.getAttribute(SESS_PROCESSING, PortletSession.APPLICATION_SCOPE) != null) {
                getUserDataService().setProcessingDbId(
                        (Long) portletSession.getAttribute(SESS_PROCESSING, PortletSession.APPLICATION_SCOPE));
                //                    logger.debug("Processing session is read.");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        if (PortalUtil.getCurrentURL(request).contains("wsver") && mainControl != null) {
            try {
                if (getPage() == DATA && (this.getUserDataService().getUserId() == 0L
                        || getUserDataService().getProjectDbId() != null)) {
                    this.getUserDataService().xnatLogin();
                }

                mainControl.update();
            } catch (RuntimeException e) {
                if (e == null || e.getMessage() == null
                        || !(e.getMessage().equals("No Password.") || e.getMessage().equals("Wrong Password.")
                                || e.getMessage().equals("No User login."))) {
                    HorizontalLayout layout = new HorizontalLayout();

                    Label label = new Label(
                            "Server error. Please sign out and sign in again, and if the problem persists, contact the administrator.");

                    layout.setWidth("100%");
                    layout.setHeight("300px");
                    layout.removeAllComponents();
                    layout.addComponent(label);

                    getMainWindow().removeAllComponents();
                    getMainWindow().addComponent(layout);

                    e.printStackTrace();

                    return;
                } else if (e.getMessage().equals("No Password.") || e.getMessage().equals("Wrong Password.")) {
                    HorizontalLayout layout = new HorizontalLayout();

                    layout.removeAllComponents();

                    LoginUI loginUI = new LoginUI(mainControl);

                    loginUI.addListener(new Component.Listener() {
                        private static final long serialVersionUID = -2775815874196476965L;

                        @Override
                        public void componentEvent(Component.Event event) { // login failed
                            mainControl.init((nl.amc.biolab.datamodel.objects.User) ((Button) event.getSource())
                                    .getData());
                        }
                    });

                    layout.addComponent(new LoginUI(mainControl));

                    getMainWindow().removeAllComponents();
                    getMainWindow().showNotification("Your XNAT password was not recognized.");
                    getMainWindow().addComponent(layout);
                } else if (e.getMessage().equals("No User login.")) { //nsgdm api not returning this message?
                    getMainWindow().showNotification("No User login.");

                    HorizontalLayout layout = new HorizontalLayout();

                    Label label = new Label("Loading page.");

                    layout.setWidth("100%");
                    layout.setHeight("300px");
                    layout.addComponent(label);

                    label = new Label("Please contact the administrator for XNAT user setup");

                    layout.removeAllComponents();
                    layout.addComponent(label);

                    getMainWindow().removeAllComponents();
                    getMainWindow().addComponent(layout);

                    return;
                }
            }
        }
    }
}

From source file:nl.kpmg.lcm.ui.view.administration.AuthorizedLcmPanel.java

License:Apache License

public AuthorizedLcmPanel(RestClientService restClientService) {
    this.restClientService = restClientService;

    HorizontalLayout menubar = initMenubar(restClientService);

    HorizontalLayout dataLayout = initDataLayout();

    VerticalLayout rootVerticalLayout = new VerticalLayout();
    rootVerticalLayout.addComponent(menubar);
    rootVerticalLayout.addComponent(dataLayout);
    rootVerticalLayout.setHeight("100%");

    HorizontalLayout root = new HorizontalLayout();
    root.addComponent(rootVerticalLayout);
    root.setSpacing(true);//from  w w  w .  j a va2 s  .co  m
    root.setMargin(true);
    root.setWidth("100%");
    root.setHeight("100%");
    root.setExpandRatio(rootVerticalLayout, 1f);

    setCompositionRoot(root);
}

From source file:nl.kpmg.lcm.ui.view.administration.RemoteLcmPanel.java

License:Apache License

public RemoteLcmPanel(RestClientService restClientService) {
    this.restClientService = restClientService;

    VerticalLayout rootVerticalLayout = new VerticalLayout();

    HorizontalLayout menubar = initMenuBar(restClientService);
    rootVerticalLayout.addComponent(menubar);

    HorizontalLayout dataLayout = initDataLayout();
    rootVerticalLayout.addComponent(dataLayout);
    rootVerticalLayout.setHeight("100%");

    HorizontalLayout root = new HorizontalLayout();
    root.addComponent(rootVerticalLayout);
    root.setSpacing(true);//from w  w  w.  ja va 2s  . c o  m
    root.setMargin(true);
    root.setWidth("100%");
    root.setHeight("100%");
    root.setExpandRatio(rootVerticalLayout, 1f);

    setCompositionRoot(root);
}

From source file:nl.kpmg.lcm.ui.view.administration.StoragePanel.java

License:Apache License

public StoragePanel(RestClientService restClientService) {
    this.restClientService = restClientService;

    HorizontalLayout menubar = initMenubar(restClientService);

    HorizontalLayout dataLayout = initDataLayout();

    VerticalLayout rootVerticalLayout = new VerticalLayout();
    rootVerticalLayout.addComponent(menubar);
    rootVerticalLayout.addComponent(dataLayout);
    rootVerticalLayout.setHeight("100%");

    HorizontalLayout root = new HorizontalLayout();
    root.addComponent(rootVerticalLayout);
    root.setSpacing(true);/* w ww .java  2  s  .c om*/
    root.setMargin(true);
    root.setWidth("100%");
    root.setHeight("100%");
    root.setExpandRatio(rootVerticalLayout, 1f);

    setCompositionRoot(root);
}

From source file:nl.kpmg.lcm.ui.view.administration.UserGroupPanel.java

License:Apache License

public UserGroupPanel(RestClientService restClientService) {
    this.restClientService = restClientService;

    HorizontalLayout menubar = initMenubar(restClientService);

    HorizontalLayout dataLayout = initDataLayout();

    VerticalLayout rootVerticalLayout = new VerticalLayout();
    rootVerticalLayout.addComponent(menubar);
    rootVerticalLayout.addComponent(dataLayout);
    rootVerticalLayout.setHeight("100%");

    HorizontalLayout root = new HorizontalLayout();
    root.addComponent(rootVerticalLayout);
    root.setSpacing(true);/*from w  w w . java  2s . c  o m*/
    root.setMargin(true);
    root.setWidth("100%");
    root.setHeight("100%");
    root.setExpandRatio(rootVerticalLayout, 1f);

    setCompositionRoot(root);
}

From source file:nl.kpmg.lcm.ui.view.administration.UserPanel.java

License:Apache License

public UserPanel(RestClientService restClientService) {
    this.restClientService = restClientService;

    HorizontalLayout menubar = initMenubar(restClientService);

    HorizontalLayout dataLayout = initDataLayout();

    VerticalLayout rootVerticalLayout = new VerticalLayout();
    rootVerticalLayout.addComponent(menubar);
    rootVerticalLayout.addComponent(dataLayout);
    rootVerticalLayout.setHeight("100%");

    HorizontalLayout root = new HorizontalLayout();
    root.addComponent(rootVerticalLayout);
    root.setSpacing(true);//w  ww . j a v  a2 s .com
    root.setMargin(true);
    root.setWidth("100%");
    root.setHeight("100%");
    root.setExpandRatio(rootVerticalLayout, 1f);

    setCompositionRoot(root);
}

From source file:nl.kpmg.lcm.ui.view.transfer.MonitorPanel.java

License:Apache License

public MonitorPanel(RestClientService restClientService) {
    this.restClientService = restClientService;

    HorizontalLayout searchlayout = initSearchLayout(restClientService);
    HorizontalLayout dataLayout = initDataLayout();

    VerticalLayout rootVerticalLayout = new VerticalLayout();
    rootVerticalLayout.addComponent(searchlayout);
    rootVerticalLayout.addComponent(dataLayout);

    HorizontalLayout root = new HorizontalLayout();
    root.addComponent(rootVerticalLayout);
    root.setSpacing(true);//  w w  w.j a  va 2  s .com
    root.setMargin(true);
    root.setWidth("100%");
    root.setHeight("100%");
    root.setExpandRatio(rootVerticalLayout, 1f);

    setCompositionRoot(root);

    reloadTasks("", ALL_KEY);
    taskStatusComboBox.select(ALL_KEY);
}

From source file:nl.kpmg.lcm.ui.view.transfer.SchedulePanel.java

License:Apache License

public SchedulePanel(RestClientService restClientService) {
    this.restClientService = restClientService;

    HorizontalLayout searchlayout = initSearchLayout(restClientService);
    HorizontalLayout dataLayout = initDataLayout();

    VerticalLayout rootVerticalLayout = new VerticalLayout();
    rootVerticalLayout.addComponent(searchlayout);
    rootVerticalLayout.addComponent(dataLayout);

    HorizontalLayout root = new HorizontalLayout();
    root.addComponent(rootVerticalLayout);
    root.setSpacing(true);/*from  www .j ava  2s  . co m*/
    root.setMargin(true);
    root.setWidth("100%");
    root.setHeight("100%");
    root.setExpandRatio(rootVerticalLayout, 1f);

    setCompositionRoot(root);
}

From source file:no.uib.probe.mnpc_2017.view.ApplicationLayout.java

public ApplicationLayout() {
    this.setWidth("100%");
    this.setHeightUndefined();
    //        this.setStyleName(Reindeer.LAYOUT_WHITE);
    this.setMargin(false);
    this.setSpacing(true);

    VerticalLayout headerLayout = new VerticalLayout();
    headerLayout.setWidth("100%");
    headerLayout.setHeight("77px");
    this.addComponent(headerLayout);

    Panel mainBodyPanel = new Panel();
    //        headerLayout.setStyleName(Reindeer.LAYOUT_BLUE);

    HorizontalLayout topLayoutContainer = new HorizontalLayout();
    headerLayout.addComponent(topLayoutContainer);
    headerLayout.setComponentAlignment(topLayoutContainer, Alignment.MIDDLE_CENTER);
    topLayoutContainer.setWidthUndefined();
    topLayoutContainer.setHeight("100%");

    VerticalLayout logoLayout = new VerticalLayout();
    logoLayout.setWidth("200px");
    logoLayout.setHeight("100%");
    logoLayout.setStyleName("starlogo");
    logoLayout.setMargin(new MarginInfo(false, true, false, false));

    Label title = new Label("NPC 2017");
    logoLayout.addComponent(title);//  ww w. j a  v  a2 s.  c om

    topLayoutContainer.addComponent(logoLayout);
    topLayoutContainer.setComponentAlignment(logoLayout, Alignment.MIDDLE_RIGHT);

    HorizontalLayout mainMenuContainer = new HorizontalLayout();
    mainMenuContainer.setWidth("780px");
    topLayoutContainer.addComponent(mainMenuContainer);
    topLayoutContainer.setComponentAlignment(mainMenuContainer, Alignment.MIDDLE_RIGHT);

    VerticalLayout layoutI = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Home", layoutI));

    VerticalLayout layoutII = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Programme", layoutII));

    VerticalLayout layoutIII = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Practical Information", layoutIII));

    VerticalLayout layoutIV = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Exhibition & Sponsorship", layoutIV));

    VerticalLayout layoutV = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Registration", layoutV));

    VerticalLayout layoutVI = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Contact", layoutVI));

}

From source file:org.accelerators.activiti.admin.ui.LoginView.java

License:Open Source License

@SuppressWarnings("serial")
public LoginView(AdminApp application) {

    // Set application reference
    this.app = application;

    // Init window caption
    app.getMainWindow().setCaption(app.getMessage(Messages.Title));

    // Set layout to full size
    setSizeFull();/*  ww w  .j  a  va 2s . co  m*/

    // Set style
    this.setStyleName("login-background");

    // Add header bar
    final HorizontalLayout header = new HorizontalLayout();
    header.setHeight("50px");
    header.setWidth("100%");
    addComponent(header);
    setComponentAlignment(header, Alignment.MIDDLE_CENTER);

    // Setup grid
    GridLayout loginGrid = new GridLayout(1, 2);
    loginGrid.setWidth("250px");
    addComponent(loginGrid);
    setComponentAlignment(loginGrid, Alignment.MIDDLE_CENTER);

    // Add title to header
    GridLayout logoGrid = new GridLayout(1, 1);
    loginGrid.addComponent(logoGrid, 0, 0);
    loginGrid.setComponentAlignment(logoGrid, Alignment.MIDDLE_CENTER);

    Embedded logoImage = new Embedded(null, new ThemeResource("img/login-logo.png"));
    logoImage.setType(Embedded.TYPE_IMAGE);
    logoImage.addStyleName("login-image");
    logoGrid.addComponent(logoImage, 0, 0);
    logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER);

    // Add field and button layout
    VerticalLayout buttonLayout = new VerticalLayout();
    buttonLayout.setSizeFull();
    buttonLayout.setSpacing(true);
    buttonLayout.setMargin(false);
    buttonLayout.setStyleName("login-form");
    loginGrid.addComponent(buttonLayout, 0, 1);
    loginGrid.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    // Add username field
    username = new TextField(app.getMessage(Messages.Username));
    username.setWidth("100%");
    buttonLayout.addComponent(username);

    // Add password field
    password = new PasswordField(app.getMessage(Messages.Password));
    password.setWidth("100%");
    buttonLayout.addComponent(password);

    // Add Login button
    buttonLayout.addComponent(login);
    buttonLayout.setComponentAlignment(login, Alignment.BOTTOM_RIGHT);

    // Set focus to this component
    username.focus();

    // Add shortcut to login button
    login.setClickShortcut(KeyCode.ENTER);

    login.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            try {

                // Athenticate the user
                authenticate((String) username.getValue(), (String) password.getValue());

                // Switch to the main view
                app.getViewManager().switchScreen(MainView.class.getName(), new MainView(app));

            } catch (Exception e) {
                getWindow().showNotification(e.toString());
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setHeight("50px");
    footer.setWidth("100%");
    addComponent(footer);

}