Example usage for com.vaadin.ui VerticalLayout setHeight

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

Introduction

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

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

From source file:com.oodrive.nuage.webui.VvrManagerUi.java

License:Apache License

/**
 * Initialize VVRs representation./*from   ww w  . ja va  2 s .  c  o m*/
 * 
 * @param jmxHandler
 */
private final void initVvrManagerUi(final JmxHandler jmxHandler) {

    // Create Model for vvrManager
    vvrManagerModel = jmxHandler.createVvrManagerModel();

    // Vvr representation
    vvrsTabsheet = new TabSheet();
    vvrManagerLayout.addComponent(vvrsTabsheet);

    // Sheet 0 create new VVR
    final VerticalLayout lastLayout = new VerticalLayout();
    lastLayout.setWidth("100%");
    lastLayout.setHeight(lastLayoutHeight);
    vvrsTabsheet.addTab(lastLayout, "+");

    // Add a sheet for each vvr
    final Set<UUID> vvrUuidList = vvrManagerModel.getVvrs();
    for (final UUID vvrUuid : vvrUuidList) {
        addVvr(vvrUuid);
    }

    // Window to create a new vvr (display on the last tabsheet)
    final VvrCreateWindow createWindow = new VvrCreateWindow(new PostProcessing() {
        @Override
        public void execute() {
            // After creation select the first tab
            vvrsTabsheet.setSelectedTab(0);
        }
    });

    vvrsTabsheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(final SelectedTabChangeEvent event) {
            final TabSheet tabsheet = event.getTabSheet();
            final String caption = tabsheet.getTab(tabsheet.getSelectedTab()).getCaption();

            if (caption.equals("+")) {
                createWindow.add(vvrManagerModel);
            } else {
                // Remove window if another tab is selected
                createWindow.remove();
            }
        }
    });

    // If no other tab, display creation window (+ tab can not be selected)
    if (vvrUuidList.isEmpty()) {
        createWindow.add(vvrManagerModel);
    }
}

From source file:com.saax.gestorweb.view.ChatView.java

/**
 * Chat Pop-Up//  w  w  w  . j a v  a 2s  .  c o  m
 *
 */
public ChatView() {
    super();

    setCaption(messages.getString("ChatView.titulo"));
    setModal(true);
    setWidth("80%");
    setHeight("80%");
    setResizable(false);

    VerticalLayout container = new VerticalLayout();
    container.setMargin(true);
    container.setWidth("100%");
    container.setHeight("100%");
    setContent(container);

    userLogged = (Usuario) GestorSession.getAttribute(SessionAttributesEnum.USUARIO_LOGADO);

    HorizontalLayout hlayout = new HorizontalLayout();

    // Have a horizontal split panel as its content
    hsplit = new HorizontalSplitPanel();
    hsplit.setSizeFull();
    // Put a component in the left panel
    hsplit.setFirstComponent(containerUserTable());
    hsplit.getFirstComponent().setWidth("100%");

    // A static variable so that everybody gets the same instance.

    //accordion
    container.addComponent(hsplit);
    accordion = new Accordion();
    accordion.setWidth("100%");
    accordion.addTab(buildAttachTable(), "Anexos", null);
    container.addComponent(accordion);
    //container.addComponent(buildAttachTable());

}

From source file:com.skysql.manager.ui.ErrorDialog.java

License:Open Source License

/**
 * Instantiates a new error dialog./*  www . j a v  a2  s . co  m*/
 *
 * @param e the exception
 * @param humanizedError the humanized error
 */
public ErrorDialog(Exception e, String humanizedError) {

    if (e != null) {
        ManagerUI.error(e.getMessage());
    }

    dialogWindow = new ModalWindow("An Error has occurred", "775px");
    dialogWindow.setHeight("340px");
    dialogWindow.addCloseListener(this);
    UI current = UI.getCurrent();
    if (current.getContent() == null) {
        current.setContent(new ErrorView(Notification.Type.ERROR_MESSAGE, null));
    }
    current.addWindow(dialogWindow);

    HorizontalLayout wrapper = new HorizontalLayout();
    wrapper.setSizeFull();
    wrapper.setMargin(true);

    VerticalLayout iconLayout = new VerticalLayout();
    iconLayout.setWidth("100px");
    wrapper.addComponent(iconLayout);
    Embedded image = new Embedded(null, new ThemeResource("img/error.png"));
    iconLayout.addComponent(image);

    VerticalLayout textLayout = new VerticalLayout();
    textLayout.setHeight("100%");
    textLayout.setSpacing(true);
    wrapper.addComponent(textLayout);
    wrapper.setExpandRatio(textLayout, 1.0f);

    if (humanizedError != null || e != null) {
        String error = (humanizedError != null) ? humanizedError : e.toString();
        ManagerUI.error(error);
        Label label = new Label(error, ContentMode.HTML);
        label.addStyleName("warning");
        textLayout.addComponent(label);
        textLayout.setComponentAlignment(label, Alignment.TOP_CENTER);
    }

    if (e != null) {
        TextArea stackTrace = new TextArea("Error Log");
        stackTrace.setSizeFull();
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        stackTrace.setValue(sw.toString());
        textLayout.addComponent(stackTrace);
        textLayout.setComponentAlignment(stackTrace, Alignment.TOP_LEFT);
        textLayout.setExpandRatio(stackTrace, 1.0f);
    }

    HorizontalLayout buttonsBar = new HorizontalLayout();
    buttonsBar.setStyleName("buttonsBar");
    buttonsBar.setSizeFull();
    buttonsBar.setSpacing(true);
    buttonsBar.setMargin(true);
    buttonsBar.setHeight("49px");

    Label filler = new Label();
    buttonsBar.addComponent(filler);
    buttonsBar.setExpandRatio(filler, 1.0f);

    Button cancelButton = new Button("Close");
    buttonsBar.addComponent(cancelButton);
    buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT);

    cancelButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            dialogWindow.close();
            //UI.getCurrent().close();
        }
    });

    Button okButton = new Button("Send Error");
    okButton.setEnabled(false);
    okButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            dialogWindow.close();
        }
    });
    buttonsBar.addComponent(okButton);
    buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT);

    VerticalLayout windowLayout = (VerticalLayout) dialogWindow.getContent();
    windowLayout.setHeight("100%");
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);
    windowLayout.addComponent(wrapper);
    windowLayout.setExpandRatio(wrapper, 1.0f);
    windowLayout.addComponent(buttonsBar);

}

From source file:com.skysql.manager.ui.LoginView.java

License:Open Source License

/**
 * Instantiates a new login view./*from  w  ww . ja  v a 2 s  .com*/
 *
 * @param aboutRecord the about record
 */
public LoginView() {

    setSizeFull();
    setMargin(true);
    setSpacing(true);
    addStyleName("loginView");

    VerticalLayout logoLayout = new VerticalLayout();
    addComponent(logoLayout);
    setComponentAlignment(logoLayout, Alignment.BOTTOM_CENTER);
    setExpandRatio(logoLayout, 1.0f);

    Embedded logo = new Embedded(null, new ThemeResource("img/loginlogo.png"));
    logoLayout.addComponent(logo);
    logoLayout.setComponentAlignment(logo, Alignment.BOTTOM_CENTER);

    Label releaseInfo = new Label("Version " + ManagerUI.GUI_RELEASE);
    releaseInfo.setSizeUndefined();
    releaseInfo.addStyleName("releaseInfo");
    logoLayout.addComponent(releaseInfo);
    logoLayout.setComponentAlignment(releaseInfo, Alignment.TOP_CENTER);

    VerticalLayout spacer = new VerticalLayout();
    spacer.setHeight("20px");
    logoLayout.addComponent(spacer);

    VerticalLayout loginBox = new VerticalLayout();
    loginBox.addStyleName("loginBox");
    loginBox.setSizeUndefined();
    loginBox.setMargin(true);
    loginBox.setSpacing(true);
    addComponent(loginBox);
    setComponentAlignment(loginBox, Alignment.MIDDLE_CENTER);

    VerticalLayout loginFormLayout = new VerticalLayout();
    loginFormLayout.addStyleName("loginForm");
    loginFormLayout.setMargin(true);
    loginFormLayout.setSpacing(true);
    loginBox.addComponent(loginFormLayout);

    // userName.focus();
    userName.setStyleName("loginControl");
    userName.setInputPrompt("Username");
    userName.setImmediate(true);
    userName.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            password.focus();
            login.setClickShortcut(KeyCode.ENTER);
        }
    });
    loginFormLayout.addComponent(userName);
    loginFormLayout.setComponentAlignment(userName, Alignment.MIDDLE_CENTER);

    // spacer
    loginFormLayout.addComponent(new Label(""));

    password.setStyleName("loginControl");
    password.setInputPrompt("Password");
    password.setImmediate(true);
    password.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            login.focus();
        }
    });
    loginFormLayout.addComponent(password);
    loginFormLayout.setComponentAlignment(password, Alignment.MIDDLE_CENTER);

    // spacer
    loginFormLayout.addComponent(new Label(" "));

    login.setStyleName("loginControl");
    login.setEnabled(false);

    loginFormLayout.addComponent(login);
    loginFormLayout.setComponentAlignment(login, Alignment.BOTTOM_CENTER);

    VerticalLayout filler = new VerticalLayout();
    addComponent(filler);
    setExpandRatio(filler, 1.0f);

    preload();

}

From source file:com.squadd.views.ChatView.java

private void buildLayout() {

    VerticalLayout chatAndFooter = new VerticalLayout();
    chatAndFooter.setHeight("90%");
    VerticalLayout contacts = new VerticalLayout();
    contacts.setSizeFull();/*from  ww  w  .  ja  v a  2 s. c o m*/
    contactsPanel.setHeight("800px");
    contactsPanel.setWidth("300px");
    contactsPanel.setContent(contactsLayout);
    contacts.addComponent(contactsPanel);
    contacts.setHeight("90%");

    TextField idTo = new TextField("idTo");
    idTo.setWidth("200px");
    Button setIdTo = new Button("set");
    setIdTo.setWidth("100px");
    HorizontalLayout setUserToId = new HorizontalLayout();

    Button.ClickListener st = new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (!idTo.getValue().equals("")) {
                UserInfoBean newUserTo = new UserInfoBean();
                newUserTo.setId(Integer.parseInt(idTo.getValue()));
                newUserTo.setName("id" + idTo.getValue());
                control.setUserTo(newUserTo);
                if (footer.isVisible() == false) {
                    footer.setVisible(true);
                }
                UserInfoFace look = new UserInfoFace(newUserTo, control, footer);
                Panel panel = look.getUserPanel();

                boolean exists = false;
                for (int i = 0; i < contactsLayout.getComponentCount(); i++) {
                    if (contactsLayout.getComponent(i).getClass() == Panel.class) {
                        Panel pan = (Panel) contactsLayout.getComponent(i);
                        if ((!(pan.getId() == null)) && pan.getId().equals(idTo.getValue())) {
                            exists = true;
                        }
                    }
                }
                if (exists == false) {
                    contactsLayout.addComponent(panel);
                }
                control.clearChat();
                control.updateChatLog(10);
            }
            idTo.clear();
        }
    };

    setIdTo.addClickListener(st);
    setUserToId.addComponents(idTo, setIdTo);
    setUserToId.setComponentAlignment(setIdTo, Alignment.BOTTOM_CENTER);
    contacts.addComponent(setUserToId);
    mainLayout.addComponents(contacts);
    footer.setVisible(false);/////////
    chatAndFooter.addComponents(chatPanel, footer);
    chatLayout = new VerticalLayout();
    chatPanel.setHeight("750px");
    chatPanel.setWidth("900px");
    chatPanel.setContent(chatLayout);
    chatInput = new TextField();
    chatInput.setWidthUndefined();
    footer.addComponent(chatInput);
    chatInput.focus();
    send.setWidth("120px");
    footer.addComponent(send);
    clear.setWidth("120px");
    footer.addComponent(clear);
    update.setWidth("120px");
    footer.addComponent(update);
    footer.setHeight("50px");
    footer.setWidth("900px");
    chatInput.setWidth("100%");
    footer.setExpandRatio(chatInput, 1f);
    chatAndFooter.setExpandRatio(chatPanel, 1f);
    mainLayout.addComponents(chatAndFooter);
    mainLayout.setExpandRatio(chatAndFooter, 1f);
    control.loadFriends();
}

From source file:com.studiodojo.qwikinvoice.QwikInvoiceApplication.java

License:Apache License

@Override
public void init() {
    this.mainWindow = new Window(
            "QwikInvoice CRM Tools - Developed by StudioDojo. Engineered by Vaadin. Powered by Google.");
    setMainWindow(mainWindow);//from w w w  .j ava 2 s.com
    //
    // Check if a user is logged in
    //
    UserService us = UserServiceFactory.getUserService();
    this.logoutURL = us.createLogoutURL(super.getURL().toExternalForm());
    if (us.getCurrentUser() == null || us.getCurrentUser().getEmail() == null) {
        super.setLogoutURL(logoutURL);
        super.close();
        return;
    }
    String login = us.getCurrentUser().getEmail();
    this.userKey = KeyFactory.createKey(TokenBean.class.getSimpleName(), us.getCurrentUser().getEmail());
    //
    Key ucKey = KeyFactory.createKey(UserCompanyBean.class.getSimpleName(), us.getCurrentUser().getEmail());
    UserCompanyBean ucBean = UserDAO.getUserCompanyBean(us.getCurrentUser().getEmail());

    this.theSession = new SessionBean(login, ucBean);
    //
    // SETUP WORKING AREA
    //
    HorizontalLayout appLayout = new HorizontalLayout();
    appLayout.setSizeFull();
    // The Main Layout
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setWidth(APP_WIDTH);
    mainLayout.setHeight(APP_HEIGHT);
    appLayout.addComponent(mainLayout);
    appLayout.setComponentAlignment(mainLayout, Alignment.TOP_CENTER);
    appLayout.setExpandRatio(mainLayout, 2);
    //
    // Setup Header (Welcome Message)
    //
    Label welcome = new Label(
            "<h1>QWIK!NVOICE</h1> You are " + (us.isUserLoggedIn() ? "logged in" : "logged out") + " as <b>"
                    + us.getCurrentUser().getNickname() + "</b>",
            Label.CONTENT_XHTML);
    mainLayout.addComponent(welcome);
    mainLayout.setComponentAlignment(welcome, Alignment.TOP_LEFT);
    //
    // Menu Bar
    //
    MenuBar menuBar = new MenuBar();
    menuBar.setWidth(APP_WIDTH);
    MenuBar.MenuItem fileMenuItem = menuBar.addItem("File", null, null);
    MenuItem newMenuItem = fileMenuItem.addItem("New...", null, null);
    newMenuItem.addItem("Invoice/Quote", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(InvoiceApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading panel", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });
    newMenuItem.addItem("Order", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(FFOrderApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading panel", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });
    /** SAVE */
    fileMenuItem.addItem("Save", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                TokenBean userTokenBean = TokenStore.getToken(QwikInvoiceApplication.this.userKey);
                // User must have an OAuth AUTH Token to access Google Doc service
                if (userTokenBean != null) {
                    /*
                    GDocFileWindow saveWindow = new GDocFileWindow("Save As...");
                    saveWindow.init(QwikInvoiceApplication.this, PdfWriter.getFilename(QwikInvoiceApplication.this.theSession));
                    QwikInvoiceApplication.this.mainWindow.addWindow(saveWindow);
                    */
                    QwikInvoiceApplication.this.activePanel.validate();
                    QwikInvoiceApplication.this.activePanel.onSave();
                } else {
                    AuthSubWindow authsubWindow = new AuthSubWindow("Service Authorization Required");
                    authsubWindow.init(QwikInvoiceApplication.this.userKey);
                    QwikInvoiceApplication.this.mainWindow.addWindow(authsubWindow);
                }
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error Saving file", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    /**
     * SETTINGS
     */
    fileMenuItem.addSeparator();
    MenuItem settingsMenuItem = fileMenuItem.addItem("Settings...", null, null);
    settingsMenuItem.addItem("Profile", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                UserCompanySetupWindow aWindow = new UserCompanySetupWindow();
                aWindow.init(QwikInvoiceApplication.this);
                QwikInvoiceApplication.this.mainWindow.addWindow(aWindow);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error Saving Profile", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    fileMenuItem.addSeparator();

    fileMenuItem.addItem("Logout", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            QwikInvoiceApplication.this.setLogoutURL(logoutURL);
            QwikInvoiceApplication.this.close();

        }
    });
    /**
     * Products
     */
    MenuBar.MenuItem productsMenuItem = menuBar.addItem("Products", null, null);
    productsMenuItem.addItem("Products", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(ProductApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading products", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    productsMenuItem.addItem("Categories", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                ProductCategorySettingsWindow window = new ProductCategorySettingsWindow();
                window.setCaption("Product Category");
                window.init(QwikInvoiceApplication.this.theSession, QwikInvoiceApplication.this);
                QwikInvoiceApplication.this.mainWindow.addWindow(window);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error Loading Products", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    productsMenuItem.addItem("Catalogs", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(CatalogApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading catalogs", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    /**
     * Help
     */
    MenuBar.MenuItem helpMenuItem = menuBar.addItem("Help", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            AboutWindow aboutWindow = new AboutWindow();
            aboutWindow.init();
            QwikInvoiceApplication.this.mainWindow.addWindow(aboutWindow);
        }
    });
    helpMenuItem.addItem("About...", null, null);
    mainLayout.addComponent(menuBar);
    mainLayout.setComponentAlignment(menuBar, Alignment.TOP_CENTER);
    //
    // Load Main Panel
    //
    IApplicationPanel invoiceApplicationPanel = (IApplicationPanel) this.map.get(InvoiceApplicationPanel.class);
    try {
        invoiceApplicationPanel.init(this.theSession, this);
        mainLayout.addComponent((Component) invoiceApplicationPanel);
        mainLayout.setComponentAlignment((Component) invoiceApplicationPanel, Alignment.TOP_CENTER);
        this.activePanel = invoiceApplicationPanel;
    } catch (Exception e) {
    }
    //
    // Setup Footer
    //
    //Label footerMessage = new Label("QwikInvoice <b>version "+_VERSION_+"</b>. This service is provided as is. E&O accepted. Developed by <a href='mailto:public@studiodojo.com?subject=QwikInvoice' target='_blank'>StudioDojo</a>. Engineered by Vaadin. Powered by Google. Apache License 2.0", Label.CONTENT_XHTML);
    //mainLayout.addComponent(footerMessage);
    //mainLayout.setComponentAlignment(footerMessage, Alignment.TOP_CENTER);
    Panel mainPanel = new Panel();
    mainPanel.setScrollable(true);
    mainPanel.setContent(appLayout);
    this.mainWindow.setContent(mainPanel);
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoadingView.java

public LoadingView() {
    setSizeFull();/*from  www .  ja  va  2 s  .c o m*/
    VerticalLayout center = new VerticalLayout();
    this.addComponent(center);
    this.setComponentAlignment(center, Alignment.MIDDLE_CENTER);

    center.setHeight("180px");
    HorizontalLayout info = new HorizontalLayout();

    Label title = new Label("PFServer Dashboard");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H4);
    title.addStyleName(ValoTheme.LABEL_COLORED);
    // center.addComponent(title);
    // center.setComponentAlignment(title, Alignment.BOTTOM_CENTER);
    Label loading = new Label("Initalizing");
    loading.addStyleName(ValoTheme.LABEL_H1);
    loading.addStyleName(ValoTheme.LABEL_LIGHT);
    info.addComponent(loading);
    info.addComponent(title);
    info.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);

    center.addComponent(info);
    info.setComponentAlignment(loading, Alignment.MIDDLE_LEFT);
    loading.setWidth("160px");

    center.setComponentAlignment(info, Alignment.MIDDLE_CENTER);
    // center.addComponent(loading);
    // center.setComponentAlignment(loading, Alignment.TOP_CENTER);
    ProgressBar indeterminate = new ProgressBar();
    indeterminate.setIndeterminate(true);
    center.addComponent(indeterminate);
    center.setComponentAlignment(indeterminate, Alignment.TOP_CENTER);

}

From source file:de.fatalix.bookery.view.common.SuggestLaneLayout.java

License:Open Source License

private VerticalLayout createBookCoverLayout(final BookEntry bookEntry) {
    Image image = new Image();
    image.setDescription(bookEntry.getTitle() + " von " + bookEntry.getAuthor());
    image.setHeight("200px");
    image.setWidth("130px");
    image.setImmediate(true);//w  ww .j ava 2  s  . c  o m
    if (bookEntry.getThumbnail() != null) {
        StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getThumbnail());
        image.setSource(new StreamResource(source, bookEntry.getId() + "_thumb.png"));
    } else if (bookEntry.getCover() != null) {
        StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getCover());
        image.setSource(new StreamResource(source, bookEntry.getId() + ".png"));
    }

    VerticalLayout result = new VerticalLayout(image);
    result.setHeight("210px");
    result.addStyleName("pointer-cursor");
    result.addStyleName("book-cover");
    result.setComponentAlignment(image, Alignment.MIDDLE_CENTER);

    result.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            bookDetailLayout.loadData(bookEntry);
            bookDetailLayout.setLayoutVisible(true);
        }
    });
    return result;
}

From source file:de.fatalix.bookery.view.common.SuggestLaneLayout.java

License:Open Source License

private VerticalLayout createEmptyDummy() {
    Label label = new Label("hab nix gfundn");
    label.addStyleName(ValoTheme.LABEL_H2);
    label.addStyleName(ValoTheme.LABEL_COLORED);
    label.setSizeUndefined();//from   ww w . jav a  2 s . c  om
    VerticalLayout dummyLayout = new VerticalLayout(label);
    dummyLayout.setHeight("150px");
    dummyLayout.setWidth("800px");
    dummyLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
    return dummyLayout;
}

From source file:de.fzi.fhemapi.view.vaadin.ui.DeviceDetailsPanel.java

License:Apache License

@AutoGenerated
private VerticalLayout buildMainLayout() {
    // common part: create layout
    VerticalLayout layout = new VerticalLayout();
    layout.setImmediate(false);//from   w w w  .jav  a 2  s.  c om
    layout.setWidth("100.0%");
    layout.setHeight("-1");
    layout.setMargin(false);

    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setImmediate(false);
    titleLayout.setWidth("-1");
    titleLayout.setHeight("50");
    titleLayout.setMargin(false);
    layout.addComponent(titleLayout);
    layout.setComponentAlignment(titleLayout, Alignment.TOP_CENTER);

    // deviceTitle
    deviceTitle = new TextField();
    deviceTitle.setImmediate(true);
    deviceTitle.setWidth("100%");
    deviceTitle.setHeight("-1px");
    deviceTitle.setValue(device.getName());
    deviceTitle.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (((String) event.getProperty().getValue()).length() > 1) {
                device.rename((String) event.getProperty().getValue());
                parent.reloadTree();
            }
        }
    });
    titleLayout.addComponent(deviceTitle);
    titleLayout.setComponentAlignment(deviceTitle, Alignment.TOP_CENTER);

    ComboBox combobox = new ComboBox();
    String[] classes = DeviceFactory.getAvailableDevicetypes();
    for (String name : classes) {
        combobox.addItem(name);
    }
    combobox.select(device.getClass().getSimpleName());
    combobox.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            setDeviceType((String) event.getProperty().getValue());
        }
    });
    combobox.setImmediate(true);

    deviceTypeHoriLayout = UIHelper.buildAttributePanel("Device Type", combobox);
    layout.addComponent(deviceTypeHoriLayout);
    layout.setComponentAlignment(deviceTypeHoriLayout, Alignment.TOP_CENTER);
    layout.setExpandRatio(deviceTypeHoriLayout, 1);

    ioDevHoriLayout = buildAttributePanel("IO Device", device.getType());
    layout.addComponent(ioDevHoriLayout);
    layout.setComponentAlignment(ioDevHoriLayout, Alignment.TOP_CENTER);
    layout.setExpandRatio(ioDevHoriLayout, 1);

    addDeviceDetails(DevicePanelManager.getDeviceDetails(device, this), layout);

    return layout;
}