List of usage examples for com.vaadin.ui Label setWidth
@Override public void setWidth(String width)
From source file:com.foc.vaadin.gui.FocCustomComponent.java
License:Apache License
private Label addLabel(String value, String style, int left, int top, int width, int heigth, ContentMode contentMode) {//from w ww. j av a 2s .c om Label lbl = null; if (mainLayout != null) { lbl = new Label(value); lbl.setContentMode(contentMode); lbl.addStyleName(style); lbl.setWidth(width + "px"); lbl.setHeight(heigth + "78px"); mainLayout.addComponent(lbl, "top:" + top + ".0px;left:" + left + ".0px;"); } return lbl; }
From source file:com.foo01.components.ReservationComponent.java
public static Component build(final Reservation r) { final HorizontalLayout reservationComponentLayout = new HorizontalLayout(); final VerticalLayout datesLayout = new VerticalLayout(); Label beginningDate = new Label( (new SimpleDateFormat("E dd.MM.", Locale.getDefault())).format(r.getBeginning().getTime())); Label endingDate = new Label( (new SimpleDateFormat("E dd.MM.", Locale.getDefault())).format(r.getEnding().getTime())); beginningDate.addStyleName("datelabel"); endingDate.addStyleName("datelabel"); datesLayout.addComponent(beginningDate); datesLayout.addComponent(endingDate); datesLayout.setSpacing(true);/*from w w w.ja va2 s. c o m*/ reservationComponentLayout.addComponent(datesLayout); Label reservationInfoLabel = new Label(r.getUser() + "</br></br>" + r.getDescription(), ContentMode.HTML); reservationInfoLabel.addStyleName("informationlabel"); reservationComponentLayout.addComponent(reservationInfoLabel); Label rightArrowIconLabel = new Label("</br>" + FontAwesome.CHEVRON_RIGHT.getHtml(), ContentMode.HTML); rightArrowIconLabel.addStyleName("rightArrowIconLabel"); reservationComponentLayout.addComponent(rightArrowIconLabel); reservationComponentLayout.setSpacing(true); reservationComponentLayout.setWidth("100%"); datesLayout.setWidth("85px"); reservationInfoLabel.setSizeFull(); rightArrowIconLabel.setHeight("100%"); rightArrowIconLabel.setWidth("20px"); reservationComponentLayout.setExpandRatio(reservationInfoLabel, 1.0f); reservationComponentLayout.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(LayoutClickEvent event) { //System.out.println(event.getClickedComponent().getParent().getId()); ((foo01TouchKitUI) UI.getCurrent()).NAVIGATIONMANAGER.navigateTo(new ReservationView(r)); } }); return reservationComponentLayout; }
From source file:com.foo01.ui.ReservationDetailView.java
@Override protected final void onBecomingVisible() { getNavigationBar().setCaption("Detail Rezervace"); //buttony pod navbarem HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setStyleName("buttonToolBarLayout"); buttonsLayout.setWidth("100%"); Button deleteButton = new Button(); deleteButton.setCaption("SMAZAT"); deleteButton.setWidth(null);//from w w w .j ava2 s . c om buttonsLayout.addComponent(deleteButton); Label plug = new Label(); buttonsLayout.addComponent(plug); Button saveButton = new Button(); saveButton.setCaption("ULOIT"); saveButton.setWidth(null); buttonsLayout.addComponent(saveButton); buttonsLayout.setExpandRatio(plug, 1.0f); List<Source> sourcesList = MockSource.mockSources(); //combobox na zdroje a jmeno uzivatele HorizontalLayout sourceAndNameLayout = new HorizontalLayout(); sourceAndNameLayout.setWidth("100%"); sourceAndNameLayout.setStyleName("sourceAndNameLayout"); NativeSelect select = new NativeSelect(); select.setNullSelectionAllowed(false); System.out.println(Page.getCurrent().getBrowserWindowWidth()); String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px"; select.setWidth(width); select.addItems(sourcesList); for (Source s : sourcesList) { if (reservation.getSource().equals(s)) { select.select(s); break; } } sourceAndNameLayout.addComponent(select); Label plug2 = new Label(); sourceAndNameLayout.addComponent(plug2); Label name = new Label(reservation.getUser()); name.setWidth(null); sourceAndNameLayout.addComponent(name); sourceAndNameLayout.setExpandRatio(plug2, 1.0f); //datepickery DatePicker dateFrom = new DatePicker(); dateFrom.setStyleName("datePickerDetailView"); dateFrom.setValue(reservation.getBeginning()); dateFrom.setUseNative(true); dateFrom.setResolution(Resolution.TIME); dateFrom.setWidth("100%"); DatePicker dateTo = new DatePicker(); dateTo.setStyleName("datePickerDetailView"); dateTo.setValue(reservation.getEnding()); dateTo.setUseNative(true); dateTo.setResolution(Resolution.TIME); dateTo.setWidth("100%"); //layout pro slider a popisky HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setStyleName("sliderLayout"); sliderLayout.setWidth("100%"); sliderLayout.setSpacing(true); Label sliderCaption = new Label("Po?et: "); sliderCaption.addStyleName("sliderCaption"); sliderCaption.setWidth(null); sliderLayout.addComponent(sliderCaption); final Label horvalue = new Label(); horvalue.setWidth("45px"); horvalue.setStyleName("value"); sliderLayout.addComponent(horvalue); final Slider horslider = new Slider(1, 10); horslider.setOrientation(SliderOrientation.HORIZONTAL); horslider.setValue(Double.valueOf(1)); horslider.getState(); horslider.getValue(); horslider.setImmediate(true); horslider.setWidth("100%"); sliderLayout.addComponent(horslider); sliderLayout.setExpandRatio(horslider, 1.0f); horvalue.setValue(String.valueOf(horslider.getValue().intValue())); horslider.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { int value = horslider.getValue().intValue(); horvalue.setValue(String.valueOf(value)); } }); //switch schvaleno HorizontalLayout switchLayout = new HorizontalLayout(); switchLayout.setStyleName("switchLayout"); switchLayout.addComponent(new Label("Schvleno:")); switchLayout.setSpacing(true); Switch checkbox = new Switch(null, true); switchLayout.addComponent(checkbox); //popis rezervace TextArea description = new TextArea(); description.setStyleName("descriptionDetailView"); description.setWidth("100%"); description.setImmediate(false); description.setCaption("Popis:"); description.setValue(reservation.getDescription()); //description.setRequired(true); description.setRequiredError("Popis mus bt zadn!"); description.setNullRepresentation(""); description.setReadOnly(true); //description.setRows(0); final VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.setStyleName(width); content.addComponent(buttonsLayout); content.addComponent(sourceAndNameLayout); content.addComponent(dateFrom); content.addComponent(dateTo); content.addComponent(sliderLayout); content.addComponent(switchLayout); content.addComponent(description); setContent(content); }
From source file:com.foo01.ui.ReservationView.java
@Override protected final void onBecomingVisible() { getNavigationBar().setCaption("Detail Rezervace"); //buttony pod navbarem // HorizontalLayout buttonsLayout = new HorizontalLayout(); // buttonsLayout.setStyleName("buttonToolBarLayout"); // buttonsLayout.setWidth("100%"); //// w ww .j ava 2 s .co m // Button deleteButton = new Button(); // deleteButton.setCaption("SMAZAT"); // deleteButton.setWidth(null); // buttonsLayout.addComponent(deleteButton); // // Label plug = new Label(); // buttonsLayout.addComponent(plug); // // Button saveButton = new Button(); // saveButton.setCaption("ULOIT"); // saveButton.setWidth(null); // buttonsLayout.addComponent(saveButton); // buttonsLayout.setExpandRatio(plug, 1.0f); //combobox na zdroje a jmeno uzivatele List<Source> sourcesList = MockSource.mockSources(); HorizontalLayout sourceAndNameLayout = new HorizontalLayout(); sourceAndNameLayout.setWidth("100%"); sourceAndNameLayout.setStyleName("sourceAndNameLayout"); NativeSelect select = new NativeSelect(); select.setNullSelectionAllowed(false); System.out.println(Page.getCurrent().getBrowserWindowWidth()); String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px"; select.setWidth(width); select.addItems(sourcesList); for (Source s : sourcesList) { if (reservation.getSource().equals(s)) { select.select(s); break; } } sourceAndNameLayout.addComponent(select); Label plug2 = new Label(); sourceAndNameLayout.addComponent(plug2); Label name = new Label(reservation.getUser()); name.setWidth(null); sourceAndNameLayout.addComponent(name); sourceAndNameLayout.setExpandRatio(plug2, 1.0f); //datepickery DatePicker dateFrom = new DatePicker(); dateFrom.setStyleName("datePickerDetailView"); dateFrom.setValue(reservation.getBeginning()); dateFrom.setUseNative(true); dateFrom.setResolution(Resolution.TIME); dateFrom.setWidth("100%"); DatePicker dateTo = new DatePicker(); dateTo.setStyleName("datePickerDetailView"); dateTo.setValue(reservation.getEnding()); dateTo.setUseNative(true); dateTo.setResolution(Resolution.TIME); dateTo.setWidth("100%"); //layout pro slider a popisky HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setStyleName("sliderLayout"); sliderLayout.setWidth("100%"); sliderLayout.setSpacing(true); Label sliderCaption = new Label("Po?et: "); sliderCaption.addStyleName("sliderCaption"); sliderCaption.setWidth(null); sliderLayout.addComponent(sliderCaption); final Label horvalue = new Label(); horvalue.setWidth("45px"); horvalue.setStyleName("value"); sliderLayout.addComponent(horvalue); final Slider horslider = new Slider(1, 10); horslider.setOrientation(SliderOrientation.HORIZONTAL); horslider.setValue(Double.valueOf(1)); horslider.getState(); horslider.getValue(); horslider.setImmediate(true); horslider.setWidth("100%"); sliderLayout.addComponent(horslider); sliderLayout.setExpandRatio(horslider, 1.0f); horvalue.setValue(String.valueOf(horslider.getValue().intValue())); horslider.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { int value = horslider.getValue().intValue(); horvalue.setValue(String.valueOf(value)); } }); //switch schvaleno HorizontalLayout switchLayout = new HorizontalLayout(); switchLayout.setStyleName("switchLayout"); switchLayout.addComponent(new Label("Schvleno:")); switchLayout.setSpacing(true); Switch checkbox = new Switch(null, true); switchLayout.addComponent(checkbox); //popis rezervace TextArea description = new TextArea(); description.setStyleName("descriptionDetailView"); description.setWidth("100%"); description.setImmediate(false); description.setCaption("Popis:"); description.setValue(reservation.getDescription()); //description.setRequired(true); description.setRequiredError("Popis mus bt zadn!"); description.setNullRepresentation(""); description.setReadOnly(true); //description.setRows(0); final VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.addComponent(new ButtonToolBarLayout(this)); content.addComponent(sourceAndNameLayout); content.addComponent(dateFrom); content.addComponent(dateTo); content.addComponent(sliderLayout); content.addComponent(switchLayout); content.addComponent(description); setContent(content); }
From source file:com.github.tempora.view.MainView.java
License:Apache License
public MainView() { VerticalLayout vlayout = new VerticalLayout(); vlayout.addStyleName("outlined"); vlayout.addStyleName("bg"); vlayout.setSizeFull();//w w w . ja v a 2s .c o m vlayout.setMargin(true); HorizontalLayout hlayout = new HorizontalLayout(); hlayout.addStyleName("outlined"); hlayout.setSizeFull(); setContent(vlayout); // Title Label caption = new Label("Tempora"); caption.setStyleName("logo-label", true); caption.setWidth(null); vlayout.addComponent(caption); vlayout.setExpandRatio(caption, 0.2f); vlayout.setComponentAlignment(caption, Alignment.MIDDLE_CENTER); vlayout.addComponent(hlayout); vlayout.setExpandRatio(hlayout, 0.7f); // // General information about the User's mailbox // final Panel generalInfoPanel = new Panel("<center>General Information</center>"); generalInfoPanel.addStyleName("frame-bg-general-info"); generalInfoPanel.setSizeFull(); this.currentHistoryId = new Label("0"); currentHistoryId.setStyleName("general-info-count", true); currentHistoryId.setCaption("History ID"); this.messagesTotal = new Label("0"); messagesTotal.setStyleName("general-info-count", true); messagesTotal.setCaption("Messages Total"); this.threadsTotal = new Label("0"); threadsTotal.setCaption("Threads Total"); threadsTotal.setStyleName("general-info-count", true); FormLayout mailboxInfoLayout = new FormLayout(messagesTotal, currentHistoryId, threadsTotal); VerticalLayout mailboxInfoMainLayout = new VerticalLayout(mailboxInfoLayout); mailboxInfoMainLayout.setSizeFull(); mailboxInfoMainLayout.setMargin(true); generalInfoPanel.setContent(mailboxInfoMainLayout); // // Stats // final Panel statsPanel = new Panel("<center>Statistics</center>"); statsPanel.addStyleName("frame-bg-stats"); statsPanel.setSizeFull(); this.bodyAvgSize = new Label("0"); bodyAvgSize.setCaption("Body Avg. Size"); bodyAvgSize.setStyleName("stats-count", true); FormLayout statsLayout = new FormLayout(bodyAvgSize); VerticalLayout statsMainLayout = new VerticalLayout(statsLayout); statsMainLayout.setSizeFull(); statsMainLayout.setMargin(true); statsPanel.setContent(statsMainLayout); // // Top 5 // Panel top5Panel = new Panel("<center>Top 5</center>"); top5Panel.addStyleName("frame-bg-top5"); // Top 5 Senders Panel top5SendersPanel = new Panel("<center>Senders</center>"); top5SendersPanel.addStyleName("frame-bg-top5"); top5SendersPanel.setSizeFull(); this.top5Senders = new Label("NO DATA", ContentMode.PREFORMATTED); top5Senders.setSizeUndefined(); top5SendersPanel.setContent(top5Senders); // Top 5 Title Tags Panel top5TitleTagsPanel = new Panel("<center>Title Tags</center>"); top5TitleTagsPanel.addStyleName("frame-bg-top5"); top5TitleTagsPanel.setSizeFull(); this.top5TitleTags = new Label("NO DATA", ContentMode.PREFORMATTED); top5TitleTags.setSizeUndefined(); top5TitleTagsPanel.setContent(top5TitleTags); top5Panel.setSizeFull(); VerticalLayout top5MainLayout = new VerticalLayout(top5SendersPanel, top5TitleTagsPanel); top5MainLayout.setMargin(true); top5MainLayout.setSpacing(true); top5MainLayout.setSizeFull(); top5MainLayout.setComponentAlignment(top5SendersPanel, Alignment.MIDDLE_CENTER); top5MainLayout.setComponentAlignment(top5TitleTagsPanel, Alignment.MIDDLE_CENTER); top5Panel.setContent(top5MainLayout); hlayout.setSpacing(true); hlayout.addComponent(generalInfoPanel); hlayout.addComponent(statsPanel); hlayout.addComponent(top5Panel); this.currentUserEmail = new Label("-"); currentUserEmail.setCaption("Email"); Button reloadButton = new Button("\u27F3 Reload"); reloadButton.addClickListener(e -> { getSession().getSession().invalidate(); getUI().getPage().reload(); }); HorizontalLayout infoHLayout = new HorizontalLayout(); infoHLayout.addStyleName("outlined"); infoHLayout.setSizeFull(); infoHLayout.setSpacing(true); infoHLayout.setMargin(true); infoHLayout.addComponent(reloadButton); reloadButton.setWidth(null); infoHLayout.setComponentAlignment(reloadButton, Alignment.BOTTOM_LEFT); infoHLayout.addComponent(currentUserEmail); currentUserEmail.setWidth(null); infoHLayout.setComponentAlignment(currentUserEmail, Alignment.BOTTOM_RIGHT); vlayout.addComponent(infoHLayout); vlayout.setExpandRatio(infoHLayout, 0.5f); }
From source file:com.haulmont.cuba.web.gui.components.presentations.TablePresentations.java
License:Apache License
protected void initLayout() { setSpacing(true);//from w w w . ja va 2s . co m Label titleLabel = new Label(messages.getMainMessage("PresentationsPopup.title")); titleLabel.setStyleName("c-table-prefs-title"); titleLabel.setWidth("-1px"); addComponent(titleLabel); setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER); menuBar = new CubaMenuBar(); menuBar.setStyleName("c-table-prefs-list"); menuBar.setWidth("100%"); menuBar.setHeight("-1px"); menuBar.setVertical(true); addComponent(menuBar); button = new WebPopupButton(); button.setCaption(messages.getMainMessage("PresentationsPopup.actions")); addComponent(button.<Component>getComponent()); setComponentAlignment(button.<Component>getComponent(), Alignment.MIDDLE_CENTER); textSelectionCheckBox = new CheckBox(); textSelectionCheckBox.setImmediate(true); textSelectionCheckBox.setInvalidCommitted(true); textSelectionCheckBox.setCaption(messages.getMainMessage("PresentationsPopup.textSelection")); addComponent(textSelectionCheckBox); textSelectionCheckBox.setPropertyDataSource(new AbstractProperty() { @Override public Object getValue() { return tableImpl.isTextSelectionEnabled(); } @Override public void setValue(Object newValue) throws Property.ReadOnlyException { if (newValue instanceof Boolean) { tableImpl.setTextSelectionEnabled((Boolean) newValue); } } @Override public Class getType() { return Boolean.class; } }); }
From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java
/** * ?//from w w w.ja va2 s .c o m * @param mainLayout */ private void createlStartSetting(VerticalLayout mainLayout) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); mainLayout.addComponent(layout); Label caption = new Label("??"); caption.setWidth("-1px"); caption.setDescription( "<B>????</B>"); layout.addComponent(caption); startSettingOption = new OptionGroup(); startSettingOption.addItem(true); startSettingOption.addItem(false); startSettingOption.setItemCaption(true, "?"); startSettingOption.setItemCaption(false, ""); startSettingOption.setImmediate(true); startSettingOption.setValue(false); startSettingOption.setReadOnly(true); startSettingOption.setDescription( "<B>????</B>"); startSettingOption.setNullSelectionAllowed(false); startSettingOption.addStyleName("twocol200"); startSettingOption.addStyleName("myopacity"); layout.addComponent(startSettingOption); }
From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java
/** * (????)/* ww w . j av a2s . co m*/ * @param mainLayout */ private void createlDaysOfWeekType(VerticalLayout mainLayout) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); mainLayout.addComponent(layout); Label caption = new Label(""); caption.setWidth("-1px"); caption.setDescription("<B>?</B>"); layout.addComponent(caption); dayOfWeekTypeSelector = new ComboBox(); dayOfWeekTypeSelector.addItem("weekday"); dayOfWeekTypeSelector.setItemCaption("weekday", ""); dayOfWeekTypeSelector.addItem("weekend"); dayOfWeekTypeSelector.setItemCaption("weekend", ""); dayOfWeekTypeSelector.addItem("custom"); dayOfWeekTypeSelector.setItemCaption("custom", ""); dayOfWeekTypeSelector.setWidth("200px"); dayOfWeekTypeSelector.setImmediate(true); dayOfWeekTypeSelector.setReadOnly(true); dayOfWeekTypeSelector.setDescription("<B>?</B>"); dayOfWeekTypeSelector.setNullSelectionAllowed(false); dayOfWeekTypeSelector.addListener(this); layout.addComponent(dayOfWeekTypeSelector); }
From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java
/** * (??...) ???/*from w w w .j ava2s .c o m*/ * @param mainLayout */ private void createlDayOfWeek(VerticalLayout mainLayout) { dayOfWeekLayout = new HorizontalLayout(); dayOfWeekLayout.setSpacing(true); dayOfWeekLayout.setVisible(false); mainLayout.addComponent(dayOfWeekLayout); Label caption = new Label(""); caption.setWidth("-1px"); caption.setDescription("<B>?</B>"); dayOfWeekLayout.addComponent(caption); BeanItemContainer<DayOfWeek> container = new BeanItemContainer<DayOfWeek>(DayOfWeek.class); container.addBean(DayOfWeek.sun); container.addBean(DayOfWeek.mon); container.addBean(DayOfWeek.tue); container.addBean(DayOfWeek.wen); container.addBean(DayOfWeek.thu); container.addBean(DayOfWeek.fri); container.addBean(DayOfWeek.sat); daysOfWeekOption = new OptionGroup(); daysOfWeekOption.setContainerDataSource(container); daysOfWeekOption.setItemCaptionPropertyId("name"); daysOfWeekOption.setMultiSelect(true); daysOfWeekOption.setNullSelectionAllowed(false); daysOfWeekOption.setImmediate(true); daysOfWeekOption.setReadOnly(true); daysOfWeekOption.setDescription("<B>?</B>"); daysOfWeekOption.addStyleName("threecol300"); daysOfWeekOption.addStyleName("myopacity"); dayOfWeekLayout.addComponent(daysOfWeekOption); }
From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java
/** * ? (18:00 - 23:59 )/*from www.j av a 2s . co m*/ * @param mainLayout */ private void createRunRedirectTime(VerticalLayout mainLayout) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); mainLayout.addComponent(layout); Label caption = new Label(""); caption.setWidth("-1px"); caption.setDescription("<B></B>"); layout.addComponent(caption); startRedirectHour = new ComboBox(); startRedirectHour.setImmediate(true); startRedirectHour.setWidth("50px"); startRedirectHour.setNullSelectionAllowed(false); layout.addComponent(startRedirectHour); Label space1 = new Label(" "); space1.setWidth("-1px"); layout.addComponent(space1); startRedirectMinute = new ComboBox(); startRedirectMinute.setImmediate(true); startRedirectMinute.setWidth("50px"); startRedirectMinute.setNullSelectionAllowed(false); layout.addComponent(startRedirectMinute); Label to = new Label(" - "); to.setWidth("-1px"); layout.addComponent(to); stopRedirectHour = new ComboBox(); stopRedirectHour.setImmediate(true); stopRedirectHour.setWidth("50px"); stopRedirectHour.setNullSelectionAllowed(false); layout.addComponent(stopRedirectHour); Label space2 = new Label(" "); space2.setWidth("-1px"); layout.addComponent(space2); stopRedirectMinute = new ComboBox(); stopRedirectMinute.setImmediate(true); stopRedirectMinute.setWidth("50px"); stopRedirectMinute.setNullSelectionAllowed(false); layout.addComponent(stopRedirectMinute); for (int hour = 0; hour < 24; hour++) { startRedirectHour.addItem(hour); stopRedirectHour.addItem(hour); } for (int minute = 0; minute < 60; minute++) { startRedirectMinute.addItem(minute); stopRedirectMinute.addItem(minute); } startRedirectHour.setValue(18); stopRedirectHour.setValue(23); startRedirectMinute.setValue(0); stopRedirectMinute.setValue(59); startRedirectHour.setReadOnly(true); startRedirectMinute.setReadOnly(true); stopRedirectHour.setReadOnly(true); stopRedirectMinute.setReadOnly(true); }