List of usage examples for com.vaadin.ui Link Link
public Link(String caption, Resource resource)
From source file:com.morevaadin.vaadin7.html.config.ConfigurableHtmlIntegrationView.java
License:Apache License
public ConfigurableHtmlIntegrationView() { FormLayout layout = new FormLayout(); addComponent(layout);/*from w w w .ja v a 2 s . com*/ Link blog = new Link("A Java Geek", new ExternalResource("http://blog.frankel.ch/")); Link morevaadin = new Link("More Vaadin", new ExternalResource("http://morevaadin.com/")); new ConfigurableTooltipExtension().extend(blog); new ConfigurableTooltipExtension().extend(morevaadin); layout.addComponent(blog); layout.addComponent(morevaadin); }
From source file:com.morevaadin.vaadin7.html.js.JavascriptIntegrationView.java
License:Apache License
public JavascriptIntegrationView() { FormLayout layout = new FormLayout(); addComponent(layout);/*from w ww . ja va 2 s . co m*/ Link blog = new Link("A Java Geek", new ExternalResource("http://blog.frankel.ch/")); Link morevaadin = new Link("More Vaadin", new ExternalResource("http://morevaadin.com/")); new JavascriptTooltipExtension().extend(blog); new JavascriptTooltipExtension().extend(morevaadin); layout.addComponent(blog); layout.addComponent(morevaadin); }
From source file:com.mycompany.filmupo.Graficos.java
/** * Metodo de inicializacion de la clase/*from w w w . j a v a 2 s . c o m*/ * * @param vaadinRequest VaadinRequest */ @Override protected void init(VaadinRequest vaadinRequest) { try { HorizontalLayout v2h2 = new HorizontalLayout(); v2h2.setMargin(true); final VerticalLayout v2h1 = new VerticalLayout(); v2h1.setMargin(true); final VerticalSplitPanel v2 = new VerticalSplitPanel(); v2.addComponent(v2h2); v2.addComponent(v2h1); v2.setSplitPosition(22, Unit.PERCENTAGE); v2.setLocked(true); VerticalLayout v1 = new VerticalLayout(); v1.setMargin(true); HorizontalSplitPanel layout = new HorizontalSplitPanel(); layout.addComponent(v1); layout.addComponent(v2); layout.setSplitPosition(28, Unit.PERCENTAGE); setContent(layout); //Creamos los 3 links de navegacion de la aplicacion y loa aadimos al layout declarado al principio del codigo Link pri = new Link("Principal", new ExternalResource("/Principal")); Link est = new Link("Graficos", new ExternalResource("/Graficos")); Link adm = new Link("Administracin", new ExternalResource("/Admin")); v2h2.addComponent(pri); v2h2.addComponent(new Label(" / ")); v2h2.addComponent(est); v2h2.addComponent(new Label(" / ")); v2h2.addComponent(adm); final DAO dao = new DAO(); dao.abrirConexion(); final List<Pelicula> listaPeliculas = dao.consultarPeliculas(); final List<Director> listaDirectores = dao.consultarDirectores(); final List<Actor> listaActores = dao.consultarActores(); //Creamos un unico arbol que contiene el acceso a las 4 graficas que hemos creado: // - Peliculas segun su duracion // - Peliculas segun su genero // - Numero de peliculas segun actor // - Numero de peliculas segun director Tree tree = new Tree(""); String a = "Estadisticas"; tree.addItem(a); String aa = "Peliculas segn su duracin"; tree.addItem(aa); tree.setParent(aa, a); tree.setChildrenAllowed(aa, false); String ab = "Peliculas segn su gnero"; tree.addItem(ab); tree.setParent(ab, a); tree.setChildrenAllowed(ab, false); String ac = "Numero de peliculas segn actor"; tree.addItem(ac); tree.setParent(ac, a); tree.setChildrenAllowed(ac, false); String ad = "Numero de peliculas segn director"; tree.addItem(ad); tree.setParent(ad, a); tree.setChildrenAllowed(ad, false); tree.setSelectable(true); tree.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { v2h1.removeAllComponents(); //Grafica de las peliculas segun su duracion if (event.getProperty().getValue().toString().contains("duracin")) { Chart chart = new Chart(ChartType.PIE); Configuration conf = chart.getConfiguration(); conf.setTitle("Peliculas"); conf.setSubTitle("Segn su duracin en minutos"); PlotOptionsPie options = new PlotOptionsPie(); options.setInnerSize(0); options.setSize("75%"); options.setCenter("50%", "50%"); conf.setPlotOptions(options); DataSeries series = new DataSeries(); for (Pelicula p : listaPeliculas) { series.add(new DataSeriesItem(p.getTitulo(), p.getDuracion())); } conf.addSeries(series); v2h1.addComponent(chart); //Grafica de las peliculas segun su genero } else if (event.getProperty().getValue().toString().contains("gnero")) { Chart chart = new Chart(ChartType.COLUMN); chart.setWidth("400px"); chart.setHeight("300px"); Configuration conf = chart.getConfiguration(); conf.setTitle("Peliculas"); conf.setSubTitle("Agrupadas segn su gnero"); PlotOptionsLine plotOptions = new PlotOptionsLine(); plotOptions.setMarker(new Marker(false)); conf.setPlotOptions(plotOptions); ListSeries series = new ListSeries("Numero de peliculas"); int i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0; try { dao.abrirConexion(); i1 = dao.numGeneros("Accin"); i2 = dao.numGeneros("Ciencia Ficcin"); i3 = dao.numGeneros("Drama"); i4 = dao.numGeneros("Romance"); i5 = dao.numGeneros("Novela de Suspense"); } catch (IllegalAccessException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } series.addData(i1); series.addData(i2); series.addData(i3); series.addData(i4); series.addData(i5); conf.addSeries(series); XAxis xaxis = new XAxis(); xaxis.setTitle("Gnero"); xaxis.setCategories("Accin", "Ciencia Ficcin", "Drama", "Romance", "Novela de suspense"); conf.addxAxis(xaxis); YAxis yayis = new YAxis(); yayis.setTitle("Nmero de peliculas"); conf.addyAxis(yayis); v2h1.addComponent(chart); //Grafica de las peliculas segun actor } else if (event.getProperty().getValue().toString().contains("actor")) { Chart chart = new Chart(ChartType.PIE); Configuration conf = chart.getConfiguration(); conf.setTitle("Actores"); conf.setSubTitle("Nmero de peliculas que tienen"); PlotOptionsPie options = new PlotOptionsPie(); options.setInnerSize(0); options.setSize("75%"); options.setCenter("50%", "50%"); conf.setPlotOptions(options); DataSeries series = new DataSeries(); for (Actor a : listaActores) { int i = 0; try { dao.abrirConexion(); i = dao.numPeliculasA(a.getIdActor()); } catch (InstantiationException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } series.add(new DataSeriesItem(a.getNombreCompleto(), i)); } conf.addSeries(series); v2h1.addComponent(chart); //Grafica del numero de peliculas segun director } else if (event.getProperty().getValue().toString().contains("director")) { Chart chart = new Chart(ChartType.PIE); Configuration conf = chart.getConfiguration(); conf.setTitle("Directores"); conf.setSubTitle("Nmero de peliculas que tienen"); PlotOptionsPie options = new PlotOptionsPie(); options.setInnerSize(0); options.setSize("75%"); options.setCenter("50%", "50%"); conf.setPlotOptions(options); DataSeries series = new DataSeries(); for (Director d : listaDirectores) { int i = 0; try { dao.abrirConexion(); i = dao.numPeliculasD(d.getIdDirector()); } catch (InstantiationException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } series.add(new DataSeriesItem(d.getNombreCompleto(), i)); } conf.addSeries(series); v2h1.addComponent(chart); } } }); v1.addComponent(tree); dao.cerrarConexion(); } catch (SQLException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.mycompany.vaadinviews.MyVerticalLayout.java
public MyVerticalLayout() { Link lnk = new Link("FieldBinderWithBeanValidation", new ExternalResource("#!" + FieldBinderWithBeanValidation.NAME)); addComponent(lnk);//from w w w .j a va2 s . c om }
From source file:com.peergreen.example.webconsole.extensions.ConfirmDialogExtension.java
License:Open Source License
public ConfirmDialogExtension() { setSizeFull();//from ww w . j a va 2s . c o m setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(ConfirmDialogExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); Label title = new Label("Drag and drop components from a panel to another"); title.addStyleName("h1"); addComponent(title); setComponentAlignment(title, Alignment.MIDDLE_CENTER); HorizontalLayout row = new HorizontalLayout(); row.setSizeFull(); row.setSpacing(true); row.setMargin(true); VerticalLayout leftPanel = new VerticalLayout(); leftPanel.setSpacing(true); leftPanel.addStyleName("dashed-area"); leftPanel.addComponent(getDraggableComponent(new Label("Label"))); leftPanel.addComponent(getDraggableComponent(new Button("Button"))); DragAndDropWrapper leftPanelWrapper = new DragAndDropWrapper(leftPanel); row.addComponent(leftPanelWrapper); row.setComponentAlignment(leftPanelWrapper, Alignment.TOP_LEFT); VerticalLayout rightPanel = new VerticalLayout(); rightPanel.setSpacing(true); rightPanel.addStyleName("dashed-area"); DragAndDropWrapper rightPanelWrapper = new DragAndDropWrapper(rightPanel); row.addComponent(rightPanelWrapper); row.setComponentAlignment(rightPanelWrapper, Alignment.TOP_RIGHT); leftPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(rightPanel, leftPanel)); rightPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(leftPanel, rightPanel)); addComponent(row); setExpandRatio(row, 1.5f); }
From source file:com.peergreen.example.webconsole.extensions.CssContributionExtension.java
License:Open Source License
public CssContributionExtension() { setSizeFull();/*from w ww . ja va2s . co m*/ setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(CssContributionExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); }
From source file:com.peergreen.example.webconsole.extensions.DefaultWindowExtension.java
License:Open Source License
public DefaultWindowExtension() { setSizeFull();/* w w w.j av a 2s .c o m*/ setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(DefaultWindowExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); Button simpleButton = new Button("Click to open a Window"); simpleButton.setWidth("400px"); simpleButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { final UI ui = clickEvent.getConnector().getUI(); String caption = "Default window"; Label content = new Label("This is a simple window"); Button close = new Button("Close"); close.addStyleName("wide"); close.addStyleName("default"); final DefaultWindow window = new DefaultWindow(caption, content, close); window.center(); ui.addWindow(window); close.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { window.close(); } }); } }); addComponent(simpleButton); setExpandRatio(simpleButton, 1.5f); }
From source file:com.peergreen.example.webconsole.extensions.NavigatorExtension.java
License:Open Source License
public NavigatorExtension() { setSizeFull();/*from ww w . j a v a 2 s .co m*/ setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(NavigatorExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); }
From source file:com.peergreen.example.webconsole.extensions.NotifierExtension.java
License:Open Source License
public NotifierExtension() { setSizeFull();//w w w.java 2s .co m setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(NotifierExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); }
From source file:com.peergreen.example.webconsole.extensions.SimpleExtension.java
License:Open Source License
public SimpleExtension() { setSizeFull();//ww w. ja v a2s.c om setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(SimpleExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); }