Example usage for com.vaadin.ui GridLayout GridLayout

List of usage examples for com.vaadin.ui GridLayout GridLayout

Introduction

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

Prototype

public GridLayout(int columns, int rows) 

Source Link

Document

Constructor for a grid of given size (number of columns and rows).

Usage

From source file:com.anphat.customer.ui.ImportCustomerUploadForm.java

private void buildGridTermInfo() {
    gridTermInfo = new GridLayout(4, 3);
    CommonUtils.setBasicAttributeLayout(gridTermInfo, GRID_UPLOAD_CAPTION, true);
    gridTermInfo.setImmediate(true);/*from  www .java 2s.c o m*/
    gridTermInfo.setWidth("100%");
    gridTermInfo.setHeight("-1px");

    cboService = CommonUtils.buildComboBox("term.information.service");
    cboService.setRequired(true);
    cboService.setRequiredError(CommonMessages.messageRequire("customerStatusForm.service"));
    cboMineName = CommonUtils.buildComboBox("term.information.mineName");
    cboMineName.setRequired(true);
    tfMineName = CommonUtils.buildTextField(BundleUtils.getString("term.information.mineName"), 100);
    tfMineName.setRequired(true);
    gridTermInfo.addComponent(cboService, 2, 1);
    gridTermInfo.addComponent(cboMineName, 3, 1);
    btnAddMineName = new Button(BundleUtils.getString("button.add.mineName"));
    btnAddMineName.setIcon(new ThemeResource(Constants.ICON.ADD));
    btnAddMineName.setDisableOnClick(true);
    btnAddMineName.addStyleName("v-button-link");
    gridTermInfo.addComponent(btnAddMineName, 3, 2);

    uFileCommonInfo = new Upload();
    uFileCommonInfo.setCaption(Constants.NULL);
    uFileTermInfo = new Upload();
    uFileTermInfo.setCaption(Constants.NULL);
    uFileCommonInfo.setWidth("100%");
    uFileTermInfo.setWidth("100%");

    gridTermInfo.addComponent(uFileTermInfo, 0, 1, 1, 1);

    gridTermInfo.addComponent(uFileCommonInfo, 0, 0, 1, 0);
    gridTermInfo.setComponentAlignment(uFileCommonInfo, Alignment.MIDDLE_CENTER);
    gridTermInfo.setComponentAlignment(uFileTermInfo, Alignment.MIDDLE_CENTER);
}

From source file:com.anphat.list.ui.MapStaffCustomerDialog.java

private void buildSearchLayout() {
    searchLayout = new GridLayout(4, 3);
    CommonUtils.setBasicAttributeLayout(searchLayout, SEARCH_LAYOUT, true);
    cbxService = CommonUtils.buildComboBox(BundleUtils.getString("customerStatusForm.service"));
    cbxStatus = CommonUtils.buildComboBox(BundleUtils.getString("customerStatusForm.status"));
    dfFromStartTime = CommonUtils.buildDateField(BundleUtils.getString("term.information.fromStartTime"));
    dfToStartTime = CommonUtils.buildDateField(BundleUtils.getString("term.information.toStartTime"));
    dfFromEndTime = CommonUtils.buildDateField(BundleUtils.getString("term.information.fromEndTime"));
    dfToEndTime = CommonUtils.buildDateField(BundleUtils.getString("term.information.toEndTime"));
    dfFromDateRegister = CommonUtils.buildDateField(BundleUtils.getString("term.information.fromDateRegister"));
    dfToDateRegister = CommonUtils.buildDateField(BundleUtils.getString("term.information.toDateRegister"));
    cbxCity = CommonUtils.buildComboBox(BundleUtils.getString("label.taxAuthority"));
    cbxMaxSearch = CommonUtils.buildComboBox(BundleUtils.getString("max.search"));
    cbxMineName = CommonUtils.buildComboBox(BundleUtils.getString("customer.mineName"));
    tfMineName = CommonUtils.buildTextField(BundleUtils.getString("customer.mineName"), 100);
    cbxProvider = CommonUtils.buildComboBox(BundleUtils.getString("term.information.provider"));

    searchLayout.addComponent(cbxService, 0, 0);
    searchLayout.addComponent(cbxMineName, 1, 0);

    searchLayout.addComponent(dfFromStartTime, 0, 1);
    searchLayout.addComponent(dfToStartTime, 1, 1);
    searchLayout.addComponent(dfFromEndTime, 2, 1);
    searchLayout.addComponent(dfToEndTime, 3, 1);

    searchLayout.addComponent(dfFromDateRegister, 0, 2);
    searchLayout.addComponent(dfToDateRegister, 1, 2);

    buildComboBoxMultiProvider();//0,2
    buildComboBoxMultiCity();// 1,2        
    searchLayout.addComponent(cbxMaxSearch, 2, 2);

    mainLayout.addComponent(searchLayout);

    GridManyButton gridManyButton = new GridManyButton(new String[] { Constants.BUTTON_SEARCH,
            Constants.BUTTON_REFRESH, Constants.BUTTON_INSERT, Constants.BUTTON_SAVE });
    btnSearch = gridManyButton.getBtnCommon().get(0);
    btnReset = gridManyButton.getBtnCommon().get(1);
    btnExecute = gridManyButton.getBtnCommon().get(2);
    btnExecute.setCaption(BundleUtils.getString("staff.customer.map"));
    btnSave = gridManyButton.getBtnCommon().get(3);
    mainLayout.addComponent(gridManyButton);
}

From source file:com.anphat.statistics.ui.StatisticStaffPointUploadDialog.java

private GridLayout buildGridUpload() {
    uploadInfoLayout = new GridLayout(4, 1);
    CommonUtils.setBasicAttributeLayout(uploadInfoLayout, GRID_UPLOAD_CAPTION, true);
    uFileCommonInfo = new Upload();
    uFileCommonInfo.setCaption(Constants.NULL);
    uFileCommonInfo.setWidth("100%");

    uploadInfoLayout.addComponent(uFileCommonInfo, 0, 0, 1, 0);
    uploadInfoLayout.setComponentAlignment(uFileCommonInfo, Alignment.MIDDLE_CENTER);

    linkTemplate = new Link(LINK_CAPTION, FontAwesome.LINK);
    linkTemplate.setImmediate(true);// ww  w . j  ava  2  s  . c o  m
    File file = new File(Constants.PATH_TEMPLATE + "Thong ke diem.xlsx");
    FileDownloader downloader = new FileDownloader(file, "Thong ke diem.xlsx");
    linkTemplate.setResource(downloader);
    uploadInfoLayout.addComponent(linkTemplate, 2, 0);

    return uploadInfoLayout;
}

From source file:com.bellkenz.modules.PersonalInformation.java

public ComponentContainer personalInformation() {
    employeeInformationDAO = new EmployeeInformationDAO(getEmployeeId());
    employeePersonalInformation = new EmployeePersonalInformation();

    GridLayout glayout = new GridLayout(5, 9);
    glayout.setSpacing(true);/*from   w  w w . java  2 s. c  om*/
    glayout.setMargin(true);

    final Panel imagePanel = new Panel();
    imagePanel.setStyleName("light");
    AbstractLayout panelLayout = (AbstractLayout) imagePanel.getContent();
    panelLayout.setMargin(false);
    imagePanel.setSizeFull();

    employeeImage = new Embedded(null, new ThemeResource("../myTheme/images/ronnie.jpg"));
    employeeImage.setImmediate(true);
    employeeImage.setWidth(90, Sizeable.UNITS_PIXELS);
    employeeImage.setHeight(90, Sizeable.UNITS_PIXELS);
    employeeImage.setStyleName("logo-img");
    imagePanel.addComponent(employeeImage);
    glayout.addComponent(employeeImage, 0, 0, 0, 1);
    glayout.setComponentAlignment(imagePanel, Alignment.MIDDLE_CENTER);

    firstname = createTextField("Firstname: ");
    glayout.addComponent(firstname, 1, 0, 2, 0);

    final TextField middlename = createTextField("Middlename: ");
    glayout.addComponent(middlename, 3, 0);

    final TextField lastname = createTextField("Lastname: ");
    glayout.addComponent(lastname, 4, 0);

    final TextField houseNo = createTextField("No: ");
    houseNo.setWidth("40px");
    glayout.addComponent(houseNo, 1, 1);

    final TextField street = createTextField("Street: ");
    street.setWidth("118");
    glayout.addComponent(street, 2, 1);

    final TextField city = createTextField("City: ");
    glayout.addComponent(city, 3, 1);

    final TextField zipCode = createTextField("Zip Code:");
    glayout.addComponent(zipCode, 4, 1);

    final TextField nickname = createTextField("Nickname: ");
    nickname.setWidth("90px");
    glayout.addComponent(nickname, 0, 2);

    final TextField permanentAddress = createTextField("Permanent/Provincial Address: ");
    permanentAddress.setWidth("533px");
    glayout.addComponent(permanentAddress, 1, 2, 4, 2);

    Button uploadPicture = new Button("Upload...");
    uploadPicture.setWidth("100%");
    uploadPicture.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (employeeId == null) {
                getWindow().showNotification("You did not select and Employee!",
                        Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            Window uploadImage = new UploadImage(imagePanel, employeeImage, employeeId);
            uploadImage.setWidth("450px");
            if (uploadImage.getParent() == null) {
                getWindow().addWindow(uploadImage);
            }
            uploadImage.setModal(true);
            uploadImage.center();
        }
    });
    glayout.addComponent(uploadPicture, 0, 3);

    final TextField landline = createTextField("Landline #: ");
    glayout.addComponent(landline, 1, 3, 2, 3);

    final TextField mobileNo = createTextField("Mobile #: ");
    glayout.addComponent(mobileNo, 3, 3);

    final TextField age = createTextField("Age: ");
    glayout.addComponent(age, 4, 3);

    final TextField emailAddress = createTextField("Email Address: ");
    glayout.addComponent(emailAddress, 1, 4, 2, 4);

    final PopupDateField dob = (PopupDateField) createDateField("Date of Birth: ");
    glayout.addComponent(dob, 3, 4);

    final TextField height = createTextField("Height: ");
    glayout.addComponent(height, 4, 4);

    final ComboBox civilStatus = new ComboBox("Civil Status: ");
    civilStatus.setWidth("100%");
    dropDownBoxList.populateCivilStatusList(civilStatus);
    glayout.addComponent(civilStatus, 1, 5, 2, 5);

    final ComboBox gender = new ComboBox("Gender: ");
    gender.setWidth("100%");
    dropDownBoxList.populateGenderList(gender);
    glayout.addComponent(gender, 3, 5);

    final TextField weight = createTextField("Weigth: ");
    glayout.addComponent(weight, 4, 5);

    final TextField driversLicenseNo = createTextField("Drivers License: ");
    glayout.addComponent(driversLicenseNo, 1, 6, 2, 6);

    final TextField restrictionCode = createTextField("Restriction Code: ");
    glayout.addComponent(restrictionCode, 3, 6);

    final TextField religion = createTextField("Religion: ");
    glayout.addComponent(religion, 4, 6);

    final ComboBox division = new ComboBox("Division: ");
    division.setWidth("100%");
    dropDownBoxList.populateBranchComboBox(division);
    glayout.addComponent(division, 1, 7, 2, 7);

    final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox());
    department.setWidth("100%");
    division.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (division.getValue() == null) {
            } else {
                divisionId = branchDAO.getBranchId(division.getValue().toString());
            }
        }

    });
    glayout.addComponent(department, 3, 7);

    final TextField position = createTextField("Position: ");
    glayout.addComponent(position, 4, 7);
    //glayout.setComponentAlignment(position, Alignment.BOTTOM_LEFT);

    Button transferButton = new Button("Transfer Employee");
    transferButton.setWidth("100%");
    transferButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (getEmployeeId() == null) {
                getWindow().showNotification("You did not select an Employee!",
                        Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            Window subWindow = transferEmployee(getEmployeeId(), division, department, position);
            if (subWindow.getParent() == null) {
                getWindow().addWindow(subWindow);
            }
            subWindow.setModal(true);
            subWindow.center();
        }
    });
    glayout.addComponent(transferButton, 1, 8, 2, 8);
    glayout.setComponentAlignment(transferButton, Alignment.BOTTOM_CENTER);

    if (employeeId != null) {
        epiList = employeeInformationDAO.employeePersonalInformation();
        for (EmployeePersonalInformation epi : epiList) {
            final byte[] image = epi.getImage();
            if (image != null) {
                StreamResource.StreamSource imageSource = new StreamResource.StreamSource() {

                    @Override
                    public InputStream getStream() {
                        return new ByteArrayInputStream(image);
                    }

                };

                StreamResource imageResource = new StreamResource(imageSource, epi.getFirstname() + ".jpg",
                        getApplication());
                imageResource.setCacheTime(0);
                employeeImage.setSource(imageResource);
            }
            firstname.setValue(epi.getFirstname());
            middlename.setValue(epi.getMiddlename());
            lastname.setValue(epi.getLastname());
            houseNo.setValue(epi.getHouseNumber());

            street.setValue(epi.getStreet());
            city.setValue(epi.getStreet());
            zipCode.setValue(epi.getZipCode());
            nickname.setValue(epi.getNickname());
            permanentAddress.setValue(epi.getPermanentAddress());
            landline.setValue(epi.getLandlineNumber());
            mobileNo.setValue(epi.getMobileNumber());
            age.setValue(epi.getAge());
            emailAddress.setValue(epi.getEmailAddress());

            if (epi.getDob() != null) {
                dob.setValue(conUtil.parsingDate(epi.getDob()));
            } else {
                dob.setValue(null);
            }

            height.setValue(epi.getHeight());

            if (epi.getCivilStatus() != null) {
                Object civilStatusId = civilStatus.addItem();
                civilStatus.setItemCaption(civilStatusId, epi.getCivilStatus());
                civilStatus.setValue(civilStatusId);
            }

            if (epi.getGender() != null) {
                Object genderId = gender.addItem();
                gender.setItemCaption(genderId, epi.getGender());
                gender.setValue(genderId);
            }

            weight.setValue(epi.getWeight());
            driversLicenseNo.setValue(epi.getDriversLicense());
            restrictionCode.setValue(epi.getRestrictionCode());
            religion.setValue(epi.getReligion());
            position.setValue(epi.getPosition());

            Object divisionObjectId = division.addItem();
            division.setItemCaption(divisionObjectId, epi.getDivision());
            division.setValue(divisionObjectId);

            Object departmentObjectId = department.addItem();
            department.setItemCaption(departmentObjectId, epi.getDepartment());
            department.setValue(departmentObjectId);
        }
    }

    firstname.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            employeePersonalInformation.setFirstname(event.getProperty().getValue().toString());
        }
    });
    firstname.setImmediate(true);
    setInformation(employeePersonalInformation);

    return glayout;
}

From source file:com.cavisson.gui.dashboard.components.calender.CalendarActionsUI.java

License:Apache License

@SuppressWarnings("deprecation")
@Override/* w  ww.j a  v a  2s. c  o  m*/
protected void init(VaadinRequest request) {
    GridLayout content = new GridLayout(1, 2);
    content.setSizeFull();
    setContent(content);

    final Calendar calendar = new Calendar();
    calendar.setLocale(new Locale("fi", "FI"));

    calendar.setSizeFull();
    calendar.setStartDate(new Date(100, 1, 1));
    calendar.setEndDate(new Date(100, 2, 1));

    calendar.addActionHandler(new Action.Handler() {

        public final Action NEW_EVENT = new Action("Add event");
        public final Action EDIT_EVENT = new Action("Edit event");
        public final Action REMOVE_EVENT = new Action("Remove event");

        /*
         * (non-Javadoc)
         * 
         * @see
         * com.vaadin.event.Action.Handler#handleAction(com.vaadin.event
         * .Action, java.lang.Object, java.lang.Object)
         */
        @Override
        public void handleAction(Action action, Object sender, Object target) {
            Date date = (Date) target;
            if (action == NEW_EVENT) {
                BasicEvent event = new BasicEvent("New event", "Hello world", date, date);
                calendar.addEvent(event);
            }
        }

        /*
         * (non-Javadoc)
         * 
         * @see com.vaadin.event.Action.Handler#getActions(java.lang.Object,
         * java.lang.Object)
         */
        @Override
        public Action[] getActions(Object target, Object sender) {
            CalendarDateRange date = (CalendarDateRange) target;

            java.util.Calendar cal = java.util.Calendar.getInstance();
            cal.set(2000, 1, 1, 12, 0, 0);

            if (date.inRange(cal.getTime())) {
                return new Action[] { NEW_EVENT, };
            }

            cal.add(java.util.Calendar.DAY_OF_WEEK, 1);

            if (date.inRange(cal.getTime())) {
                return new Action[] { REMOVE_EVENT };
            }

            return null;
        }
    });

    content.addComponent(calendar);

    content.addComponent(new Button("Set week view", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            calendar.setEndDate(new Date(100, 1, 7));
        }
    }));

    content.setRowExpandRatio(0, 1);

}

From source file:com.cavisson.gui.dashboard.components.calender.HiddenFwdBackButtons.java

License:Apache License

@SuppressWarnings("deprecation")
@Override//from ww w.ja va2  s.  com
protected void init(VaadinRequest request) {
    GridLayout content = new GridLayout(1, 2);
    content.setSizeFull();
    setContent(content);

    final Calendar calendar = new Calendar();
    calendar.setLocale(new Locale("fi", "FI"));

    calendar.setSizeFull();
    calendar.setStartDate(new Date(100, 1, 1));
    calendar.setEndDate(new Date(100, 1, 7));
    content.addComponent(calendar);
    Button button = new Button("Hide forward and back buttons");
    button.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            // This should hide the forward and back navigation buttons
            calendar.setHandler((BackwardHandler) null);
            calendar.setHandler((ForwardHandler) null);
        }
    });
    content.addComponent(button);

    content.setRowExpandRatio(0, 1);

}

From source file:com.cavisson.gui.dashboard.components.calender.NotificationTestUI.java

License:Apache License

@Override
protected void init(com.vaadin.server.VaadinRequest request) {
    GridLayout content = new GridLayout(1, 2);
    content.setSizeFull();//from w w  w .  j  a  v  a 2 s.  c  o  m
    content.setRowExpandRatio(1, 1.0f);
    setContent(content);
    final Button btn = new Button("Show working notification", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Notification.show("This will disappear when you move your mouse!");
        }
    });
    content.addComponent(btn);

    provider = new DummyEventProvider();
    final Calendar cal = new Calendar(provider);
    cal.setLocale(Locale.US);
    cal.setSizeFull();
    cal.setHandler(new DateClickHandler() {
        @Override
        public void dateClick(DateClickEvent event) {
            provider.addEvent(event.getDate());
            Notification.show("This should disappear, but if wont unless clicked.");

            // this requestRepaint call interferes with the notification
            cal.markAsDirty();
        }
    });
    content.addComponent(cal);

    java.util.Calendar javaCal = java.util.Calendar.getInstance();
    javaCal.set(java.util.Calendar.YEAR, 2000);
    javaCal.set(java.util.Calendar.MONTH, 0);
    javaCal.set(java.util.Calendar.DAY_OF_MONTH, 1);
    Date start = javaCal.getTime();
    javaCal.set(java.util.Calendar.DAY_OF_MONTH, 31);
    Date end = javaCal.getTime();

    cal.setStartDate(start);
    cal.setEndDate(end);
}

From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java

License:Apache License

Panel notifications() {
    Panel p = new Panel("Notifications");
    VerticalLayout content = new VerticalLayout() {
        Notification notification = new Notification("");
        TextField title = new TextField("Title");
        TextArea description = new TextArea("Description");
        MenuBar style = new MenuBar();
        MenuBar type = new MenuBar();
        String typeString = "";
        String styleString = "";
        TextField delay = new TextField();
        {/*from   www  . j  a  va2s. co  m*/
            setSpacing(true);
            setMargin(true);

            title.setInputPrompt("Title for the notification");
            title.addValueChangeListener(new ValueChangeListener() {
                @Override
                public void valueChange(final ValueChangeEvent event) {
                    if (title.getValue() == null || title.getValue().length() == 0) {
                        notification.setCaption(null);
                    } else {
                        notification.setCaption(title.getValue());
                    }
                }
            });
            title.setValue("Notification Title");
            title.setWidth("100%");
            addComponent(title);

            description.setInputPrompt("Description for the notification");
            description.addStyleName("small");
            description.addValueChangeListener(new ValueChangeListener() {
                @Override
                public void valueChange(final ValueChangeEvent event) {
                    if (description.getValue() == null || description.getValue().length() == 0) {
                        notification.setDescription(null);
                    } else {
                        notification.setDescription(description.getValue());
                    }
                }
            });
            description.setValue(
                    "A more informative message about what has happened. Nihil hic munitissimus habendi senatus locus, nihil horum? Inmensae subtilitatis, obscuris et malesuada fames. Hi omnes lingua, institutis, legibus inter se differunt.");
            description.setWidth("100%");
            addComponent(description);

            Command typeCommand = new Command() {
                @Override
                public void menuSelected(final MenuItem selectedItem) {
                    if (selectedItem.getText().equals("Humanized")) {
                        typeString = "";
                        notification.setStyleName(styleString.trim());
                    } else {
                        typeString = selectedItem.getText().toLowerCase();
                        notification.setStyleName((typeString + " " + styleString.trim()).trim());
                    }
                    for (MenuItem item : type.getItems()) {
                        item.setChecked(false);
                    }
                    selectedItem.setChecked(true);
                }
            };

            type.setCaption("Type");
            MenuItem humanized = type.addItem("Humanized", typeCommand);
            humanized.setCheckable(true);
            humanized.setChecked(true);
            type.addItem("Tray", typeCommand).setCheckable(true);
            type.addItem("Warning", typeCommand).setCheckable(true);
            type.addItem("Error", typeCommand).setCheckable(true);
            type.addItem("System", typeCommand).setCheckable(true);
            addComponent(type);
            type.addStyleName("small");

            Command styleCommand = new Command() {
                @Override
                public void menuSelected(final MenuItem selectedItem) {
                    styleString = "";
                    for (MenuItem item : style.getItems()) {
                        if (item.isChecked()) {
                            styleString += " " + item.getText().toLowerCase();
                        }
                    }
                    if (styleString.trim().length() > 0) {
                        notification.setStyleName((typeString + " " + styleString.trim()).trim());
                    } else if (typeString.length() > 0) {
                        notification.setStyleName(typeString.trim());
                    } else {
                        notification.setStyleName(null);
                    }
                }
            };

            style.setCaption("Additional style");
            style.addItem("Dark", styleCommand).setCheckable(true);
            style.addItem("Success", styleCommand).setCheckable(true);
            style.addItem("Failure", styleCommand).setCheckable(true);
            style.addItem("Bar", styleCommand).setCheckable(true);
            style.addItem("Small", styleCommand).setCheckable(true);
            style.addItem("Closable", styleCommand).setCheckable(true);
            addComponent(style);
            style.addStyleName("small");

            CssLayout group = new CssLayout();
            group.setCaption("Fade delay");
            group.addStyleName("v-component-group");
            addComponent(group);

            delay.setInputPrompt("Infinite");
            delay.addStyleName("align-right");
            delay.addStyleName("small");
            delay.setWidth("7em");
            delay.addValueChangeListener(new ValueChangeListener() {
                @Override
                public void valueChange(final ValueChangeEvent event) {
                    try {
                        notification.setDelayMsec(Integer.parseInt(delay.getValue()));
                    } catch (Exception e) {
                        notification.setDelayMsec(-1);
                        delay.setValue("");
                    }

                }
            });
            delay.setValue("1000");
            group.addComponent(delay);

            Button clear = new Button(null, new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    delay.setValue("");
                }
            });
            clear.setIcon(FontAwesome.TIMES_CIRCLE);
            clear.addStyleName("last");
            clear.addStyleName("small");
            clear.addStyleName("icon-only");
            group.addComponent(clear);
            group.addComponent(new Label("  msec", ContentMode.HTML));

            GridLayout grid = new GridLayout(3, 3);
            grid.setCaption("Show in position");
            addComponent(grid);
            grid.setSpacing(true);

            Button pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.TOP_LEFT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.TOP_CENTER);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.TOP_RIGHT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.MIDDLE_LEFT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.MIDDLE_CENTER);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.MIDDLE_RIGHT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.BOTTOM_LEFT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.BOTTOM_CENTER);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

            pos = new Button("", new ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    notification.setPosition(Position.BOTTOM_RIGHT);
                    notification.show(Page.getCurrent());
                }
            });
            pos.addStyleName("small");
            grid.addComponent(pos);

        }
    };
    p.setContent(content);

    return p;
}

From source file:com.cerebro.provevaadin.Equipment.java

public Equipment() {
    GridLayout contentSx = new GridLayout(15, 18);
    contentSx.setId("equip_body");
    contentSx.setHeight("600px");
    contentSx.setWidth("300px");

    FileResource helmetFile = new FileResource(new File(basepath + "red.png"));
    Image helmet = new Image("Helmet", helmetFile);
    helmet.setHeight("100px");
    contentSx.addComponent(helmet, 8, 0);

    sinistra.setContent(contentSx);//from w w w  .  ja  v a 2  s  .c  o  m
    //        root.setWidth("300px");
    //        root.setHeight("600px");
    //        
    //        FileResource bodyMaleFile = new FileResource(new File(basepath + "body-male.jpg"));
    //        FileResource helmetFile = new FileResource(new File(basepath + "red.png"));
    //        
    //        Image image = new Image("MaleBody", bodyMaleFile);
    //        image.setWidth(root.getWidth(), root.getWidthUnits());
    //        Image helmet = new Image("Helmet", helmetFile);
    //        helmet.setHeight("100px");
    //        
    //        root.addComponent(image, "left: 0px; top: 0px;");
    //        root.addComponent(helmet, "left: 50%; top: 100px");
    //        
    //        sinistra.setContent(root);
    //        
    //        
    //        destra.setContent(rootDx);
    //        
    this.addComponents(sinistra, destra);
}

From source file:com.cms.component.MappingCombobox.java

public MappingCombobox(int column, int first) {
    layout = new GridLayout(column, 1);
    layout.setImmediate(true);//  w  w  w . j  a va 2s.c om
    layout.setWidth("100%");
    layout.setHeight("-1px");
    codeCombo = new ComboBox();
    nameCombo = new ComboBox();
    codeCombo.setWidth("100%");
    nameCombo.setWidth("100%");
    codeCombo.setHeight("-1px");
    nameCombo.setHeight("-1px");
    if (first >= column) {
        first = 1;
    }
    layout.addComponent(codeCombo, 0, 0, first - 1, 0);
    layout.addComponent(nameCombo, first, 0, column - 1, 0);
}