List of usage examples for com.vaadin.ui Alignment isLeft
public boolean isLeft()
From source file:info.magnolia.ui.workbench.StatusBarViewImpl.java
License:Open Source License
/** * Adds component based on its alignment, first added first aligned. Concretely, we have to insert components * at the correct index in this {@link HorizontalLayout}.<br /> * <br />/*from w ww . j a v a 2 s .com*/ * For left alignment: new insertion position is after last left-aligned component (LTR).<br /> * For right alignment: new insertion position is before first right-aligned component (RTL).<br /> * For center alignment: same as for right alignment, equals to position after last centered component (LTR). */ @Override public void addComponent(Component c, Alignment align) { // compute index based on requested alignment, first come first aligned int index = 0; Iterator<Component> it = iterator(); if (align.isLeft()) { while (it.hasNext() && getComponentAlignment(it.next()).isLeft()) { index++; } } else { while (it.hasNext() && !getComponentAlignment(it.next()).isRight()) { index++; } } addComponent(c, index); setComponentAlignment(c, align); }
From source file:pt.ist.vaadinframework.ui.PaginatedSorterViewer.java
License:Open Source License
private void addControls(Component controls, Alignment position) { HorizontalLayout controlBar;/* w w w . ja v a2s .c o m*/ int x = position.isLeft() ? 0 : (position.isCenter() ? 1 : 2); int y = position.isTop() ? 0 : 2; controlBar = (HorizontalLayout) getComponent(x, y); controlBar.addComponent(controls); }