List of usage examples for com.vaadin.ui Link Link
public Link(String caption, Resource resource)
From source file:fi.jasoft.dragdroplayouts.demo.views.DragdropAbsoluteLayoutDemo.java
License:Apache License
@Override public Component getLayout() { // start-source final DDAbsoluteLayout layout = new DDAbsoluteLayout(); layout.setId("layout"); layout.setSizeFull();/*from ww w.java 2 s .c o m*/ // Enable dragging components layout.setDragMode(LayoutDragMode.CLONE); // Enable dropping components layout.setDropHandler(new DefaultAbsoluteLayoutDropHandler()); // Add some components Label lbl = new Label("This is an Absolute layout, you can freely drag the components around"); layout.addComponent(lbl); Button btn = new Button("Button 1", new Button.ClickListener() { public void buttonClick(ClickEvent event) { Notification.show("Click!"); } }); btn.setId("button"); layout.addComponent(btn, "left:50px; top:50px"); Link link = new Link("A link to Vaadin", new ExternalResource("http://www.vaadin.com")); layout.addComponent(link, "left:200px; top:100px"); // end-source return layout; }
From source file:fi.racetrace.adminpanel.ui.columngenerator.CustomerLinkGC.java
License:Open Source License
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Link lnk = new Link("Show details", new ExternalResource("#!" + CustomerDetails.NAME + "/" + ((Customer) itemId).getId())); return lnk;/*from w w w.j a va 2 s . co m*/ }
From source file:fi.racetrace.adminpanel.ui.CustomerDetails.java
License:Open Source License
private void buildBreadcrumbs() { HorizontalLayout b = new HorizontalLayout(); layout.addComponent(b);//from w ww .ja v a 2s.co m b.addComponent(new Link("Customers", new ExternalResource("#!"))); b.addComponent(new Label(" >> ")); b.addComponent(new Link((String) customer.getItemProperty("name").getValue(), new ExternalResource( "#!" + CustomerDetails.NAME + "/" + customer.getItemProperty("id").getValue()))); }
From source file:fi.racetrace.adminpanel.ui.CustomerEventTable.java
License:Open Source License
@Override protected void initTable() { table = new Table("Events", dataSource) { @Override//www.ja va2 s.c o m protected String formatPropertyValue(Object rowId, Object colId, Property<?> property) { if (property.getType() == Date.class && property.getValue() != null) { SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy"); return df.format((Date) property.getValue()); } return super.formatPropertyValue(rowId, colId, property); } }; table.addGeneratedColumn("detailsLink", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Link lnk = new Link("Show details", new ExternalResource( "#!" + EventDetails.NAME + "/" + ((fi.racetrace.adminpanel.data.Event) itemId).getId())); return lnk; } }); table.addGeneratedColumn("sessionCount", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { List<Session> sessions = ((fi.racetrace.adminpanel.data.Event) itemId).getSessions(); int sessionCount = 0; if (sessions != null) { sessionCount = sessions.size(); } Label label = new Label("" + sessionCount); return label; } }); }
From source file:fi.racetrace.adminpanel.ui.CustomerList.java
License:Open Source License
private void buildBreadcrumbs() { HorizontalLayout b = new HorizontalLayout(); customerList.addComponent(b);//from w ww .j a v a 2 s . c om b.addComponent(new Link("Customers", new ExternalResource("#!"))); }
From source file:fi.racetrace.adminpanel.ui.EventDetails.java
License:Open Source License
private void buildBreadcrumbs() { HorizontalLayout b = new HorizontalLayout(); layout.addComponent(b);//ww w . jav a2 s.c o m b.addComponent(new Link("Customers", new ExternalResource("#!"))); b.addComponent(new Label(" >> ")); b.addComponent(new Link(event.getCustomer().getName(), new ExternalResource("#!" + CustomerDetails.NAME + "/" + event.getCustomer().getId()))); b.addComponent(new Label(" >> ")); b.addComponent(new Link(event.getName(), new ExternalResource("#!" + NAME + "/" + event.getId()))); }
From source file:fi.racetrace.adminpanel.ui.SessionDetails.java
License:Open Source License
private void buildBreadcrumbs() { HorizontalLayout b = new HorizontalLayout(); layout.addComponent(b);/*w w w .j ava 2 s . com*/ b.addComponent(new Link("Customers", new ExternalResource("#!"))); b.addComponent(new Label(" >> ")); b.addComponent(new Link(session.getEvent().getCustomer().getName(), new ExternalResource( "#!" + CustomerDetails.NAME + "/" + session.getEvent().getCustomer().getId()))); b.addComponent(new Label(" >> ")); b.addComponent(new Link(session.getEvent().getName(), new ExternalResource("#!" + EventDetails.NAME + "/" + session.getEvent().getId()))); b.addComponent(new Label(" >> ")); b.addComponent(new Link(session.getName(), new ExternalResource("#!" + NAME + "/" + session.getId()))); }
From source file:fi.racetrace.adminpanel.ui.SessionTable.java
License:Open Source License
@Override protected void initTable() { table = new Table("Sessions", dataSource) { @Override/*from w w w .j ava 2s . co m*/ protected String formatPropertyValue(Object rowId, Object colId, Property<?> property) { if (property.getType() == Date.class && property.getValue() != null) { SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy"); return df.format((Date) property.getValue()); } return super.formatPropertyValue(rowId, colId, property); } }; table.addGeneratedColumn("detailsLink", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Link lnk = new Link("Show details", new ExternalResource("#!" + SessionDetails.NAME + "/" + ((Session) itemId).getId())); return lnk; } }); }
From source file:fi.vtt.RVaadin.RContainer.java
License:Apache License
/** * Get a Vaadin Window element that contains the corresponding R plot * generated by submitting and evaluating the RPlotCall String. The * imageName corresponds to the downloadable .png image name. The full name * of the images shown in the browser are of the format * {@code imageName_ISODate_runningId_[sessionId].png}, e.g. * 'Image_2012-08-29_001_[bmgolmfgvk].png' to keep them chronologically * ordered.//from w w w .ja va2 s . co m * * @param RPlotCall * the String to be evaluated by R * @param width * the width of the graphical image * @param height * the height of the graphical image * @param imageName * the image name attached to the right-click downloadable file * @param windowName * the title name of the Vaadin window element * @return Vaadin Window object */ public Window getGraph(final String RPlotCall, final int width, final int height, final String imageName, String windowName) { /* Construct a Window to show the graphics */ Window RGraphics = new Window(windowName); HorizontalLayout root = new HorizontalLayout(); root.setMargin(true); RGraphics.setContent(root); RGraphics.setSizeUndefined(); /* Control the image position */ final int imageXoffset = 180; final int imageYoffset = 60; int imageYpos = rand.nextInt(50); int imageXpos = rand.nextInt(90); RGraphics.setPositionX(imageXoffset + imageXpos); RGraphics.setPositionY(imageYoffset + imageYpos); /* Call R for the graphics */ Embedded rPlot = getEmbeddedGraph(RPlotCall, width, height, imageName); root.addComponent(rPlot); /* * Button bar to generate PDF (and for other options in the future) */ if (showButtonsInGraph) { final HorizontalLayout buttonLayout = new HorizontalLayout(); Button open = new Button("PDF"); open.setStyleName(Reindeer.BUTTON_SMALL); buttonLayout.addComponent(open); Button.ClickListener openClicked = new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { StreamResource s = getImageResource(RPlotCall, width / screen_dpi, height / screen_dpi, imageName, "pdf"); Link pdfLink = new Link("Open pdf", s); pdfLink.setTargetName("_blank"); buttonLayout.removeAllComponents(); buttonLayout.addComponent(pdfLink); } }; open.addClickListener(openClicked); root.addComponent(buttonLayout); } return RGraphics; }
From source file:fr.amapj.view.engine.excelgenerator.LinkCreator.java
License:Open Source License
/** * //w w w. j a v a 2 s . c o m * @param generator * @param addPrefixTelecharger : si true, on ajoute le libell "Telecharger" devant le nom du fichier * @return */ static public Link createLink(CoreGenerator generator, boolean addPrefixTelecharger) { FileInfoDTO fileInfoDTO = new CoreGeneratorService().getFileInfo(generator); String titre = fileInfoDTO.nameToDisplay; String fileName = fileInfoDTO.fileName; String extension = fileInfoDTO.extension; StreamResource streamResource = new StreamResource(new CoreResource(fileInfoDTO.generator), fileName + "." + extension); streamResource.setCacheTime(1000); String lien = addPrefixTelecharger ? "Tlcharger " + titre : titre; Link extractFile = new Link(lien, streamResource); extractFile.setIcon(FontAwesome.DOWNLOAD); extractFile.setTargetName("_blank"); return extractFile; }