List of usage examples for com.vaadin.server ExternalResource ExternalResource
public ExternalResource(String sourceURL)
From source file:org.rubicone.poc.vpush.uil.sending.SendingUI.java
License:Apache License
private Panel createInstructionsPanel() { Panel instructionsPanel = new Panel("instructions"); VerticalLayout instructionsLayout = new VerticalLayout(); instructionsPanel.setContent(instructionsLayout); Label instructionsLabel = new Label( "open another UI receiving notifications from server using following transport:"); instructionsLayout.addComponent(instructionsLabel); Link websocketsUILink = new Link("websockets", new ExternalResource("./receive-messages-websockets")); websocketsUILink.setIcon(VaadinIcons.CHEVRON_RIGHT_SMALL); websocketsUILink.setTargetName("_blank"); instructionsLayout.addComponent(websocketsUILink); Link websocketsXhrUILink = new Link("websockets + XHR", new ExternalResource("./receive-messages-websocketsxhr")); websocketsXhrUILink.setIcon(VaadinIcons.CHEVRON_RIGHT_SMALL); websocketsXhrUILink.setTargetName("_blank"); instructionsLayout.addComponent(websocketsXhrUILink); Link httpLongPollingUILink = new Link("HTTP long polling", new ExternalResource("./receive-messages-httplongpolling")); httpLongPollingUILink.setIcon(VaadinIcons.CHEVRON_RIGHT_SMALL); httpLongPollingUILink.setTargetName("_blank"); instructionsLayout.addComponent(httpLongPollingUILink); Label noteLabel = new Label( "<i>" + VaadinIcons.INFO_CIRCLE_O.getHtml() + " note: you may open several UIs at the same time to receive push notifications</i>", ContentMode.HTML);/*from w w w .j a va2s. c o m*/ noteLabel.addStyleName(ValoTheme.LABEL_TINY); instructionsLayout.addComponents(noteLabel); return instructionsPanel; }
From source file:org.sensorhub.ui.SOSConfigForm.java
License:Mozilla Public License
@Override public void build(String title, MyBeanItem<? extends Object> beanItem) { super.build(title, beanItem); // add link to capabilities Property<?> endPointProp = beanItem.getItemProperty(PROP_ENDPOINT); if (endPointProp != null) { String baseUrl = ((String) endPointProp.getValue()).substring(1); String href = baseUrl + "?service=SOS&version=2.0&request=GetCapabilities"; Link link = new Link("Link to capabilities", new ExternalResource(href), "_blank", 0, 0, null); this.addComponent(link, 0); }/* ww w.jav a 2s . c o m*/ }
From source file:org.vaadin.addon.leaflet.demoandtestapp.util.TListUi.java
License:Apache License
private void loadTestClasses(TListUi aThis) { if (testClassess != null) { return;//from w w w. j a v a 2s .c o m } testClassess = listTestClasses(); Table table = new Table("Test cases", testClassess); table.addGeneratedColumn("name", new Table.ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); Link link = new Link(); link.setResource(new ExternalResource("/" + name)); link.setCaption(name); link.setTargetName("_new"); return link; } }); table.addGeneratedColumn("description", new Table.ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); return new Label(description); } }); table.setSizeFull(); table.setColumnExpandRatio("description", 1); setContent(table); }
From source file:org.vaadin.addon.levelindicator.demoandtestapp.TListUi.java
License:Apache License
private void loadTestClasses(TListUi aThis) { if (testClassess != null) { return;/*w w w . java 2 s. co m*/ } testClassess = listTestClasses(); Table table = new Table("Test cases", testClassess); table.addGeneratedColumn("name", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); Link link = new Link(); link.setResource(new ExternalResource("/" + name)); link.setCaption(name); link.setTargetName("_new"); return link; } }); table.addGeneratedColumn("description", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); return new Label(description); } }); table.setSizeFull(); table.setColumnExpandRatio("description", 1); setContent(table); }
From source file:org.vaadin.addon.touchkitstuff.demoandtestapp.TListUi.java
License:Apache License
private void loadTestClasses(TListUi aThis) { if (testClassess != null) { return;// w w w . j a v a 2 s . com } testClassess = listTestClasses(); Table table = new Table("Test cases", testClassess); table.addGeneratedColumn("name", new Table.ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); Link link = new Link(); link.setResource(new ExternalResource("/" + name)); link.setCaption(name); link.setTargetName("_new"); return link; } }); table.addGeneratedColumn("description", new Table.ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); return new Label(description); } }); table.setSizeFull(); table.setColumnExpandRatio("description", 1); VerticalLayout verticalLayout = new VerticalLayout(); TextField filter = new TextField(); filter.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { String text = event.getText(); testClassess.removeAllContainerFilters(); testClassess.addContainerFilter("name", text, true, false); } }); verticalLayout.addComponent(filter); filter.focus(); verticalLayout.addComponent(table); setContent(verticalLayout); }
From source file:org.vaadin.addonhelpers.TListUi.java
License:Apache License
private void loadTestClasses(TListUi aThis) { if (testClassess != null) { return;/* w w w . ja v a2 s .c om*/ } testClassess = listTestClasses(); Table table = new Table("Test cases", testClassess); table.setVisibleColumns("name", "description"); table.addGeneratedColumn("name", new Table.ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); Class clazz = (Class) source.getItem(itemId).getItemProperty("clazz").getValue(); Link link = new Link(); link.setResource(new ExternalResource("/" + clazz.getName())); link.setCaption(name); link.setTargetName("_new"); return link; } }); table.addGeneratedColumn("description", new Table.ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); return new Label(description); } }); table.setSizeFull(); table.setColumnExpandRatio("description", 1); VerticalLayout verticalLayout = new VerticalLayout(); TextField filter = new TextField(); filter.setInputPrompt("Filter list"); filter.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { String text = event.getText(); testClassess.removeAllContainerFilters(); testClassess.addContainerFilter("name", text, true, false); } }); verticalLayout.addComponent(filter); filter.focus(); verticalLayout.addComponent(table); verticalLayout.setSizeFull(); verticalLayout.setExpandRatio(table, 1); verticalLayout.setMargin(true); setContent(verticalLayout); }
From source file:org.vaadin.addons.sitekit.viewlet.user.ProfileImageViewlet.java
License:Apache License
@Override public void enter(final String parameters) { final String user = getSite().getSecurityProvider().getUser(); if (user == null) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(false);// ww w . j a v a 2s. c o m final Link link = new Link(null, new ExternalResource("#!login")); link.setStyleName("gravatar"); link.setIcon(getSite().getIcon("view-icon-login")); link.setWidth(32, UNITS_PIXELS); link.setHeight(32, UNITS_PIXELS); layout.addComponent(link); layout.setComponentAlignment(link, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layout); return; } try { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); if (getSite().getSiteContext().getObject("gravatar-url") == null) { getSite().getSiteContext().putObject("gravatar-url", getGravatarUrl(user)); } final URL gravatarUrl = new URL((String) getSite().getSiteContext().getObject("gravatar-url")); //final Embedded embedded = new Embedded(null, new ExternalResource(gravatarUrl)); final Link link = new Link(null, new ExternalResource("http://www.gravatar.com/")); link.setStyleName("gravatar"); link.setIcon(new ExternalResource(gravatarUrl)); link.setWidth(32, UNITS_PIXELS); link.setHeight(32, UNITS_PIXELS); layout.addComponent(link); layout.setComponentAlignment(link, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layout); } catch (final Exception e) { LOGGER.warn("Error reading gravatar image for user: " + user, e); } }
From source file:org.vaadin.alump.fancylayouts.demo.FancyLayoutsUI.java
License:Apache License
private ComponentContainer buildWelcome() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/* w w w . j av a 2 s . com*/ layout.setSpacing(true); layout.setWidth("100%"); Label header = new Label("This is online demo for FancyLayouts Vaadin AddOn."); header.addStyleName("demo-header"); layout.addComponent(header); StringBuilder sb = new StringBuilder(); sb.append( "FancyLayouts adds transitions to UI when you replace content with new. This allows you to have fancier UI in your vaadin based application."); sb.append( " Currently package contains Image widget that can be used to present multiple images in one component slot. And Panel widget which is useful"); sb.append(" if you have to replace content inside your UI often."); Label desc = new Label(sb.toString()); desc.addStyleName("demo-desc"); layout.addComponent(desc); layout.setExpandRatio(desc, 1.0f); Link link = new Link("Source code of this demo application", new ExternalResource( "https://github.com/alump/FancyLayouts/blob/master/fancylayouts-demo/src/main/java/org/vaadin/alump/fancylayouts/demo/FancyLayoutsUI.java")); layout.addComponent(link); Button sourceLink = new Button(); sourceLink.addStyleName(BaseTheme.BUTTON_LINK); return layout; }
From source file:org.vaadin.alump.fancylayouts.demo.ImageDemo.java
License:Apache License
private List<Resource> getImageResources() { List<Resource> list = new ArrayList<Resource>(); list.add(new ExternalResource("http://misc.siika.fi/fancy-demo1.jpg")); list.add(new ExternalResource("http://misc.siika.fi/fancy-demo2.jpg")); list.add(new ExternalResource("http://misc.siika.fi/fancy-demo3.jpg")); // Image is only added if present in file system. Will not be there // unless manually added! File fileResImage = new File("/tmp/test.png"); if (fileResImage.exists()) { list.add(new FileResource(fileResImage)); }//from w w w .j a v a2s .c o m return list; }
From source file:org.vaadin.alump.fancylayouts.demo.PanelDemo.java
License:Apache License
/** * Sample content for panel//from ww w .ja v a 2s .c o m * * @return */ private ComponentContainer createPanelContentA() { VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setMargin(true); layout.setSpacing(true); Label label = new Label(LOREM_STR); layout.addComponent(label); Embedded image = new Embedded(); image.setSource(new ExternalResource("http://misc.siika.fi/fancy-demo1.jpg")); image.setWidth("500px"); image.setHeight("281px"); layout.addComponent(image); return layout; }