@Override public void enter(ViewChangeEvent event) { pageHelper.setErrorHandler(this); this.removeAllComponents(); // Get application int appId = Integer.parseInt(event.getParameters()); Application app = pageHelper.getApp(appId); // Header this.addComponent(new PageHeader(app, "Endpoints")); // Add endpoints links app.endpoints().asList().stream() .forEach(endpointUrl -> this.addComponent(new Link(endpointUrl+".json", new ExternalResource(endpointUrl+".json"), "_blank", 0, 0, BorderStyle.DEFAULT))); }
public SourceView() { Label caption = new Label("Sources"); caption.addStyleName(DSTheme.LABEL_HUGE); addComponents(caption); List<Link> linkList = new ArrayList<Link>(); Link aidedd = new Link("AideDD", new ExternalResource("http://www.aidedd.org/")); linkList.add(aidedd); Link gemmaline = new Link("Gemmaline", new ExternalResource("http://www.gemmaline.com/faerun/")); linkList.add(gemmaline); Link frwiki = new Link("Wiki des royaumes oubliés", new ExternalResource("https://fr.wikipedia.org/wiki/Portail:Royaumes_oubli%C3%A9s")); linkList.add(frwiki); for (Link link : linkList) { link.setTargetName("_blank"); addComponent(link); } }
private HorizontalLayout saveConfigurationButtonsLayout() { final HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setSpacing(true); saveConfigurationBtn = SPUIComponentProvider.getButton(UIComponentIdProvider.SYSTEM_CONFIGURATION_SAVE, "", "", "", true, FontAwesome.SAVE, SPUIButtonStyleSmallNoBorder.class); saveConfigurationBtn.setEnabled(false); saveConfigurationBtn.setDescription(i18n.getMessage("configuration.savebutton.tooltip")); saveConfigurationBtn.addClickListener(event -> saveConfiguration()); hlayout.addComponent(saveConfigurationBtn); undoConfigurationBtn = SPUIComponentProvider.getButton(UIComponentIdProvider.SYSTEM_CONFIGURATION_CANCEL, "", "", "", true, FontAwesome.UNDO, SPUIButtonStyleSmallNoBorder.class); undoConfigurationBtn.setEnabled(false); undoConfigurationBtn.setDescription(i18n.getMessage("configuration.cancellbutton.tooltip")); undoConfigurationBtn.addClickListener(event -> undoConfiguration()); hlayout.addComponent(undoConfigurationBtn); final Link linkToSystemConfigHelp = SPUIComponentProvider .getHelpLink(uiProperties.getLinks().getDocumentation().getSystemConfigurationView()); hlayout.addComponent(linkToSystemConfigHelp); return hlayout; }
public MenuView() { setMargin(true); setSpacing(true); Label header = new Label("GridStack Vaadin add-on"); header.addStyleName(ValoTheme.LABEL_H1); addComponent(header); addComponents( createNavigation(SimpleView.class, SimpleView.VIEW_NAME, "Simple example"), createNavigation(TestView.class, TestView.VIEW_NAME, "Test it"), createNavigation(SplitView.class, SplitView.VIEW_NAME, "List demo") ); addComponent(new Link( "GridStack Vaadin add-on project page on GitHub", new ExternalResource("https://github.com/alump/GridStack"))); addComponent(new Link( "This project is based on gridstack.js JavaScript library, written by Pavel Reznikov", new ExternalResource("https://github.com/troolee/gridstack.js"))); }
public Component getOverviewComponent(final Attachment attachment, final RelatedContentComponent parent) { // If the attachment has no description, overview link is link to actual page // instead of showing popup with details. if(attachment.getDescription() != null && !"".equals(attachment.getDescription())) { Button attachmentLink = new Button(attachment.getName()); attachmentLink.addStyleName(Reindeer.BUTTON_LINK); attachmentLink.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { parent.showAttachmentDetail(attachment); } }); return attachmentLink; } else { return new Link(attachment.getName(), new ExternalResource(attachment.getUrl())); } }
public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSpacing(true); verticalLayout.setMargin(true); verticalLayout.addComponent(new Label(attachment.getDescription())); HorizontalLayout linkLayout = new HorizontalLayout(); linkLayout.setSpacing(true); verticalLayout.addComponent(linkLayout); // Icon linkLayout.addComponent(new Embedded(null, Images.RELATED_CONTENT_URL)); // Link Link link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); linkLayout.addComponent(link); return verticalLayout; }
@Override protected void init(VaadinRequest request) { layout.setMargin(true); layout.setSpacing(true); setContent(layout); addTwitterButton(); addFacebookButton(); addLinkedInButton(); addGitHubButton(); addTwitterNativeButton(); layout.addComponent(new Link("Add-on at Vaadin Directory", new ExternalResource("http://vaadin.com/addon/oauth-popup-add-on"))); layout.addComponent(new Link("Source code at GitHub", new ExternalResource("https://github.com/ahn/vaadin-oauthpopup"))); }
private void drawPush(final UserProfile profile) { final String remote = remoteName(profile); String url = githubLinkFromOrigin(repo.getRemote(remote)); layout.addComponent(new Link(url, new ExternalResource(url))); Button b = new Button("Push to GitHub"); b.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { gitPush(profile.getToken().getToken(), remote); } catch (GitAPIException e) { Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE); e.printStackTrace(); } } }); layout.addComponent(b); }
Deployer(String pathToWar, String paasApiUri, Link linkToApp, Button buttonLinkToApp , String apiLocation, User user, Button deployButton){ super(apiLocation); //System.out.println("apiLocation in Deployer: " + apiLocation); //System.out.println("apiLocation in CoapsCaller: " + getApiLocation()); this.deployButton = deployButton; this.user = user; this.linkToApp = linkToApp; this.buttonLinkToApp = buttonLinkToApp; this.pathToWar = pathToWar; this.paasApiUri = paasApiUri; File file = new File(pathToWar); warName = file.getName(); warLocation = file.getParentFile().getAbsolutePath(); appName = warName.replace(".war", ""); deployLocation = "/home/ubuntu/delpoyedprojects"; memory = "512"; Date today = new Date(); date = new SimpleDateFormat("yyyy-MM-dd").format(today); }
public AboutView() { setCaption(Messages.getString("aboutTitle")); //$NON-NLS-1$ setModal(true); setResizable(false); center(); VerticalLayout main = new VerticalLayout(); Resource logoResource = new ThemeResource("img/omc-logo.png"); //$NON-NLS-1$ Image appLogoImage = new Image("",logoResource); //$NON-NLS-1$ Label appLabel = new Label(appName + " v." + version); //$NON-NLS-1$ Label developerLabel = new Label(developer); Link githubLink = new Link(github, new ExternalResource(github)); main.addComponents(appLogoImage, appLabel, developerLabel, githubLink); main.setComponentAlignment(appLabel, Alignment.MIDDLE_CENTER); main.setComponentAlignment(developerLabel, Alignment.MIDDLE_CENTER); main.setComponentAlignment(githubLink, Alignment.MIDDLE_CENTER); setContent(main); }
private void filterTracksByArtistId(int artistId){ if(artistId >= 0) { trackTable.removeAllItems(); for(Track track : tracks) { if(track.getArtist().getId() == artistId){ Link downloadLink = new Link(null, new ExternalResource(track.getFile().getAudioMp3UrlString())); downloadLink.setIcon(new ThemeResource("img/download.png")); //$NON-NLS-1$ String albumTitle = ""; //$NON-NLS-1$ if(track.getAlbum() != null && track.getAlbum().getName().length() > 0) { track.getAlbum().getName(); } trackTable.addItem(new Object[] {new CheckBox(), track.getTitle(), albumTitle, downloadLink}, track.getId()); } } } }
public ArchiveLayout(ArchiveServiceApi archiveService, GetJobsArchiveServiceApi getJobsArchiveService, UpdateJobsArchiveServiceApi updateJobsArchiveService) { super(); VerticalLayout downloadContainer = new VerticalLayout(); VerticalLayout archiveContainer = new VerticalLayout(); // Component to Archive Jobs JobsArchiverPanel archiveConfigurator = new JobsArchiverPanel(this, archiveService, getJobsArchiveService, updateJobsArchiveService); archiveConfigurator.setSizeFull(); archiveContainer.addComponent(ViewUtil.createSubHeader("Archive Jobs/Alerts", null)); archiveContainer.addComponent(archiveConfigurator); downloadContainer.addComponent(ViewUtil.createSubHeader("Download Archive", null)); // Component to download archive this.archiveTable = new Table(); this.archiveTable.setSizeFull(); this.archiveTable.setPageLength(5); this.archiveTable.setImmediate(true); this.archiveTable.addContainerProperty("Name", String.class, null); this.archiveTable.addContainerProperty("Date", Date.class, null); this.archiveTable.addContainerProperty("Size", Long.class, null); this.archiveTable.addContainerProperty("Download", Link.class, null); this.archiveTable.addContainerProperty("Delete", Button.class, null); buildArchivesTable(); Panel archiveTablePanel = new Panel(); archiveTablePanel.setContent(this.archiveTable); addComponent(archiveContainer); addComponent(archiveTablePanel); }
public static Object generateMgrLink(String caption, String url) { Link mgrLink = new Link(); mgrLink.setCaption(caption); mgrLink.setResource(new ExternalResource(url)); mgrLink.setDescription("Click to go to application"); mgrLink.setTargetName("_blank"); return mgrLink; }
private static Link createJobLink(String caption, Long lastJobId, ServerApi server) { HashMap<String, Object> paramMap = new HashMap<>(); paramMap.put(JOB_ID_PARAM_KEY, lastJobId); return createInternalLink(MainUI.VIEW_FRAGMENT_JOBS, paramMap, caption, VmidcMessages.getString(VmidcMessages_.JOB_LINK_TOOLTIP), server); }
private static Link createInternalLink(String fragment, HashMap<String, Object> paramMap, String linkCaption, String linkDescription, ServerApi server) { String jobLinkUrl = createInternalUrl(fragment, paramMap, server); if (jobLinkUrl == null) { return null; } Link jobLink = new Link(); jobLink.setCaption(linkCaption); jobLink.setDescription(linkDescription); jobLink.setResource(new ExternalResource(jobLinkUrl)); return jobLink; }
private Layout getFooter() { Layout footer = new HorizontalLayout(); footer.addComponent(new Label("Persephone v"+persephoneVersion)); footer.addComponent(new Link("Created by Vianney FAIVRE", new ExternalResource("https://vianneyfaiv.re"), "_blank", 0, 0, BorderStyle.DEFAULT)); footer.addComponent(new Link("GitHub", new ExternalResource("https://github.com/vianneyfaivre/Persephone"), "_blank", 0, 0, BorderStyle.DEFAULT)); footer.setHeight(20, Unit.PIXELS); footer.setStyleName("persephone-footer"); return footer; }
protected Component buildLinks() { final HorizontalLayout links = new HorizontalLayout(); links.setSpacing(true); links.addStyleName("links"); final String linkStyle = "v-link"; if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) { final Link docuLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_DOCUMENTATION, i18n.getMessage("link.documentation.name"), uiProperties.getLinks().getDocumentation().getRoot(), FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle); links.addComponent(docuLink); docuLink.addStyleName(ValoTheme.LINK_SMALL); } if (!uiProperties.getDemo().getUser().isEmpty()) { final Link demoLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_DEMO, i18n.getMessage("link.demo.name"), "?demo", FontAwesome.DESKTOP, "_top", linkStyle); links.addComponent(demoLink); demoLink.addStyleName(ValoTheme.LINK_SMALL); } if (!uiProperties.getLinks().getRequestAccount().isEmpty()) { final Link requestAccountLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_REQUESTACCOUNT, i18n.getMessage("link.requestaccount.name"), uiProperties.getLinks().getRequestAccount(), FontAwesome.SHOPPING_CART, "", linkStyle); links.addComponent(requestAccountLink); requestAccountLink.addStyleName(ValoTheme.LINK_SMALL); } if (!uiProperties.getLinks().getUserManagement().isEmpty()) { final Link userManagementLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_USERMANAGEMENT, i18n.getMessage("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(), FontAwesome.USERS, "_blank", linkStyle); links.addComponent(userManagementLink); userManagementLink.addStyleName(ValoTheme.LINK_SMALL); } return links; }
private void addContainerproperties() { /* Create HierarchicalContainer container */ container.addContainerProperty(SPUILabelDefinitions.NAME, Link.class, null); container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null); container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, Date.class, null); container.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, Date.class, null); container.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null); container.addContainerProperty(SPUILabelDefinitions.AUTO_ASSIGN_DISTRIBUTION_SET, String.class, null); }
private void addHelpLink() { if (StringUtils.isEmpty(helpLink)) { return; } final Link helpLinkComponent = SPUIComponentProvider.getHelpLink(helpLink); buttonsLayout.addComponent(helpLinkComponent); buttonsLayout.setComponentAlignment(helpLinkComponent, Alignment.MIDDLE_RIGHT); }
/** * Generates help/documentation links from within management UI. * * @param uri * to documentation site * * @return generated link */ public static Link getHelpLink(final String uri) { final Link link = new Link("", new ExternalResource(uri)); link.setTargetName("_blank"); link.setIcon(FontAwesome.QUESTION_CIRCLE); link.setDescription("Documentation"); return link; }
@Override public Link createMainViewPageLink() { final Link pageLink = new Link(MAIN_VIEW_LINK_TEXT, new ExternalResource( LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME)); pageLink.setId(ViewAction.VISIT_MAIN_VIEW.name()); pageLink.setIcon(VaadinIcons.STAR); return pageLink; }
@Override public Link createRegisterPageLink() { final Link pageLink = new Link("Register", new ExternalResource( LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME + PAGE_SEPARATOR + ApplicationPageMode.REGISTER)); pageLink.setId(ViewAction.VISIT_REGISTER.name()); pageLink.setIcon(VaadinIcons.RANDOM); return pageLink; }
@Override public Link createLoginPageLink() { final Link pageLink = new Link("Login", new ExternalResource( LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME + PAGE_SEPARATOR + ApplicationPageMode.LOGIN)); pageLink.setId(ViewAction.VISIT_LOGIN.name()); pageLink.setIcon(VaadinIcons.SIGN_IN); return pageLink; }
@Override public Link addCommitteePageLink(final ViewRiksdagenCommittee data) { final Link pageLink = new Link(COMMITTEE + data.getEmbeddedId().getDetail(), new ExternalResource(PAGE_PREFIX + UserViews.COMMITTEE_VIEW_NAME + PAGE_SEPARATOR + data.getEmbeddedId().getOrgCode())); pageLink.setId(ViewAction.VISIT_COMMITTEE_VIEW.name() + PAGE_SEPARATOR + data.getEmbeddedId().getOrgCode()); pageLink.setIcon(VaadinIcons.GROUP); return pageLink; }
@Override public Link addMinistryPageLink(final ViewRiksdagenMinistry data) { final Link pageLink = new Link(MINISTRY + data.getNameId(), new ExternalResource(PAGE_PREFIX + UserViews.MINISTRY_VIEW_NAME + PAGE_SEPARATOR + data.getNameId())); pageLink.setId(ViewAction.VISIT_MINISTRY_VIEW.name() + PAGE_SEPARATOR + data.getNameId()); pageLink.setIcon(VaadinIcons.GROUP); return pageLink; }
@Override public Link addPartyPageLink(final ViewRiksdagenParty data) { final Link pageLink = new Link(PARTY + data.getPartyName(), new ExternalResource(PAGE_PREFIX + UserViews.PARTY_VIEW_NAME + PAGE_SEPARATOR + data.getPartyId())); pageLink.setId(ViewAction.VISIT_PARTY_VIEW.name() + PAGE_SEPARATOR + data.getPartyId()); pageLink.setIcon(VaadinIcons.GROUP); return pageLink; }
@Override public Link createPoliticianPageLink(final PersonData personData) { final Link pageLink = new Link(POLITICIAN + personData.getFirstName() + ' ' + personData.getLastName(), new ExternalResource(PAGE_PREFIX + UserViews.POLITICIAN_VIEW_NAME + PAGE_SEPARATOR + personData.getId())); pageLink.setId(ViewAction.VISIT_POLITICIAN_VIEW.name() + PAGE_SEPARATOR + personData.getId()); pageLink.setIcon(VaadinIcons.BUG); return pageLink; }
@Override public Link createSearchDocumentViewPageLink() { final Link pageLink = new Link(SEARCH, new ExternalResource(PAGE_PREFIX + UserViews.SEARCH_DOCUMENT_VIEW_NAME)); pageLink.setId(ViewAction.VISIT_DOCUMENT_VIEW.name()); pageLink.setIcon(VaadinIcons.SEARCH); return pageLink; }
@Override public Link createAdminPagingLink(final String label,final String page, final String pageId, final String pageNr) { final Link pageLink = new Link(label, new ExternalResource(PAGE_PREFIX + page + PAGE_SEPARATOR + "[" + pageNr + "]")); pageLink.setId(page +"ShowPage" + PAGE_SEPARATOR + pageNr); pageLink.setIcon(VaadinIcons.SERVER); return pageLink; }
@Override public Link createUserHomeViewPageLink() { final Link pageLink = new Link("User account:" + UserContextUtil.getUserNameFromSecurityContext(), new ExternalResource(PAGE_PREFIX + UserViews.USERHOME_VIEW_NAME)); pageLink.setId(ViewAction.VISIT_USER_HOME_VIEW.name()); pageLink.setIcon(VaadinIcons.USER); return pageLink; }
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.size() > 0) { 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); } }; Link resourceLink = new Link(resourceName, new StreamResource(streamSource, resourceName, ExplorerApp.get())); resourceLinksLayout.addComponent(resourceLink); } } }
public VaadinExportDialog(String title) { super(title); try { HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setMargin(false); final PipedInputStream pipedInputStream = new PipedInputStream(pipedOutputStream); StreamSource ss = new StreamSource() { private static final long serialVersionUID = 1L; @Override public InputStream getStream() { VaadinExportDialog.this.close(); return pipedInputStream; } }; StreamResource sr = new StreamResource(ss, "export.xml"); sr.setMIMEType("application/octet-stream"); sr.setCacheTime(0); link = new Link("Link to Download", sr); horizontalLayout.addComponent(link); setContent(horizontalLayout); setModal(true); UI.getCurrent().addWindow(this); } catch (IOException x) { x.printStackTrace(); } }
@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); } }
public static Link getGravatarImageLink(final String email) { final URL gravatarUrl = GravatarUtil.getGravatarUrl(email, 32); final Link link = new Link(null, new ExternalResource("http://www.gravatar.com/")); link.setStyleName("gravatar"); link.setIcon(new ExternalResource(gravatarUrl)); link.setWidth(32, Sizeable.Unit.PIXELS); link.setHeight(32, Sizeable.Unit.PIXELS); return link; }
public LinkField(Item item, Object propertyId) { String url = (String) item.getItemProperty(propertyId).getValue(); link = new Link(url, new ExternalResource(url)); link.setTargetName("_blank"); setCompositionRoot(link); }
@Override public Object generateCell(final Object columnId, final Item item, final Object itemId) { final String url = (String) item.getItemProperty(columnId).getValue(); if (!isNullOrEmpty(url)) { final Link link = new Link(url, new ExternalResource(url)); link.setTargetName("_blank"); return link; } else return null; }
@Override public Object generateCell(final Object columnId, final Item item, final Object itemId) { final String url = (String) item.getItemProperty(columnId).getValue(); if (!isNullOrEmpty(url)) { final Link link = new Link(url, new ExternalResource(MessageFormat.format("mailto:{0}", url))); link.setTargetName("_blank"); return link; } else return null; }