/** Returns the result of an AU request representing the update result. */ public static Object getUpdateResult(AuRequest request) throws UiException { final String key = (String) request.getData().get("contentId"); final Object result = request.getDesktop().removeAttribute(key); if (result == null) throw new UiException("Content not found: " + key); return result; }
public Object removeAttribute(String name, boolean recurse) { if (recurse && !hasAttribute(name)) { if (_desktop != null) { if (_desktop.hasAttribute(name, true)) return _desktop.removeAttribute(name, true); } return null; } return removeAttribute(name); }
public Object removeAttribute(String name, boolean recurse) { if (recurse && !hasAttribute(name)) { Desktop desktop = getDesktop(); if (desktop != null) { if (desktop.hasAttribute(name, true)) return desktop.removeAttribute(name, true); } return null; } return removeAttribute(name); }
private static void outDivTemplateEnd(Page page, Writer out) throws IOException { final Desktop dt; if (page != null && (dt = page.getDesktop()) != null) { if (dt.getAttribute(ATTR_DESKTOP_CLIENTINFO) != null) { dt.removeAttribute(ATTR_DESKTOP_CLIENTINFO); if (!"CE".equals(WebApps.getEdition())) out.write( "<script type=\"text/javascript\">if(zk.clientinfo === undefined)zk.clientinfo = true;</script>"); } if (dt.getAttribute(ATTR_DESKTOP_VISIBILITYCHANGE) != null) { dt.removeAttribute(ATTR_DESKTOP_VISIBILITYCHANGE); out.write( "<script type=\"text/javascript\">if(zk.visibilitychange === undefined)zk.visibilitychange = true;</script>"); } String resourceURL = (String) page.getAttribute(ATTR_PORTLET2_RESOURCEURL, Page.PAGE_SCOPE), namespace = (String) page.getAttribute(ATTR_PORTLET2_NAMESPACE, Page.PAGE_SCOPE); if (resourceURL != null) { page.removeAttribute(ATTR_PORTLET2_RESOURCEURL, Page.PAGE_SCOPE); page.removeAttribute(ATTR_PORTLET2_NAMESPACE, Page.PAGE_SCOPE); // B65-ZK-2210: store url and namespace per desktop. out.write("<script type=\"text/javascript\">if(!zk.portlet2Data) zk.portlet2Data = {};\n" + "zk.portlet2Data['" + dt.getId() + "'] = {" + "resourceURL: '" + resourceURL + "', " + "namespace: '" + namespace + "'};</script>"); } } outSEOContent(page, out); out.write("</div>"); }
/** * Terminate a {@linkplain OperationThread} which is stored in desktop and clear it. * * @param desktop the associated desktop */ public static void destroyWith(Desktop desktop) { if (desktop == null){ throw new NullPointerException("desktop is null"); } if(D.ON && log.debugable()){ log.debug("destory a Operation Thread for desktop:"+desktop); } synchronized(desktop) { if (desktop.isAlive()) {// destroy desktop if it still alive. OperationThread t = (OperationThread) desktop .getAttribute(DESKTOP_KEY); desktop.removeAttribute(DESKTOP_KEY); if (t != null && t.isRunning()) { t.terminate(); } } } }
/** * Creates an instance of {@link UploadEvent} based on the event name and component, * the {@link UploadEvent} contains the latest upload media from user. * Internal Use Only. * * @param name event name * @param component component that triggers the upload event * @return upload event * @since 8.6.0 */ public static UploadEvent getLatestUploadEvent(String name, Component component) { Desktop desktop = component.getDesktop(); String uuid = component.getUuid(); final List<Media> result = cast((List) desktop.getAttribute(uuid)); desktop.removeAttribute(uuid); return new UploadEvent(name, desktop.getComponentByUuid(uuid), UploadUtils.parseResult(result)); } }