@Override public void setState(String state) { StringBuilder sb = new StringBuilder(ui.getUiRootPath()); if (!ui.getUiRootPath().endsWith("/")) { // make sure there is a '/' between the root path and the // navigation state. sb.append('/'); } sb.append(state); URI location = ui.getPage().getLocation(); if (location != null) { ui.getPage().pushState(location.resolve(sb.toString())); } else { throw new IllegalStateException( "The Page of the UI does not have a location."); } } }
@Override public String getState() { // Get the current URL URI location = ui.getPage().getLocation(); String path = location.getPath(); if (ui.getUiPathInfo() != null && path.contains(ui.getUiPathInfo())) { // Split the path from after the UI PathInfo path = path.substring(path.indexOf(ui.getUiPathInfo()) + ui.getUiPathInfo().length()); } else if (path.startsWith(ui.getUiRootPath())) { // Use the whole path after UI RootPath String uiRootPath = ui.getUiRootPath(); path = path.substring(uiRootPath.length()); } else { throw new IllegalStateException(getClass().getSimpleName() + " is unable to determine the view path from the URL."); } if (path.startsWith("/")) { // Strip leading '/' path = path.substring(1); } return path; }
URI oldLocation = page.getLocation(); int oldWidth = page.getBrowserWindowWidth(); int oldHeight = page.getBrowserWindowHeight(); URI newLocation = page.getLocation(); int newWidth = page.getBrowserWindowWidth(); int newHeight = page.getBrowserWindowHeight();
&& getPage().getLocation() != null) { String uiRootPath = getPage().getLocation().getPath();
@Override public List<String> getSVGIconFiles() { List<String> svgUrls = Lists.newArrayList(); try { URI location = Page.getCurrent().getLocation(); URL url = new URL(location.getScheme(), location.getHost(), location.getPort(), "/opennms"); Path path = Paths.get(System.getProperty("opennms.home", ""), "jetty-webapps", "opennms", "svg"); File[] files = path.toFile().listFiles((file) -> file.isFile() && file.getName().endsWith(".svg")); for (File eachFile : files) { svgUrls.add(String.format("%s/svg/%s", url, eachFile.getName())); } } catch (MalformedURLException e) { LoggerFactory.getLogger(this.getClass()).error("Error while loading SVG definitions", e); } return svgUrls; }
protected String getFullUrl(final String urlFragment) { final URI currentLocation = Page.getCurrent().getLocation(); final String contextRoot = VaadinServlet.getCurrent().getServletContext().getContextPath(); try { return new URL(currentLocation.toURL(), contextRoot + "/" + urlFragment).toString(); } catch (final MalformedURLException e) { throw new RuntimeException("Failed to create full URL from current location: " + currentLocation + ", context root: " + contextRoot + ", url: " + urlFragment); } } }
protected String getFullUrl(final String urlFragment) { final URI currentLocation = Page.getCurrent().getLocation(); final String contextRoot = VaadinServlet.getCurrent().getServletContext().getContextPath(); try { return new URL(currentLocation.toURL(), contextRoot + "/" + urlFragment).toString(); } catch (final MalformedURLException e) { throw new RuntimeException("Failed to create full URL from current location: " + currentLocation + ", context root: " + contextRoot + ", url: " + urlFragment); } } }
protected String getFullUrl(final String urlFragment) { final URI currentLocation = Page.getCurrent().getLocation(); final String contextRoot = VaadinServlet.getCurrent().getServletContext().getContextPath(); try { return new URL(currentLocation.toURL(), contextRoot + "/" + urlFragment).toString(); } catch (final MalformedURLException e) { throw new RuntimeException("Failed to create full URL from current location: " + currentLocation + ", context root: " + contextRoot + ", url: " + urlFragment); } } }
private static URL getURL(int nodeId) { final URI currentLocation = Page.getCurrent().getLocation(); final String contextRoot = VaadinServlet.getCurrent().getServletContext().getContextPath(); final String redirectFragment = contextRoot + "/element/node.jsp?node=" + nodeId; try { return new URL(currentLocation.toURL(), redirectFragment); } catch (MalformedURLException e) { throw Throwables.propagate(e); } }
private static URL getURL(int nodeId) { final URI currentLocation = Page.getCurrent().getLocation(); final String contextRoot = VaadinServlet.getCurrent().getServletContext().getContextPath(); final String redirectFragment = contextRoot + "/element/node.jsp?node=" + nodeId; try { return new URL(currentLocation.toURL(), redirectFragment); } catch (MalformedURLException e) { throw Throwables.propagate(e); } }
/** * Gets the request parameters with which the application was loaded.<p> * * @return the request parameters */ public Multimap<String, String> getParameters() { return CmsRequestUtil.getParameters(getPage().getLocation()); }
private String getPathToVaadin() { final URI location = Page.getCurrent().getLocation(); return location.getScheme() + "://" +location.getAuthority() + VaadinService.getCurrentRequest().getContextPath() + "/VAADIN"; } }
@Override public Page getPage() { Page page = mock(Page.class); doReturn(returnURI).when(page).getLocation(); return page; } });
Page profile=facebookTemplate.pageOperations().getPage(id); String name=profile.getName(); String webside=profile.getWebsite(); String logo="http://graph.facebook.com/" + id + "/picture"; party=new FullPoliticalParty(name,color,logo,webside); String phone=profile.getPhone() == null ? "No disponible" : profile.getPhone(); party.setPhone(phone); org.springframework.social.facebook.api.Location loc=profile.getLocation(); if (loc != null) { location=new LocationMapa(loc.getCity(),loc.getCountry(),loc.getStreet(),loc.getZip()); } party.setLocation(location);
/** * The URL string that is returned will have '/' in the end */ public static String getLocationWithoutParams() { URI location = AppUI.getCurrent().getPage().getLocation(); return getLocationWithoutParams(location); }
@Override public NavigationState getState() { if (UrlHandlingMode.URL_ROUTES != webConfig.getUrlHandlingMode()) { log.debug("UrlRouting is disabled for '{}' URL handling mode", webConfig.getUrlHandlingMode()); return NavigationState.EMPTY; } if (UrlTools.headless()) { log.debug("Unable to resolve navigation state in headless mode"); return NavigationState.EMPTY; } return UrlTools.parseState(Page.getCurrent().getLocation().getRawFragment()); }
public WebNewWindowButton() { component = new CubaButton(); component.addStyleName(NEW_WINDOW_BUTTON_STYLENAME); component.setDescription(null); URL pageUrl; try { pageUrl = Page.getCurrent().getLocation().toURL(); } catch (MalformedURLException ignored) { LoggerFactory.getLogger(WebNewWindowButton.class).warn("Couldn't get URL of current Page"); return; } ExternalResource currentPage = new ExternalResource(pageUrl); final BrowserWindowOpener opener = new BrowserWindowOpener(currentPage); opener.setWindowName("_blank"); opener.extend(component); }
@Override protected void init(final VaadinRequest request) { SpringContextHelper.setContext(context); params = UriComponentsBuilder.fromUri(Page.getCurrent().getLocation()).build().getQueryParams(); setContent(buildContent()); fillOutUsernameTenantFields(); readCookie(); }
@Override protected void init(final VaadinRequest request) { SpringContextHelper.setContext(context); params = UriComponentsBuilder.fromUri(Page.getCurrent().getLocation()).build().getQueryParams(); setContent(buildContent()); fillOutUsernameTenantFields(); readCookie(); }
/** * @see org.opencms.ui.actions.I_CmsWorkplaceAction#executeAction(org.opencms.ui.I_CmsDialogContext) */ public void executeAction(I_CmsDialogContext context) { View view = CmsAppWorkplaceUi.get().getCurrentView(); if (view instanceof CmsAppView) { ((CmsAppView)view).setCacheStatus(CacheStatus.cacheOnce); } CmsAppWorkplaceUi.get().showApp( OpenCms.getWorkplaceAppManager().getAppConfiguration("editor"), CmsEditor.getEditState( context.getResources().get(0).getStructureId(), false, UI.getCurrent().getPage().getLocation().toString())); }