/** Rendering and interface methods- */ public void renderFor(Rendering rendering) { final Viewport port = rendering.port; for (Mission mission : missions) { final Sprite flag = mission.flagSprite(); if (!port.intersects(flag.position, 2)) continue; rendering.addClient(flag); } }
public static void appendHeaderContent(FacesContext context) { List<String> renderedJsLinks = Resources.getRenderedJsLinks(context); String utilJs = Resources.utilJsURL(context); boolean renderFocusScript = isAutoFocusTrackingEnabled(context); boolean renderScrollingScript = isAutoScrollPosTrackingEnabled(context); boolean renderContextMenuScript = isDisabledContextMenuEnabled(context); if (!renderedJsLinks.contains(utilJs)) { if (renderFocusScript || renderScrollingScript || renderContextMenuScript || getForceIncludingUtilJs(context)) { Resources.addHeaderResource(context, Resources.UTIL_JS_PATH, Resources.LIBRARY_NAME); } } if (renderFocusScript) Resources.addHeaderInitScript(context, encodeFocusTracking(context)); if (renderScrollingScript) Resources.addHeaderInitScript(context, encodeScrollPosTracking(context)); if (renderContextMenuScript) Rendering.appendOnLoadScript(context, encodeDisabledContextMenu(context)); encodeAjaxProgressMessage(context); }
public static void encodeFormSubmissionAjaxInactivityTimeout(FacesContext context) { ExternalContext externalContext = context.getExternalContext(); String paramStr = externalContext.getInitParameter(SUBMISSION_AJAX_INACTIVITY_TIMEOUT_CONTEXT_PARAM); long inactivityTimeout = DEFAULT_SUBMISSION_AJAX_INACTIVITY_TIMEOUT; if (paramStr != null) { try { final long parameterValue = Long.parseLong(paramStr); inactivityTimeout = Math.abs(parameterValue); } catch (NumberFormatException e) { externalContext.log( "Invalid value specified for context parameter named " + SUBMISSION_AJAX_INACTIVITY_TIMEOUT_CONTEXT_PARAM + ": it must be a number"); } } final ScriptBuilder script = new ScriptBuilder("O$.setSubmissionAjaxInactivityTimeout(" + inactivityTimeout + ");"); Rendering.appendOnLoadScript(context, script); }
/** * Fix placeholders just before returning output. * * @param r Output about to be returned */ private void fixPlaceholders(Rendering r) { XML.replaceTokens(r.getXHTML(), "__", mPlaceholders); }
public Rendering render(RefImageNode node, String url, String title, String alt) { Rendering rendering = new Rendering(url, alt); return StringUtils.isEmpty(title) ? rendering : rendering.withAttribute("title", encode(title)); }
public Rendering render(ExpImageNode node, String text) { Rendering rendering = new Rendering(node.url, text); return StringUtils.isEmpty(node.title) ? rendering : rendering.withAttribute("title", encode(node.title)); }
private static boolean getForceIncludingUtilJs(FacesContext context) { return Rendering.getBooleanContextParam(context, FORCE_UTIL_JS_CONTEXT_PARAM); }
private static boolean isAutoScrollPosTrackingEnabled(FacesContext context) { return Rendering.getBooleanContextParam(context, AUTO_SCROLL_POS_TRACKING_CONTEXT_PARAM); }
private static boolean isDisabledContextMenuEnabled(FacesContext context) { return Rendering.getBooleanContextParam(context, DISABLED_CONTEXT_MENU_CONTEXT_PARAM); }
private static boolean isAutoFocusTrackingEnabled(FacesContext context) { return Rendering.getBooleanContextParam(context, AUTO_FOCUS_TRACKING_CONTEXT_PARAM); }