List of usage examples for com.vaadin.ui VerticalLayout setDefaultComponentAlignment
@Override public void setDefaultComponentAlignment(Alignment defaultAlignment)
From source file:org.sensorhub.ui.SensorAdminPanel.java
License:Mozilla Public License
protected Panel newPanel(String title) { Panel panel = new Panel(title); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();//from w w w.ja v a 2s .c o m layout.setMargin(true); layout.setSpacing(true); layout.setDefaultComponentAlignment(Alignment.TOP_LEFT); panel.setContent(layout); return panel; }
From source file:org.vaadin.spinkit.demo.DemoUI.java
License:Apache License
private Component spinnerSizesContainer() { int types = SpinnerSize.values().length; GridLayout spinners = new GridLayout(4, (types / 4 + types % 4)); spinners.setSizeFull();//from ww w. ja va 2 s . co m spinners.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); spinners.setSpacing(true); ComboBox selector = new ComboBox("Select spinner type", Arrays.asList(SpinnerType.values())); selector.setNullSelectionAllowed(false); selector.setPageLength(0); selector.setValue(SpinnerType.ROTATING_PLANE); selector.addValueChangeListener(e -> { for (Component c : spinners) { if (c instanceof Spinner) { ((Spinner) c).setType((SpinnerType) selector.getValue()); } } }); StringToEnumConverter converter = new StringToEnumConverter(); for (SpinnerSize size : SpinnerSize.values()) { Spinner spinner = new Spinner(SpinnerType.ROTATING_PLANE); spinner.setSize(size); spinner.setCaption(converter.convertToPresentation(size, String.class, getLocale())); spinners.addComponent(spinner); } VerticalLayout l = new VerticalLayout(); l.setDefaultComponentAlignment(Alignment.TOP_CENTER); l.setSizeFull(); l.setMargin(false); l.setSpacing(true); l.addComponents(selector, spinners); l.setExpandRatio(spinners, 1); return l; }