Example usage for com.vaadin.ui HorizontalLayout setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

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

License:Open Source License

/**
 * Removes the user./*  w w w.ja  v a2s.co m*/
 *
 * @param event the event
 */
public void removeUser(Button.ClickEvent event) {
    secondaryDialog = new ModalWindow("Delete User", null);
    UI.getCurrent().addWindow(secondaryDialog);
    secondaryDialog.addCloseListener(this);

    final VerticalLayout formContainer = new VerticalLayout();
    formContainer.setMargin(new MarginInfo(true, true, false, true));
    formContainer.setSpacing(false);

    final Form form = new Form();
    formContainer.addComponent(form);
    form.setFooter(null);
    form.setDescription("Delete user " + userInfo.completeNamesByID(selectedUserID) + " from the system");

    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("Cancel");
    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) {
            form.discard();
            secondaryDialog.close();
        }
    });

    Button okButton = new Button("Delete User");
    okButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            try {
                form.setComponentError(null);
                form.commit();
                boolean success = userInfo.deleteUser(selectedUserID);
                if (success) {
                    select.removeItem(selectedUserID);
                } else {
                    return;
                }
            } catch (EmptyValueException e) {
                return;
            } catch (Exception e) {
                ManagerUI.error(e.getMessage());
                return;
            }
            secondaryDialog.close();
        }
    });
    buttonsBar.addComponent(okButton);
    buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT);

    VerticalLayout windowLayout = (VerticalLayout) secondaryDialog.getContent();
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);
    windowLayout.addComponent(formContainer);
    windowLayout.addComponent(buttonsBar);

}

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

License:Open Source License

/**
 * Instantiates a new warning window./*from w  w w.  j  a v a2s  .c  o  m*/
 *
 * @param caption the caption
 * @param message the message
 * @param label the label
 * @param okListener the ok listener
 */
public WarningWindow(String caption, String message, String label, Button.ClickListener okListener) {
    super(caption, "60%");

    HorizontalLayout wrapper = new HorizontalLayout();
    wrapper.setWidth("100%");
    wrapper.setMargin(true);
    VerticalLayout iconLayout = new VerticalLayout();
    iconLayout.setWidth("100px");
    wrapper.addComponent(iconLayout);
    Embedded image = new Embedded(null, new ThemeResource("img/warning.png"));
    iconLayout.addComponent(image);
    VerticalLayout textLayout = new VerticalLayout();
    textLayout.setSizeFull();
    wrapper.addComponent(textLayout);
    wrapper.setExpandRatio(textLayout, 1.0f);

    Label msgLabel = new Label(message);
    msgLabel.addStyleName("warning");
    textLayout.addComponent(msgLabel);
    textLayout.setComponentAlignment(msgLabel, Alignment.MIDDLE_CENTER);

    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("Cancel");
    buttonsBar.addComponent(cancelButton);
    buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT);

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

        public void buttonClick(Button.ClickEvent event) {
            warningWindow.close();
        }
    });

    Button okButton = new Button(label);
    okButton.addClickListener(okListener);
    buttonsBar.addComponent(okButton);
    buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT);

    VerticalLayout windowLayout = (VerticalLayout) this.getContent();
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);
    windowLayout.addComponent(wrapper);
    windowLayout.addComponent(buttonsBar);

}

From source file:com.snowy.Chat.java

public Chat(int id, data d) {

    this.d = d;//  w ww  .  j  a  v  a 2 s .c  om
    this.id = id;
    tf.setSizeFull();
    //ts = d.getCurrentSqlTimestamp();
    //Logger.getLogger(Chat.class).info(ts.toString());
    //tA.setValue("hello\n");
    lastMessageId = d.lastMessageIdFromCurrent(id);
    HorizontalLayout fl = new HorizontalLayout();
    fl.addComponent(tf);
    Button b = new Button("Send");
    fl.addComponent(b);
    tf.setSizeFull();
    fl.setExpandRatio(tf, 1);
    b.addClickListener(e -> {
        if (tf.getValue().length() != 0) {

            d.sendMessage(id, (tf.getValue().length() < 200 ? tf.getValue() : tf.getValue().substring(0, 199)));

            tf.clear();
        }

    });
    /*tf.addTextChangeListener(e->{
    Logger.getLogger(Chat.class).info(e.getText().charAt(e.getText().length()-1)+"");
    if(e.getText().charAt(e.getText().length()-1)==10){
        b.click();
    }
            
    });*/
    tf.addFocusListener(new FocusListener() {
        @Override
        public void focus(final FocusEvent event) {
            b.setClickShortcut(KeyCode.ENTER);
        }

    });
    tf.addBlurListener(new BlurListener() {
        @Override
        public void blur(final BlurEvent event) {
            b.removeClickShortcut();
        }
    });
    fl.setSizeFull();
    fl.setHeightUndefined();
    tA.setSizeFull();
    //tA.setReadOnly(true);
    tf.setHeightUndefined();
    tA.setWordwrap(true);
    tA.setImmediate(true);

    this.addComponent(tA);
    this.addComponent(fl);
    this.setExpandRatio(tA, 2);
    tA.setReadOnly(true);

    //this.setExpandRatio(fl, 0);
    this.setSizeFull();
}

From source file:com.snowy.PostLoginView.java

@PostConstruct
void init() {//from   w  ww .  java 2s  .co m
    //Logger.getLogger(PostLoginView.class.getName()).info(d);
    d = ((MyVaadinUI) UI.getCurrent()).getDataObject();
    //Logger.getLogger(PostLoginView.class.getName()).info(d);
    g = new GameWindow(d);
    c = new ChatWindow(d);
    HorizontalLayout hl = new HorizontalLayout();
    setMargin(true);
    /*this.getUI().addPollListener(new UIEvents.PollListener(){
    @Override
    public void poll(UIEvents.PollEvent event) {
        c.getUsersList().retrieveActiveUsers();
    }
            
    });*/

    this.setSizeFull();
    Button b = new Button("Logout");
    b.addClickListener(e -> {

        d.logout(VaadinSession.getCurrent().getCsrfToken());
        VaadinSession.getCurrent().close();

        Page.getCurrent().setLocation("/");
    });
    Button ccc = new Button("Unpause polling");
    ccc.setEnabled(false);
    Button cc = new Button("Pause polling");
    cc.addClickListener(e -> {
        if (ccc.isEnabled() == false) {
            UI.getCurrent().setPollInterval(1000000000);
            cc.setEnabled(false);
            ccc.setEnabled(true);
        }
    });
    ccc.addClickListener(e -> {
        if (cc.isEnabled() == false) {
            UI.getCurrent().setPollInterval(1000);
            cc.setEnabled(true);
            ccc.setEnabled(false);
        }
    });
    hl.setSizeFull();
    hl.setSpacing(true);
    //whdjwandjawd
    //this.addComponent(cc);
    //this.addComponent(ccc);
    this.addComponent(b);

    //this.setHeightUndefined();
    this.setSpacing(true);
    this.setComponentAlignment(b, Alignment.TOP_RIGHT);
    //this.addComponent(c);
    //this.addComponent(ul);
    hl.addComponent(g);

    hl.addComponent(c);

    //this.addComponent(c);
    hl.setExpandRatio(c, 1);
    hl.setExpandRatio(g, 3);
    g.setSizeFull();
    c.setSizeFull();
    this.addComponent(hl);
    //this.setExpandRatio(g, 2);
    this.setExpandRatio(hl, 1);
}

From source file:com.squadd.UI.ConfirmRegistrationLayout.java

private void centerAligningComponent(HorizontalLayout where, Component what) {
    where.setSizeFull();
    where.setComponentAlignment(what, Alignment.TOP_CENTER);
}

From source file:com.squadd.UI.LoginUI.java

private void buildLayout(Button first) {
    HorizontalLayout usernameLayout = new HorizontalLayout(username);
    usernameLayout.setSizeFull();
    usernameLayout.setComponentAlignment(username, Alignment.TOP_CENTER);
    HorizontalLayout passwordLayout = new HorizontalLayout(password);
    passwordLayout.setSizeFull();/*from ww w.j av  a  2s  .  c om*/
    passwordLayout.setComponentAlignment(password, Alignment.TOP_CENTER);

    actions.setSizeFull();
    actions.setComponentAlignment(first, Alignment.TOP_RIGHT);
    actions.setSpacing(true);

    if (!isModal) {
        addComponent(header);
        for (int i = 0; i < 3; ++i) {
            HorizontalLayout curr = new HorizontalLayout();
            curr.setSizeFull();
            addComponents(curr);
        }
    }

    addComponents(usernameLayout, passwordLayout, actions);
}

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

private void configureActionsLayout(HorizontalLayout layout) {
    layout.setSizeFull();
    layout.setSpacing(true);//www. jav  a  2 s.  c o  m
    layout.setComponentAlignment(back, Alignment.TOP_RIGHT);
}

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. java 2 s . c om*/
    //
    // 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.swifta.mats.web.usermanagement.AddUserModule.java

public VerticalLayout aumModifier(HorizontalLayout contentC) {
    contentC.removeAllComponents();//from   w w  w  .j  a va2s .co m
    VerticalLayout uf = getAddUserForm();
    contentC.addComponent(uf);
    contentC.setComponentAlignment(uf, Alignment.MIDDLE_CENTER);
    contentC.setSpacing(false);
    contentC.setMargin(true);
    contentC.setSizeFull();
    return uf;
}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private HorizontalLayout getAccLog() {
    HorizontalLayout c = new HorizontalLayout();
    c.setSizeFull();
    Label lb = new Label("No Data Available!");
    c.addComponent(lb);//from w w  w  . j a va  2  s . c  o m
    c.setMargin(true);
    c.setComponentAlignment(lb, Alignment.MIDDLE_CENTER);
    return c;
}