Example usage for com.vaadin.ui Image Image

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

Introduction

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

Prototype

public Image() 

Source Link

Document

Creates a new empty Image.

Usage

From source file:net.pkhsolutions.pecsapp.ui.components.PictureLayout.java

License:Open Source License

public PictureLayout(@NotNull PictureModel model) {
    this.model = model;
    setSpacing(true);/* w w w  .j a v  a2 s .co  m*/

    infoLabel = new Label("Drag och slpp en bild hr");
    infoLabel.setSizeUndefined();

    dropPane = new VerticalLayout();
    dropPane.setSizeFull();
    dropPane.addComponent(infoLabel);
    dropPane.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER);

    image = new Image();
    image.setSizeUndefined();
    dropPane.addComponent(image);
    dropPane.setComponentAlignment(image, Alignment.MIDDLE_CENTER);

    progressBar = new ProgressBar();
    progressBar.setIndeterminate(true);
    progressBar.setVisible(false);
    dropPane.addComponent(progressBar);
    dropPane.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER);

    DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(dropPane);
    dragAndDropWrapper.setDropHandler(this);
    dragAndDropWrapper.setSizeFull();
    addComponent(dragAndDropWrapper);
    setExpandRatio(dragAndDropWrapper, 1f);

    title = new TextField();
    title.setInputPrompt("Skriv namnet hr");
    title.setWidth("100%");
    title.setImmediate(true);
    addComponent(title);
    setComponentAlignment(title, Alignment.BOTTOM_LEFT);

    imageChanged(null);
}

From source file:org.opencms.ui.components.CmsUserInfo.java

License:Open Source License

/**
 * Creates the user image button.<p>
 *
 * @return the created button//from   w  ww.  j  a  v  a 2 s  .  c  o  m
 */
private Component createImageButton() {

    CssLayout layout = new CssLayout();
    layout.addStyleName(OpenCmsTheme.USER_IMAGE);
    Image userImage = new Image();
    userImage.setSource(new ExternalResource(OpenCms.getWorkplaceAppManager().getUserIconHelper()
            .getBigIconPath(A_CmsUI.getCmsObject(), m_user)));

    layout.addComponent(userImage);

    if (!CmsAppWorkplaceUi.isOnlineProject()) {
        CmsUploadButton uploadButton = createImageUploadButton(null, FontOpenCms.UPLOAD_SMALL, m_user,
                m_uploadListener);
        layout.addComponent(uploadButton);
        if (CmsUserIconHelper.hasUserImage(m_user)) {
            Button deleteButton = new Button(FontOpenCms.TRASH_SMALL);
            deleteButton.addClickListener(new ClickListener() {

                private static final long serialVersionUID = 1L;

                public void buttonClick(ClickEvent event) {

                    OpenCms.getWorkplaceAppManager().getUserIconHelper()
                            .deleteUserImage(A_CmsUI.getCmsObject());
                    m_context.updateUserInfo();

                }
            });
            layout.addComponent(deleteButton);
        }
    }

    return layout;
}

From source file:org.vaadin.alump.fancylayouts.demo.PanelDemo.java

License:Apache License

/**
 * Sample content with simple table (disabled as table is so broken in
 * Vaadin 7). To get table work you probably need some special timer.
 * /*from   w ww  .  j  a v a 2  s  .c o m*/
 * @return
 */
// private ComponentContainer createPanelContentC() {
// VerticalLayout layout = new VerticalLayout();
// layout.setWidth("100%");
// layout.setMargin(true);
// layout.setSpacing(true);
//
// Label label = new Label ("Table is quite broken in Vaadin 7?");
// layout.addComponent(label);
//
// Table table = new Table();
// table.setWidth("400px");
// table.setHeight("500px");
// table.addContainerProperty("Name", String.class, "");
// table.addContainerProperty("Phone Number", String.class, "");
// table.addItem(new Object[] { "Matti Meiklinen", "555 234 2344" },
// "Matti");
// table.addItem(new Object[] { "Donald Duck", "555 332 7782" }, "Donald");
//
// layout.addComponent(table);
//
// return layout;
// }

private ComponentContainer createPanelContentD() {
    CssLayout layout = new CssLayout();
    layout.addStyleName("demo-panel-d");
    layout.setWidth("100%");
    layout.setHeight("100%");

    Image image = new Image();
    image.setSource(new ThemeResource("images/meme.jpg"));
    image.addStyleName("demo-meme");
    layout.addComponent(image);

    return layout;
}

From source file:org.vaadin.easyuploads.ImagePreviewField.java

License:Apache License

@Override
protected Component createDisplayComponent() {
    Image image = new Image();
    image.setHeight("100px");
    return image;
}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.ComparisonsSelectionOverviewBubbleChart.java

public ComparisonsSelectionOverviewBubbleChart(final QuantCentralManager Quant_Central_Manager,
        final CSFPRHandler CSFPR_Handler, int chartWidth, int chartHeight,
        Set<QuantDiseaseGroupsComparison> selectedComparisonList,
        List<QuantProtein> searchQuantificationProtList) {

    userDataCounter = 0;/*from  ww w.j a  va  2s. c om*/
    this.searchQuantificationProtList = searchQuantificationProtList;
    Map<String, String> diseaseHashedColorMap = Quant_Central_Manager.getDiseaseHashedColorMap();
    for (String str : diseaseHashedColorMap.keySet()) {
        diseaseColorMap.put(str, Color.decode(diseaseHashedColorMap.get(str)));
    }
    this.width = chartWidth;
    this.height = 600;
    this.CSFPR_Handler = CSFPR_Handler;
    this.setWidth(width + "px");
    this.setHeightUndefined();
    this.Quant_Central_Manager = Quant_Central_Manager;
    this.Quant_Central_Manager.registerStudySelectionListener(ComparisonsSelectionOverviewBubbleChart.this);
    this.setSpacing(true);

    //init toplayout
    topLayout.setHeight(30 + "px");
    topLayout.setSpacing(true);
    topLayout.setMargin(new MarginInfo(false, false, true, false));
    this.addComponent(topLayout);

    Label overviewLabel = new Label("<font style='margin-left :50px;'>Overview</font> ");
    overviewLabel.setContentMode(ContentMode.HTML);
    topLayout.addComponent(overviewLabel);
    overviewLabel.setStyleName("subtitle");
    overviewLabel.setWidth("120px");

    InfoPopupBtn info = new InfoPopupBtn(
            "The bubble chart give an overview for the proteins existed in the selected comparisons.<br/>The diameter of the bubble represents the number of the proteins in the selected comparison and the color represents the trend<br/>");
    info.setWidth("16px");
    info.setHeight("16px");
    topLayout.addComponent(info);
    this.topLayout.setVisible(false);

    //end of toplayout
    //init chartlayout
    this.chartLayoutContainer.setVisible(false);
    this.addComponent(chartLayoutContainer);
    chartLayoutContainer.setWidth(width + "px");
    chartLayoutContainer.setHeight(height + "px");

    chartLayoutContainer.addComponent(chartImage, "left: " + 0 + "px; top: " + 0 + "px;");
    chartLayoutContainer.addComponent(chartLayout, "left: " + 0 + "px; top: " + 0 + "px;");
    chartLayout.setWidth(width + "px");
    chartLayout.setHeight(height + "px");
    chartLayout.addLayoutClickListener(ComparisonsSelectionOverviewBubbleChart.this);

    //end of chartlayout
    //init bottomlayout 
    bottomLayout.setWidth("100%");
    this.addComponent(bottomLayout);
    this.setComponentAlignment(bottomLayout, Alignment.BOTTOM_RIGHT);
    bottomLayout.setVisible(false);
    HorizontalLayout btnContainerLayout = new HorizontalLayout();
    btnContainerLayout.setSpacing(true);
    //        btnContainerLayout.setMargin(new MarginInfo(false, false, false, false));
    btnContainerLayout.setWidthUndefined();
    btnContainerLayout.setHeightUndefined();
    //        btnContainerLayout.addStyleName("leftspacer");
    bottomLayout.addComponent(btnContainerLayout);
    bottomLayout.setComponentAlignment(btnContainerLayout, Alignment.TOP_RIGHT);

    TrendLegend legendLayout = new TrendLegend("bubblechart");
    legendLayout.setWidthUndefined();
    legendLayout.setHeight("24px");
    btnContainerLayout.addComponent(legendLayout);
    btnContainerLayout.setComponentAlignment(legendLayout, Alignment.TOP_RIGHT);
    //        btnContainerLayout.setExpandRatio(legendLayout, 600);
    //        btnContainerLayout.setExpandRatio(btnContainerLayout, 210);

    //         VerticalLayout stableBtnWrapper = new VerticalLayout();
    ////        stableBtnWrapper.setWidth("64px");
    //        HorizontalLayout stableBtn = new HorizontalLayout();
    //        stableBtnWrapper.addComponent(stableBtn);
    //        stableBtnWrapper.setComponentAlignment(stableBtn, Alignment.TOP_LEFT);
    //        btnContainerLayout.addComponent(stableBtnWrapper);
    groupSwichBtn = new GroupSwichBtn(Quant_Central_Manager, searchQuantificationProtList);
    btnContainerLayout.addComponent(groupSwichBtn);

    final VerticalLayout appliedIcon = new VerticalLayout();
    appliedIcon.setStyleName("appliedicon");
    appliedIcon.setWidth("24px");
    appliedIcon.setHeight("24px");
    appliedIcon.setDescription("Hide stable proteins");
    btnContainerLayout.addComponent(appliedIcon);
    //        stableBtn.setStyleName("stablebtn");
    //        stableBtn.setHeight("24px");
    //        Label stableLabel = new Label("Equal");
    //        stableLabel.setWidth("44px");
    //        stableBtn.addComponent(stableLabel);

    appliedIcon.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {
        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (appliedIcon.getStyleName().equalsIgnoreCase("appliedicon")) {
                appliedIcon.setStyleName("unappliedicon");
                Quant_Central_Manager.updateSignificantOnlySelection(true);
                appliedIcon.setDescription("Show stable proteins");
            } else {
                appliedIcon.setStyleName("appliedicon");
                Quant_Central_Manager.updateSignificantOnlySelection(false);
                appliedIcon.setDescription("Hide stable proteins");
            }
        }
    });

    exportPdfBtn = new Button("");
    exportPdfBtn.setWidth("24px");
    exportPdfBtn.setHeight("24px");
    exportPdfBtn.setPrimaryStyleName("exportpdfbtn");
    exportPdfBtn.setDescription("Export chart image");
    StreamResource myResource = createResource();
    FileDownloader fileDownloader = new FileDownloader(myResource);
    fileDownloader.extend(exportPdfBtn);
    btnContainerLayout.addComponent(exportPdfBtn);

    VerticalLayout unselectAllBtn = new VerticalLayout();
    unselectAllBtn.setStyleName("unselectallbtn");
    btnContainerLayout.addComponent(unselectAllBtn);
    btnContainerLayout.setComponentAlignment(unselectAllBtn, Alignment.TOP_LEFT);
    unselectAllBtn.setDescription("Clear selection");
    unselectAllBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            Quant_Central_Manager.setBubbleChartQuantProteinsSelection(new HashSet<String>(), "");
            resetChart();

        }
    });

    final VerticalLayout selectMultiBtn = new VerticalLayout();
    selectMultiBtn.setStyleName("selectmultiselectedbtn");
    btnContainerLayout.addComponent(selectMultiBtn);
    btnContainerLayout.setComponentAlignment(selectMultiBtn, Alignment.TOP_LEFT);
    selectMultiBtn.setDescription("Multiple selection");
    activeMultiSelect = true;
    selectMultiBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (selectMultiBtn.getStyleName().equalsIgnoreCase("selectmultiselectedbtn")) {
                selectMultiBtn.setStyleName("selectmultibtn");
                activeMultiSelect = false;

            } else {
                selectMultiBtn.setStyleName("selectmultiselectedbtn");
                activeMultiSelect = true;

            }
        }
    });

    //end of btns layout
    //init empty layout
    emptySelectionLayout = new VerticalLayout();
    this.addComponent(emptySelectionLayout);
    emptySelectionLayout.setWidth(100 + "%");
    emptySelectionLayout.setHeightUndefined();

    VerticalLayout spacer = new VerticalLayout();
    spacer.setHeight("100px");
    spacer.setWidth("10px");
    spacer.setStyleName(Reindeer.LAYOUT_WHITE);
    emptySelectionLayout.addComponent(spacer);
    emptySelectionLayout.setComponentAlignment(spacer, Alignment.BOTTOM_RIGHT);

    Label startLabel = new Label(
            "<center><h2 style='color:gray;'><b>Select comparison from the table</b></h2></center>");
    startLabel.setContentMode(ContentMode.HTML);

    emptySelectionLayout.addComponent(startLabel);
    emptySelectionLayout.setComponentAlignment(startLabel, Alignment.MIDDLE_CENTER);

    Image handleft = new Image();
    handleft.setSource(new ThemeResource("img/handleft.png"));
    emptySelectionLayout.addComponent(handleft);
    emptySelectionLayout.setComponentAlignment(handleft, Alignment.MIDDLE_CENTER);

    //init bubble chart
}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.ComparisonsSelectionOverviewBubbleChart.java

public ComparisonsSelectionOverviewBubbleChart(final QuantCentralManager Quant_Central_Manager,
        final CSFPRHandler CSFPR_Handler, int chartWidth, int chartHeight,
        Set<QuantDiseaseGroupsComparison> selectedComparisonList,
        List<QuantProtein> searchQuantificationProtList,
        QuantDiseaseGroupsComparison userCustomizedComparison) {
    this.userCustomizedComparison = userCustomizedComparison;
    userDataCounter = 1;/*  ww w. jav a2 s  .c  om*/
    this.searchQuantificationProtList = searchQuantificationProtList;
    Map<String, String> diseaseHashedColorMap = Quant_Central_Manager.getDiseaseHashedColorMap();
    for (String str : diseaseHashedColorMap.keySet()) {
        diseaseColorMap.put(str, Color.decode(diseaseHashedColorMap.get(str)));
    }
    this.width = chartWidth;
    this.height = 600;
    this.CSFPR_Handler = CSFPR_Handler;
    this.setWidth(width + "px");
    this.setHeightUndefined();
    this.Quant_Central_Manager = Quant_Central_Manager;
    this.Quant_Central_Manager.registerStudySelectionListener(ComparisonsSelectionOverviewBubbleChart.this);
    this.setSpacing(true);

    //init toplayout
    topLayout.setHeight(30 + "px");
    topLayout.setSpacing(true);
    topLayout.setMargin(new MarginInfo(false, false, true, false));
    this.addComponent(topLayout);

    Label overviewLabel = new Label("<font style='margin-left :50px;'>Overview</font> ");
    overviewLabel.setContentMode(ContentMode.HTML);
    topLayout.addComponent(overviewLabel);
    overviewLabel.setStyleName("subtitle");
    overviewLabel.setWidth("120px");

    InfoPopupBtn info = new InfoPopupBtn(
            "The bubble chart give an overview for the proteins existed in the selected comparisons.<br/>The diameter of the bubble represents the number of the proteins in the selected comparison and the color represents the trend<br/>");
    info.setWidth("16px");
    info.setHeight("16px");
    topLayout.addComponent(info);

    //end of toplayout
    //init chartlayout
    this.chartLayoutContainer.setVisible(false);
    this.addComponent(chartLayoutContainer);

    this.addComponent(chartLayoutContainer);
    chartLayoutContainer.setWidth(width + "px");
    chartLayoutContainer.setHeight(height + "px");

    chartLayoutContainer.addComponent(chartImage, "left: " + 0 + "px; top: " + 0 + "px;");
    chartLayoutContainer.addComponent(chartLayout, "left: " + 0 + "px; top: " + 0 + "px;");
    chartLayout.setWidth(width + "px");
    chartLayout.setHeight(height + "px");
    chartLayout.addLayoutClickListener(ComparisonsSelectionOverviewBubbleChart.this);

    //end of chartlayout
    //init bottomlayout 
    bottomLayout.setWidth("100%");
    this.addComponent(bottomLayout);
    this.setComponentAlignment(bottomLayout, Alignment.BOTTOM_RIGHT);
    bottomLayout.setVisible(false);
    HorizontalLayout btnContainerLayout = new HorizontalLayout();
    btnContainerLayout.setSpacing(true);
    //        btnContainerLayout.setMargin(new MarginInfo(false, false, false, false));
    btnContainerLayout.setWidthUndefined();
    btnContainerLayout.setHeightUndefined();
    //        btnContainerLayout.addStyleName("leftspacer");
    bottomLayout.addComponent(btnContainerLayout);
    bottomLayout.setComponentAlignment(btnContainerLayout, Alignment.TOP_RIGHT);

    TrendLegend legendLayout = new TrendLegend("bubblechart");
    legendLayout.setWidthUndefined();
    legendLayout.setHeight("24px");
    btnContainerLayout.addComponent(legendLayout);
    btnContainerLayout.setComponentAlignment(legendLayout, Alignment.TOP_RIGHT);

    Quant_Central_Manager.insertNoftfication("Quantitative Datasets",
            "Remeber you can flip the disease group comparisons using (Swich disease groups button)<img src='VAADIN/themes/dario-theme/img/flip-v-updated.png' height='25px' width='25' alt='Reorder and select' Align='center'/> ",
            width, width, "flipnotification");

    //        btnContainerLayout.setExpandRatio(legendLayout, 600);
    //        btnContainerLayout.setExpandRatio(btnContainerLayout, 210);

    //         VerticalLayout stableBtnWrapper = new VerticalLayout();
    ////        stableBtnWrapper.setWidth("64px");
    //        HorizontalLayout stableBtn = new HorizontalLayout();
    //        stableBtnWrapper.addComponent(stableBtn);
    //        stableBtnWrapper.setComponentAlignment(stableBtn, Alignment.TOP_LEFT);
    //        btnContainerLayout.addComponent(stableBtnWrapper);
    groupSwichBtn = new GroupSwichBtn(Quant_Central_Manager, searchQuantificationProtList);
    btnContainerLayout.addComponent(groupSwichBtn);
    final VerticalLayout appliedIcon = new VerticalLayout();
    appliedIcon.setStyleName("appliedicon");
    appliedIcon.setWidth("24px");
    appliedIcon.setHeight("24px");
    appliedIcon.setDescription("Hide stable proteins");
    btnContainerLayout.addComponent(appliedIcon);
    //        stableBtn.setStyleName("stablebtn");
    //        stableBtn.setHeight("24px");
    //        Label stableLabel = new Label("Equal");
    //        stableLabel.setWidth("44px");
    //        stableBtn.addComponent(stableLabel);

    appliedIcon.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {
        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (appliedIcon.getStyleName().equalsIgnoreCase("appliedicon")) {
                appliedIcon.setStyleName("unappliedicon");
                Quant_Central_Manager.updateSignificantOnlySelection(true);
                appliedIcon.setDescription("Show stable proteins");
            } else {
                appliedIcon.setStyleName("appliedicon");
                Quant_Central_Manager.updateSignificantOnlySelection(false);
                appliedIcon.setDescription("Hide stable proteins");
            }
        }
    });

    exportPdfBtn = new Button("");
    exportPdfBtn.setWidth("24px");
    exportPdfBtn.setHeight("24px");
    exportPdfBtn.setPrimaryStyleName("exportpdfbtn");
    exportPdfBtn.setDescription("Export chart image");
    StreamResource myResource = createResource();
    FileDownloader fileDownloader = new FileDownloader(myResource);
    fileDownloader.extend(exportPdfBtn);
    btnContainerLayout.addComponent(exportPdfBtn);

    VerticalLayout unselectAllBtn = new VerticalLayout();
    unselectAllBtn.setStyleName("unselectallbtn");
    btnContainerLayout.addComponent(unselectAllBtn);
    btnContainerLayout.setComponentAlignment(unselectAllBtn, Alignment.TOP_LEFT);
    unselectAllBtn.setDescription("Clear selection");
    unselectAllBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            Quant_Central_Manager.setBubbleChartQuantProteinsSelection(new HashSet<String>(), "");
            resetChart();

        }
    });

    final VerticalLayout selectMultiBtn = new VerticalLayout();
    selectMultiBtn.setStyleName("selectmultiselectedbtn");
    btnContainerLayout.addComponent(selectMultiBtn);
    btnContainerLayout.setComponentAlignment(selectMultiBtn, Alignment.TOP_LEFT);
    selectMultiBtn.setDescription("Multiple selection");
    activeMultiSelect = true;
    selectMultiBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (selectMultiBtn.getStyleName().equalsIgnoreCase("selectmultiselectedbtn")) {
                selectMultiBtn.setStyleName("selectmultibtn");
                activeMultiSelect = false;

            } else {
                selectMultiBtn.setStyleName("selectmultiselectedbtn");
                activeMultiSelect = true;

            }
        }
    });

    //end of btns layout
    //init empty layout
    emptySelectionLayout = new VerticalLayout();
    this.addComponent(emptySelectionLayout);
    emptySelectionLayout.setWidth(width + "px");
    emptySelectionLayout.setHeightUndefined();

    VerticalLayout spacer = new VerticalLayout();
    spacer.setHeight("100px");
    spacer.setWidth("10px");
    spacer.setStyleName(Reindeer.LAYOUT_WHITE);
    emptySelectionLayout.addComponent(spacer);
    emptySelectionLayout.setComponentAlignment(spacer, Alignment.BOTTOM_RIGHT);

    Label startLabel = new Label(
            "<center><h2 style='color:gray;'><b>Select comparison from the table</b></h2></center>");
    startLabel.setContentMode(ContentMode.HTML);

    emptySelectionLayout.addComponent(startLabel);
    emptySelectionLayout.setComponentAlignment(startLabel, Alignment.MIDDLE_CENTER);

    Image handleft = new Image();
    handleft.setSource(new ThemeResource("img/handleft.png"));
    emptySelectionLayout.addComponent(handleft);
    emptySelectionLayout.setComponentAlignment(handleft, Alignment.MIDDLE_CENTER);

}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.heatmap.HeatMapComponent.java

/**
 * @param heatmapCellWidth/*  www. j a  va2  s  .  c  o m*/
 * @param heatmapHeaderCellWidth
 * @param diseaseStyleMap
 */
public HeatMapComponent(int heatmapCellWidth, int heatmapHeaderCellWidth, Map<String, String> diseaseStyleMap) {

    this.diseaseStyleMap = diseaseStyleMap;

    this.setMargin(false);
    this.setSpacing(true);
    this.setWidth("100%");
    this.heatmapCellWidth = heatmapCellWidth;
    this.heatmapHeaderCellWidth = heatmapHeaderCellWidth;

    columnContainer = new VerticalLayout();
    columnContainer.setWidth("100%");
    columnContainer.setSpacing(true);

    diseaseGroupsColumnsLabels = new HorizontalLayout();
    diseaseGroupsColumnsLabels.setWidth("10px");
    diseaseGroupsColumnsLabels.setHeight("20px");
    diseaseGroupsColumnsLabels.setStyleName(Reindeer.LAYOUT_BLUE);
    columnContainer.addComponent(diseaseGroupsColumnsLabels);

    this.columnHeader = new GridLayout();
    columnContainer.addComponent(columnHeader);
    columnContainer.setComponentAlignment(columnHeader, Alignment.TOP_LEFT);
    this.rowHeader = new GridLayout();
    this.heatmapBody = new GridLayout();
    heatmapBody.setStyleName("hmbackground");

    topLayout = new HorizontalLayout();
    topLayout.setHeight((heatmapHeaderCellWidth + 24) + "px");
    topLayout.setSpacing(false);
    spacer = new VerticalLayout();
    spacer.setWidth((heatmapHeaderCellWidth + 25) + "px");
    spacer.setHeight((heatmapHeaderCellWidth + 24) + "px");
    spacer.setStyleName(Reindeer.LAYOUT_WHITE);

    hideCompBtn = new VerticalLayout();
    hideCompBtn.setSpacing(true);
    hideCompBtn.setWidth((heatmapHeaderCellWidth + 25) + "px");
    //        hideCompBtn.setHeight((heatmapHeaderCellWidth) + "px");
    hideCompBtn.setStyleName("matrixbtn");

    icon = new Image();
    defaultResource = new ThemeResource("img/logo.png");

    icon.setSource(defaultResource);
    hideCompBtn.setDescription("Expand chart and hide comparisons table");
    hideCompBtn.addComponent(icon);
    hideCompBtn.setComponentAlignment(icon, Alignment.MIDDLE_CENTER);
    icon.setHeight((heatmapHeaderCellWidth - 20 + 10) + "px");
    hideShowBtnLabel = new Label("Expand Chart");
    hideShowBtnLabel.setHeight((20) + "px");
    hideCompBtn.addComponent(hideShowBtnLabel);
    hideCompBtn.setComponentAlignment(hideShowBtnLabel, Alignment.BOTTOM_CENTER);

    spacer.addComponent(hideCompBtn);
    spacer.setComponentAlignment(hideCompBtn, Alignment.MIDDLE_CENTER);
    hideCompBtn.setEnabled(false);

    topLayout.addComponent(spacer);
    topLayout.setComponentAlignment(spacer, Alignment.BOTTOM_LEFT);
    topLayout.setSpacing(true);
    topLayout.addComponent(columnContainer);
    topLayout.setComponentAlignment(columnContainer, Alignment.TOP_LEFT);
    this.addComponent(topLayout);

    bottomLayout = new HorizontalLayout();
    diseaseGroupsRowsLabels = new VerticalLayout();
    diseaseGroupsRowsLabels.setHeight("10px");
    diseaseGroupsRowsLabels.setWidth("20px");
    diseaseGroupsRowsLabels.setStyleName(Reindeer.LAYOUT_BLUE);
    bottomLayout.addComponent(diseaseGroupsRowsLabels);

    rowHeader.setWidth(heatmapHeaderCellWidth + "px");
    rowHeader.setHeight("100%");
    bottomLayout.addComponent(rowHeader);
    bottomLayout.addComponent(heatmapBody);
    bottomLayout.setSpacing(true);
    bottomLayout.setComponentAlignment(heatmapBody, Alignment.MIDDLE_LEFT);
    this.addComponent(bottomLayout);

}

From source file:uk.co.intec.keyDatesApp.components.HeaderComponent.java

License:Apache License

/**
 * Constructor, passing the Vaadin application page
 *
 * @param ui//from   ww  w  .  ja  v a 2 s.c  om
 *            MainUI application page
 */
public HeaderComponent(MainUI ui) {
    setHeight("50px");
    setStyleName("header");

    final HorizontalLayout bannerArea = new HorizontalLayout();
    bannerArea.setStyleName("menuArea");
    bannerArea.setSizeFull();

    final ThemeResource resource = new ThemeResource("img/intec-logo.gif.png");
    final Image bannerImg = new Image();
    bannerImg.setAlternateText("Intec");
    bannerImg.setHeight("50px");
    bannerImg.setDescription("Intec Logo");
    bannerImg.setSource(resource);
    bannerImg.setWidth(null);
    bannerImg.setStyleName("bannerImg");

    setMenubar(new MenuBar());
    getMenubar().setStyleName(ValoTheme.MENU_SUBTITLE);
    getMenubar().addStyleName("valo-menu-subtitle-indent");
    getMenubar().setWidth(100, Unit.PERCENTAGE);

    if (!"Anonymous".equals(getUserName())) {
        final MenuItem logout = menubar.addItem("Logout", null);
        logout.setStyleName("menuRight");
    }

    final MenuItem userItem = menubar.addItem(getUserName(), null);
    userItem.setStyleName("menuRight");

    bannerArea.addComponents(bannerImg, menubar);
    bannerArea.setExpandRatio(menubar, 1);
    addComponent(bannerArea);
    setExpandRatio(bannerArea, 1);
    setSizeFull();
}