All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.myfaces.trinidadinternal.agent.TrinidadAgent Maven / Gradle / Ivy

The newest version!
/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */
package org.apache.myfaces.trinidadinternal.agent;

import java.util.HashMap;
import java.util.Map;

import org.apache.myfaces.trinidad.context.Agent;
import org.apache.myfaces.trinidad.context.Version;


/**
 * Extension of public Agent interface. Defines constants/method for AdInternal use.
 * Keeping this Interace as is (from before), but extends the public
 * the current (internal) code base uses this heavily.
 *
 */
public abstract class TrinidadAgent implements Agent, Cloneable
{
  static public final CapabilityKey CAP_DOM =
          CapabilityKey.getCapabilityKey("dom", true);

  static public final CapabilityKey CAP_ONCLICK_IMG_INPUT =
          CapabilityKey.getCapabilityKey("-adfinternal-onclickOnImgInput", true);

  static public final CapabilityKey CAP_XMLDOM =
          CapabilityKey.getCapabilityKey("-adfinternal-xmldom", true);

  static public final CapabilityKey CAP_ID =
          CapabilityKey.getCapabilityKey("-adfinternal-id", true);

  static public final CapabilityKey CAP_ACCESS_KEYS =
          CapabilityKey.getCapabilityKey("accessKeys", true);

  static public final CapabilityKey CAP_PARTIAL_RENDERING =
          CapabilityKey.getCapabilityKey("partialRendering", true);

  static public final CapabilityKey CAP_DISABLED_FORM_ELEMENTS =
          CapabilityKey.getCapabilityKey("-adfinternal-disabledFormElements", true);

  static public final CapabilityKey CAP_READONLY_FORM_ELEMENTS =
          CapabilityKey.getCapabilityKey("-adfinternal-readonlyFormElements", true);

  static public final CapabilityKey CAP_AUTO_COMPLETE_FORM_ELEMENTS =
          CapabilityKey.getCapabilityKey("-adfinternal-autoCompleteFormElements", true);

  static public final CapabilityKey CAP_ADVANCED_BUTTONS =
          CapabilityKey.getCapabilityKey("-adfinternal-advancedButtons", true);

  static public final CapabilityKey CAP_WIDTH =
          CapabilityKey.getCapabilityKey("width", true);

  static public final CapabilityKey CAP_HEIGHT =
          CapabilityKey.getCapabilityKey("height", true);

  /**
   * Touch-screen capability, indicating the agent supports TouchEvent and GestureEvent
   * events.
   */
  static public final CapabilityKey CAP_TOUCH_SCREEN =
          CapabilityKey.getCapabilityKey("touchScreen", true);
  
  /**
   * Session History Management (HTML5 History) Capability indicating support for 
   * APIs like history.pushState, history.replaceState, etc.
   */
  static public final CapabilityKey CAP_HISTORY_MANAGEMENT = 
          CapabilityKey.getCapabilityKey("historyManagement", true);

  //
  // XHTML Modularization
  //
  static public final CapabilityKey CAP_TEXT_PRESENTATION =
          CapabilityKey.getCapabilityKey("textPresentation", true);

  static public final CapabilityKey CAP_ADVANCED_FORMS =
          CapabilityKey.getCapabilityKey("-adfinternal-advancedForms", true);

  static public final CapabilityKey CAP_TABLES =
          CapabilityKey.getCapabilityKey("tables", true);

  static public final CapabilityKey CAP_FRAMES =
          CapabilityKey.getCapabilityKey("frames", true);

  static public final CapabilityKey CAP_TARGET =
          CapabilityKey.getCapabilityKey("-adfinternal-target", true);

  static public final CapabilityKey CAP_IFRAMES =
          CapabilityKey.getCapabilityKey("iframes", true);

  static public final CapabilityKey CAP_INTRINSIC_EVENTS =
          CapabilityKey.getCapabilityKey("-adfinternal-intrinsicEvents", true);

  static public final CapabilityKey CAP_STYLE_ATTRIBUTES =
          CapabilityKey.getCapabilityKey("-adfinternal-styleAttributes", true);

  static public final CapabilityKey CAP_NAME_IDENTIFICATION =
          CapabilityKey.getCapabilityKey("-adfinternal-nameIdentification", true);

  static public final CapabilityKey CAP_FIELDSET =
          CapabilityKey.getCapabilityKey("-adfinternal-fieldset", true);

  /**
   * capability describing level of support for css selectors
   */
  static public final CapabilityKey CAP_CSS_SELECTORS =
          CapabilityKey.getCapabilityKey("-adfinternal-cssSelectors", true);

  /**
   * true if supports disabling wrapping
   */
  static public final CapabilityKey CAP_NOWRAP =
          CapabilityKey.getCapabilityKey("-adfinternal-nowrap", true);

  /**
   * true if supports vertical alignment
   */
  static public final CapabilityKey CAP_VALIGN =
          CapabilityKey.getCapabilityKey("-adfinternal-valign", true);

  /**
   * true if the alt key renders a tooltip for an image *
   */
  static public final CapabilityKey CAP_ALT_RENDERS_TOOLTIP_ON_IMAGE =
          CapabilityKey.getCapabilityKey("-adfinternal-altRendersTooltipOnImage", true);

  static public final CapabilityKey CAP_SCRIPTING_SPEED =
          CapabilityKey.getCapabilityKey("scriptingSpeed", true);


  /**
   * true if multiple windows can be opened
   */
  static public final CapabilityKey CAP_MULTIPLE_WINDOWS =
          CapabilityKey.getCapabilityKey("-adfinternal-multipleWindows", true);


  // True if agent supports page navigation
  static public final CapabilityKey CAP_NAVIGATION =
          CapabilityKey.getCapabilityKey("-adfinternal-navigation", true);

  // True if agent supports editing
  static public final CapabilityKey CAP_EDITING =
          CapabilityKey.getCapabilityKey("-adfinternal-editing", true);

  // True if agent supports image stretching, ie. setting the img
  // width/height to a percentage.
  static public final CapabilityKey CAP_IMAGE_STRETCH =
          CapabilityKey.getCapabilityKey("-adfinternal-imageStretch", true);

  static public final CapabilityKey CAP_GIF_TYPE_IMAGE =
          CapabilityKey.getCapabilityKey("-adfinternal-gifImage", true);

  static public final CapabilityKey CAP_JPEG_TYPE_IMAGE =
          CapabilityKey.getCapabilityKey("-adfinternal-jpegImage", true);

  static public final CapabilityKey CAP_PNG_TYPE_IMAGE =
          CapabilityKey.getCapabilityKey("-adfinternal-pngImage", true);

  static public final CapabilityKey CAP_TRANSPARENT_PNG_TYPE_IMAGE =
          CapabilityKey.getCapabilityKey("-adfinternal-transparentPngImage", true);

  static public final CapabilityKey CAP_BMP_TYPE_IMAGE =
               CapabilityKey.getCapabilityKey("-adfinternal-bmpImage", true);

  static public final CapabilityKey CAP_SUPPORTS_DISABLED_OPTIONS = CapabilityKey
    .getCapabilityKey("-adfinternal-supportsDisabledOptions", true);


  static public final CapabilityKey CAP_IS_JDEV_VE = CapabilityKey
    .getCapabilityKey("-adfinternal-isJDevVE", true);

  static public final CapabilityKey CAP_IS_JDEV_JAVASCRIPT_VE = CapabilityKey
    .getCapabilityKey("-adfinternal-isJDevJavascriptVE", true);

  // If this capability flag is true, it means that the request is from an agent
  // that is running in a narrow-screen PDA. Trinidad optimizes its rendering
  // for narrow-screen PDAs to reduce the overall width of the page rendered.
  static public final CapabilityKey CAP_NARROW_SCREEN = CapabilityKey
    .getCapabilityKey("narrowScreen", true);

  //
  // Values for CAP_DOM
  //
  static public final Object DOM_CAP_NONE    =
          CapabilityValue.getCapabilityValue (CAP_DOM, "none");
  static public final Object DOM_CAP_FORM    =
          CapabilityValue.getCapabilityValue (CAP_DOM, "form");
  static public final Object DOM_CAP_LEVEL_1 =
          CapabilityValue.getCapabilityValue (CAP_DOM, "level1");
  static public final Object DOM_CAP_LEVEL_2 =
          CapabilityValue.getCapabilityValue (CAP_DOM, "level2");

  //
  // Values for CAP_SCRIPTING_SPEED
  //
  static public final Object SCRIPTING_SPEED_CAP_NONE =
          CapabilityValue.getCapabilityValue (CAP_SCRIPTING_SPEED, "none");
  static public final Object SCRIPTING_SPEED_CAP_SLOW =
          CapabilityValue.getCapabilityValue (CAP_SCRIPTING_SPEED, "slow");
  static public final Object SCRIPTING_SPEED_CAP_FAST =
          CapabilityValue.getCapabilityValue (CAP_SCRIPTING_SPEED,"fast");

  //
  // Values for CAP_TABLES
  //
  static public final Object TABLES_CAP_BASIC          =
          CapabilityValue.getCapabilityValue (CAP_TABLES, "basic");
  static public final Object TABLES_CAP_ADVANCED_ATTRS =
          CapabilityValue.getCapabilityValue (CAP_TABLES, "advanced_attrs");
  static public final Object TABLES_CAP_ADVANCED       =
          CapabilityValue.getCapabilityValue (CAP_TABLES, "advanced");

  //
  // Values for CAP_STYLE_ATTRIBUTES
  //
  // no styling is supported
  static public final Object STYLES_NONE               =
          CapabilityValue.getCapabilityValue (CAP_STYLE_ATTRIBUTES, "none");
  // only the 'style' attribute is supported. The 'class' attribute is not
  // supported.
  static public final Object STYLES_STYLE_ONLY              =
          CapabilityValue.getCapabilityValue (CAP_STYLE_ATTRIBUTES, "style_only");
  // internal styles only; this includes the style attribute, or the class attribute
  // as long as the style selectors are in the page with the