Example usage for com.vaadin.ui VerticalLayout setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

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

/**
 * Chat Pop-Up/*  ww w  . ja  v  a2 s  . co 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.save.client.promodeals.PDDataGridProperties.java

Window delete(Object itemId, int promoId) {
    Window sub = new Window("REMOVE PROMO DEAL");
    sub.setWidth("250px");
    sub.setModal(true);/* w w  w. j  a  v  a 2  s  .  c o  m*/
    sub.center();

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);

    Button delBtn = new Button("CONFIRM DELETE?", (Button.ClickEvent event) -> {
        boolean result = pds.delete(promoId, "removed");
        getContainerDataSource().removeItem(itemId);
        sub.close();
    });
    delBtn.setWidth("100%");
    delBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    delBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    v.addComponent(delBtn);

    sub.setContent(v);
    return sub;
}

From source file:com.save.employee.EmployeeInformationTabSheet.java

public EmployeeInformationTabSheet() {
    VerticalLayout v = new VerticalLayout();
    v.setCaption("Personal Information");
    v.setWidth("100%");
    v.setMargin(true);/*from   w  w w  . java 2  s.c o  m*/
    v.setSpacing(true);
    //        v.addComponent(new PersonalInformationForm(this, getEmployeeId(), null, null));
    addComponent(v);

    v = new VerticalLayout();
    v.setCaption("Employment Information");
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);
    //        v.addComponent(new EmploymentInformationForm(this, getEmployeeId()));
    addComponent(v);
}

From source file:com.save.employee.EmployeeInformationTabSheet.java

public EmployeeInformationTabSheet(HorizontalSplitPanel hsplit, int employeeId) {
    this.hsplit = hsplit;
    this.employeeId = employeeId;

    VerticalLayout v = new VerticalLayout();
    v.setCaption("Personal Information");
    v.setWidth("100%");
    v.setMargin(true);//from   www.j a  v a2 s  .  com
    v.setSpacing(true);
    v.addComponent(new PersonalInformationForm(hsplit, employeeId, null, null));
    addComponent(v);

    v = new VerticalLayout();
    v.setCaption("Employment Information");
    v.setWidth("100%");
    v.setMargin(true);
    v.setSpacing(true);
    v.addComponent(new EmploymentInformationForm(hsplit, employeeId));
    addComponent(v);
}

From source file:com.save.employee.maintenance.MRDataGridProperties.java

Window deletConfirmationWindow(int mrId, Object itemId) {
    Window sub = new Window();
    sub.setCaption("CONFIRM DELETE");
    sub.setWidth("250px");
    sub.setModal(true);//from   w w w.j  av a  2 s .  com

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);

    Button deleteBtn = new Button("DELETE?");
    deleteBtn.setWidth("100%");
    deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    deleteBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = mrs.removeMaintenanceReimbursement(mrId);
        if (result) {
            getContainerDataSource().removeItem(itemId);
            sub.close();
        }
    });
    v.addComponent(deleteBtn);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
    return sub;
}

From source file:com.save.employee.request.RequestFormWindow.java

Window deleteRequestForm() {
    Window sub = new Window("DELETE REQUEST");
    sub.setWidth("280px");
    sub.setModal(true);/* w ww .j a v  a 2  s.  c  o  m*/
    sub.center();

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);

    Button delete = new Button();
    delete.setCaption("CONFIRM DELETE REQUEST?");
    delete.setWidth("100%");
    delete.addStyleName(ValoTheme.BUTTON_PRIMARY);
    delete.addStyleName(ValoTheme.BUTTON_SMALL);
    delete.addClickListener((Button.ClickEvent event) -> {
        boolean result = rls.deleteRequestById(getRequestId());
        if (result) {
            sub.close();
            close();
        }
    });
    v.addComponent(delete);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.save.employee.request.RLDataGridProperties.java

Window deletConfirmationWindow(int rlId, Object itemId) {
    Window sub = new Window();
    sub.setCaption("CONFIRM DELETE");
    sub.setWidth("250px");
    sub.setModal(true);/*from   w ww  . j a  va  2s.c  om*/

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);

    Button deleteBtn = new Button("DELETE?");
    deleteBtn.setWidth("100%");
    deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    deleteBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = rls.deleteRequestById(rlId);
        if (result) {
            getContainerDataSource().removeItem(itemId);
            sub.close();
        }
    });
    v.addComponent(deleteBtn);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
    return sub;
}

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

License:Open Source License

/**
 * Instantiates a new error dialog./*from   w ww.jav  a 2  s  .com*/
 *
 * @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.GeneralSettings.java

License:Open Source License

/**
 * Instantiates a new general settings./*from  w  w  w.  jav a  2  s.  c o m*/
 *
 * @param settingsDialog the settings dialog
 */
GeneralSettings(SettingsDialog settingsDialog) {
    this.settingsDialog = settingsDialog;

    addStyleName("generalTab");
    setWidth("458px");
    setSpacing(false);

    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    addComponent(layout);

    final Label separator = new Label("<hr>", ContentMode.HTML);

    userObject = VaadinSession.getCurrent().getAttribute(UserObject.class);

    //layout.addComponent(backupsLayout());
    //layout.addComponent(separator);
    layout.addComponent(timeLayout());
    //layout.addComponent(separator);
    //layout.addComponent(commandsLayout());

}

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

License:Open Source License

/**
 * Time layout./*w w w  .jav a2s  .  c  o  m*/
 *
 * @return the vertical layout
 */
private VerticalLayout timeLayout() {

    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setSpacing(true);
    layout.setMargin(new MarginInfo(false, true, false, true));

    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setSpacing(true);
    layout.addComponent(titleLayout);

    final Label title = new Label("<h3>Date & Time Presentation</h3>", ContentMode.HTML);
    title.setSizeUndefined();
    titleLayout.addComponent(title);

    Embedded info = new Embedded(null, new ThemeResource("img/info.png"));
    info.addStyleName("infoButton");
    info.setDescription(
            "Determines if date & time stamps are displayed in the originally recorded format or adjusted to the local timezone.<br/>The format can be customized by using the following Java 6 SimpleDateFormat patterns:"
                    + "</blockquote>"
                    + " <table border=0 cellspacing=3 cellpadding=0 summary=\"Chart shows pattern letters, date/time component, presentation, and examples.\">\n"
                    + "     <tr bgcolor=\"#ccccff\">\n" + "         <th align=left>Letter\n"
                    + "         <th align=left>Date or Time Component\n"
                    + "         <th align=left>Presentation\n" + "         <th align=left>Examples\n"
                    + "     <tr>\n" + "         <td><code>G</code>\n" + "         <td>Era designator\n"
                    + "         <td><a href=\"#text\">Text</a>\n" + "         <td><code>AD</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>y</code>\n"
                    + "         <td>Year\n" + "         <td><a href=\"#year\">Year</a>\n"
                    + "         <td><code>1996</code>; <code>96</code>\n" + "     <tr>\n"
                    + "         <td><code>M</code>\n" + "         <td>Month in year\n"
                    + "         <td><a href=\"#month\">Month</a>\n"
                    + "         <td><code>July</code>; <code>Jul</code>; <code>07</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>w</code>\n"
                    + "         <td>Week in year\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>27</code>\n" + "     <tr>\n" + "         <td><code>W</code>\n"
                    + "         <td>Week in month\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>2</code>\n" + "     <tr bgcolor=\"#eeeeff\">\n"
                    + "         <td><code>D</code>\n" + "         <td>Day in year\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>189</code>\n"
                    + "     <tr>\n" + "         <td><code>d</code>\n" + "         <td>Day in month\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>10</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>F</code>\n"
                    + "         <td>Day of week in month\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>2</code>\n" + "     <tr>\n" + "         <td><code>E</code>\n"
                    + "         <td>Day in week\n" + "         <td><a href=\"#text\">Text</a>\n"
                    + "         <td><code>Tuesday</code>; <code>Tue</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>a</code>\n"
                    + "         <td>Am/pm marker\n" + "         <td><a href=\"#text\">Text</a>\n"
                    + "         <td><code>PM</code>\n" + "     <tr>\n" + "         <td><code>H</code>\n"
                    + "         <td>Hour in day (0-23)\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>0</code>\n" + "     <tr bgcolor=\"#eeeeff\">\n"
                    + "         <td><code>k</code>\n" + "         <td>Hour in day (1-24)\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>24</code>\n"
                    + "     <tr>\n" + "         <td><code>K</code>\n" + "         <td>Hour in am/pm (0-11)\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>0</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>h</code>\n"
                    + "         <td>Hour in am/pm (1-12)\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>12</code>\n" + "     <tr>\n" + "         <td><code>m</code>\n"
                    + "         <td>Minute in hour\n" + "         <td><a href=\"#number\">Number</a>\n"
                    + "         <td><code>30</code>\n" + "     <tr bgcolor=\"#eeeeff\">\n"
                    + "         <td><code>s</code>\n" + "         <td>Second in minute\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>55</code>\n"
                    + "     <tr>\n" + "         <td><code>S</code>\n" + "         <td>Millisecond\n"
                    + "         <td><a href=\"#number\">Number</a>\n" + "         <td><code>978</code>\n"
                    + "     <tr bgcolor=\"#eeeeff\">\n" + "         <td><code>z</code>\n"
                    + "         <td>Time zone\n" + "         <td><a href=\"#timezone\">General time zone</a>\n"
                    + "         <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>\n"
                    + "     <tr>\n" + "         <td><code>Z</code>\n" + "         <td>Time zone\n"
                    + "         <td><a href=\"#rfc822timezone\">RFC 822 time zone</a>\n"
                    + "         <td><code>-0800</code>\n" + " </table>\n" + " </blockquote>\n" + "");
    titleLayout.addComponent(info);
    titleLayout.setComponentAlignment(info, Alignment.MIDDLE_CENTER);

    final DateConversion dateConversion = VaadinSession.getCurrent().getAttribute(DateConversion.class);

    OptionGroup option = new OptionGroup("Display options");
    option.addItem(false);
    option.setItemCaption(false, "Show time in UTC/GMT");
    option.addItem(true);
    option.setItemCaption(true, "Adjust to local timezone (" + dateConversion.getClientTZname() + ")");

    String propertyTimeAdjust = userObject.getProperty(UserObject.PROPERTY_TIME_ADJUST);
    option.select(propertyTimeAdjust == null ? DEFAULT_TIME_ADJUST : Boolean.valueOf(propertyTimeAdjust));
    option.setNullSelectionAllowed(false);
    option.setHtmlContentAllowed(true);
    option.setImmediate(true);
    layout.addComponent(option);

    final HorizontalLayout defaultLayout = new HorizontalLayout();
    defaultLayout.setSpacing(true);
    layout.addComponent(defaultLayout);

    final Form form = new Form();
    form.setFooter(null);
    final TextField timeFormat = new TextField("Format");
    form.addField("timeFormat", timeFormat);
    defaultLayout.addComponent(form);

    option.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent event) {
            boolean value = (Boolean) event.getProperty().getValue();
            dateConversion.setAdjustedToLocal(value);
            userObject.setProperty(UserObject.PROPERTY_TIME_ADJUST, String.valueOf(value));
            settingsDialog.setRefresh(true);
            if (value == false) {
                timeFormat.removeAllValidators();
                timeFormat.setComponentError(null);
                form.setComponentError(null);
                form.setValidationVisible(false);
                settingsDialog.setClose(true);
            } else {
                timeFormat.addValidator(new TimeFormatValidator());
                timeFormat.setInputPrompt(DateConversion.DEFAULT_TIME_FORMAT);
                //timeFormat.setClickShortcut(KeyCode.ENTER);
            }
        }
    });

    String propertyTimeFormat = userObject.getProperty(UserObject.PROPERTY_TIME_FORMAT);
    propertyTimeFormat = (propertyTimeFormat == null ? DateConversion.DEFAULT_TIME_FORMAT
            : String.valueOf(propertyTimeFormat));

    timeFormat.setColumns(16);
    timeFormat.setValue(propertyTimeFormat);
    timeFormat.setImmediate(true);
    timeFormat.setRequired(true);
    timeFormat.setRequiredError("Format cannot be empty.");
    timeFormat.addValidator(new TimeFormatValidator());

    timeFormat.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent event) {
            String value = (String) event.getProperty().getValue();
            try {
                form.setComponentError(null);
                form.commit();
                timeFormat.setComponentError(null);
                form.setValidationVisible(false);
                dateConversion.setFormat(value);
                userObject.setProperty(UserObject.PROPERTY_TIME_FORMAT, value);
                settingsDialog.setClose(true);
                settingsDialog.setRefresh(true);
            } catch (InvalidValueException e) {
                settingsDialog.setClose(false);
                timeFormat.setComponentError(new UserError("Invalid Format (Java SimpleDateFormat)."));
                timeFormat.focus();
            }
        }
    });

    Button defaultButton = new Button("Restore Default");
    defaultLayout.addComponent(defaultButton);
    defaultLayout.setComponentAlignment(defaultButton, Alignment.MIDDLE_LEFT);
    defaultButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(Button.ClickEvent event) {
            timeFormat.setValue(DateConversion.DEFAULT_TIME_FORMAT);
        }
    });

    return layout;
}