@Override public SafeUri getSafeUri() { return UriUtils.fromTrustedString(url); }
@Override public SafeUri getSafeUri() { return UriUtils.fromTrustedString(url); }
public Object call(Method method, Object[] args) throws Exception { if (method.getName().equals("getUrl")) { return url; } else if (method.getName().equals("getSafeUri")) { return UriUtils.fromTrustedString(url); } return null; }
public Object call(Method method, Object[] args) throws Exception { if (method.getName().equals("getUrl")) { return url; } else if (method.getName().equals("getSafeUri")) { return UriUtils.fromTrustedString(url); } return null; }
public static SafeUri safeUri(ResourceId id, PageId pageId) { return UriUtils.fromTrustedString("#" + pageId + "/" + id.asString()); }
@Override protected SafeHtml getRenderedImage(String imageDataurl) { return template.image(UriUtils.fromTrustedString(imageDataurl)); } }
public static SafeUri safeUri(ResourceId instanceId) { return UriUtils.fromTrustedString("#" + historyToken(instanceId)); }
public Object call(Method method, Object[] args) throws Exception { if (method.getName().equals("getURL")) { return url; } else if (method.getName().equals("getSafeUri")) { return UriUtils.fromTrustedString(url); } else if (method.getName().equals("getHeight")) { return 0; } else if (method.getName().equals("getLeft")) { return 0; } else if (method.getName().equals("getWidth")) { return 0; } else if (method.getName().equals("getTop")) { return 0; } else if (method.getName().equals("isAnimated")) { return false; } return null; }
@Override public SafeUri getSafeUri() { return UriUtils.fromTrustedString(getURL()); }
public Object call(Method method, Object[] args) throws Exception { if (method.getName().equals("getURL")) { return url; } else if (method.getName().equals("getSafeUri")) { return UriUtils.fromTrustedString(url); } else if (method.getName().equals("getHeight")) { return 0; } else if (method.getName().equals("getLeft")) { return 0; } else if (method.getName().equals("getWidth")) { return 0; } else if (method.getName().equals("getTop")) { return 0; } else if (method.getName().equals("isAnimated")) { return false; } return null; }
public static SafeUri getAttachmentUri(ResourceId formId, String blobId) { return UriUtils.fromTrustedString(getAttachmentUri(blobId, formId)); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Exception { Class<?> returnType = method.getReturnType(); if (returnType == String.class) { return name; } else if (returnType == SafeHtml.class) { return SafeHtmlUtils.fromTrustedString(name); } else if (returnType == SafeUri.class) { return UriUtils.fromTrustedString(name); } else if (returnType == boolean.class) { return false; } else if (returnType == int.class) { return 0; } else if (method.getParameterTypes()[0] == ResourceCallback.class) { // Read the underlying resource type out of the generic parameter // in the method's argument Class<?> resourceType = (Class<?>) ((ParameterizedType) args[0].getClass().getGenericInterfaces()[0]) .getActualTypeArguments()[0]; ((ResourceCallback<ResourcePrototype>) args[0]).onSuccess( (ResourcePrototype) createFakeResource(resourceType, name)); return null; } else { throw new IllegalArgumentException( "Unexpected return type for method " + method.getName()); } } });
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Exception { Class<?> returnType = method.getReturnType(); if (returnType == String.class) { return name; } else if (returnType == SafeHtml.class) { return SafeHtmlUtils.fromTrustedString(name); } else if (returnType == SafeUri.class) { return UriUtils.fromTrustedString(name); } else if (returnType == boolean.class) { return false; } else if (returnType == int.class) { return 0; } else if (method.getParameterTypes()[0] == ResourceCallback.class) { // Read the underlying resource type out of the generic parameter // in the method's argument Class<?> resourceType = (Class<?>) ((ParameterizedType) args[0].getClass().getGenericInterfaces()[0]) .getActualTypeArguments()[0]; ((ResourceCallback<ResourcePrototype>) args[0]).onSuccess( (ResourcePrototype) createFakeResource(resourceType, name)); return null; } else { throw new IllegalArgumentException( "Unexpected return type for method " + method.getName()); } } });
@Override protected void renderItem(ModelData modelData, SafeHtmlBuilder html) { SafeUri iconUri = UriUtils.fromTrustedString((String) modelData.get("path")); String baseMapName = (String) modelData.get("name"); html.append(TEMPLATES.baseMap(iconUri, baseMapName)); } });
@Override public void render(List<SiteAttachmentDTO> attachments, SafeHtmlBuilder html) { SafeUri iconUrl = UriUtils.fromTrustedString(GWT.getModuleBaseURL() + "/image/attach.png"); html.appendHtmlConstant("<dl>"); for (SiteAttachmentDTO attachment : attachments) { html.append(TEMPLATES.item(iconUrl, attachment.getFileName())); } html.appendHtmlConstant("<div style=\"clear:left;\"></div>"); html.appendHtmlConstant("</dl>"); } }
@Override public void render(List<T> models, SafeHtmlBuilder html) { html.appendHtmlConstant("<dl>"); for (T model : models) { SafeUri iconPath = UriUtils.fromTrustedString(GWT.getModuleBaseURL() + this.iconPath + model.get("path")); String name = model.get("name"); String description = model.get("description"); html.append(TEMPLATES.item(iconPath, name, description)); } html.appendHtmlConstant("<div style=\"clear:left;\"></div>"); html.appendHtmlConstant("</dl>"); } }