List of usage examples for com.vaadin.ui Label getWidth
@Override public float getWidth()
From source file:org.ripla.web.controllers.RiplaBody.java
License:Open Source License
/** * We have to clone the separator label defined in the skin. * /*from w ww .j a v a 2s . c o m*/ * @param inSeparator * Label * @return {@link Label} the cloned label */ private Label getSeparator(final Label inSeparator) { final Label out = new Label(inSeparator.getValue().toString(), inSeparator.getContentMode()); out.setWidth(inSeparator.getWidth(), inSeparator.getWidthUnits()); out.setStyleName(inSeparator.getStyleName()); return out; }
From source file:org.vaadin.addons.core.window.DialogWindow.java
License:Apache License
private VerticalLayout buildContent(String title, VaadinIcons type, Component content, ButtonType[] buttonTypes) {// w w w. j ava 2 s . com VerticalLayout root = new VerticalLayout(); root.setMargin(false); root.setSpacing(false); float width = -1; float height = 0; if (title != null) { HorizontalLayout header = new HorizontalLayout(); header.setMargin(true); header.setHeightUndefined(); header.setWidth("100%"); header.addStyleName(ValoTheme.WINDOW_TOP_TOOLBAR); Label l = new Label("<font size=\"4\">" + title + "</font>", ContentMode.HTML); width = l.getWidth(); header.addComponent(l); header.setComponentAlignment(l, Alignment.MIDDLE_LEFT); if (type != null) { Label i = new Label(type.getHtml(), ContentMode.HTML); header.addComponent(i); header.setComponentAlignment(i, Alignment.MIDDLE_RIGHT); } height = header.getHeight(); root.addComponent(header); } if (content != null) { content.setSizeFull(); HorizontalLayout contentRoot = new HorizontalLayout(content); contentRoot.setMargin(true); root.addComponent(contentRoot); height = height + contentRoot.getHeight(); } HorizontalLayout footer = new HorizontalLayout(); footer.setHeightUndefined(); footer.setWidth("100%"); footer.setMargin(true); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); HorizontalLayout buttons = new HorizontalLayout(); if (buttonTypes != null) { Stream.of(buttonTypes).forEach(buttonType -> { Button b = new Button(buttonType.getCaption()); if (buttonType.getIcon() != null) { b.setIcon(buttonType.getIcon()); } if (buttonType.getDescription() != null) { b.setDescription(buttonType.getDescription()); } if (buttonType.getStyle() != null) { b.addStyleName(buttonType.getStyle()); } b.addClickListener(event -> buttonType.getActions().forEach(buttonAction -> { ButtonTypeClickEvent event1 = new ButtonTypeClickEvent(buttonType, DialogWindow.this); buttonAction.getListener().buttonClick(event1); })); buttons.addComponent(b); }); } buttons.setSizeUndefined(); buttons.setMargin(false); buttons.setSpacing(true); footer.addComponent(buttons); footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); if (buttons.getWidth() > width) { width = buttons.getWidth(); } root.addComponent(footer); root.setComponentAlignment(footer, Alignment.BOTTOM_LEFT); height = height + footer.getHeight(); root.setHeight(height, Unit.PIXELS); root.setWidth(width, Unit.PIXELS); return root; }
From source file:probe.com.view.core.jfreeutil.SquaredDot.java
@Override public int compareTo(Label other) { if (this.getWidth() > other.getWidth()) { return -1; } else {//from ww w . ja v a2 s . c o m return 1; } }