Example usage for com.vaadin.ui Alignment BOTTOM_LEFT

List of usage examples for com.vaadin.ui Alignment BOTTOM_LEFT

Introduction

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

Prototype

Alignment BOTTOM_LEFT

To view the source code for com.vaadin.ui Alignment BOTTOM_LEFT.

Click Source Link

Usage

From source file:org.vaadin.overlay.sample.OverlaySampleApplication.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();

    final Label label = new Label("Alignment.TOP_LEFT");
    layout.addComponent(label);/*from   w w  w .  ja va2  s  .  co m*/

    for (int i = 0; i < 20; i++) {

        Button button = new Button("Sample Button");
        layout.addComponent(button);

        final ImageOverlay io = new ImageOverlay(button);

        Resource res = new ClassResource(this.getClass(), "../icon-new.png");
        io.setImage(res);
        io.setComponentAnchor(Alignment.TOP_LEFT); // Top left of the button
        io.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image
        io.setClickListener(new OverlayClickListener() {
            public void overlayClicked(CustomClickableOverlay overlay) {
                Notification.show("ImageOverlay Clicked!");
            }
        });
        layout.addComponent(io);
        io.setEnabled(true);

        final TextOverlay to = new TextOverlay(button, "New!");
        to.setComponentAnchor(Alignment.MIDDLE_RIGHT); // Top right of the button
        to.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image
        to.setClickListener(new OverlayClickListener() {
            public void overlayClicked(CustomClickableOverlay overlay) {
                Notification.show("TextOverlay Clicked!");
            }
        });
        layout.addComponent(to);

        button.addClickListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                Alignment a = io.getComponentAnchor();
                String s = "";
                if (Alignment.TOP_LEFT.equals(a)) {
                    a = Alignment.TOP_CENTER;
                    s = "TOP_CENTER";
                } else if (Alignment.TOP_CENTER.equals(a)) {
                    a = Alignment.TOP_RIGHT;
                    s = "TOP_RIGHT";
                } else if (Alignment.TOP_RIGHT.equals(a)) {
                    a = Alignment.MIDDLE_RIGHT;
                    s = "MIDDLE_RIGHT";
                } else if (Alignment.MIDDLE_RIGHT.equals(a)) {
                    a = Alignment.BOTTOM_RIGHT;
                    s = "BOTTOM_RIGHT";
                } else if (Alignment.BOTTOM_RIGHT.equals(a)) {
                    a = Alignment.BOTTOM_CENTER;
                    s = "BOTTOM_CENTER";
                } else if (Alignment.BOTTOM_CENTER.equals(a)) {
                    a = Alignment.BOTTOM_LEFT;
                    s = "BOTTOM_LEFT";
                } else if (Alignment.BOTTOM_LEFT.equals(a)) {
                    a = Alignment.MIDDLE_LEFT;
                    s = "MIDDLE_LEFT";
                } else if (Alignment.MIDDLE_LEFT.equals(a)) {
                    a = Alignment.TOP_LEFT;
                    s = "TOP_LEFT";
                }
                io.setComponentAnchor(a);
                label.setValue("Alignment." + s);
            }
        });
    }

    setContent(layout);
}

From source file:org.vaadin.peholmst.samples.dddwebinar.ui.admin.ProcedureCategoryAdminView.java

@PostConstruct
void init() {// w  w  w  . jav a2  s  .  c om
    setSpacing(true);
    setMargin(true);
    setSizeFull();
    Label label = new Label("Procedure Categories");
    label.addStyleName(ValoTheme.LABEL_H1);
    addComponent(label);

    procedureCategoryContainer = new BeanItemContainer<>(ProcedureCategory.class);
    procedureCategoryGrid = new Grid(procedureCategoryContainer);
    procedureCategoryGrid.setColumns("name", "licenseTypes");
    procedureCategoryGrid.getColumn("licenseTypes").setConverter(new LicenseTypeMapConverter());
    procedureCategoryGrid.setSizeFull();
    procedureCategoryGrid.addSelectionListener(this::select);

    addComponent(procedureCategoryGrid);
    setExpandRatio(procedureCategoryGrid, 1.0f);

    formLayout = new HorizontalLayout();
    formLayout.setSpacing(true);
    formLayout.setVisible(false);
    addComponent(formLayout);

    name = new TextField("Category Name");
    formLayout.addComponent(name);
    formLayout.setComponentAlignment(name, Alignment.TOP_LEFT);

    licenseTypes = new LicenseTypeMapField("License Types");
    licenseTypes.setSelectable(licenseTypeRepository.findAll());
    formLayout.addComponent(licenseTypes);

    Button save = new Button("Save", this::save);
    formLayout.addComponent(save);
    formLayout.setComponentAlignment(save, Alignment.BOTTOM_LEFT);

    binder.bindMemberFields(this);
    refresh();
}

From source file:org.vaadin.spring.samples.security.ui.login.views.LoginView.java

License:Apache License

private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);/*w  w  w .  ja  v a2 s .  c  o  m*/
    fields.addStyleName("fields");

    username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {

            try {

                security.login(username.getValue(), password.getValue());

            } catch (AuthenticationException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
            // TODO Register Remember me Token

            /*
             * Redirect is handled by the VaadinRedirectStrategy
             * User is redirected to either always the default
             * or the URL the user request before authentication
             * 
             * Strategy is configured within SecurityConfiguration
             * Defaults to User request URL.
             */
        }
    });

    return fields;
}

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

/**
 * @param heatmapCellWidth/*ww  w  .  ja  v  a2  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:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.PopupInteractiveDSFiltersLayout.java

/**
 *
 * @param interactivePieChartFiltersContainerLayout
 *//* www  .  ja va2  s .  c  o  m*/
public PopupInteractiveDSFiltersLayout(
        final StudiesPieChartFiltersContainerLayout interactivePieChartFiltersContainerLayout) {
    VerticalLayout datasetExplorerFiltersIcon = new VerticalLayout();
    //        datasetExplorerFiltersIcon.setWidth("45px");
    //        datasetExplorerFiltersIcon.setHeight("24px");
    //        Label btnTitle = new Label("Studies");
    //        datasetExplorerFiltersIcon.addComponent(btnTitle);
    datasetExplorerFiltersIcon.setStyleName("studyexplorer");
    datasetExplorerFiltersIcon.setDescription("Dataset expolorer filter");
    this.addComponent(datasetExplorerFiltersIcon);
    this.setComponentAlignment(datasetExplorerFiltersIcon, Alignment.BOTTOM_LEFT);
    datasetExplorerFiltersIcon.addLayoutClickListener(PopupInteractiveDSFiltersLayout.this);
    this.setHeightUndefined();

    int height = Page.getCurrent().getBrowserWindowHeight() - 100;
    int width = Page.getCurrent().getBrowserWindowWidth() - 100;
    VerticalLayout popupBody = new VerticalLayout();
    popupBody.setWidth((width) + "px");
    popupBody.setHeightUndefined();
    popupBody.setStyleName(Reindeer.LAYOUT_WHITE);

    this.interactivePieChartFiltersContainerLayout = interactivePieChartFiltersContainerLayout;
    popupWindow = new Window() {

        @Override
        public void close() {
            interactivePieChartFiltersContainerLayout.updateSelectionManager(true);
            popupWindow.setVisible(false);

        }

    };
    popupWindow.setContent(popupBody);
    popupWindow.setWindowMode(WindowMode.NORMAL);
    popupWindow.setWidth((width + 40) + "px");
    popupWindow.setHeight((height) + "px");
    popupWindow.setVisible(false);
    popupWindow.setResizable(false);
    popupWindow.setClosable(false);
    popupWindow.setStyleName(Reindeer.WINDOW_LIGHT);
    popupWindow.setModal(true);
    popupWindow.setDraggable(false);
    popupWindow.center();

    popupWindow.setCaption(
            "<font color='gray' style='font-weight: bold;!important'>&nbsp;&nbsp;Dataset Explorer Filters</font>");

    UI.getCurrent().addWindow(popupWindow);
    popupWindow.setPositionX(30);
    popupWindow.setPositionY(40);

    popupWindow.setCaptionAsHtml(true);
    popupWindow.setClosable(true);

    popupBody.setMargin(true);
    popupBody.setSpacing(true);

    popupBody.addComponent(interactivePieChartFiltersContainerLayout);

}

From source file:probe.com.view.core.HideOnClickLayout.java

/**
 *
 * @param title// w ww.j  a v  a2 s . com
 * @param fullBodyLayout
 * @param miniBodyLayout
 * @param infoText
 */
public HideOnClickLayout(String title, Layout fullBodyLayout, AbstractOrderedLayout miniBodyLayout,
        String infoText, VerticalLayout tipsIcon) {
    this.setMargin(new MarginInfo(false, false, false, false));
    this.setWidth("100%");
    this.fullBodyLayout = fullBodyLayout;
    this.fullBodyLayout.setVisible(false);
    this.miniBodyLayout = miniBodyLayout;

    titleLayout = new HorizontalLayout();
    titleLayout.setHeight("30px");
    titleLayout.setWidth("100%");
    titleLayout.setSpacing(true);
    HorizontalLayout titleHeaderLayout = new HorizontalLayout();
    titleHeaderLayout.setWidthUndefined();
    titleHeaderLayout.setSpacing(true);

    show = new ShowLabel();
    show.setHeight("20px");
    titleHeaderLayout.addComponent(show);
    titleHeaderLayout.setComponentAlignment(show, Alignment.BOTTOM_LEFT);

    titleLabel = new Label(title);
    titleLabel.setContentMode(ContentMode.HTML);

    titleLabel.setHeight("20px");

    titleHeaderLayout.addComponent(titleLabel);
    titleHeaderLayout.setComponentAlignment(titleLabel, Alignment.TOP_LEFT);
    titleHeaderLayout.addLayoutClickListener(HideOnClickLayout.this);

    VerticalLayout titleHeaderContainer = new VerticalLayout(titleHeaderLayout);
    titleHeaderContainer.setWidthUndefined();

    titleLayout.addComponent(titleHeaderContainer);

    info = new InfoPopupBtn(infoText);
    if (infoText != null && !infoText.trim().equalsIgnoreCase("")) {
        titleHeaderLayout.addComponent(info);
        titleLabel.setStyleName("filterShowLabel");
    } else {
        titleLabel.setStyleName("normalheader");
    }
    this.addComponent(titleLayout);
    this.addComponent(this.fullBodyLayout);
    this.setComponentAlignment(this.fullBodyLayout, Alignment.MIDDLE_CENTER);
    if (miniBodyLayout != null) {
        titleLayout.addComponent(this.miniBodyLayout);
        titleLayout.setComponentAlignment(this.miniBodyLayout, Alignment.BOTTOM_LEFT);
        titleLayout.setExpandRatio(this.miniBodyLayout, 5);
        titleLayout.setExpandRatio(titleHeaderContainer, 1);
        miniBodyLayout.addLayoutClickListener(HideOnClickLayout.this);
    }
    if (tipsIcon != null) {
        titleHeaderLayout.addComponent(tipsIcon);

    }
}

From source file:probe.com.view.core.HideOnClickLayout.java

/**
 *
 * @param title//from   w w  w  .  jav a  2 s  .  com
 * @param fullBodyLayout
 * @param miniBodyLayout
 * @param align
 * @param infoText
 */
public HideOnClickLayout(String title, Component fullBodyLayout, AbstractOrderedLayout miniBodyLayout,
        Alignment align, String infoText, VerticalLayout tipsIcon) {
    this.setMargin(new MarginInfo(false, false, false, false));
    this.setWidth("100%");
    this.fullBodyLayout = fullBodyLayout;
    this.fullBodyLayout.setVisible(false);
    this.miniBodyLayout = miniBodyLayout;

    titleLayout = new HorizontalLayout();
    titleLayout.setHeight("30px");
    titleLayout.setSpacing(true);

    HorizontalLayout titleHeaderLayout = new HorizontalLayout();
    titleHeaderLayout.setWidthUndefined();
    titleHeaderLayout.setSpacing(true);

    show = new ShowLabel();
    show.setHeight("20px");
    titleHeaderLayout.addComponent(show);
    titleHeaderLayout.setComponentAlignment(show, Alignment.BOTTOM_LEFT);

    titleLabel = new Label(title);
    titleLabel.setContentMode(ContentMode.HTML);

    titleLabel.setHeight("20px");

    titleHeaderLayout.addComponent(titleLabel);
    titleHeaderLayout.setComponentAlignment(titleLabel, Alignment.TOP_LEFT);
    titleHeaderLayout.addLayoutClickListener(HideOnClickLayout.this);

    VerticalLayout titleHeaderContainer = new VerticalLayout(titleHeaderLayout);
    titleHeaderContainer.setWidthUndefined();

    titleLayout.addComponent(titleHeaderContainer);

    info = new InfoPopupBtn(infoText);
    if (infoText != null && !infoText.trim().equalsIgnoreCase("")) {
        titleLayout.addComponent(info);
        titleLabel.setStyleName("filterShowLabel");
    } else {
        titleLabel.setStyleName("normalheader");
    }
    this.addComponent(titleLayout);
    this.addComponent(this.fullBodyLayout);
    this.setComponentAlignment(this.fullBodyLayout, align);
    if (miniBodyLayout != null) {
        titleLayout.addComponent(this.miniBodyLayout);
        titleLayout.setComponentAlignment(this.miniBodyLayout, Alignment.TOP_LEFT);
        titleLayout.setExpandRatio(this.miniBodyLayout, 5);
        titleLayout.setExpandRatio(titleHeaderContainer, 1);
        miniBodyLayout.addLayoutClickListener(HideOnClickLayout.this);
    }
    if (tipsIcon != null) {
        titleHeaderLayout.addComponent(tipsIcon);

    }

}

From source file:probe.com.view.core.SingleStudyFilterLayout.java

/**
 *
 * @param dataset/*from w  w w.j  av  a  2s .c  om*/
 * @param datasetIndex
 * @param uniqueAttr
 * @param view
 */
public SingleStudyFilterLayout(QuantDatasetObject dataset, int datasetIndex, boolean[] uniqueAttr,
        boolean view) {

    init();
    this.setMargin(new MarginInfo(false, false, false, false));
    VerticalLayout miniLayout = new VerticalLayout();
    Label miniAttrLabel = new Label();
    if (!dataset.getUniqueValues().equalsIgnoreCase("")) {
        miniAttrLabel.setValue("[ " + dataset.getUniqueValues() + "]");
    }
    miniLayout.addComponent(miniAttrLabel);
    GridLayout studyInfo = new GridLayout();
    studyInfo.setColumns(3);
    studyInfo.setWidth("100%");

    SubTreeHideOnClick layout = new SubTreeHideOnClick("Dataset " + datasetIndex, studyInfo, miniLayout, view);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);
    for (int i = 0; i < uniqueAttr.length; i++) {

        boolean check = uniqueAttr[i];

        if (check) {
            if (!dataset.getProperty(i).toString().trim().equalsIgnoreCase("Not Available")
                    && !dataset.getProperty(i).toString().trim().equalsIgnoreCase("0")
                    && !dataset.getProperty(i).toString().trim().equalsIgnoreCase("-1")) {
                if (publicationInfoLayoutComponents[i] != null) {
                    studyInfo.addComponent(publicationInfoLayoutComponents[i]);
                    ((InformationField) publicationInfoLayoutComponents[i])
                            .setValue(dataset.getProperty(i).toString(), null);
                }
            }

        }

    }
    Button btn = new Button("Load Dataset");
    btn.setStyleName(Reindeer.BUTTON_SMALL);
    VerticalLayout btnLayout = new VerticalLayout();
    btnLayout.setMargin(true);
    btnLayout.setHeight("30px");
    btnLayout.addComponent(btn);

    int rowNum = studyInfo.getRows();
    if (studyInfo.getComponentCount() % 3 != 0) {
        studyInfo.addComponent(btnLayout, 2, rowNum - 1);
    } else {
        studyInfo.setRows(rowNum + 1);
        studyInfo.addComponent(btnLayout, 2, rowNum);
    }

    studyInfo.setComponentAlignment(btnLayout, Alignment.BOTTOM_LEFT);

}

From source file:probe.com.view.core.SubTreeHideOnClick.java

/**
 *
 * @param title/*from www .  j  a va 2 s .  c o  m*/
 * @param fullBodyLayout
 * @param miniBodyLayout
 * @param view
 */
public SubTreeHideOnClick(String title, Layout fullBodyLayout, VerticalLayout miniBodyLayout, boolean view) {
    //       title= title.toLowerCase();
    this.setMargin(new MarginInfo(false, false, false, false));
    this.setWidth("100%");
    this.fullBodyLayout = fullBodyLayout;
    this.fullBodyLayout.setVisible(false);
    this.miniBodyLayout = miniBodyLayout;

    titleLayout = new HorizontalLayout();
    titleLayout.setHeight("20px");
    titleLayout.setSpacing(true);
    show = new ShowMiniLabel();
    show.setHeight("20px");
    titleLayout.addComponent(show);
    titleLayout.setComponentAlignment(show, Alignment.BOTTOM_LEFT);
    titleLayout.setMargin(true);

    filterstLabel = new Label(title);//"<h4  style='font-family:verdana;font-weight:bold;'><strong aligen='center' style='font-family:verdana;color:#00000;'>Searching Filters</strong></h4>");
    filterstLabel.setContentMode(ContentMode.HTML);

    filterstLabel.setStyleName("treeNodeLabel");
    filterstLabel.setHeight("20px");
    titleLayout.addComponent(filterstLabel);
    titleLayout.setComponentAlignment(filterstLabel, Alignment.TOP_RIGHT);
    titleLayout.addLayoutClickListener(SubTreeHideOnClick.this);
    this.addComponent(titleLayout);
    this.addComponent(this.fullBodyLayout);
    if (miniBodyLayout != null) {
        titleLayout.addComponent(this.miniBodyLayout);
        miniBodyLayout.setStyleName("treeValue");
        miniBodyLayout.addLayoutClickListener(SubTreeHideOnClick.this);
    }
    if (view) {
        this.showLayout();
    }
}

From source file:pt.ist.vaadinframework.ui.PaginatedSorterViewer.java

License:Open Source License

public void setPagination(int pageLength) {
    setPagination(pageLength, Alignment.BOTTOM_LEFT, Alignment.BOTTOM_RIGHT);
}