List of usage examples for com.vaadin.ui PopupView setCaption
@Override public void setCaption(String caption)
From source file:com.cavisson.gui.dashboard.components.controls.PopupViews.java
License:Apache License
public PopupViews() { setMargin(true);/* w w w .j a va 2s .c om*/ Label h1 = new Label("Popup Views"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); PopupView pv = new PopupView(new Content() { @Override public Component getPopupComponent() { return new VerticalLayout() { { setMargin(true); setWidth("300px"); addComponent(new Label( "Fictum, deserunt mollit anim laborum astutumque! Magna pars studiorum, prodita quaerimus.")); } }; } @Override public String getMinimizedValueAsHTML() { return "Click to view"; } }); row.addComponent(pv); pv.setHideOnMouseOut(true); pv.setCaption("Hide on mouse-out"); pv = new PopupView(new Content() { int count = 0; @Override public Component getPopupComponent() { try { Thread.sleep(1000); } catch (InterruptedException e) { } return new VerticalLayout() { { setMargin(true); addComponent(new Label("<h3>Thanks for waiting!</h3><p>You've opened this popup <b>" + ++count + " time" + (count > 1 ? "s" : " only") + "</b>.</p>", ContentMode.HTML)); } }; } @Override public String getMinimizedValueAsHTML() { return "Show slow loading content"; } }); row.addComponent(pv); pv.setHideOnMouseOut(false); pv.setCaption("Hide on click-outside"); }
From source file:org.ikasan.dashboard.ui.dashboard.panel.DashboardPanel.java
License:BSD License
@Subscribe public void receiveAlertEvent(final AlertEvent event) { UI.getCurrent().access(new Runnable() { @Override/*from w w w . jav a 2 s. c om*/ public void run() { VaadinSession.getCurrent().getLockInstance().lock(); try { Item item = container.addItemAt(0, event.getAlert() + this); Property<String> alertProperty = item.getItemProperty("Alert"); alertProperty.setValue(event.getAlert()); final Property<String> moduleProperty = item.getItemProperty("Module"); moduleProperty.setValue(event.getModule()); TextArea notesField = new TextArea("Notes"); notesField.setWidth("500px"); notesField.setRequired(false); notesField.setHeight("150px"); notesField.setImmediate(true); notesField.setStyleName("coursedetailtext"); // popup notes view final PopupView notesPopupView = new PopupView("Details", notesField); notesPopupView.setCaption("Details"); notesPopupView.setHideOnMouseOut(false); notesPopupView.setData(event.getAlert() + this); final Property<PopupView> detailsProperty = item.getItemProperty("Details"); detailsProperty.setValue(notesPopupView); System.out.println("container = " + container); System.out.println("Item = " + item); } finally { VaadinSession.getCurrent().getLockInstance().unlock(); } // UI.getCurrent().push(); } }); }