Example #1
0
  /** 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);
    }
  }
Example #2
0
  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);
  }
Example #3
0
  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);
 }
Example #5
0
 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));
 }
Example #6
0
 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));
 }
Example #7
0
 private static boolean getForceIncludingUtilJs(FacesContext context) {
   return Rendering.getBooleanContextParam(context, FORCE_UTIL_JS_CONTEXT_PARAM);
 }
Example #8
0
 private static boolean isAutoScrollPosTrackingEnabled(FacesContext context) {
   return Rendering.getBooleanContextParam(context, AUTO_SCROLL_POS_TRACKING_CONTEXT_PARAM);
 }
Example #9
0
 private static boolean isDisabledContextMenuEnabled(FacesContext context) {
   return Rendering.getBooleanContextParam(context, DISABLED_CONTEXT_MENU_CONTEXT_PARAM);
 }
Example #10
0
 private static boolean isAutoFocusTrackingEnabled(FacesContext context) {
   return Rendering.getBooleanContextParam(context, AUTO_FOCUS_TRACKING_CONTEXT_PARAM);
 }