List of usage examples for com.vaadin.ui Alignment TOP_CENTER
Alignment TOP_CENTER
To view the source code for com.vaadin.ui Alignment TOP_CENTER.
Click Source Link
From source file:org.ripla.web.internal.views.RiplaLogin.java
License:Open Source License
private void createForm(final VerticalLayout inLayout, final IAppConfiguration inConfiguration) { final IMessages lMessages = Activator.getMessages(); final FormLayout lLayout = new FormLayout(); lLayout.setStyleName("ripla-login-form"); //$NON-NLS-1$ lLayout.setWidth(400, Unit.PIXELS);//w ww . j a v a 2 s. c o m inLayout.addComponent(lLayout); inLayout.setComponentAlignment(lLayout, Alignment.TOP_CENTER); lLayout.addComponent(LabelHelper.createLabel(inConfiguration.getWelcome(), "ripla-welcome")); userid = new TextField(String.format("%s:", lMessages.getMessage("login.field.user"))); //$NON-NLS-1$ //$NON-NLS-2$ lLayout.addComponent(userid); userid.focus(); password = new PasswordField(String.format("%s:", lMessages.getMessage("login.field.pass"))); //$NON-NLS-1$ //$NON-NLS-2$ lLayout.addComponent(password); loginButton = new Button(lMessages.getMessage("login.button")); //$NON-NLS-1$ lLayout.addComponent(loginButton); loginItem = createLoginItem(); final FieldGroup lBinding = new FieldGroup(loginItem); lBinding.bindMemberFields(this); lBinding.setBuffered(false); }
From source file:org.vaadin.addon.twitter.demo.ButtonDemo.java
License:Apache License
private Component makeButtonContainer(TweetButton tweetButton, String caption) { return new MVerticalLayout( new MLabel(caption).withWidth("-1").withStyleName("centered-caption") .withStyleName(ValoTheme.LABEL_LARGE).withStyleName(ValoTheme.LABEL_COLORED), tweetButton.withStyleName("tw-widget", "tw-button", "centered-caption")).withSpacing(false) .withMargin(false).alignAll(Alignment.TOP_CENTER).withWidth("-1"); }
From source file:org.vaadin.addon.twitter.demo.TimelineDemo.java
License:Apache License
private VerticalLayout createTimeline(String caption, Timeline timeline) { MVerticalLayout verticalLayout = new MVerticalLayout().withSpacing(false).withMargin(false); timeline.addStyleName("tw-timeline"); timeline.addStyleName("tw-widget"); timeline.setHeight("400px"); verticalLayout.add(new MLabel(caption).withStyleName("centered-caption") .withStyleName(ValoTheme.LABEL_LARGE).withStyleName(ValoTheme.LABEL_COLORED), timeline) .alignAll(Alignment.TOP_CENTER); verticalLayout.setWidthUndefined();/* w w w. j a v a 2 s . co m*/ return verticalLayout; }
From source file:org.vaadin.addon.twitter.demo.TweetDemo.java
License:Apache License
private VerticalLayout createTweet(String caption, Consumer<Tweet> customizer) { MVerticalLayout verticalLayout = new MVerticalLayout() //.withFullWidth() .withSpacing(false).withMargin(false); Tweet tweet = new Tweet(tweetId); tweet.addStyleName("tw-widget"); tweet.addStyleName("tw-single-tweet"); customizer.accept(tweet);/* www .j ava2 s. c om*/ verticalLayout.add(new MLabel(caption).withStyleName("centered-caption") .withStyleName(ValoTheme.LABEL_LARGE).withStyleName(ValoTheme.LABEL_COLORED), tweet ).alignAll(Alignment.TOP_CENTER); //.expand(tweet); verticalLayout.setWidthUndefined(); return verticalLayout; }
From source file:org.vaadin.alump.fancylayouts.demo.ImageDemo.java
License:Apache License
public ImageDemo() { setMargin(true);/* w w w . ja v a2 s . c o m*/ setSpacing(true); setWidth("100%"); Label desc = new Label( "FancyImage can be used when you want to present multiple images in one place. This component allows you to select which image to show when or just enabled the automatic slide show mode."); addComponent(desc); final FancyImage image = new FancyImage(); image.setWidth("500px"); image.setHeight("281px"); // Setting images used final List<Resource> resources = getImageResources(); for (Resource resource : resources) { image.addResource(resource); } // Setting slideshow timeout to 3 seconds (3000 millisecs) image.setSlideShowTimeout(3000); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); addComponent(buttonLayout); addComponent(image); setComponentAlignment(image, Alignment.TOP_CENTER); for (int i = 0; i < resources.size(); ++i) { final Button button = new Button("Pic " + (i + 1)); buttonLayout.addComponent(button); final Resource res = resources.get(i); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { image.showResource(res); } }); disableWhenAutoPlay.add(button); } CheckBox auto = new CheckBox("Slide show"); auto.setImmediate(true); buttonLayout.addComponent(auto); CheckBox fade = new CheckBox("Fade"); fade.setDescription("Fade image when changing"); fade.setImmediate(true); fade.setValue(image.isFadeTransition()); buttonLayout.addComponent(fade); CheckBox rotate = new CheckBox("Rotate"); rotate.setDescription("Rotate image when changing"); rotate.setImmediate(true); rotate.setValue(image.isRotateTransition()); buttonLayout.addComponent(rotate); horizontal = new CheckBox("Horizontal"); horizontal.setDescription("Should rotate happen horizontally or vertically."); horizontal.setValue(true); buttonLayout.addComponent(horizontal); TextField timeout = new TextField(); timeout.setCaption("Slide show millisecs"); timeout.setValue(String.valueOf(image.getSlideShowTimeout())); timeout.setDescription("How many millisec the slideshow shows one image"); buttonLayout.addComponent(timeout); timeout.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { try { int value = Integer.parseInt(event.getText()); // Change slide show value image.setSlideShowTimeout(value); } catch (NumberFormatException e) { } } }); auto.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Boolean value = (Boolean) event.getProperty().getValue(); // Enable/disable slideshow mode image.setSlideShowEnabled(value); for (Component component : disableWhenAutoPlay) { component.setEnabled(!value); } } }); fade.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Boolean value = (Boolean) event.getProperty().getValue(); image.setFadeTransition(value.booleanValue()); } }); rotate.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Boolean value = (Boolean) event.getProperty().getValue(); image.setRotateTransition(value.booleanValue(), horizontal.getValue()); } }); horizontal.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (image.isRotateTransition()) { image.setRotateTransition(true, (Boolean) event.getProperty().getValue()); } } }); }
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 va 2 s . c om*/ 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.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 w w w . ja v a 2 s . c o 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; }
From source file:org.vaadin.spring.samples.security.shared.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("Vaadin Shared Security Demo Login"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();/*from w w w.j a va 2 s. co m*/ userName = new TextField("Username"); passwordField = new PasswordField("Password"); rememberMe = new CheckBox("Remember me"); login = new Button("Login"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(rememberMe); loginForm.addComponent(login); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }
From source file:pl.edu.agh.samm.testapp.SAMMTestApplication.java
License:Apache License
private Panel createChartsPanel() { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.addComponent(slavesCountChart = new FlotChart("Slaves count", "#0062FF")); verticalLayout.setComponentAlignment(slavesCountChart, Alignment.TOP_CENTER); verticalLayout.addComponent(queueLengthCountChart = new FlotChart("Queue length", "#D11739")); verticalLayout.setComponentAlignment(queueLengthCountChart, Alignment.TOP_CENTER); verticalLayout/*from ww w . jav a2 s. co m*/ .addComponent(processedExpressionsCountChart = new FlotChart("Processed expressions", "#1ABD28")); verticalLayout.setComponentAlignment(processedExpressionsCountChart, Alignment.TOP_CENTER); return new Panel("Charts", verticalLayout); }
From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.StudiesInformationPopupBtn.java
public StudiesInformationPopupBtn(QuantCentralManager Quant_Central_Manager) { // super("Study Information"); this.Quant_Central_Manager = Quant_Central_Manager; this.setStyleName(Reindeer.BUTTON_LINK); this.addStyleName("studyinfo"); this.setDescription("Show dataset information"); this.addClickListener(StudiesInformationPopupBtn.this); int selectedDsNumber = 0; Set<QuantDatasetObject> dsObjects = new TreeSet<QuantDatasetObject>(); if (Quant_Central_Manager.getSelectedDiseaseGroupsComparisonList() != null && !Quant_Central_Manager.getSelectedDiseaseGroupsComparisonList().isEmpty()) { Set<QuantDiseaseGroupsComparison> compSet = Quant_Central_Manager .getSelectedDiseaseGroupsComparisonList(); for (QuantDiseaseGroupsComparison comp : compSet) { selectedDsNumber += comp.getDatasetIndexes().length; for (int dsId : comp.getDatasetIndexes()) { DatasetInformationOverviewLayout datasetInfoLayout = new DatasetInformationOverviewLayout( (Page.getCurrent().getBrowserWindowWidth() * 90 / 100), Quant_Central_Manager.getDiseaseHashedColorMap()); datasetInfoLayout.updateDatasetForm(Quant_Central_Manager.getFullQuantDatasetMap().get(dsId)); // datasetInfoLayout.setWidth("100%"); datasetInfoLayoutDSIndexMap.put(dsId, datasetInfoLayout); dsObjects.add(Quant_Central_Manager.getFullQuantDatasetMap().get(dsId)); }/*from w w w . j a v a 2 s. co m*/ } } else { selectedDsNumber = Quant_Central_Manager.getFilteredDatasetsList().size(); Map<Integer, QuantDatasetObject> fullDsMap = Quant_Central_Manager.getFilteredDatasetsList(); for (QuantDatasetObject quantDs : fullDsMap.values()) { DatasetInformationOverviewLayout datasetInfoLayout = new DatasetInformationOverviewLayout( (Page.getCurrent().getBrowserWindowWidth() * 90 / 100), Quant_Central_Manager.getDiseaseHashedColorMap()); datasetInfoLayout.updateDatasetForm(quantDs); // datasetInfoLayout.setWidth("100%"); datasetInfoLayoutDSIndexMap.put(quantDs.getDsKey(), datasetInfoLayout); dsObjects.add(quantDs); } } this.studiesPopupLayout = new StudyPopupLayout(datasetInfoLayoutDSIndexMap); VerticalLayout popupBody = new VerticalLayout(); popupBody.setWidth("100%"); popupBody.addComponent(studiesPopupLayout); popupBody.setComponentAlignment(studiesPopupLayout, Alignment.TOP_CENTER); popupWindow = new Window() { @Override public void close() { popupWindow.setVisible(false); } }; popupWindow.setContent(popupBody); popupWindow.setWindowMode(WindowMode.NORMAL); popupWindow.setWidth("95%"); popupWindow.setHeight("95%"); 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'> Study Information (" + selectedDsNumber + ")</font>"); studiesPopupLayout.setInformationData(dsObjects); UI.getCurrent().addWindow(popupWindow); popupWindow.center(); popupWindow.setCaptionAsHtml(true); popupWindow.setClosable(true); popupBody.setMargin(true); popupBody.setSpacing(true); Quant_Central_Manager.registerStudySelectionListener(StudiesInformationPopupBtn.this); }