List of usage examples for com.vaadin.ui Link Link
public Link(String caption, Resource resource)
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getSotisFrontPage() { GridSystemLayout layout = new GridSystemLayout(12); Label title = new Label( "O <strong>SOTIS</strong> o Repositrio Institucional do Instituto Superior Tcnico.", Label.CONTENT_XHTML); title.addStyleName(BennuTheme.LABEL_BIG); layout.setCell("title", 12, title); Label description = new Label( "Aqui poder encontrar artigos publicados em <a href=\"\">Revistas</a>, <a href=\"\">Conferncias</a>, <a href=\"\">Livros</a>, <a href=\"\">Manuais</a> e <a href=\"\">Outros</a>, categorizados por <a href=\"\">Unidades de Investigao</a> e <a href=\"\">Unidades Acadmicas</a>.", Label.CONTENT_XHTML); description.addStyleName(BennuTheme.LABEL_BIG); layout.setCell("description", 12, description); VerticalLayout searchPanel = new VerticalLayout(); layout.setCell("search", 2, 8, 2, searchPanel); searchPanel.addStyleName("big"); searchPanel.addStyleName("inset"); searchPanel.setMargin(true);/*from w w w. jav a2 s. c o m*/ searchPanel.setSpacing(true); HorizontalLayout searchForm = new HorizontalLayout(); searchPanel.addComponent(searchForm); searchForm.setSpacing(true); searchForm.setWidth("100%"); TextField searchText = new TextField(); searchForm.addComponent(searchText); searchText.setInputPrompt("Introduza o termo a pesquisar"); searchText.setWidth("100%"); Button searchSubmit = new Button("Pesquisar"); searchForm.addComponent(searchSubmit); searchSubmit.addStyleName(BennuTheme.BUTTON_DEFAULT); searchForm.setExpandRatio(searchText, 1f); Link advanced = new Link("advanced search", null); searchPanel.addComponent(advanced); Panel browseByType = new Panel("Publicaes por Tipo"); browseByType.addStyleName(BennuTheme.PANEL_LIGHT); layout.setCell("type", 4, browseByType); Panel browseByDept = new Panel("Publicaes por Departamento"); browseByDept.addStyleName(BennuTheme.PANEL_LIGHT); layout.setCell("dept", 4, browseByDept); Panel contacts = new Panel("Contactos"); contacts.addStyleName(BennuTheme.PANEL_LIGHT); layout.setCell("contacts", 4, contacts); return layout; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getButtonPreviews() { Layout grid = getPreviewLayout("Buttons"); Button button = new Button("Button"); grid.addComponent(button);/*from ww w . j a va 2 s .c om*/ button = new Button("Default"); button.setStyleName("default"); grid.addComponent(button); button = new Button("Small"); button.setStyleName("small"); grid.addComponent(button); button = new Button("Small Default"); button.setStyleName("small default"); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); grid.addComponent(button); button = new Button("Disabled"); button.setEnabled(false); grid.addComponent(button); button = new Button("Disabled default"); button.setEnabled(false); button.setStyleName("default"); grid.addComponent(button); button = new Button("Link style"); button.setStyleName(BaseTheme.BUTTON_LINK); grid.addComponent(button); button = new Button("Disabled link"); button.setStyleName(BaseTheme.BUTTON_LINK); button.setEnabled(false); grid.addComponent(button); button = new Button("120px overflows out of the button"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); button.setWidth("120px"); grid.addComponent(button); button = new Button("Small"); button.setStyleName("small"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); button.setIcon(new ThemeResource("../runo/icons/32/document-txt.png")); grid.addComponent(button); button = new Button("Big link"); button.setStyleName(BaseTheme.BUTTON_LINK + " big"); button.setIcon(new ThemeResource("../runo/icons/32/document.png")); grid.addComponent(button); button = new Button("Borderless"); button.setStyleName("borderless"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Borderless icon on top"); button.setStyleName("borderless icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Icon on top"); button.setStyleName("icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/users.png")); grid.addComponent(button); button = new Button("Wide Default"); button.setStyleName("wide default"); grid.addComponent(button); button = new Button("Wide"); button.setStyleName("wide"); grid.addComponent(button); button = new Button("Tall"); button.setStyleName("tall"); grid.addComponent(button); button = new Button("Wide, Tall & Big"); button.setStyleName("wide tall big"); grid.addComponent(button); button = new Button("Icon on right"); button.setStyleName("icon-on-right"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big icon"); button.setStyleName("icon-on-right big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Toggle (down)"); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("down"); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); button = new Button(); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("icon-only"); button.addStyleName("down"); button.setIcon(new ThemeResource("../runo/icons/16/user.png")); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); Link l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); grid.addComponent(l); l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); l.setIcon(new ThemeResource("../runo/icons/32/globe.png")); grid.addComponent(l); return grid; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.about.AboutProvider.java
License:Apache License
@Override public Component getContent() { VerticalLayout vl = new VerticalLayout(); vl.addComponent(new Image("", LOGO)); TextField version = new TextField(TRANSLATOR.translate("general.version")); version.setValue(((ValidationManagerUI) UI.getCurrent()).getVersion()); version.setReadOnly(true);//from ww w . ja v a2 s. c o m vl.addComponent(version); TextField build = new TextField(TRANSLATOR.translate("general.build")); build.setValue(((ValidationManagerUI) UI.getCurrent()).getBuild()); build.setReadOnly(true); vl.addComponent(build); TextArea desc = new TextArea(); desc.setValue("Validation Manager is a tool to handle all the " + "cumbersome paperwork of regulated environment validations. " + "Including Validation Plans, protocols, " + "executions and exceptions. Keeping everything in one " + "place and best of all paperless. "); desc.setReadOnly(true); desc.setWidth(100, Unit.PERCENTAGE); Link link = new Link("Get more information here", new ExternalResource("https://github.com/javydreamercsw/validation-manager")); vl.addComponent(desc); vl.addComponent(link); vl.setId(getComponentCaption()); return vl; }
From source file:org.activiti.explorer.ui.content.file.ImageAttachmentRenderer.java
License:Apache License
@Override public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();//from w ww .j a v a 2 s. co m verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); // Image TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); String mimeType = extractMineType(attachment.getType()); InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()), mimeType, 900, 550); Resource resource = new StreamResource(new InputStreamStreamSource(imageStream), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get()); Embedded image = new Embedded(null, resource); verticalLayout.addComponent(image); // Linke HorizontalLayout LinkLayout = new HorizontalLayout(); LinkLayout.setSpacing(true); verticalLayout.addComponent(LinkLayout); verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER); Label fullSizeLabel = new Label( ExplorerApp.get().getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE)); LinkLayout.addComponent(fullSizeLabel); Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); Resource res = new StreamResource( new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get()); link = new Link(attachment.getName(), res); } link.setIcon(Images.RELATED_CONTENT_PICTURE); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); LinkLayout.addComponent(link); return verticalLayout; }
From source file:org.activiti.explorer.ui.content.GenericAttachmentRenderer.java
License:Apache License
public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();/*from w w w.j a v a2 s . co m*/ verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); HorizontalLayout linkLayout = new HorizontalLayout(); linkLayout.setSpacing(true); verticalLayout.addComponent(linkLayout); // Image linkLayout.addComponent(new Embedded(null, getImage(attachment))); // Link Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); Resource res = new StreamResource( new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get()); link = new Link(attachment.getName(), res); } // Set generic image and external window link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); linkLayout.addComponent(link); return verticalLayout; }
From source file:org.activiti.explorer.ui.custom.SkypeLabel.java
License:Apache License
/** * Constructs a {@link SkypeLabel} based on the given Skype id *//*from w ww .jav a 2s . c om*/ public SkypeLabel(String skypeId) { CssLayout layout = new CssLayout(); setCompositionRoot(layout); Label label = new Label( "<script type='text/javascript' src='http://download.skype.com/share/skypebuttons/js/skypeCheck.js'></script>", Label.CONTENT_XHTML); layout.addComponent(label); Link link = new Link(null, new ExternalResource("skype:" + skypeId + "?call")); link.setIcon(Images.SKYPE); layout.addComponent(link); setWidth(16, UNITS_PIXELS); setHeight(16, UNITS_PIXELS); }
From source file:org.activiti.explorer.ui.management.deployment.DeploymentDetailPanel.java
License:Apache License
protected void addResourceLinks() { List<String> resourceNames = repositoryService.getDeploymentResourceNames(deployment.getId()); Collections.sort(resourceNames); // small nr of elements, so we can do it in-memory if (!resourceNames.isEmpty()) { Label resourceHeader = new Label(i18nManager.getMessage(Messages.DEPLOYMENT_HEADER_RESOURCES)); resourceHeader.setWidth("95%"); resourceHeader.addStyleName(ExplorerLayout.STYLE_H3); resourceHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); addDetailComponent(resourceHeader); // resources VerticalLayout resourceLinksLayout = new VerticalLayout(); resourceLinksLayout.setSpacing(true); resourceLinksLayout.setMargin(true, false, false, false); addDetailComponent(resourceLinksLayout); for (final String resourceName : resourceNames) { StreamResource.StreamSource streamSource = new StreamSource() { public InputStream getStream() { return repositoryService.getResourceAsStream(deployment.getId(), resourceName); }/*ww w.ja v a 2s . c om*/ }; Link resourceLink = new Link(resourceName, new StreamResource(streamSource, resourceName, ExplorerApp.get())); resourceLinksLayout.addComponent(resourceLink); } } }
From source file:org.activiti.explorer.ui.profile.ProfilePanel.java
License:Apache License
protected void initContactSection() { Label header = createProfileHeader(infoPanelLayout, i18nManager.getMessage(Messages.PROFILE_CONTACT)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); infoPanelLayout.addComponent(header); GridLayout contactLayout = createInfoSectionLayout(2, 4); // Email/*from www . j ava2 s. c om*/ if (!editable && isDefined(user.getEmail())) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), user.getEmail()); } else if (editable) { emailField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), emailField, user.getEmail()); } // Phone if (!editable && isDefined(phone)) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phone); } else if (editable) { phoneField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phoneField, phone); } // Twitter if (!editable && isDefined(twitterName)) { Link twitterLink = new Link(twitterName, new ExternalResource("http://www.twitter.com/" + twitterName)); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterLink); } else if (editable) { twitterField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterField, twitterName); } // Skype if (!editable && isDefined(skypeId)) { // The skype entry shows the name + skype icon, laid out in a small grid GridLayout skypeLayout = new GridLayout(2, 1); skypeLayout.setSpacing(true); skypeLayout.setSizeUndefined(); Label skypeIdLabel = new Label(skypeId); skypeIdLabel.setSizeUndefined(); skypeLayout.addComponent(skypeIdLabel); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeLayout); } else if (editable) { skypeField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeField, skypeId); } }
From source file:org.activiti.kickstart.ui.panel.SelectAdhocWorkflowPanel.java
License:Apache License
protected void initWorkflowTableContents() { List<KickstartWorkflowInfo> processDefinitions = adhocWorkflowService.findKickstartWorkflowInformation(); for (final KickstartWorkflowInfo infoDto : processDefinitions) { Item workflowItem = workflowTable.getItem(workflowTable.addItem()); Button nameButton = new Button(infoDto.getName()); nameButton.setStyleName("link"); nameButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 5671158538486627690L; public void buttonClick(ClickEvent event) { viewManager.showPopupWindow(new ProcessImagePopupWindow(viewManager, infoDto.getId())); }//from www . ja va2s . co m }); workflowItem.getItemProperty("name").setValue(nameButton); workflowItem.getItemProperty("key").setValue(infoDto.getKey()); workflowItem.getItemProperty("version").setValue(infoDto.getVersion()); workflowItem.getItemProperty("createTime").setValue(infoDto.getCreateTime()); workflowItem.getItemProperty("nrOfRunningInstance").setValue(infoDto.getNrOfRuntimeInstances()); workflowItem.getItemProperty("nrOfHistoricInstances").setValue(infoDto.getNrOfHistoricInstances()); HorizontalLayout actions = new HorizontalLayout(); actions.setSpacing(true); Button editButton = new Button("edit"); editButton.setStyleName("link"); // editButton.setIcon(editImage); editButton.setData(infoDto.getId()); editButton .addListener(new EditExistingKickstartWorkflowClickListener(viewManager, adhocWorkflowService)); actions.addComponent(editButton); StreamResource.StreamSource streamSource = new StreamSource() { private static final long serialVersionUID = -8875067466181823014L; public InputStream getStream() { return ServiceLocator.getAdhocWorkflowService().getProcessBpmnXml(infoDto.getId()); } }; Link bpmnXmlLink = new Link("get xml", new StreamResource(streamSource, infoDto.getKey() + ".bpmn20.xml", viewManager.getApplication())); // bpmnXmlLink.setIcon(xmlImage); actions.addComponent(bpmnXmlLink); workflowItem.getItemProperty("actions").setValue(actions); } workflowTable.setPageLength(workflowTable.size()); }
From source file:org.activiti.kickstart.ui.panel.SelectWorkflowPanel.java
License:Apache License
protected void initWorkflowTableContents() { List<KickstartWorkflowInfo> processDefinitions = kickstartService.findWorkflowInformation(true); for (final KickstartWorkflowInfo infoDto : processDefinitions) { Item workflowItem = workflowTable.getItem(workflowTable.addItem()); Button nameButton = new Button(infoDto.getName()); nameButton.setStyleName("link"); nameButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 5671158538486627690L; public void buttonClick(ClickEvent event) { KickstartApplication.get().getViewManager() .showPopupWindow(new ProcessImagePopupWindow(infoDto.getId())); }//from w ww . ja v a 2s .com }); workflowItem.getItemProperty("name").setValue(nameButton); workflowItem.getItemProperty("key").setValue(infoDto.getKey()); workflowItem.getItemProperty("version").setValue(infoDto.getVersion()); workflowItem.getItemProperty("createTime").setValue(infoDto.getCreateTime()); workflowItem.getItemProperty("nrOfRunningInstance").setValue(infoDto.getNrOfRuntimeInstances()); workflowItem.getItemProperty("nrOfHistoricInstances").setValue(infoDto.getNrOfHistoricInstances()); HorizontalLayout actions = new HorizontalLayout(); actions.setSpacing(true); Button editButton = new Button("edit"); editButton.setStyleName("link"); // editButton.setIcon(editImage); editButton.setData(infoDto.getId()); editButton.addListener(new EditExistingKickstartWorkflowClickListener(kickstartService)); actions.addComponent(editButton); StreamResource.StreamSource streamSource = new StreamSource() { private static final long serialVersionUID = -8875067466181823014L; public InputStream getStream() { return KickstartApplication.get().getKickstartService().getBpmnXml(infoDto.getId()); } }; Link bpmnXmlLink = new Link("get xml", new StreamResource(streamSource, infoDto.getKey() + ".bpmn20.xml", KickstartApplication.get())); // bpmnXmlLink.setIcon(xmlImage); actions.addComponent(bpmnXmlLink); workflowItem.getItemProperty("actions").setValue(actions); } workflowTable.setPageLength(workflowTable.size()); }