List of usage examples for com.vaadin.ui Label setValue
public void setValue(String value)
From source file:com.selzlein.lojavirtual.vaadin.core.NavigationMenu.java
License:Open Source License
/** * Adds menu separator item.//from w ww.j a v a 2s.c o m * Possible to add number badge for this item for showing active to-dos for example. * * @param titleKey * @param badgeValue number that will appear in upper right corner of menu item */ public void addMenuSeparator(String titleKey, Integer badgeValue) { Label label = new Label(ui.getMessage(titleKey), ContentMode.HTML); if (badgeValue != null) { label.setValue(label.getValue() + "<span class=\"valo-menu-badge\">" + badgeValue + "</span>"); } label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); mainMenu.addComponent(label); }
From source file:com.skysql.manager.ui.CalendarDialog.java
License:Open Source License
/** * Initializes a modal window to edit schedule event. * * @param event the event/*from w ww . j ava 2 s . c o m*/ * @param newEvent the new event */ private void createCalendarEventPopup(CalendarCustomEvent event, boolean newEvent) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); scheduleEventPopup = new Window(null, layout); scheduleEventPopup.setWidth("400px"); scheduleEventPopup.setModal(true); scheduleEventPopup.center(); Date occurrence = event.getOccurrence(); if (!newEvent && occurrence != null) { Form form = new Form(); form.setCaption("This is a repeat occurrence"); layout.addComponent(form); DateField dateField = new DateField("Occurrence Start"); if (useSecondResolution) { dateField.setResolution(Resolution.SECOND); } else { dateField.setResolution(Resolution.MINUTE); } dateField.setValue(event.getStart()); dateField.setEnabled(false); form.addField("dateField", dateField); form.setFooter(null); HorizontalLayout editLayout = new HorizontalLayout(); editLayout.setSpacing(true); layout.addComponent(editLayout); final Label label = new Label("Click to change the original event below:"); editLayout.addComponent(label); editLayout.setComponentAlignment(label, Alignment.BOTTOM_LEFT); editOriginalButton = new Button("Edit", new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent clickEvent) { scheduleEventForm.setEnabled(true); applyEventButton.setEnabled(true); label.setValue("Editing original event:"); editOriginalButton.setVisible(false); } }); editLayout.addComponent(editOriginalButton); scheduleEventForm.setEnabled(false); } else { scheduleEventForm.setEnabled(true); } layout.addComponent(scheduleEventForm); applyEventButton = new Button("Add", new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { commitCalendarEvent(); } }); Button cancel = new Button("Cancel", new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { discardCalendarEvent(); } }); deleteEventButton = new Button("Delete", new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { deleteCalendarEvent(); } }); scheduleEventPopup.addListener(new CloseListener() { private static final long serialVersionUID = 1L; public void windowClose(CloseEvent e) { discardCalendarEvent(); } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(deleteEventButton); buttons.addComponent(cancel); buttons.addComponent(applyEventButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); }
From source file:com.squadd.chat.ChatController.java
public static Panel createDatePanel(ChatMessage mess) { Panel datePanel = new Panel(); //FormLayout form = new FormLayout(); //form.setMargin(false); Label dateLabel = new Label(mess.getFormattedDate()); dateLabel.addStyleName("dateLabel"); dateLabel.setValue("YrMOOOm"); //form.addComponent(dateLabel); //datePanel.setContent(form); datePanel.setContent(dateLabel);/*from w w w. j a va 2s. c o m*/ datePanel.setWidth("100px"); datePanel.setHeight("50px"); return datePanel; }
From source file:com.squadd.UI.MainInformationAboutGroup.java
private void applyChanges() { Label groupName = groupInfo.getGroupName(); Label placeName = groupInfo.getPlaceName(); Label date = groupInfo.getDate(); Label description = groupInfo.getDescr(); String valGr = new String("Group Name: " + editVersion.getGroupName().getValue()); String valPl = new String("Place: " + editVersion.getPlaceName().getValue()); String valDt = (editVersion.getDate().getValue() == null) ? "Place: " : new String("Date: " + editVersion.getDate().getValue().toString()); String valDs = new String("Description: " + editVersion.getDescr().getValue()); groupName.setValue(valGr); placeName.setValue(valPl);//from w w w.ja v a2s.c om date.setValue(valDt); description.setValue(valDs); }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private void addDatum(String cap, String val, Object container) { Label lb = new Label(); lb.setImmediate(true);//from w w w . java 2 s.c o m lb.setStyleName("label_ud"); lb.setCaption(cap + ": "); lb.setValue(val); if (container instanceof HorizontalLayout) { ((HorizontalLayout) container).addComponent(lb); } else if (container instanceof FormLayout) { ((FormLayout) container).addComponent(lb); ((FormLayout) container).setSpacing(false); } else { ((VerticalLayout) container).addComponent(lb); ((VerticalLayout) container).setSpacing(false); } }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private HorizontalLayout getPC() { VerticalLayout cAgentInfo = new VerticalLayout(); final HorizontalLayout cPlaceholder = new HorizontalLayout(); cAgentInfo.setMargin(new MarginInfo(true, true, true, true)); cAgentInfo.setStyleName("c_details_test"); final VerticalLayout cLBody = new VerticalLayout(); cLBody.setStyleName("c_body_visible"); tb = new Table("Linked child accounts"); // addLinksTable(); final VerticalLayout cAllProf = new VerticalLayout(); HorizontalLayout cProfActions = new HorizontalLayout(); final FormLayout cProfName = new FormLayout(); cProfName.setStyleName("frm_profile_name"); cProfName.setSizeUndefined();/*from w ww .j a v a 2 s . co m*/ final Label lbProf = new Label(); final TextField tFProf = new TextField(); lbProf.setCaption("Profile Name: "); lbProf.setValue("Certified Authorized User."); tFProf.setCaption(lbProf.getCaption()); cProfName.addComponent(lbProf); final Button btnEdit = new Button(); btnEdit.setIcon(FontAwesome.EDIT); btnEdit.setStyleName("btn_link"); btnEdit.setDescription("Edit profile name"); final Button btnCancel = new Button(); btnCancel.setIcon(FontAwesome.UNDO); btnCancel.setStyleName("btn_link"); btnCancel.setDescription("Cancel Profile name editting."); Button btnAdd = new Button("+"); // btnAdd.setIcon(FontAwesome.EDIT); btnAdd.setStyleName("btn_link"); btnAdd.setDescription("Set new profile"); Button btnRemove = new Button("-"); // btnRemove.setIcon(FontAwesome.EDIT); btnRemove.setStyleName("btn_link"); btnRemove.setDescription("Remove current profile"); // cProf.addComponent(cProfName); cProfActions.addComponent(btnEdit); cProfActions.addComponent(btnCancel); cProfActions.addComponent(btnAdd); cProfActions.addComponent(btnRemove); btnCancel.setVisible(false); cAllProf.addComponent(cProfName); cAllProf.addComponent(cProfActions); cAllProf.setComponentAlignment(cProfActions, Alignment.TOP_CENTER); cLBody.addComponent(cAllProf); // cLBody.addComponent(tb); tb.setSelectable(true); cAgentInfo.addComponent(cLBody); btnLink = new Button("Add New Link"); btnLink.setIcon(FontAwesome.LINK); btnLink.setDescription("Link new account."); // cLBody.addComponent(btnLink); // cLBody.setComponentAlignment(btnLink, Alignment.TOP_LEFT); btnLink.addClickListener(new LinkClickHandler()); cPlaceholder.setVisible(false); addLinkUserContainer(); cPlaceholder.setWidth("100%"); cLBody.addComponent(cPlaceholder); cLBody.setComponentAlignment(cPlaceholder, Alignment.TOP_CENTER); HorizontalLayout c = new HorizontalLayout(); c.addComponent(cAgentInfo); btnEdit.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -8427226211153164650L; @Override public void buttonClick(ClickEvent event) { if (btnEdit.getIcon().equals(FontAwesome.EDIT)) { tFProf.setValue(lbProf.getValue()); tFProf.selectAll(); cProfName.replaceComponent(lbProf, tFProf); btnEdit.setIcon(FontAwesome.SAVE); btnCancel.setVisible(true); return; } else if (btnEdit.getIcon().equals(FontAwesome.SAVE)) { lbProf.setValue(tFProf.getValue()); cProfName.replaceComponent(tFProf, lbProf); btnEdit.setIcon(FontAwesome.EDIT); btnCancel.setVisible(false); return; } lbProf.setValue(tFProf.getValue()); cProfName.replaceComponent(tFProf, lbProf); btnEdit.setIcon(FontAwesome.EDIT); btnCancel.setVisible(false); } }); btnCancel.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -2870045546205986347L; @Override public void buttonClick(ClickEvent event) { cProfName.replaceComponent(tFProf, lbProf); btnEdit.setIcon(FontAwesome.EDIT); btnCancel.setVisible(false); } }); btnAdd.addClickListener(new AddProfileHandler(cAllProf, cPlaceholder)); btnRemove.addClickListener(new RemoveProfileHandler(pop)); return c; }
From source file:com.terralcode.gestion.frontend.view.widgets.desplegable.ComponenteDesplegableView.java
private Component buildCustomerDetail() { GridLayout miGrid = new GridLayout(3, 2); ComboBox combo = new ComboBox(); combo.addValueChangeListener(new Property.ValueChangeListener() { @Override/*from ww w .ja v a2s . co m*/ public void valueChange(Property.ValueChangeEvent event) { seleccion = (String) event.getProperty().getValue(); } }); combo.addItems("Pocino Ibrico", "Pocino Blanco", "Ovino", "Vacuno", "Avicultura", "Otros"); // combo.addItem(especies); Label informacion = new Label("datos"); Button botonMas = new Button("+"); botonMas.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Integer clave; if (valores.containsValue(seleccion)) { clave = 1; if (!valores.isEmpty()) { clave = valores.size() + 1; } valores.put(clave, seleccion); } informacion.setValue(mostrarValores()); Notification.show(seleccion + " aadido"); } }); Button botonMenos = new Button("-"); miGrid.addComponent(informacion, 0, 0); miGrid.addComponent(combo, 0, 1); miGrid.addComponent(botonMas, 1, 1); miGrid.addComponent(botonMenos, 2, 1); return miGrid; }
From source file:com.trender.user.component.UserForm.java
public Component ProfilForm() { addStyleName("light"); setWidth(90, Unit.PERCENTAGE);//from ww w . j a va2 s.co m Label title = new Label(); title.setStyleName("h2"); title.setValue(""); passwordField = new PasswordField(" "); passwordField.setInputPrompt("12345678"); passwordField.setWidth(80, Unit.PERCENTAGE); surnameField = new TextField("?"); surnameField.addValidator(new StringLengthValidator( " , " + "? 2 ?, ?? 45", 2, 45, false)); surnameField.addValidator(new RegexpValidator(regexpValue, " " + " ?? ? ?")); surnameField.setInputPrompt("?"); surnameField.setWidth(80, Unit.PERCENTAGE); nameField = new TextField("?"); nameField.addValidator(new StringLengthValidator(" ?, ? " + " 2 ?, ?? 45", 2, 45, false)); nameField.addValidator(new RegexpValidator(regexpValue, " " + " ?? ? ?")); nameField.setInputPrompt("?"); nameField.setWidth(80, Unit.PERCENTAGE); performButton = new Button(""); performButton.setStyleName("v-button-friendly"); clearButton = new Button("?"); clearButton.setStyleName("v-button-quiet"); horizontalLayout = new HorizontalLayout(); horizontalLayout.addComponent(performButton); horizontalLayout.addComponent(clearButton); horizontalLayout.setSpacing(true); horizontalLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); horizontalLayout.setMargin(new MarginInfo(true, false, false, true)); addComponent(title); addComponent(passwordField); addComponent(surnameField); addComponent(nameField); addComponent(horizontalLayout); return this; }
From source file:de.catma.ui.repository.wizard.IndexerOptionsPanel.java
License:Open Source License
private void initComponents() { setSpacing(true);//from w w w .j a v a 2s . c o m setSizeFull(); Label infoLabel = new Label(); infoLabel.setContentMode(Label.CONTENT_XHTML); infoLabel.setValue("<p>This section allows you to finetune the creation " + "of the word list of your Source Document.</p>" + "<p>If you are unsure what to do, just select the language " + "and leave everything else unmodified.</p>"); addComponent(infoLabel, 0, 0, 2, 0); cbUseApostrophe = new CheckBox("always use the apostrophe as a word separator"); addComponent(cbUseApostrophe, 0, 1, 2, 1); Locale[] all = Locale.getAvailableLocales(); sortedLangs = new TreeSet<LanguageItem>(); for (Locale locale : all) { sortedLangs.add(new LanguageItem(locale)); } languagesListSelect = new ListSelect("Please select the predominant language of the Source Document:", sortedLangs); languagesListSelect.setNullSelectionAllowed(false); languagesListSelect.setSizeFull(); languagesListSelect.setImmediate(true); addComponent(languagesListSelect, 0, 2, 0, 3); unseparableCharacterSequencesListSelect = new ListSelect("Unseparable character sequences:"); unseparableCharacterSequencesListSelect.setNullSelectionAllowed(false); unseparableCharacterSequencesListSelect.setSizeFull(); unseparableCharacterSequencesListSelect.setImmediate(true); addComponent(unseparableCharacterSequencesListSelect, 1, 2, 1, 3); HorizontalLayout ucsAddRemoveLayout = new HorizontalLayout(); Panel ucsAddRemovePanel = new Panel(ucsAddRemoveLayout); ucsAddRemovePanel.setStyleName(Reindeer.PANEL_LIGHT); ucsAddRemoveLayout.setSpacing(true); ucsAddRemoveLayout.setSizeFull(); btAddUcs = new Button("Add entry"); btAddUcs.setEnabled(false); ucsAddRemovePanel.addComponent(btAddUcs); tfUcs = new TextField(); tfUcs.setInputPrompt("Add things like 'e.g.' as you see fit."); tfUcs.setImmediate(true); tfUcs.setTextChangeEventMode(TextChangeEventMode.EAGER); tfUcs.setWidth("100%"); ucsAddRemovePanel.addComponent(tfUcs); ucsAddRemoveLayout.setExpandRatio(tfUcs, 2); btRemoveUcs = new Button("Remove entry"); btRemoveUcs.setEnabled(false); ucsAddRemovePanel.addComponent(btRemoveUcs); addComponent(ucsAddRemovePanel, 1, 4); VerticalLayout loadSavePanel = new VerticalLayout(); loadSavePanel.setSpacing(true); loadSavePanel.setWidth("80px"); btLoadUcsList = new Button("Load list"); loadSavePanel.addComponent(btLoadUcsList); btSaveUcsList = new Button("Save list"); loadSavePanel.addComponent(btSaveUcsList); addComponent(loadSavePanel, 2, 2); setColumnExpandRatio(0, 2); setColumnExpandRatio(1, 2); setRowExpandRatio(2, 2); setRowExpandRatio(3, 2); }
From source file:de.catma.ui.Slider.java
License:Open Source License
public Slider(String caption, int min, int max, final String unit) { this.setCaption(caption); setSizeUndefined();/*from w w w . ja v a 2 s . c o m*/ HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setSpacing(true); this.sliderComp = new SliderComp(min, max); minLabel = new Label(String.valueOf(min)); maxLabel = new Label(String.valueOf(max)); sliderLayout.addComponent(minLabel); sliderLayout.addComponent(sliderComp); sliderLayout.addComponent(maxLabel); addComponent(sliderLayout); setComponentAlignment(sliderLayout, Alignment.MIDDLE_CENTER); final Label current = new Label(sliderComp.getValue().toString()); current.setWidth("100%"); current.addStyleName("slider-centered-text"); addComponent(current); setComponentAlignment(current, Alignment.MIDDLE_CENTER); sliderComp.addListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { current.setValue(event.getProperty().getValue() + (unit.isEmpty() ? "" : " ") + unit); } }); }