Example usage for com.vaadin.ui Alignment TOP_LEFT

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

Introduction

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

Prototype

Alignment TOP_LEFT

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

Click Source Link

Usage

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

/**
 *
 * @param title//from w w w  .j a  v a 2s. co m
 * @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// ww w.java 2 s.  c  om
 * @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.MiniStudyFilter.java

/**
 *
 * @param filterId//from   w  w  w  . ja  v  a2s .  c  o  m
 * @param value
 * @param Filter_Manager
 * @param filterLabel
 */
public MiniStudyFilter(String filterId, String value, StudiesSelectionManager Filter_Manager,
        String filterLabel) {
    filterValueLabel = new Label();
    this.Filter_Manager = Filter_Manager;

    filterValueLabel.setStyleName("studyFilterClosableBtnLabel");

    //        filterValueLabel.setValue(space + value);
    filterValueLabel.setContentMode(ContentMode.HTML);
    this.setVisible(true);
    this.setStyleName(Reindeer.LAYOUT_WHITE);
    this.filterId = filterId;
    this.value = value;
    if (value.trim().equalsIgnoreCase("Not Available") || value.trim().equalsIgnoreCase("none")) {
        this.filterValueLabel.setValue(space + filterLabel + " " + this.value);
    } else {
        this.filterValueLabel.setValue(space + this.value);
    }
    this.addComponent(filterValueLabel);
    this.setComponentAlignment(filterValueLabel, Alignment.TOP_LEFT);
    this.addLayoutClickListener(MiniStudyFilter.this);
}

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

public ToggleBtn(String strBtn1Label, String strBtn2Label, String btn1Comment, String btn2Comment, int width) {

    final Label btn1CommentLabel = new Label(btn1Comment);
    btn1CommentLabel.setStyleName(Reindeer.LABEL_SMALL);
    btn1CommentLabel.setWidth("120px");
    final Label btn2CommentLabel = new Label(btn2Comment);
    btn2CommentLabel.setStyleName(Reindeer.LABEL_SMALL);
    btn2CommentLabel.setVisible(false);/*  ww w  . java2 s  .  c  om*/
    btn2CommentLabel.setWidth("120px");

    this.setSpacing(true);
    Label btn1Label = new Label(strBtn1Label);
    btn1Label.setStyleName(Reindeer.LABEL_SMALL);
    Label btn2Label = new Label(strBtn2Label);
    btn2Label.setStyleName(Reindeer.LABEL_SMALL);
    toggleSwichButton = new HorizontalLayout();
    toggleSwichButton.setStyleName("toggleleft");
    toggleSwichButton.setWidth("50px");
    toggleSwichButton.setHeight("15px");
    toggleSwichButton.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (toggleSwichButton.getStyleName().equalsIgnoreCase("toggleleft")) {
                toggleSwichButton.setStyleName("toggleright");
                btn1CommentLabel.setVisible(false);
                btn2CommentLabel.setVisible(true);
            } else {
                toggleSwichButton.setStyleName("toggleleft");
                btn1CommentLabel.setVisible(true);
                btn2CommentLabel.setVisible(false);
            }
        }
    });

    this.addComponent(btn1CommentLabel);//commentLabel
    this.setComponentAlignment(btn1CommentLabel, Alignment.TOP_LEFT);//commentLabel
    this.addComponent(btn2CommentLabel);//commentLabel
    this.setComponentAlignment(btn2CommentLabel, Alignment.TOP_LEFT);//commentLabel
    VerticalLayout spacer = new VerticalLayout();
    width = Math.max((width - 120 - 75 - 75 - 55), 1);
    spacer.setHeight("15px");
    spacer.setWidth(width + "px");
    spacer.setStyleName(Reindeer.LAYOUT_WHITE);
    this.addComponent(spacer);
    this.addComponent(btn1Label);
    this.addComponent(toggleSwichButton);
    this.addComponent(btn2Label);

}

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

License:Open Source License

public void setGrouper(Object[] grouperIds, boolean[] initialAscending, String[] grouperLabels) {
    setGrouper(Alignment.TOP_LEFT, grouperIds, initialAscending, grouperLabels);
}

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

License:Open Source License

public void setSorter(Object[] sorterIds, boolean[] initialAscending, String[] sorterLabels) {
    setSorter(Alignment.TOP_LEFT, sorterIds, initialAscending, sorterLabels);
}

From source file:ru.codeinside.gses.webui.form.GridForm.java

License:Mozilla Public License

void buildControls(final FieldTree.Entry entry, int level) {
    switch (entry.type) {
    case ITEM://from   w w w  . j a v  a2 s  . c  o m
    case BLOCK:
        if (!entry.readable)
            break; // ?   ? ? ?,       
        if (isNotBlank(entry.caption)) {
            Label caption = new Label(entry.caption);
            caption.setStyleName("right");
            if (entry.type == FieldTree.Type.BLOCK) {
                caption.addStyleName("bold");
            }
            caption.setWidth(300, UNITS_PIXELS);
            caption.setHeight(100, UNITS_PERCENTAGE);
            gridLayout.addComponent(caption, level, entry.index, valueColumn - 1, entry.index);
            gridLayout.setComponentAlignment(caption, Alignment.TOP_RIGHT);
        }
        final Component sign = entry.sign;
        if (sign != null) {
            gridLayout.addComponent(sign, valueColumn + 1, entry.index);
            gridLayout.setComponentAlignment(sign, Alignment.TOP_LEFT);
            if (!entry.readOnly) {
                entry.field.addListener(new ValueChangeListener() {
                    @Override
                    public void valueChange(Property.ValueChangeEvent event) {
                        entry.field.removeListener(this);
                        gridLayout.removeComponent(sign);
                        entry.sign = null;
                    }
                });
            }
        }
        // ???  
        addField(entry.path, entry.field);
        break;
    case CONTROLS:
        HorizontalLayout layout = new HorizontalLayout();
        layout.setImmediate(true);
        layout.setSpacing(true);
        layout.setMargin(false, false, true, false);
        Button plus = createButton("+");
        Button minus = createButton("-");
        layout.addComponent(plus);
        layout.addComponent(minus);
        FieldTree.Entry block = getBlock(entry);
        plus.addListener(new AppendAction(entry, minus));
        minus.addListener(new RemoveAction(entry, plus));
        if (block.field != null) {
            final StringBuilder sb = new StringBuilder();
            if (!isBlank(block.caption)) {
                sb.append(' ').append('\'').append(block.caption).append('\'');
            }
            if (block.field.getDescription() != null) {
                sb.append(' ').append('(').append(block.field.getDescription()).append(')');
            }
            plus.setDescription("" + sb);
            minus.setDescription("" + sb);
        }
        updateCloneButtons(plus, minus, block);
        gridLayout.addComponent(layout, valueColumn, entry.index, valueColumn, entry.index);
        break;
    case CLONE:
        int y = entry.index;
        int dy = entry.getControlsCount() - 1;
        Label cloneCaption = new Label(entry.cloneIndex + ")");
        cloneCaption.setWidth(20, UNITS_PIXELS);
        cloneCaption.setStyleName("right");
        cloneCaption.addStyleName("bold");
        gridLayout.addComponent(cloneCaption, level - 1, y, level - 1, y + dy);
        gridLayout.setComponentAlignment(cloneCaption, Alignment.TOP_RIGHT);
        break;
    case ROOT:
        break;
    default:
        throw new IllegalStateException(
                "??? ?  ? " + entry.type);
    }

    if (entry.items != null) { //  ?  ?
        if (entry.type == FieldTree.Type.BLOCK) {
            level++;
        }
        for (FieldTree.Entry child : entry.items) {
            buildControls(child, level);
        }
    }
}

From source file:ru.codeinside.gses.webui.form.GridForm.java

License:Mozilla Public License

private void addToLayout(FieldTree.Entry entry) {
    Field field = entry.field;//from ww w.j  ava2 s .c om
    field.setCaption(field.isRequired() ? "" : null);
    Component component = entry.underline == null ? field : entry.underline;
    gridLayout.addComponent(component, valueColumn, entry.index);
    gridLayout.setComponentAlignment(component, Alignment.TOP_LEFT);
}

From source file:uk.co.intec.keyDatesApp.pages.MainView.java

License:Apache License

@Override
public void enter(ViewChangeEvent event) {
    try {/*w  w w  . ja  va  2s.c om*/
        if (!isLoaded()) {
            body.setDefaultComponentAlignment(Alignment.TOP_LEFT);

            final Pager newPager = new Pager(viewWrapper, null);
            newPager.loadContent();
            setPager(newPager);

            loadContent();
            getPager().loadPagerPagesButtons();
            setLoaded(true);
        }

    } catch (final Exception e) {
        e.printStackTrace();
    }
}