Example usage for com.vaadin.ui Image setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:com.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidgetOld.java

public UserDetailsWidgetOld() {

    setSpacing(true);//from   w w  w  .jav a2 s . c om
    Panel iPanel = new Panel();
    iPanel.setWidth("50px");
    iPanel.setHeight("50px");
    iPanel.setStyleName("backColorWhite");
    addComponent(iPanel);
    String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();

    // Image as a file resource
    FileResource resource = new FileResource(new File(basepath + "/VAADIN/themes/mytheme/img/loginPage.jpg"));

    // Show the image in the application
    Image image = new Image("", resource);
    image.setSizeFull();
    iPanel.setContent(image);

}

From source file:com.uib.onlinepeptideshaker.presenter.view.SmallSideBtn.java

public SmallSideBtn(String iconUrl) {
    Image icon = new Image();
    icon.setSource(new ThemeResource(iconUrl));
    icon.setSizeFull();
    SmallSideBtn.this.addComponent(icon);
    SmallSideBtn.this.setSizeFull();
    SmallSideBtn.this.setStyleName("smallmenubtn");
}

From source file:edu.kit.dama.ui.commons.util.UIUtils7.java

License:Apache License

public static void openResourceSubWindow(File sourceFile) {
    boolean fileAccessible = sourceFile != null && sourceFile.exists() && sourceFile.canRead();

    // Set subwindow for displaying file resource
    final Window window = new Window(fileAccessible ? sourceFile.getName() : "Information");
    window.center();/*from  w ww  .ja  v a  2  s .  c  o m*/
    // Set window layout
    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setSizeFull();

    if (fileAccessible) {
        // Set resource that has to be embedded
        final Embedded resource = new Embedded(null, new FileResource(sourceFile));
        if ("application/octet-stream".equals(resource.getMimeType())) {
            window.setWidth("570px");
            window.setHeight("150px");
            windowLayout.setMargin(true);

            Label attentionNote = new Label(
                    "A file preview is not possible as the file type is not supported by your browser.");
            attentionNote.setContentMode(ContentMode.HTML);
            Link fileURL = new Link("Click here for downloading the file.", new FileResource(sourceFile));

            windowLayout.addComponent(attentionNote);
            windowLayout.addComponent(fileURL);
            windowLayout.setComponentAlignment(attentionNote, Alignment.MIDDLE_CENTER);
            windowLayout.setComponentAlignment(fileURL, Alignment.MIDDLE_CENTER);
        } else {
            window.setResizable(true);
            window.setWidth("800px");
            window.setHeight("500px");
            final Image image = new Image(null, new FileResource(sourceFile));
            image.setSizeFull();
            windowLayout.addComponent(image);
        }
    } else {
        //file is not accessible
        window.setWidth("570px");
        window.setHeight("150px");
        windowLayout.setMargin(true);
        Label attentionNote = new Label("Provided file cannot be accessed.");
        attentionNote.setContentMode(ContentMode.HTML);
        windowLayout.addComponent(attentionNote);
        windowLayout.setComponentAlignment(attentionNote, Alignment.MIDDLE_CENTER);
    }

    window.setContent(windowLayout);
    UI.getCurrent().addWindow(window);
}

From source file:lifetime.component.LifetimeBackground.java

License:Apache License

public LifetimeBackground(String language, Image image) {
    this.language = language;
    this.image = image;
    setSizeFull();/*w w  w .  j  a  v a 2 s  .  co  m*/
    image.setSizeFull();
    addComponents(image);
}

From source file:me.uni.emuseo.view.common.helpers.ImagePreviewWindow.java

License:Open Source License

public ImagePreviewWindow(String url) {
    setSizeUndefined();//from w  ww  .j  a va 2  s .c  om
    setWidth(400, Unit.PIXELS);
    setHeight(360, Unit.PIXELS);
    windowLayout = new VerticalLayout();

    if (url != null) {
        Image image = new Image();
        image.setSource(new ExternalResource(url));
        image.setSizeFull();
        windowLayout.addComponent(image);
    }

    // buildButtons();
    // windowLayout.addComponent(buttonLayout);
    setContent(windowLayout);
    setModal(true);
}

From source file:org.opennms.features.vaadin.dashboard.dashlets.ChartsDashlet.java

License:Open Source License

@Override
public DashletComponent getWallboardComponent() {
    if (m_dashletComponent == null) {
        m_dashletComponent = new AbstractDashletComponent() {
            private VerticalLayout m_verticalLayout = new VerticalLayout();

            {//  w w w . j a  v  a  2  s .c  o  m
                m_verticalLayout.setCaption(getName());
                m_verticalLayout.setSizeFull();
            }

            @Override
            public void refresh() {
                String newImage = "/opennms/charts?chart-name=" + getDashletSpec().getParameters().get("chart");

                String maximizeHeightString = getDashletSpec().getParameters().get("maximizeHeight");
                String maximizeWidthString = getDashletSpec().getParameters().get("maximizeWidth");

                boolean maximizeHeight = ("true".equals(maximizeHeightString)
                        || "yes".equals(maximizeHeightString) || "1".equals(maximizeHeightString));
                boolean maximizeWidth = ("true".equals(maximizeWidthString) || "yes".equals(maximizeWidthString)
                        || "1".equals(maximizeWidthString));

                if (!newImage.equals(m_imageUrl)) {
                    m_imageUrl = newImage;
                    m_verticalLayout.removeAllComponents();
                    Image image = new Image(null, new ExternalResource(m_imageUrl));
                    if (maximizeHeight && maximizeWidth) {
                        image.setSizeFull();
                    } else {
                        if (maximizeHeight) {
                            image.setHeight(100, Sizeable.Unit.PERCENTAGE);
                        }
                        if (maximizeWidth) {
                            image.setWidth(100, Sizeable.Unit.PERCENTAGE);
                        }
                    }
                    m_verticalLayout.addComponent(image);
                    m_verticalLayout.setComponentAlignment(image, Alignment.MIDDLE_CENTER);
                }
            }

            @Override
            public Component getComponent() {
                return m_verticalLayout;
            }
        };
    }

    return m_dashletComponent;
}

From source file:org.opennms.features.vaadin.dashboard.dashlets.ImageDashlet.java

License:Open Source License

@Override
public DashletComponent getWallboardComponent() {
    if (m_dashletComponent == null) {
        m_dashletComponent = new AbstractDashletComponent() {
            private VerticalLayout m_verticalLayout = new VerticalLayout();

            {//  w w w  .j  a  v  a 2 s.c  o m
                m_verticalLayout.setCaption(getName());
                m_verticalLayout.setSizeFull();
            }

            @Override
            public void refresh() {
                String newImage = getDashletSpec().getParameters().get("imageUrl");

                String maximizeHeightString = getDashletSpec().getParameters().get("maximizeHeight");
                String maximizeWidthString = getDashletSpec().getParameters().get("maximizeWidth");

                boolean maximizeHeight = ("true".equals(maximizeHeightString)
                        || "yes".equals(maximizeHeightString) || "1".equals(maximizeHeightString));
                boolean maximizeWidth = ("true".equals(maximizeWidthString) || "yes".equals(maximizeWidthString)
                        || "1".equals(maximizeWidthString));

                if (!newImage.equals(m_imageUrl)) {
                    m_imageUrl = newImage;
                    m_verticalLayout.removeAllComponents();
                    Image image = new Image(null, new ExternalResource(m_imageUrl));
                    if (maximizeHeight && maximizeWidth) {
                        image.setSizeFull();
                    } else {
                        if (maximizeHeight) {
                            image.setHeight(100, Sizeable.Unit.PERCENTAGE);
                        }
                        if (maximizeWidth) {
                            image.setWidth(100, Sizeable.Unit.PERCENTAGE);
                        }
                    }
                    m_verticalLayout.addComponent(image);
                    m_verticalLayout.setComponentAlignment(image, Alignment.MIDDLE_CENTER);
                }
            }

            @Override
            public Component getComponent() {
                return m_verticalLayout;
            }
        };
    }

    return m_dashletComponent;
}

From source file:tad.grupo7.ccamistadeslargas.AdminIndexView.java

public AdminIndexView() {
    setMenuCaption("CCAmistadesLargas - ADMIN");
    String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath()
            + "/WEB-INF/wallpaper2.jpg";
    FileResource resource = new FileResource(new File(basepath));
    Image image = new Image(null, resource);
    image.setSizeFull();
    addComponent(image);//from  w  ww.jav a 2s .  c  o m
    addMenuItem("Listado", FontAwesome.LIST, () -> {
        removeAllComponents();
        addComponent(new ListadoLayout());
    });
    addMenuItem("Grafica", FontAwesome.PIE_CHART, () -> {
        removeAllComponents();
        addComponent(new GraficaLayout());
    });
    addMenuItem("Cerrar sesin", FontAwesome.POWER_OFF, () -> {
        Session.destroy();
        UI.getCurrent().getNavigator().navigateTo("");
    });
}

From source file:tad.grupo7.ccamistadeslargas.IndexView.java

public IndexView() {
    setMenuCaption("CCAmistadesLargas");
    String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath()
            + "/WEB-INF/wallpaper2.jpg";
    FileResource resource = new FileResource(new File(basepath));
    Image image = new Image(null, resource);
    image.setSizeFull();
    addComponent(image);//from  w  ww  . j  a va 2 s  .c  o  m
    addMenuItem("Perfil", FontAwesome.USER, () -> {
        removeAllComponents();
        addComponent(new PerfilLayout());
    });
    addMenuItem("Eventos", FontAwesome.COMPASS, () -> {
        removeAllComponents();
        addComponent(new EventosLayout());
    });
    addMenuItem("Amigos", FontAwesome.USERS, () -> {
        removeAllComponents();
        addComponent(new AmigosLayout());
    });
    addMenuItem("Cerrar sesin", FontAwesome.POWER_OFF, () -> {
        Session.destroy();
        UI.getCurrent().getNavigator().navigateTo("");
    });
}

From source file:ui.LifetimeBackground.java

License:Apache License

public LifetimeBackground(String language, Image image, DataLayout data) {
    setSizeFull();//  w ww  .  j a  v a 2s . c  o m
    this.image = image;
    image.setSizeFull();
    this.data = data;
    addComponents(image, data);
    setPosition(data, getDataPosition());
}