Package org.apache.myfaces.trinidad.context

Examples of org.apache.myfaces.trinidad.context.Agent


  public static boolean supportsBooleanCapability(
    RenderingContext context,
    CapabilityKey cap
    )
  {
    Agent agent = context.getAgent();
    Object capPartial = agent.getCapabilities().get(cap);
    if (!Boolean.TRUE.equals(capPartial))
      return false;

    return true;
  }
View Full Code Here


    if (isUpper)
    {
      // We only generate the navigation bar ID if the agent is IE
      // and partial rendering is enabled.
      Object id = tContext.getTableId();
      Agent agent = rc.getAgent();

      if ((agent.getAgentName() == Agent.AGENT_IE) &&
          PartialPageUtils.isPPRActive(context))
      {
        String navBarID = id.toString() + "-nb";
        setRenderingProperty(rc, _UPPER_NAV_BAR_ID_PROPERTY, navBarID);
      }
View Full Code Here

   * @param context
   * @return
   */
  public static TrinidadAgent getAgent(FacesContext context)
  {
    Agent agent = RequestContext.getCurrentInstance().getAgent();
    if (agent instanceof TrinidadAgent)
      return (TrinidadAgent) agent;

    return new TrinidadAgentImpl(context, agent);
  }
View Full Code Here

        _characterSet = (matcher.groupCount() > 1) ? matcher.group(2) : null;

        if ("application/xhtml+xml".equals(_contentType))
        {
          //TODO: Is this still needed in IE7??
          Agent agent = RenderingContext.getCurrentInstance().getAgent();
          if (agent != null && Agent.AGENT_IE.equals(agent.getAgentName()))
          {
            // IE must serve XHTML as text/html
            contentTypeAndCharset = "text/html";

            if (_characterSet != null)
View Full Code Here

  @Override
  public Agent getAgent()
  {
    if (_agent == null)
    {
      Agent agent = _agentFactory.createAgent(__getFacesContext());
      // =-=AEW In theory, this does not need to be a TrinidadAgent
      // That should only be necessary once we get to rendering...
      // However, we're gonna have to turn it into one when it comes
      // to rendering time, and our RenderingContext isn't doing this
      // today
View Full Code Here

  {
    RequestContext trinContext = RequestContext.getCurrentInstance();
   
    if (trinContext != null)
    {
      Agent agent  = trinContext.getAgent();
     
      if (agent != null)
      {
        return agent.getCapabilities().get(TrinidadAgent.CAP_VE) != null;
      }
    }
   
    return false;
  }
View Full Code Here

      // BlackBerry(BB) browsers cannot handle width if it is expressed in
      // percentage and the percentage value contains a decimal points like
      // 40.0%. So lets truncate the percentage value from the decimal point
      // for BB browsers. Example, instead of 40.0%, lets render 40%.
      RenderingContext arc = RenderingContext.getCurrentInstance();
      Agent agent = arc.getAgent();

      boolean isBlackBerry =
                 Agent.AGENT_BLACKBERRY.equals(agent.getAgentName());

      // Now normalize the percentages (including the footer label width):
      double ratioTotal = (labelRatio + fieldRatio) / 100;
      double effectiveLabelWidthDouble = labelRatio / ratioTotal;
      double footerLabel = effectiveLabelWidthDouble / actualColumns;
View Full Code Here

    // In that case RequestContext could also be null.
    // bug 4695929:
    if (afc != null)
    {
      // TODO: Obviously, this cheesy algorithm is not quite enough!
      Agent agent = afc.getAgent();
      if (Agent.TYPE_PDA.equals(agent.getType()))
        return "org.apache.myfaces.trinidad.core.pda";
    }
    return "org.apache.myfaces.trinidad.core.desktop";
  }
View Full Code Here

          // BlackBerry browsers underline the entire text instead of just
          // the accessKey character in cases where the accessKey character
          // happens to be the first character in the text. Rendering an
          // empty span element before rendering the text fixes this problem.

          Agent agent = rc.getAgent();

          if ((accessKeyIndex == 0) &&
               Agent.AGENT_BLACKBERRY.equals(agent.getAgentName()))
          {
            rw.startElement("span", null);
            // Since an empty span element is not rendered, lets
            // include some attribute to the span element
            rw.writeAttribute("style", "display:inline", null);
View Full Code Here

    if ((null != messageType) &&
        !"none".equals(messageType) ||
        ((forId != null) &&
        isInline))
    {
      Agent agent = rc.getAgent();

      if ((agent != null) &&
            (Agent.AGENT_BLACKBERRY.equals(agent.getAgentName()) ||
             Agent.AGENT_GENERICPDA.equals(agent.getAgentName())) &&
          (null == messageType || "none".equals(messageType)))
      {
        return false;
      }
      return true;
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.context.Agent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.