Package org.apache.myfaces.trinidad.context

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


      // 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


  }

  protected void encodeAll(FacesContext context, RenderingContext arc,
      UIComponent component, FacesBean bean) throws IOException
  {
    Agent agent = arc.getAgent();

    // BlackBerry and many pda browsers don't support inline style of
    // display:none. Thus, it is necessary to slip rendering entire
    // element if there is no message to display.
    // This method checks for the condition and returns true.

    if (agent != null &&
                 (Agent.AGENT_BLACKBERRY.equals(agent.getAgentName()) ||
                  Agent.AGENT_GENERICPDA.equals(agent.getAgentName()) ))
    {
      boolean hasMessages =
                    FacesContext.getCurrentInstance().getMessages().hasNext();
      if (!hasMessages)
      {
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 = arc.getAgent();

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

    RenderingContext arc
    )
  {

    // First, make sure the agent supports partial rendering
    Agent agent = arc.getAgent();
    Object capPartial = agent.getCapabilities().get(TrinidadAgent.CAP_PARTIAL_RENDERING);
    if (!Boolean.TRUE.equals(capPartial))
      return false;

    return true;
  }
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

  @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

  @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

    // 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

  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 = arc.getAgent();

      if ((agent.getAgentName() == Agent.AGENT_IE) &&
          PartialPageUtils.isPPRActive(context))
      {
        String navBarID = id.toString() + "-nb";
        setRenderingProperty(arc, _UPPER_NAV_BAR_ID_PROPERTY, navBarID);
      }
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.