Example usage for com.vaadin.ui Embedded getWidth

List of usage examples for com.vaadin.ui Embedded getWidth

Introduction

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

Prototype

@Override
    public float getWidth() 

Source Link

Usage

From source file:com.klwork.explorer.ui.user.ProfilePanel.java

License:Apache License

protected void initPicture() {
    StreamResource imageresource = new StreamResource(new StreamSource() {
        private static final long serialVersionUID = 1L;

        public InputStream getStream() {
            return picture.getInputStream();
        }/*from w w  w .  j av a  2 s. c  om*/
    }, user.getId());
    imageresource.setCacheTime(0);

    Embedded picture = new Embedded(null, imageresource);
    picture.setType(Embedded.TYPE_IMAGE);
    picture.setHeight(200, UNITS_PIXELS);
    picture.setWidth(200, UNITS_PIXELS);
    picture.addStyleName(ExplorerLayout.STYLE_PROFILE_PICTURE);

    imageLayout.addComponent(picture);
    imageLayout.setWidth(picture.getWidth() + 5, picture.getWidthUnits());

    // Change picture button
    if (isCurrentLoggedInUser) {
        Upload changePictureButton = initChangePictureButton();
        imageLayout.addComponent(changePictureButton);
        imageLayout.setComponentAlignment(changePictureButton, Alignment.MIDDLE_CENTER);
    }
}

From source file:org.activiti.explorer.ui.profile.ProfilePanel.java

License:Apache License

protected void initPicture() {
    StreamResource imageresource = new StreamResource(new StreamSource() {
        private static final long serialVersionUID = 1L;

        public InputStream getStream() {
            return picture.getInputStream();
        }//w ww  .  j  a v  a  2s. c  o m
    }, user.getId(), ExplorerApp.get());
    imageresource.setCacheTime(0);

    Embedded picture = new Embedded(null, imageresource);
    picture.setType(Embedded.TYPE_IMAGE);
    picture.setHeight(200, UNITS_PIXELS);
    picture.setWidth(200, UNITS_PIXELS);
    picture.addStyleName(ExplorerLayout.STYLE_PROFILE_PICTURE);

    imageLayout.addComponent(picture);
    imageLayout.setWidth(picture.getWidth() + 5, picture.getWidthUnits());

    // Change picture button
    if (isCurrentLoggedInUser) {
        Upload changePictureButton = initChangePictureButton();
        imageLayout.addComponent(changePictureButton);
        imageLayout.setComponentAlignment(changePictureButton, Alignment.MIDDLE_CENTER);
    }
}