Parent Project

CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

File Line
org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerImpl.java 111
org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerUsingApiImpl.java 114
  public MenuContentHandlerUsingApiImpl()
  {
    super();

  }

  /**
   * Called by the SAX Parser at the start of parsing a document.
   */
  @Override
  public void startDocument()
  {
    _nodeDepth = 0;
    _menuNodes = new ArrayList<List<MenuNode>>();
    _menuList  = null;

    // Handler Id will have to change also to be unique
    _handlerId = Integer.toString(System.identityHashCode(_menuNodes));
  }

  /**
    * Start the parsing of an node element entry in the menu metadata file.
    * <p>
    * If the entry is for an itemNode or a destinationNode, create the node
    * and it to the List.  If the entry is for a sharedNode, a new submenu
    * model is created.
    *
    * @param nameSpaceUri - only used when passed to super class.
    * @param localElemName - only used when passed to super class.
    * @param qualifiedElemName - String designating the node type of the entry.
    * @param attrList - List of attributes in the menudata entry.
    * @throws SAXException
    */
  @SuppressWarnings("unchecked")
  @Override
  public void startElement(String nameSpaceUri, String localElemName,
                           String qualifiedElemName, Attributes attrList)
    throws SAXException
  {
    super.startElement(nameSpaceUri, localElemName, qualifiedElemName,
                       attrList);

    if (_ROOT_NODE.equals(qualifiedElemName))
    {
      // Unless both of these are specified, don't attempt to load
      // the resource bundle.
      String resBundle    = attrList.getValue(_RES_BUNDLE_ATTR);
      String resBundleKey = attrList.getValue(_VAR_ATTR);

      if (   (resBundle != null    && !"".equals(resBundle))
          && (resBundleKey != null && !"".equals(resBundleKey))
         )
      {
        // Load the resource Bundle.
        // Ensure the bundle key is unique by appending the
        // handler Id.
        MenuUtils.loadBundle(resBundle, resBundleKey + getHandlerId());
        _resBundleKey  = resBundleKey;
        _resBundleName = resBundle;
      }
    }
    else
    {
      // Either itemNode, destinationNode, or groupNode
      boolean isNonSharedNode = (   _ITEM_NODE.equals(qualifiedElemName)
                                 || _GROUP_NODE.equals(qualifiedElemName)
                                );

      if (isNonSharedNode)
      {
        _currentNodeStyle = (  _ITEM_NODE.equals(qualifiedElemName)
                             ? MenuConstants.NODE_STYLE_ITEM
                             : MenuConstants.NODE_STYLE_GROUP
                            );
        _nodeDepth++;

        if ((_skipDepth >= 0) && (_nodeDepth > _skipDepth))
        {
          // This sub-tree is being skipped, so just return
          return;
        }

        if (_menuNodes.size() < _nodeDepth)
        {
          _menuNodes.add(new ArrayList<MenuNode>());
        }

        _attrMap = _getMapFromList(attrList);

        // Create either an itemNode or groupNode.
        MenuNode menuNode = _createMenuNode();

        if (menuNode == null)
        {
          // No menu item is created, so note that we are
          // now skipping the subtree
          _skipDepth = _nodeDepth;
        }
        else
        {
          if (   (_resBundleName != null && !"".equals(_resBundleName))
              && (_resBundleKey  != null && !"".equals(_resBundleKey))
             )
          {
            menuNode.setResBundleKey(_resBundleKey);
            menuNode.setResBundleName(_resBundleName);
          }

          // Set the node's MenuContentHandlerUsingApiImpl id so that when
          // the node's getLabel() method is called, we can
          // use the handlerId to insert into the label
          // if it is an EL expression.
          menuNode.setHandlerId(getHandlerId());

          // Set the root model on the node so we can call into
          // the root model from the node to populate its
          // idNodeMap (See XMLMenuModel.java)
          menuNode.setRootModelKey(getRootModelKey());

          // Set the local model (created when parsing a sharedNode)
          // on the node in case the node needs to get back to its
          // local model.
          menuNode.setModelId(getModelId());

          // menu nodes need to know how to refer
          // back to the specific xml menu model
          // so that they can mutate them.
          FacesContext facesContext = FacesContext.getCurrentInstance();
          Map<String, Object> requestMap =
            facesContext.getExternalContext().getRequestMap();
          if(!requestMap.containsKey(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY))
            menuNode.setRootId( (getId() ) );
          else
            menuNode.setRootId((Integer) requestMap.get(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY));

          List<MenuNode> list = _menuNodes.get(_nodeDepth-1);
          list.add(menuNode.getThreadSafeCopy());
        }
      }
      else if (_SHARED_NODE.equals(qualifiedElemName))
      {
        _nodeDepth++;

        // SharedNode's "ref" property points to another submenu's metadata,
        // and thus a new model, which we build here.  Note: this will
        // recursively call into this MenuContentHandlerUsingApiImpl when parsing the
        // submenu's metadata.
        String expr = attrList.getValue(_REF_ATTR);
        
        // push this only when we are root model
        FacesContext facesContext = FacesContext.getCurrentInstance();
        Map<String, Object> requestMap =
          facesContext.getExternalContext().getRequestMap();
        Integer recurseLevel = (Integer) requestMap.get(_RECURSE_COUNTER);
        if(recurseLevel == null) 
          recurseLevel = 0;
        if(recurseLevel == 0)
          requestMap.put(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY, this.getId());
        
        recurseLevel++;
        requestMap.put(_RECURSE_COUNTER, recurseLevel);
        

        // Need to push several items onto the stack now as we recurse
        // into another menu model.
        _saveModelData();

        // Create the sub menu model specified in the sharedNode
        XMLMenuModel menuModel = (XMLMenuModel)MenuUtils.getBoundValue(expr,
                                                              Object.class);


        // Now must pop the values cause we are back to the parent
        // model.
        _restoreModelData();
        
        recurseLevel = (Integer) requestMap.get(_RECURSE_COUNTER);
        recurseLevel --;
        requestMap.put(_RECURSE_COUNTER, recurseLevel);
        
        if(recurseLevel == 0)
          requestMap.remove(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY);
        

        // Name of the managed bean that is the sub menu XMLMenuModel.
        String modelStr = expr.substring(expr.indexOf('{')+1,
                                         expr.indexOf('}'));

        // There are 2 ways that a Model can be invalid:
        // 1) Something such as a missing managed bean definition
        //    for the submenu model causes the creation of the
        //    XMLMenuModel for the submenu to fail. This will result
        //    in menuModel being NULL.
        // 2) Some kind of parsing error in its metadata.  If a node
        //    type is invalid, an exception will be thrown (see below)
        //    and caught in getTreeModel().  This will result in a
        //    null submenu list the following SAXException will also
        //    be logged.
        if (menuModel != null)
        {
          Object         subMenuObj  = menuModel.getWrappedData();
          List<MenuNode> subMenuList = null;

          if (subMenuObj instanceof ChildPropertyTreeModel)
          {
            subMenuList =
              (List<MenuNode>)((ChildPropertyTreeModel)subMenuObj).getWrappedData();
          }

          if (subMenuList != null)
          {
            // SharedNode could be the first child
            // So we need a new list for the children
            if (_menuNodes.size() < _nodeDepth)
            {
              _menuNodes.add(new ArrayList<MenuNode>());
            }

            List<MenuNode> list = _menuNodes.get(_nodeDepth-1);
            list.addAll(subMenuList);
          }
          else
          {
            // Let it go through but log it.  This way the rest of
            // the Tree gets built and this submenu is skipped.
            SAXException npe =
              new SAXException("Shared Node Model not created for " + modelStr);
          }
        }
        else
        {
          // Let it go through but log it.  This way the rest of
          // the Tree gets built and this submenu is skipped.
          NullPointerException npe =
            new NullPointerException("Shared Node Model not created for "
              + modelStr + ". Check for the existence of the corresponding "
              + "managed bean in your config files.");

          _LOG.severe (npe.getMessage(), npe);
        }
      }
      else
      {
        // Throw an Exception for any node that is not of type
        // menu, itemNode, groupNode, or sharedNode.  This will get
        // caught in getTreeModel()
        throw new SAXException("Invalid Node type: " + localElemName);
      }
    }
  }

  /**
   * Processing done at the end of parsing a node enty element from the
   * menu metadata file.  This manages the node depth properly so that
   * method startElement works correctly to build the List.
   *
   * @param nameSpaceUri - not used.
   * @param localElemName - not used.
   * @param qualifiedElemName - String designating the node type of the entry.
   */
  @Override
  public void endElement(String nameSpaceUri, String localElemName, String qualifiedElemName)
  {
    if (   _ITEM_NODE.equals(qualifiedElemName)
        || _GROUP_NODE.equals(qualifiedElemName)
       )
    {
      _nodeDepth--;

      if (_skipDepth >= 0)
      {
        if (_nodeDepth < _skipDepth)
        {
          _skipDepth = -1;
        }
      }
      else
      {
        if (_nodeDepth > 0)
        {
          // The parent menu item is the last menu item at the previous depth
          List<MenuNode> parentList = _menuNodes.get(_nodeDepth-1);
          MenuNode       parentNode = parentList.get(parentList.size()-1);

          parentNode.setChildren(_menuNodes.get(_nodeDepth));
        }

        // If we have dropped back two levels, then we are done adding
        // the parent's sub tree, remove the list of menu items at that level
        // so they don't get added twice.
        if (_nodeDepth == (_menuNodes.size() - 2))
        {
          _menuNodes.remove(_nodeDepth+1);
        }
      }
    }
    else if (_SHARED_NODE.equals(qualifiedElemName))
    {
      _nodeDepth--;

      // In processing a sharedNode in startElement(), it is possible
      // that a sharedNode model is not created properly. However,
      // we only log an error and let parsing continue so that the whole
      // Tree can get created w/o the failed sharedNode submenu model.
      // Thus we need the 2nd conditional here to detect if we are at
      // the end of parsing a failed sharedNode.
      if (_nodeDepth > 0  && _menuNodes.size() > _nodeDepth)
      {
        // The parent menu item is the last menu item at the previous depth
        List<MenuNode> parentList = _menuNodes.get(_nodeDepth-1);
        MenuNode       parentNode = parentList.get(parentList.size()-1);

        parentNode.setChildren(_menuNodes.get(_nodeDepth));
      }
    }
  }

  /**
   * Called by the SAX Parser at the end of parsing a document.
   * Here, the menuList is put on the menuList map.
   */
  @Override
  public void endDocument()
  {
    if (_menuNodes.isEmpty())
    {
      // Empty tree is created to prevent
      // later NPEs if menu model methods are called.
      _LOG.warning ("CREATE_TREE_WARNING: Empty Tree!");

      List<MenuNode> list = Collections.emptyList();
      _menuList = list;
    }
    else
    {
      _menuList = _menuNodes.get(0);

      // Create the treeModel
      ChildPropertyTreeModel treeModel =
                    new ChildPropertyTreeModel(_menuList, "children");


      if (_isRootHandler)
      {
        _viewIdFocusPathMap = new HashMap<String,List<Object>>();
        _nodeFocusPathMap   = new HashMap<Object, List<Object>>();
        _idNodeMap          = new HashMap<String, Object>();
        Object oldPath      = treeModel.getRowKey();

        treeModel.setRowKey(null);

        // Populate the maps
        _addToMaps(treeModel, _viewIdFocusPathMap, _nodeFocusPathMap, _idNodeMap);

        treeModel.setRowKey(oldPath);
      }
    }
  }

  /**
   * Get the Model's viewIdFocusPathMap
   *
   * @return the Model's viewIdFocusPathMap
   */
  public Map<String, List<Object>> getViewIdFocusPathMap(Object modelKey)
  {
    return _viewIdFocusPathMap;
  }

  /**
   * Get the Model's nodeFocusPathMap
   *
   * @return the Model's nodeFocusPathMap
   */
  public Map<Object, List<Object>> getNodeFocusPathMap(Object modelKey)
  {
    return _nodeFocusPathMap;
  }

  /**
   * Get the Model's idNodeMap
   *
   * @return the Model's idNodeMap
   */
  public Map<String, Object> getIdNodeMap(Object modelKey)
  {
    return _idNodeMap;
  }

  /**
    * Get the treeModel built during parsing
    *
    * @return List of menu nodes.
    */
  public TreeModel getTreeModel(String uri)
  {
     List<MenuNode> list = _menuList;
     
    // If we have a cached model, return it.
    if (list != null)
      return new ChildPropertyTreeModel(list,"children");

    synchronized(this)
    {
      list = _menuList;
      if (list == null)// double check inside lock
      {
        // Build a Tree model.  Parsing puts the tree model
        // in the map, see method endDocument().
        _currentTreeModelMapKey = uri;
        try
        {
          // Get a parser.  NOTE: we are using the jdk's 1.5 SAXParserFactory
          // and SAXParser here.
          SAXParser parser = _SAX_PARSER_FACTORY.newSAXParser();

          // Call the local menu model's getStream() method. This is a model
          // method so that it can be overridden by any model extending
          // XmlMenuModel.
          InputStream inStream = getModel().getStream(uri);

          // Parse the metadata
          parser.parse(inStream, this);

          inStream.close();
        } catch (SAXException saxex)
        {
          _LOG.severe("SAX Parse Exception parsing " + uri + ": " +
              saxex.getMessage(), saxex);
        } catch (IOException ioe)
        {
          _LOG.severe("Unable to open an InputStream to " + uri, ioe);
        } catch (IllegalArgumentException iae)
        {
          _LOG.severe("InputStream to " + iae + " is null", iae);
        } catch (ParserConfigurationException pce)
        {
          _LOG.severe("Unable to create SAX parser for " + uri, pce);
        }
        list = _menuList;
      }
    }
    return new ChildPropertyTreeModel(list,"children");
  }

  /**
   * Get the top-level, root menu model, which contains
   * the entire menu tree.
   *
   * @return root, top-level XMLMenuModel
   */
  @SuppressWarnings("unchecked")
  public XMLMenuModel getRootModel()
  {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Map<String, Object> requestMap =
      facesContext.getExternalContext().getRequestMap();

    Map<String,XMLMenuModel> modelMap = (Map<String,XMLMenuModel>) requestMap.get(getRootModelKey());
    if(!requestMap.containsKey(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY))
      return modelMap.get( (this.getId() ) );
    else
      return modelMap.get((Integer) requestMap.get(XMLMenuModel.SHARED_MODEL_INDICATOR_KEY));
  }

  /**
   * Get the top-level, root menu model's Request Map Key.
   *
   * @return root, top-level XMLMenuModel's Request Map Key.
   */
  public String getRootModelKey()
  {
    return _rootModelKey;
  }

  /**
   * Sets the root menu Model's Request map key.
   * <p>
   * This is always only the top-level, root model's Request map key.
   * We do this because the MenuContentHandlerUsingApiImpl and nodes need to be able
   * to call into the root model to:
   * <ul>
   * <li>notify them root menu model of the currently selected node on a POST
   * <li>group node needs to find its referenced item node.
   * </ul>
   *
   * @param rootModelKey - String the root, top-level menu model's Request
   *        map key.
   */
  public void setRootModelKey(String rootModelKey)
  {
    _rootModelKey = rootModelKey;
  }

  /**
   * Get the local (sharedNode) menu model.
   *
   * @return sharedNode's XMLMenuModel
   */
  @SuppressWarnings("unchecked")
  public XMLMenuModel getModel()
  {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Map<String, Object> requestMap =
      facesContext.getExternalContext().getRequestMap();

    return (XMLMenuModel) requestMap.get(getModelId());
  }

  /**
   * Get the local (sharedNode) menu model's Uri.
   *
   * @return sharedNode's XMLMenuModel Uri
   */
  public String getModelId()
  {
    return _localModelId;
  }

  /**
   * Sets the local (sharedNode's) menu Model's System Id.
   *
   * @param localModelId - String the root, top-level menu model's Uri.
   */
  public void setModelId(String localModelId)
  {
    _localModelId = localModelId;
  }

  /**
   * Sets the treeModel map key used to get a cached treeModel
   * from the MenuContentHandlerUsingApiImpl.
   *
   * Note: this is set from the XMLMenuModel BEFORE parsing begins
   *
   * @param uri String path to the menu model's metadata
   */
  public void setTreeModelKey(String uri)
  {
    _currentTreeModelMapKey = uri;
  }

  
  public void setRootHandler(boolean isRoot)
  {
    _isRootHandler = isRoot;
  }
  
  /**
   * sets the id of this content handler
   * 
   * No synchronization necessary,let
   * the first thread set the id,
   * the rest of the threads will immediately
   * see the new value and will not try to 
   * set again.
   */
  public void setId(int id)
  {
    if(_id == -1)
      _id = id;
  }
  
  public int getId()
  {
    return _id;
  }
  //=======================================================================
  // Package Private Methods
  //=======================================================================
  /**
   * Gets the MenuContentHandlerUsingApiImpl's id.
   *
   * This is set in the MenuContentHandlerUsingApiImpl's Constructor
   * and is used to ensure that the all resource bundle keys
   * and node ids are unique.
   *
   * @return String handler id.
   */
  String getHandlerId()
  {
    return _handlerId;
  }

  /**
   * Returns the hashmap key for a resource bundle.
   *
   * This the value of the "var" attribute for the menu root node
   * from the menu's metadata
   *
   * @return String hashmap key.
   */
  String getBundleKey()
  {
    return _resBundleKey;
  }

  //=======================================================================
  // Private Methods
  //=======================================================================

 /**
   * Create a Map of name/value pairs from the attrList given
   * to us by the Sax parser.
   *
   * @param attrList List of attributes of an XML element
   * @return Map hashMap of attributes converted to name/value pairs.
   */
  @SuppressWarnings("unchecked")
  private Map<String, String> _getMapFromList(Attributes attrList)
  {
    Map<String, String> attrMap = new HashMap<String, String>();

    for (int i=0; i < attrList.getLength(); i++)
    {
      attrMap.put(attrList.getQName(i), attrList.getValue(i) );
    }

    return attrMap;
  }

 /**
   * Creates a MenuNode from attribute list.
   *
   * @return MenuNode used in the Menu List.
   */
  private MenuNode _createMenuNode ()
  {
    // Get generic attributes

    // If the node has rendered = false, do not create it.
    // This is a security risk and cannot be allowed
    String renderedStr = _getAndRemoveAttrValue(_RENDERED_ATTR);

    // We do not create nodes whose rendered attr is false
    // and if the Root model or the local model's (sharedNode
    // model) says that nodes whose rendered attribute is false
    // should not be created, then we don't either.
    //
    // This default value of false (don't create nodes whose
    // rendered attr is false) can be overridden by the
    // XMLMenuModel's managed property, createHiddenNodes.
    // Typically this is done in faces-config.xml
    //
    if (   "false".equals(renderedStr)
        && (   !getRootModel().getCreateHiddenNodes()
            || !getModel().getCreateHiddenNodes()
           )
       )
    {
      return null;
    }

    String label       = _getAndRemoveAttrValue(_LABEL_ATTR);
    String icon        = _getAndRemoveAttrValue(_ICON_ATTR);
    String disabledStr = _getAndRemoveAttrValue(_DISABLED_ATTR);
    String readOnlyStr = _getAndRemoveAttrValue(_READONLY_ATTR);
    String accessKey   = _getAndRemoveAttrValue(_ACCESSKEY_ATTR);
    String labelAndAccessKey = _getAndRemoveAttrValue(_LABEL_AND_ACCESSKEY_ATTR);
    String id          = _getAndRemoveAttrValue(_ID_ATTR);
    String visibleStr  = _getAndRemoveAttrValue(_VISIBLE_ATTR);

    MenuNode menuNode = (  _currentNodeStyle == MenuConstants.NODE_STYLE_ITEM
                         ? _createItemNode()
                         : _createGroupNode()
                        );

    // Set the generic attributes
    menuNode.setLabel(label);
    menuNode.setIcon(icon);
    menuNode.setDisabled(disabledStr);
    menuNode.setRendered(renderedStr);
    menuNode.setReadOnly(readOnlyStr);
    menuNode.setAccessKey(accessKey);
    menuNode.setId(id);
    menuNode.setVisible(visibleStr);

    if (labelAndAccessKey != null)
      menuNode.setLabelAndAccessKey(labelAndAccessKey);

    return menuNode;
  }

  /**
    * Creates an itemNode from attribute list obtained by parsing an
    * itemNode menu metadata entry.
    *
    * @return Node of type ItemNode.
    */
  private ItemNode _createItemNode()
  {
    // Create the itemNode
    ItemNode itemNode = new ItemNode();

    String action         = _getAndRemoveAttrValue(_ACTION_ATTR);
    String actionListener = _getAndRemoveAttrValue(_ACTIONLISTENER_ATTR);
    String launchListener = _getAndRemoveAttrValue(_LAUNCHLISTENER_ATTR);
    String returnListener = _getAndRemoveAttrValue(_RETURNLISTENER_ATTR);
    String immediate      = _getAndRemoveAttrValue(_IMMEDIATE_ATTR);
    String useWindow      = _getAndRemoveAttrValue(_USEWINDOW_ATTR);
    String windowHeight   = _getAndRemoveAttrValue(_WINDOWHEIGHT_ATTR);
    String windowWidth    = _getAndRemoveAttrValue(_WINDOWWIDTH_ATTR);
    String defaultFocusPathStr = _getAndRemoveAttrValue(_DEFAULT_FOCUS_PATH_ATTR);
    String focusViewId    = _getAndRemoveAttrValue(_FOCUS_VIEWID_ATTR);

    // Former Destination node attrs
    String destination = _getAndRemoveAttrValue(_DESTINATION_ATTR);
    String targetFrame = _getAndRemoveAttrValue(_TARGETFRAME_ATTR);

    // An item node with one of two(2) possible values:
    // 1) outcome
    // 2) EL method binding  (which can return either a URI or
    //    an outcome

    // Set its properties - null is ok.
    itemNode.setAction(action);
    itemNode.setActionListener(actionListener);
    itemNode.setLaunchListener(launchListener);
    itemNode.setReturnListener(returnListener);
    itemNode.setImmediate(immediate);
    itemNode.setUseWindow(useWindow);
    itemNode.setWindowHeight(windowHeight);
    itemNode.setWindowWidth(windowWidth);
    itemNode.setFocusViewId(focusViewId);
    itemNode.setDefaultFocusPath(defaultFocusPathStr);

    // Former destination node attrs
    itemNode.setDestination(destination);
    itemNode.setTargetFrame(targetFrame);

    // Set the Any Attributes Attrlist
    if (_attrMap.size() > 0)
    {
      itemNode.setCustomPropList(_attrMap);
    }

    return itemNode;
  }

  /**
    * Creates a GroupNode from attribute list passed obtained by parsing
    * a GroupNode menu metadata entry.
    *
    * @return Node of type GroupNode
    */
  private GroupNode _createGroupNode()
  {
    // Create the GroupNode
    GroupNode groupNode = new GroupNode();
    String idRef = _getAndRemoveAttrValue(_IDREF_ATTR);

    // Set its attributes - null is ok
    groupNode.setIdRef(idRef);

    return groupNode;
  }

  /**
   * Saves all information needed for parsing and building model data
   * before recursing into the new model of a sharedNode.
   *
   * Note: if you add a new push in this method, you must also add
   * a corresponding pop in _restoreModelData() below in the correct order.
   */
  @SuppressWarnings("unchecked")
  private void _saveModelData()
  {
    if (_saveDataStack == null)
    {
      _saveDataStack = new Stack<Object>();
    }

    // DO NOT CHANGE THE ORDER HERE.  IT MUST MATCH
    // "pops" DONE BELOW in _restoreModelData.
    int nodeDepthSave       = _nodeDepth;
    ArrayList<List<MenuNode>> menuNodesSave =
      new ArrayList<List<MenuNode>>(_menuNodes);


    ArrayList<Object> menuListSave  =
      (  _menuList != null
       ? new ArrayList<Object>(_menuList)
       : null
      );

    String mapTreeKeySave    = _currentTreeModelMapKey;
    String localModelIdSave = _localModelId;
    String handlerId         = _handlerId;
    String resBundleName     = _resBundleName;
    String resBundleKey      = _resBundleKey;
    _saveDataStack.push(nodeDepthSave);
    _saveDataStack.push(menuNodesSave);
    _saveDataStack.push(menuListSave);
    _saveDataStack.push(mapTreeKeySave);
    _saveDataStack.push(localModelIdSave);
    _saveDataStack.push(handlerId);
    _saveDataStack.push(resBundleName);
    _saveDataStack.push(resBundleKey);
  }

  /**
   * Restores data needed for parsing and building model data
   * as execution returns from creating a sharedNode child menu model.
   *
   * Note: if you add a new pop in this method, you must also add
   * a corresponding push in _saveModelData() above in the correct order.
   */
  @SuppressWarnings("unchecked")
  private void _restoreModelData()
  {
    // DO NOT CHANGE THE ORDER HERE.  IT MUST MATCH
    // "pushes" DONE ABOVE in _saveModelData.
    _resBundleKey           = (String) _saveDataStack.pop();
    _resBundleName          = (String) _saveDataStack.pop();
    _handlerId              = (String) _saveDataStack.pop();
    _localModelId          = (String) _saveDataStack.pop();
    _currentTreeModelMapKey = (String) _saveDataStack.pop();
    _menuList               = (ArrayList<MenuNode>) _saveDataStack.pop();
    _menuNodes              = (ArrayList<List<MenuNode>>) _saveDataStack.pop();
    _nodeDepth              = ((Integer)_saveDataStack.pop()).intValue();
  }

  /**
   * Gets the specified attribute's value from the Attributes List
   * passed in by the parser.  Also removes this attribute so that
   * once we are finished processing and removing all the known
   * attributes, those left are custom attributes.
   *
   * @param attrName
   * @return String value of the attribute in the Attributes List.
   */
  private String _getAndRemoveAttrValue(String attrName)
  {
    String attrValue = _attrMap.get(attrName);

    if (attrValue != null)
      _attrMap.remove(attrName);

    return attrValue;
  }

  /*=========================================================================
   * Menu Model Data Structure section.
   * ======================================================================*/
  /**
   * Traverses the tree and builds the model's viewIdFocusPathMap,
   * nodeFocusPathMap, and _idNodeMap
   *
   * @param tree
   */
  @SuppressWarnings("unchecked")
  private void _addToMaps(
    TreeModel tree,
    Map viewIdFocusPathMap,
    Map nodeFocusPathMap,
    Map idNodeMap)
  {
    for ( int i = 0; i < tree.getRowCount(); i++)
    {
      tree.setRowIndex(i);

      // Get the node
      MenuNode node = (MenuNode) tree.getRowData();

      // Get its focus path
      List<Object> focusPath = (List<Object>)tree.getRowKey();

      // Get the focusViewId of the node
      Object viewIdObject = node.getFocusViewId();

      if (viewIdObject != null)
      {
        // Put this entry in the nodeFocusPathMap
        nodeFocusPathMap.put(node, focusPath);

        // Does this viewId already exist in the _viewIdFocusPathMap?
        List<Object> existingFpArrayList =
          _viewIdFocusPathMap.get(viewIdObject);

        if (existingFpArrayList == null)
        {
          // This is a node with a unique focusViewId.  Simply create
          // and Arraylist and add the focusPath as the single entry
          // to the focus path ArrayList.  Then put the focusPath
          // ArrayList in the focusPath HashMap.
          List<Object> fpArrayList = new ArrayList<Object>();
          fpArrayList.add(focusPath);
          viewIdFocusPathMap.put(viewIdObject, fpArrayList);
        }
        else
        {
          // This is a node that points to the same viewId as at least one
          // other node.

          // If the node's defaultFocusPath is set to true, we move it to
          // the head of the ArrayList. The 0th element of the list is
          // always returned when navigation to a viewId occurs from outside
          // the menu model (that is _currentNode is null)
          boolean defFocusPath = node.getDefaultFocusPath();

          if (defFocusPath)
          {
            existingFpArrayList.add(0, focusPath);
          }
          else
          {
            existingFpArrayList.add(focusPath);
          }
        }
      }

      // Get the Id of the node
      String idProp = node.getUniqueId();

      if (idProp != null)
      {
        idNodeMap.put(idProp, node);
      }

      if (tree.isContainer() && !tree.isContainerEmpty())
      {
        tree.enterContainer();
        _addToMaps(tree, viewIdFocusPathMap, nodeFocusPathMap, idNodeMap);
        tree.exitContainer();
      }
    }
  }

  //========================================================================
  // Private variables
  //========================================================================

  private List<List<MenuNode>> _menuNodes;
  private volatile List<MenuNode>       _menuList;
  private String _currentTreeModelMapKey;
  private int    _nodeDepth;
  private int    _skipDepth = -1;
  private String _currentNodeStyle;
  private String _handlerId;
  private String _resBundleKey;
  private String _resBundleName;

  private Map<String, String>       _attrMap;
  private Stack<Object>             _saveDataStack;
  private Map<String, List<Object>> _viewIdFocusPathMap;
  private Map<Object, List<Object>> _nodeFocusPathMap;
  private Map<String, Object>       _idNodeMap;


  // Local (shared) Menu models Uri
  private String _localModelId = null;

  // Root Menu model's Session map key
  private String _rootModelKey  = null;
  
  private volatile boolean _isRootHandler;
  
  private volatile int _id  = -1;

  // Nodes
  private final static String _GROUP_NODE        = "groupNode";
  private final static String _ITEM_NODE         = "itemNode";
  private final static String _SHARED_NODE       = "sharedNode";
  private final static String _ROOT_NODE         = "menu";

  // Attributes
  private final static String _LABEL_ATTR        = "label";
  private final static String _RENDERED_ATTR     = "rendered";
  private final static String _ID_ATTR           = "id";
  private final static String _IDREF_ATTR        = "idref";
  private final static String _ICON_ATTR         = "icon";
  private final static String _DISABLED_ATTR     = "disabled";
  private final static String _DESTINATION_ATTR  = "destination";
  private final static String _ACTION_ATTR       = "action";
  private final static String _REF_ATTR          = "ref";
  private final static String _READONLY_ATTR     = "readOnly";
  private final static String _VAR_ATTR          = "var";
  private final static String _RES_BUNDLE_ATTR   = "resourceBundle";
  private final static String _FOCUS_VIEWID_ATTR = "focusViewId";
  private final static String _ACCESSKEY_ATTR    = "accessKey";
  private final static String _LABEL_AND_ACCESSKEY_ATTR = "labelAndAccessKey";
  private final static String _TARGETFRAME_ATTR  = "targetframe";
  private final static String _ACTIONLISTENER_ATTR = "actionListener";
  private final static String _LAUNCHLISTENER_ATTR = "launchListener";
  private final static String _RETURNLISTENER_ATTR = "returnListener";
  private final static String _IMMEDIATE_ATTR      = "immediate";
  private final static String _USEWINDOW_ATTR      = "useWindow";
  private final static String _WINDOWHEIGHT_ATTR   = "windowHeight";
  private final static String _WINDOWWIDTH_ATTR    = "windowWidth";
  private final static String _DEFAULT_FOCUS_PATH_ATTR  = "defaultFocusPath";
  private final static String _VISIBLE_ATTR        = "visible";

  private static final SAXParserFactory _SAX_PARSER_FACTORY;
  static
  {
      _SAX_PARSER_FACTORY = SAXParserFactory.newInstance();
  }
  
  private final static TrinidadLogger _LOG =
                        TrinidadLogger.createTrinidadLogger(MenuContentHandlerUsingApiImpl.class);
File Line
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/MessageBoxRenderer.java 157
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SideBarRenderer.java 176
    _renderFilterChild(context, node);
  }

  // End the table row with the contents
  private void _endContentsRow(
    FacesContext     fContext,
    RenderingContext arc,
    IconData         icons
    ) throws IOException
  {
    ResponseWriter writer = fContext.getResponseWriter();

    writer.endElement(TABLE_DATA_ELEMENT);

    if (icons.endBackground != null)
    {
      writer.startElement(TABLE_DATA_ELEMENT, null);
      org.apache.myfaces.trinidadinternal.renderkit.core.skin.CoreSkinUtils.__renderBackgroundIcon(fContext, arc, icons.endBackground);
      writer.endElement(TABLE_DATA_ELEMENT);
    }

    writer.endElement(TABLE_ROW_ELEMENT);
  }

  // Tests whether this contentContainer has a bottom row
  private boolean _hasBottomRow(IconData icons)
  {
    // We have a bottom row if we have a bottom start/end icon
    return ((icons.bottomStart != null) || (icons.bottomEnd != null));
  }

  // Renders the bottom row
  private void _renderBottomRow(
    FacesContext     fContext,
    RenderingContext arc,
    IconData         icons,
    int              columnCount
    ) throws IOException
  {
    ResponseWriter writer = fContext.getResponseWriter();

    // Render the contents inside of its own table row
    writer.startElement(TABLE_ROW_ELEMENT, null);

    // If we've got a start icon, render it
    if (icons.bottomStart != null)
    {
      writer.startElement(TABLE_DATA_ELEMENT, null);
      OutputUtils.renderIcon(fContext, arc, icons.bottomStart, "", null);     
      writer.endElement(TABLE_DATA_ELEMENT);
    }

    // Render the cell with the bottom background icon.  We first
    // need to determine how many columns the background cell should
    // fill.
    Integer colspan = _getBottomBackgroundColumnCount(icons, columnCount);

    writer.startElement(TABLE_DATA_ELEMENT, null);
    writer.writeAttribute(COLSPAN_ATTRIBUTE, colspan, null);
    writer.writeAttribute(WIDTH_ATTRIBUTE, "100%", null);
    org.apache.myfaces.trinidadinternal.renderkit.core.skin.CoreSkinUtils.__renderBackgroundIcon(fContext, arc, icons.bottomBackground);
    writer.endElement(TABLE_DATA_ELEMENT);

    // If we've got an end icon, render it
    if (icons.bottomEnd != null)
    {
      writer.startElement(TABLE_DATA_ELEMENT, null);
      OutputUtils.renderIcon(fContext, arc, icons.bottomEnd, "", null);     
      writer.endElement(TABLE_DATA_ELEMENT);
    }

    writer.endElement(TABLE_ROW_ELEMENT);
  }

  // Tests whether this contentContainer has a top row
  private boolean _hasTopRow(IconData icons)
  {
    // We have a top row if we have a top start/end icon
    return ((icons.topStart != null) || (icons.topEnd != null));
  }

  // Renders the top row
  private void _renderTopRow(
    FacesContext     fContext,
    RenderingContext arc,
    IconData         icons,
    int              columnCount
    ) throws IOException
  {
    ResponseWriter writer = fContext.getResponseWriter();

    // Render the contents inside of its own table row
    writer.startElement(TABLE_ROW_ELEMENT, null);

    // If we've got a start icon, render it
    if (icons.topStart != null)
    {
      writer.startElement(TABLE_DATA_ELEMENT, null);
      OutputUtils.renderIcon(fContext, arc, icons.topStart, "", null);           
      writer.endElement(TABLE_DATA_ELEMENT);
    }

    // Render the cell with the top background icon.  We first
    // need to determine how many columns the background cell should
    // fill.
    Integer colspan = _getTopBackgroundColumnCount(icons, columnCount);

    writer.startElement(TABLE_DATA_ELEMENT, null);
    writer.writeAttribute(COLSPAN_ATTRIBUTE, colspan, null);
    writer.writeAttribute(WIDTH_ATTRIBUTE, "100%", null);
    org.apache.myfaces.trinidadinternal.renderkit.core.skin.CoreSkinUtils.__renderBackgroundIcon(fContext, arc, icons.topBackground);
    writer.endElement(TABLE_DATA_ELEMENT);

    // If we've got an end icon, render it
    if (icons.topEnd != null)
    {
      writer.startElement(TABLE_DATA_ELEMENT, null);
      OutputUtils.renderIcon(fContext, arc, icons.topEnd, "", null);  
      writer.endElement(TABLE_DATA_ELEMENT);
    }

    writer.endElement(TABLE_ROW_ELEMENT);
  }

  // Renders the filter named child
  private void _renderFilterChild(
File Line
org/apache/myfaces/trinidadinternal/ui/expl/ColorPaletteUtils.java 58
org/apache/myfaces/trinidadinternal/ui/expl/ColorPaletteUtils.java 464
    new Color(255,255,255),
    new Color(255,204,204),
    new Color(255,204,153),
    new Color(255,255,204),
    new Color(153,255,153),
    new Color(204,255,255),
    new Color(255,204,255),
    // 2nd-row
    new Color(255,255,255),
    new Color(255,102,102),
    new Color(255,204,51),
    new Color(255,255,153),
    new Color(102,255,153),
    new Color(102,255,255),
    new Color(255,153,255),
    // 3rd-row
    new Color(204,204,204),
    new Color(255,0,0),
    new Color(255,153,0),
    new Color(255,255,0),
    new Color(51,255,51),
    new Color(51,204,255),
    new Color(204,102,204),
    // 4th-row
    new Color(153,153,153),
    new Color(204,0,0),
    new Color(255,102,0),
    new Color(255,204,0),
    new Color(0,204,0),
    new Color(51,102,255),
    new Color(204,51,204),
    // 5th-row
    new Color(102,102,102),
    new Color(153,0,0),
    new Color(204,102,0),
    new Color(153,153,0),
    new Color(0,153,0),
    new Color(51,51,255),
    new Color(153,51,102),
    // 6th-row
    new Color(51,51,51),
    new Color(102,0,0),
    new Color(153,51,0),
    new Color(102,102,0),
    new Color(0,102,0),
    new Color(0,0,153),
    new Color(102,51,102),
    // 7th-row
    new Color(0,0,0),
    new Color(51,0,0),
    new Color(102,51,0),
    new Color(51,51,0),
    new Color(0,51,0),
    new Color(0,0,102),
    new Color(51,0,51),
  };

  // ArrayMap-style Object array which maps color palette names
  // to DataObjectLists which contain the colors
  private static final Object[] _PALETTE_ARRAY = new Object[]
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/BreadCrumbsRenderer.java 333
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationPathRenderer.java 306
  }

  //
  // Renders (almost) everything that goes before the link
  //
  private void _renderStartOfLink(
    UIXRenderingContext context,
    boolean      vertical,
    boolean      isLastChild) throws IOException
  {
    ResponseWriter writer = context.getResponseWriter();

    if (vertical)
    {
      writer.startElement(DIV_ELEMENT, null);
    }

    // Breadcrumbs wrap within a page depending on the size of the
    // browser window. The wrap occurs to the right of the greater-than
    // symbol that follows after the breadcrumb text string,
    // and not within the text string itself.
    writer.startElement(XhtmlLafConstants.NO_BREAK_ELEMENT, null);
  }


  //
  // Renders everything that goes after the link
  //
  private void _renderEndOfLink(
    UIXRenderingContext context,
    boolean      vertical
    ) throws IOException
  {
    ResponseWriter writer = context.getResponseWriter();


    writer.endElement(XhtmlLafConstants.NO_BREAK_ELEMENT);

    if(vertical)
    {
      writer.endElement(DIV_ELEMENT);
    }
  }

  /**
   * gets the orientation attribute from the link. If this attr is not set,
   * defaults to horizontal.
   * @return true if the orientation is vertical
   */
  private static boolean _getOrientation(UIXRenderingContext context,
                                         UINode breadCrumbs)
  {
    Object orientation = breadCrumbs.getAttributeValue(context,
                                                       ORIENTATION_ATTR);
    return (orientation != null) &&
      ORIENTATION_VERTICAL.equals(orientation);
  }


  // # of hard spaces to use in indenting vertical breadcrumbs
  private static final int _INDENT_SPACES = 10;

  //
  // BetweenRenderer is used to render everything that goes "between"
  // links.  Really, it gets called _before_ each link, so we have to specially
  // handle the first time it gets called.
  //
  /**
   * @deprecated This class comes from the old Java 1.2 UIX codebase and should not be used anymore.
   */
  @Deprecated
  private class BetweenRenderer implements Renderer
  {
    public BetweenRenderer(
      UINode  breadCrumbs,
      boolean vertical,
      int     totalCrumbs,
      Icon    separatorIcon)
    {
      _vertical     = vertical;
      _totalCrumbs  = totalCrumbs;

      // We stash away the separator Icon so we don't
      // have to look it up repeatedly.
      _separatorIcon = separatorIcon;
    }

    public void render(UIXRenderingContext context, UINode node)
      throws IOException
    {
      ResponseWriter writer = context.getResponseWriter();

      // Special handling for when we're the first or last child
      boolean isLastChild;
      if (_totalCrumbs >= 0)
        isLastChild = ((_renderedCount + 1) >= _totalCrumbs);
      else
        isLastChild = _isLastChild(context);

      boolean isFirstChild = (_renderedCount == 0);

      if (!isFirstChild)
      {
        // render the separator
        if (_separatorIcon != null)
        {
          RenderingContext arc = RenderingContext.getCurrentInstance();
          FacesContext fContext = context.getFacesContext();
          OutputUtils.renderIcon(fContext, arc, _separatorIcon, "", null);
        }

        // and render everything that goes after the previous link.
        // We'll take care of also rendering this content in prerender()
        _renderEndOfLink(context, _vertical);
      }

      _renderStartOfLink(context, _vertical, isLastChild);


      // if breadcrumbs are oriented vertically, then indent the levels
      if(!isFirstChild && _vertical)
      {
     char[] chars = new char[1];
  chars[0] = NBSP_CHAR;

        for(int i = 0; i < _renderedCount * _INDENT_SPACES; i++)
        {
          writer.writeText(chars, 0, 1);
        }
      }

      _renderedCount++;

      if (isLastChild)
        LinkRenderer.setDisabled(context, true);
    }

    private boolean _isLastChild(UIXRenderingContext context)
    {
      // See if BreadCrumbs has taken responsibility for determining
      // this.  This code's here so that our "BetweenRenderer" strategy
      // doesn't break anything - in practice, the other code path will usually
      // produce the same results (albeit a bit more expensively)
      Object o  = getRenderingProperty(context, _IS_LAST_CHILD_KEY);
      return (o != null);
    }

    private final boolean _vertical;
    private int           _totalCrumbs;
    private int           _renderedCount;
    private Icon          _separatorIcon;
  }

  static private final Object _IS_LAST_CHILD_KEY = new Object();
  static private final Object _BETWEEN_RENDERER_KEY = new Object();
  private static final Map<String, String> _RESOURCE_KEY_MAP;
  static
  {
    _RESOURCE_KEY_MAP  =  new HashMap<String, String>();
    
    _RESOURCE_KEY_MAP.put(
      XhtmlLafConstants.LINK_STYLE_CLASS,
      XhtmlLafConstants.AF_NAVIGATION_PATH_STEP_STYLE_CLASS);
    // the selected step is disabled, which is why we map these two styles
    _RESOURCE_KEY_MAP.put(
      XhtmlLafConstants.LINK_DISABLED_STYLE_CLASS,
      XhtmlLafConstants.AF_NAVIGATION_PATH_SELECTED_STEP_STYLE_CLASS);
  }
}
File Line
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 156
org/apache/myfaces/trinidadinternal/menu/ImmutableItemNode.java 198
  }

  public final String getLabel()
  {
    if (_bundleKey != null && _bundleName != null)
    {
      // Load the resource bundle based on the locale of the
      // current request. If the locale has not changed, this
      // method just returns.
      MenuUtils.loadBundle(_bundleName, _bundleKey + getHandlerId());
    }

    if (_label != null && ContainerUtils.isValueReference(_label))
    {
      // do not set _label to the evaluated EL.
      // It may change at times in the EL.
      return _evalElStr(_label);
    }
    if (_label == null && _labelAndAccessKey != null)
    {
      int ampIdx = 0;
      String labelAndAccessKeyEval = null;
      String labelAndAccessKey = _labelAndAccessKey;
      String label;
      if (ContainerUtils.isValueReference(labelAndAccessKey))
      {
        labelAndAccessKeyEval = _evalElStr(labelAndAccessKey);
      } else
      {
        labelAndAccessKeyEval = labelAndAccessKey;
      }

      String accessKey;
      if (labelAndAccessKeyEval == null ||
          (ampIdx = labelAndAccessKeyEval.indexOf('&')) == -1)
      {
        // String is null or a label w/o an accesskey
        label = labelAndAccessKeyEval;
      } else if (ampIdx == (labelAndAccessKeyEval.length() - 1))
      {
        // & is last character, strip it.
        label = labelAndAccessKeyEval.substring(0, ampIdx);
      } else
      {
        // We have a string with an accessKey somewhere
        char[] keyArray = labelAndAccessKeyEval.toCharArray();
        int len = labelAndAccessKeyEval.length();
        char[] keyArray2 = new char[len];
        int i, j = 0;
        boolean accessKeyFound = false;

        for (i = 0, j = 0; i < len; i++, j++)
        {
          if (keyArray[i] == '&')
          {
            i++;

            if (!accessKeyFound && keyArray[i] != '&')
            {
              // We have our accessKey
              accessKey = labelAndAccessKeyEval.substring(i, i + 1);
              accessKeyFound = true;
            }
          }

          keyArray2[j] = keyArray[i];
        }

        String label1 = new String(keyArray2, 0, j);
        label = label1;
      }
      return label;

    }
    return _label;
  }

  public final String getIcon()
  {
    return MenuUtils.evalString(_icon);
  }

  public final List<MenuNode> getChildren()
  {
    return _children;
  }

  public void setChildren(List<MenuNode> children)
  {
    _children = children;
  }

  public final String getFocusViewId()
  {
    return _focusViewId;
  }

  public final boolean getRendered()
  {
    boolean rendered = MenuUtils.evalBoolean(_renderedStr, true);
    return rendered;
  }

  public final boolean getDisabled()
  {
    boolean disabled = MenuUtils.evalBoolean(_disabledStr, false);
    return disabled;
  }

  public final boolean getVisible()
  {
    boolean visible = MenuUtils.evalBoolean(_visibleStr, true);
    return visible;
  }

  public final boolean getReadOnly()
  {
    boolean readOnly = MenuUtils.evalBoolean(_readOnlyStr, false);
    return readOnly;
  }

  protected final String getHandlerId()
  {
    return _handlerId;
  }

  public final String getBundleKey()
  {
    return _bundleKey;
  }

  public final String getBundleName()
  {
    return _bundleName;
  }

  public void actionListener(ActionEvent event)
File Line
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 447
org/apache/myfaces/trinidadinternal/menu/ImmutableItemNode.java 531
  }

  public final boolean getDefaultFocusPath()
  {
    boolean defaultFocusPath =
        MenuUtils.evalBoolean(_defaultFocusPathStr, false);
    return defaultFocusPath;
  }

  public final String getRootModelKey()
  {
    return _rootModelKey;
  }

  public final int getRootId()
  {
    return _rootId;
  }

  private String _evalElStr(String str)
  {
    if (str == null)
      return null;

    String keystr =
        MenuUtils.stringReplaceFirst(str.trim(), _bundleKey, _bundleKey +
            getHandlerId());
    String elVal = MenuUtils.getBoundValue(keystr, String.class);
    return elVal;
  }

  private String _joinLabelAndAccessKey(String label, String accessKey)
  {
    char[] keyArray = label.toCharArray();
    int len = label.length();
    int lentimes2 = len * 2;
    char[] keyArray2 = new char[lentimes2];
    int i, j = 0;
    boolean accessKeyFound = false;

    // find the first occurrence of a single Ampersand
    for (i = 0, j = 0; i < len; i++, j++)
    {
      // AccessKey
      if (keyArray[i] == accessKey.charAt(0) && !accessKeyFound)
      {
        keyArray2[j] = '&';
        j++;
        accessKeyFound = true;
      }

      keyArray2[j] = keyArray[i];

      // Ampersand as regular character
      // double it up.
      if (keyArray[i] == '&')
      {
        j++;
        keyArray2[j] = keyArray[i];
      }
    }

    String combinedLabel = new String(keyArray2, 0, j);
    return combinedLabel;
  }

  private final String _icon;
  private List<MenuNode> _children = null;
  private final String _focusViewId;
  private final String _renderedStr;
  private final String _disabledStr;
  private final String _visibleStr;
  private final String _readOnlyStr;
  private final String _handlerId;
  private final String _bundleKey;
  private final String _bundleName;
  private final String _accessKey;
  private final String _id;
  private final String _modelId;
  private final String _labelAndAccessKey;
  private final String _defaultFocusPathStr;
  private final String _uniqueId;

  // Root Menu model's Request Map Key
  private final String _rootModelKey;

  private final int _rootId;

  private final Map<String, String> _customPropList;
File Line
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 290
org/apache/myfaces/trinidadinternal/menu/ImmutableItemNode.java 375
  }

  public final char getAccessKey()
  {
    if (_accessKey == null && _labelAndAccessKey != null)
    {
      int ampIdx = 0;
      String labelAndAccessKeyEval = null;
      String labelAndAccessKey = _labelAndAccessKey;
      String label;
      if (ContainerUtils.isValueReference(labelAndAccessKey))
      {
        labelAndAccessKeyEval = _evalElStr(labelAndAccessKey);
      } 
      else
      {
        labelAndAccessKeyEval = labelAndAccessKey;
      }

      String accessKey = null;
      if (labelAndAccessKeyEval == null ||
          (ampIdx = labelAndAccessKeyEval.indexOf('&')) == -1)
      {
        // String is null or a label w/o an accesskey
        label = labelAndAccessKeyEval;
      } else if (ampIdx == (labelAndAccessKeyEval.length() - 1))
      {
        // & is last character, strip it.
        label = labelAndAccessKeyEval.substring(0, ampIdx);
      } else
      {
        // We have a string with an accessKey somewhere
        char[] keyArray = labelAndAccessKeyEval.toCharArray();
        int len = labelAndAccessKeyEval.length();
        char[] keyArray2 = new char[len];
        int i, j = 0;
        boolean accessKeyFound = false;

        for (i = 0, j = 0; i < len; i++, j++)
        {
          if (keyArray[i] == '&')
          {
            i++;

            if (!accessKeyFound && keyArray[i] != '&')
            {
              // We have our accessKey
              accessKey = labelAndAccessKeyEval.substring(i, i + 1);
              accessKeyFound = true;
            }
          }

          keyArray2[j] = keyArray[i];
        }

        String label1 = new String(keyArray2, 0, j);
        label = label1;
      }
      return (accessKey != null)? accessKey.charAt(0):'\0';

    }
    else 
    {
      String accessKeyStr = MenuUtils.evalString(_accessKey);
      if (accessKeyStr == null || accessKeyStr.length() > 1)
        return '\0';
      return accessKeyStr.charAt(0);
    }
    
  }

  public final String getId()
File Line
org/apache/myfaces/trinidadinternal/validator/DoubleRangeValidator.java 71
org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java 72
    String minStr = min == Long.MIN_VALUE ? "null" : IntegerUtils.getString(min);
    
    String messageDetailMax = this.getMessageDetailMaximum();
    String messageDetailMin = this.getMessageDetailMinimum();
    String messageDetailRange = this.getMessageDetailNotInRange();
    String hintMax = this.getHintMaximum();
    String hintMin = this.getHintMinimum();
    String hintRange = this.getHintNotInRange();
    
    Map<String, String> cMessages = null;
    if(messageDetailMax != null || messageDetailMin != null || messageDetailRange != null || hintMax != null || hintMin != null|| hintRange != null)
    {
      cMessages = new HashMap<String, String>();
      cMessages.put("max", messageDetailMax);
      cMessages.put("min", messageDetailMin);
      cMessages.put("range", messageDetailRange);
      cMessages.put("hintMax", hintMax);
      cMessages.put("hintMin", hintMin);
      cMessages.put("hintRange", hintRange);
    }
    
    return _getTrRangeValidator(context, component, maxStr, minStr, cMessages);

  }
  
  public String getClientLibrarySource(
   FacesContext context)
  {
    return null;
  }
  
  private static String _getTrRangeValidator(
      FacesContext context,
      UIComponent component,
      String max,
      String min,
      Map<String, String> messages)
  {
    StringBuilder outBuffer = new StringBuilder();
    outBuffer.append("new TrRangeValidator(");
    outBuffer.append(max);
    outBuffer.append(',');
    outBuffer.append(min);
    outBuffer.append(',');
    if(messages == null)
    {
      outBuffer.append("null");
    }
    else
    {
      try
      {
        JsonUtils.writeMap(outBuffer, messages, false);
      }
      catch (IOException e)
      {
        outBuffer.append("null");
      }
    }
    outBuffer.append(")");
File Line
org/apache/myfaces/trinidadinternal/image/laf/browser/ButtonImageRenderer.java 113
org/apache/myfaces/trinidadinternal/image/laf/browser/CompositeButtonImageRenderer.java 110
      ((ProxyContext)context).flush();
  }

  /**
   * Returns the foreground color to use when painting an image
   * with the specified dictionary.
   */
  @Override
  protected Color getPaintForeground(
      ImageContext context, 
      Map<Object, Object> d)
  {
    Color foreground = super.getPaintForeground(context, d);

    if (foreground != null)
      return foreground;

    return ButtonPainter.getDefaultForeground(context, _isDisabled(d));
  }

  /**
   * Returns the background color to use when painting an image
   * with the specified dictionary.
   */
  @Override
  protected Color getPaintBackground(
      ImageContext context, 
      Map<Object, Object> d)
  {
    Color background = super.getPaintBackground(context, d);

    if (background != null)
      return background;

    return ButtonPainter.getDefaultBackground(context, _isDisabled(d));
  }

  /**
   * Returns the font color to use when painting an image
   * with the specified dictionary.
   */
  @Override
  protected Font getPaintFont(Map<Object, Object> d)
  {
    Font font = super.getPaintFont(d);

    if (font != null)
      return font;

    return ButtonPainter.getDefaultFont().getFont();
  }

  private String _getFontName(Map<Object, Object> requestedProperties)
  {
    // Make sure we've got a valid font
    Object o = requestedProperties.get(FONT_KEY);
    String name = null;
    if (o instanceof FontProxy)
      name = ((FontProxy)o).getName();
    else if (o instanceof Font)
      name = ((Font)o).getName();

    return name;
  }

  private boolean _isDisabled(Map<Object, Object> properties)
  {
    Boolean disabled = (Boolean)properties.get(DISABLED_KEY);

    if (disabled == null)
      return false;

    return disabled.booleanValue();
  }

  private static class ProxyContext extends PaintContextProxy
  {
    public ProxyContext(
      PaintContext context,
File Line
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 367
org/apache/myfaces/trinidadinternal/menu/ImmutableItemNode.java 464
    if (_labelAndAccessKey != null)
    {
      int ampIdx = 0;
      String labelAndAccessKeyEval = null;
      String labelAndAccessKey = _labelAndAccessKey;
      String label;
      if (_bundleKey != null && _bundleName != null)
      {
        // Load the resource bundle based on the locale of the
        // current request. If the locale has not changed, this
        // method just returns.
        MenuUtils.loadBundle(_bundleName, _bundleKey + getHandlerId());
      }
      if (ContainerUtils.isValueReference(labelAndAccessKey))
      {
        labelAndAccessKeyEval = _evalElStr(labelAndAccessKey);
      } else
      {
        labelAndAccessKeyEval = labelAndAccessKey;
      }

      String accessKey = null;
      if (labelAndAccessKeyEval == null ||
          (ampIdx = labelAndAccessKeyEval.indexOf('&')) == -1)
      {
        // String is null or a label w/o an accesskey
        label = labelAndAccessKeyEval;
      } else if (ampIdx == (labelAndAccessKeyEval.length() - 1))
      {
        // & is last character, strip it.
        label = labelAndAccessKeyEval.substring(0, ampIdx);
      } else
      {
        // We have a string with an accessKey somewhere
        char[] keyArray = labelAndAccessKeyEval.toCharArray();
        int len = labelAndAccessKeyEval.length();
        char[] keyArray2 = new char[len];
        int i, j = 0;
        boolean accessKeyFound = false;

        for (i = 0, j = 0; i < len; i++, j++)
        {
          if (keyArray[i] == '&')
          {
            i++;

            if (!accessKeyFound && keyArray[i] != '&')
            {
              // We have our accessKey
              accessKey = labelAndAccessKeyEval.substring(i, i + 1);
              accessKeyFound = true;
            }
          }

          keyArray2[j] = keyArray[i];
        }

        String label1 = new String(keyArray2, 0, j);
        label = label1;
      }
      // https://issues.apache.org/jira/browse/TRINIDAD-1588
      if (accessKey == null) {
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/MenuListRenderer.java 108
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/MenuListRenderer.java 107
      if (style != null )
      {
        inlineStyleBuffer = new StringBuffer( _LIST_STYLE_TYPE.length() +
                                              style.length());
        inlineStyleBuffer.append(_LIST_STYLE_TYPE).append(style);

      }

      if ( inlineStyleBuffer != null && inlineStyleBuffer.length() > 0 )
        writer.writeAttribute("style", inlineStyleBuffer.toString(), null);
    }
  }


  protected UIXHierarchy getHierarchyBase(
    UIXRenderingContext context,
    UINode           node
  )
  {
    return (UIXHierarchy) node.getUIComponent();
  }


  protected UINode getStamp(
    UIXRenderingContext context,
    UINode           node
    )
  {
    return node.getNamedChild(context, NODE_STAMP_CHILD);
  }


  protected boolean setNewPath(
    UIXRenderingContext context,
    UINode           node,
    UIXHierarchy    component
  )
  {
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);
    return ModelRendererUtils.setNewPath(component, startDepth,
                                         ((UIXNavigationLevel)component).getFocusRowKey());


  }

  @Override
  protected void renderContent(
    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {

    UIXHierarchy component = getHierarchyBase(context, node);
    UINode stamp = getStamp(context, node);

    if(stamp != null)
    {

      // Save the current key
      Object oldPath = component.getRowKey();
      boolean isNewPath = setNewPath(context, node, component);
      if (isNewPath)
      {

        int size = component.getRowCount();
        int rowIndex = component.getRowIndex();

        for (int i = 0; i < size; i++)
        {
          component.setRowIndex(i);
File Line
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/MessageBoxRenderer.java 279
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SideBarRenderer.java 316
  }

  // Gets the number of columns that this sideBar renders
  private int _getColumnCount(
    IconData         icons
    )
  {
    int columnCount = 1;

    if ((icons.bottomStart != null)  ||
        (icons.topStart != null)     ||
        (icons.startBackground != null))
      columnCount++;

    if ((icons.bottomEnd != null) ||
        (icons.bottomEnd != null) ||
        (icons.endBackground != null))
      columnCount++;

    return columnCount;
  }

  // Returns the number of columns that the body cell should occupy
  private static Integer _getBodyColumnCount(
    IconData icons,
    int      columnCount
    )
  {
    int bodyColumnCount = columnCount;

    // If we have a start background icon, leave room for it
    if (icons.startBackground != null)
      bodyColumnCount--;

    // If we have an end background icon, leave room for it
    if (icons.endBackground != null)
     bodyColumnCount--;

    if (bodyColumnCount == 1)
      return null;

    return bodyColumnCount;
  }

  // Returns the number of columns for the bottom background cell
  private static Integer _getBottomBackgroundColumnCount(
    IconData icons,
    int      columnCount
    )
  {
    int backgroundColumnCount = columnCount;

    if (icons.bottomStart != null)
      backgroundColumnCount--;

    if (icons.bottomEnd != null)
      backgroundColumnCount--;

    if (backgroundColumnCount == 1)
      return null;

    return backgroundColumnCount;
  }

  // Returns the number of columns for the top background cell
  private static Integer _getTopBackgroundColumnCount(
    IconData icons,
    int      columnCount
    )
  {
    int backgroundColumnCount = columnCount;

    if (icons.topStart != null)
      backgroundColumnCount--;

    if (icons.topEnd != null)
      backgroundColumnCount--;

    if (backgroundColumnCount == 1)
      return null;

    return backgroundColumnCount;
  }

  // Get the IconData to use for rendering this sideBar
  private IconData _getIconData(
    UIXRenderingContext context
    )
  {
    // Check to see whether we have already created
    // the IconData for this background color
    Skin skin = context.getSkin();
    IconData icons = (IconData)skin.getProperty(_ICONS_KEY);
    
    Icon bottomStart      = context.getIcon(
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/MessageBoxRenderer.java 183
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/MessageBoxRenderer.java 208
  }

  private void _renderMessages(
    UIXRenderingContext context,
    ResponseWriter writer,
    boolean isGlobal,
    boolean useList
    ) throws IOException
  {
    BaseMutableUINode currentChild = null;
    String summary;
    String detail;

    Iterator<MessageWrapper> itr = (isGlobal
                    ? MessageBoxUtils.sGetGlobalsIterator(context)
                    : MessageBoxUtils.sGetClientsIterator(context));

    while (itr.hasNext())
    {
      MessageWrapper msg = itr.next();

      if (useList)
        writer.startElement("li", null);

      summary = msg.getSummary();
      detail = msg.getDetail();

      if (isGlobal)
        _writeGlobalMsg(context, writer, summary, detail);
      else
        currentChild = _writeClientMsg(context, writer, summary,
                                       msg, currentChild);

      if (useList)
        writer.endElement("li");
    }
  }

  private void _writeGlobalMsg(
    UIXRenderingContext context,
    ResponseWriter writer,
    String summary,
    String detail
    ) throws IOException
  {
    String text = MessageUtils.getGlobalMessage(context, summary, detail);
    if (isTextFormatted(text))
      renderFormattedText(context, text);
    else if (text != null)
      writer.writeText(text, null);
  }

  private BaseMutableUINode _writeClientMsg(
    UIXRenderingContext context,
    ResponseWriter writer,
    String summary,
    MessageWrapper msg,
    BaseMutableUINode currentChild
    ) throws IOException
  {
    String description;

    if (summary != null)
    {
      String pattern;
      String[] parameters;

      parameters = new String[] {summary};
      pattern = getTranslatedString(context, "af_messages.LIST_FORMAT_private");
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyCheckboxRenderer.java 268
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneRadioRenderer.java 257
  }

  @Override
  protected void renderId(
    FacesContext context,
    UIComponent  component
    ) throws IOException
  {
    if (shouldRenderId(context, component))
    {
      String clientId = getClientId(context, component);
      context.getResponseWriter().writeAttribute("id", clientId, "id");
    }
  }

  /**
   * Disable rendering the form event handlers on the parent.
   * In Gecko, they bubble up, but in IE, they don't, so
   * they have to go on the items.
   */
  @Override
  protected void renderFormEventHandlers(
    FacesContext context,
    UIComponent  component,
    FacesBean    bean
    ) throws IOException
  {
  }

  /**
   * Disable rendering "onclick" on the parent;  it needs to
   * go on the individual radio buttons
   */
  @Override
  protected String getOnclick(
    UIComponent component,
    FacesBean   bean)
  {
    return null;
  }

  /**
   * Render the per-item event handlers
   */
  protected void renderItemFormEventHandlers(
    FacesContext context,
    UIComponent  component,
    FacesBean    bean
    ) throws IOException
  {
    super.renderFormEventHandlers(context, component, bean);
  }

  /**
   * Get the onclick for the individual radio buttons.
   */
  protected String getItemOnclick(
    RenderingContext rc,
    UIComponent component,
    FacesBean   bean)
  {
    // Get the overall onclick, and merge in any needed autosubmit script
    String onclick = super.getOnclick(component, bean);
    if (isAutoSubmit(component, bean))
    {
      String source = LabelAndMessageRenderer.__getCachedClientId(rc);
      boolean immediate = isImmediate(component, bean);
      String auto = AutoSubmitUtils.getSubmitScript(rc,
                                                    source,
                                                    XhtmlConstants.AUTOSUBMIT_EVENT,
                                                    immediate);
      onclick = XhtmlUtils.getChainedJS(onclick, auto, true);
    }

    return onclick;
  }

  protected Object getAccessKey(
    UIComponent component,
    FacesBean   bean)
  {
    return bean.getProperty(_accessKeyKey);
  }

  protected String getLayout(
    UIComponent component,
    FacesBean   bean)
  {
    return toString(bean.getProperty(_layoutKey));
  }

  @Override
  protected String getUnselectedLabel(
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaFrameBorderLayoutRenderer.java 77
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FrameBorderLayoutRenderer.java 128
    writer.startElement("frameset", component);
    renderId(context, component);

    renderAllAttributes(context, rc, component, bean);

    String leftName       = HtmlFrameBorderLayout.LEFT_FACET;
    String innerLeftName  = HtmlFrameBorderLayout.INNER_LEFT_FACET;
    String rightName      = HtmlFrameBorderLayout.RIGHT_FACET;
    String innerRightName = HtmlFrameBorderLayout.INNER_RIGHT_FACET;

    UIComponent center = getFacet(component, HtmlFrameBorderLayout.CENTER_FACET);
    UIComponent top    = getFacet(component, HtmlFrameBorderLayout.TOP_FACET);
    UIComponent bottom = getFacet(component, HtmlFrameBorderLayout.BOTTOM_FACET);
    UIComponent left   = getFacet(component, leftName);
    UIComponent right  = getFacet(component, rightName);
    UIComponent innerLeft   = getFacet(component, innerLeftName);
    UIComponent innerRight  = getFacet(component, innerRightName);

    boolean r2l = rc.getLocaleContext().isRightToLeft();
    if (left == null)
    {
      leftName = r2l ? HtmlFrameBorderLayout.END_FACET : HtmlFrameBorderLayout.START_FACET;
      left     = getFacet(component, leftName);
    }

    if (right == null)
    {
      rightName = r2l ? HtmlFrameBorderLayout.START_FACET : HtmlFrameBorderLayout.END_FACET;
      right     = getFacet(component, rightName);
    }

    if (innerLeft == null)
    {
      innerLeftName = r2l ? HtmlFrameBorderLayout.INNER_END_FACET : HtmlFrameBorderLayout.INNER_START_FACET;
      innerLeft     = getFacet(component, innerLeftName);
    }

    if (innerRight == null)
    {
      innerRightName = r2l ? HtmlFrameBorderLayout.INNER_START_FACET : HtmlFrameBorderLayout.INNER_END_FACET;
      innerRight     = getFacet(component, innerRightName);
    }
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlFormattedText.java 120
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlFormattedText.java 120
        super.writeStyleClass(context, styleClass);
        //   XhtmlLafRenderer.renderStyleClassAttribute(context, styleClass);
      }
      /*else if (XhtmlLafRenderer.renderStyleElements(context))
      {
        // =-= Darn annoying to do given the current API for
        // ElementInfo;  we could start the style elements here
        // easily enough, but how do we know when to end the style elements?
      }*/
    }
  }

  static private final FormattedTextParser _sParser =
    new FormattedTextParser();
  
  static
  {
    // Register all the allowed elements
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("br", true, true));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("hr", true, true));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("li", false, false));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("p", false, false));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("b"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("i"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("tt"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("big"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("small"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("span"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("pre"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("ul"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("ol"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("em"));
    _sParser.addElement(new XhtmlFormattedText.XhtmlElement("a"));
    _sParser.addElement(new XhtmlFormattedText.FontElement("font"));   
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlFormattedText.java 35
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlFormattedText.java 35
class XhtmlFormattedText
{
  static public FormattedTextParser getFormattedTextParser()
  {
    return _sParser;
  }

  
  private XhtmlFormattedText()
  {
  }

  // This is for the font element. Only size is the allowed attribute.
  static private class FontElement
    extends FormattedTextParser.DefaultElementInfo
  {
    public FontElement(String name)
    {
      super(name);
    }

    public FontElement(String name, boolean empty, boolean closeRequired)
    {
      super(name, empty, closeRequired);
    }
    
    @Override
    public void writeInlineStyle(FacesContext context, String style)
    {

    }

    @Override
    public void writeStyleClass(FacesContext context, String styleClass)
    {

    }
    
    @Override
    public void writeHRef(FacesContext context, String href)
    {
    
    }  

    @Override
    public void writeSize(FacesContext context, String fontSize)
      throws IOException
    {
     context.getResponseWriter().writeAttribute("size", fontSize, null);
    }   
  }
  
  static private class XhtmlElement
    extends FormattedTextParser.DefaultElementInfo
  {
    public XhtmlElement(String name)
    {
      super(name);
    }

    public XhtmlElement(String name, boolean empty, boolean closeRequired)
    {
      super(name, empty, closeRequired);
    }

    @Override
    public void writeInlineStyle(FacesContext context, String style)
      throws IOException
    {
      //      if (XhtmlLafRenderer.supportsStyleAttributes(context))
      {
        super.writeInlineStyle(context, style);
      }
      /*else if (XhtmlLafRenderer.renderStyleElements(context))
      {
        // ??? =-=AEW How do we get a Style object???
      }*/
    }

    @Override
    public void writeStyleClass(FacesContext context, String styleClass)
      throws IOException
    {
      //      if (XhtmlLafRenderer.supportsStyleAttributes(context))
      {
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TrinidadRenderingConstants.java 32
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java 39
  public static final String AUTOSUBMIT_EVENT = "autosub";

  // Mobile dateField and LovField
  // "picker" events and types
  public static final String DATE_EVENT   = "date";
  public static final String CANCEL_EVENT = "cancel";
  public static final String TYPE_POST    = "post";

  // NavigationBar
  public static final String GOTO_EVENT = "goto";

  // HideShow
  public static final String HIDE_EVENT = "hide";
  public static final String SHOW_EVENT = "show";

  // HGrid
  public static final int INCOMPLETE_DATA_SET = -1;
  
  // SortableHeader
  public static final String SORT_EVENT = "sort";

  // Poll
  public static final String POLL_EVENT = "poll";

  // Chart Drill down
  public static final String CHART_DRILL_DOWN_EVENT = "chartDrillDown";

  /**
   * Constant for the value of the "value" event parameter when
   * the user is asking to see all rows.
   */
  public static final String VALUE_SHOW_ALL = "all";

  
  
  //
  // Context Property Names
  //
  /**
   * String rendering property for the name of the current form bean.
   */
  public static final String FORM_NAME_PROPERTY   = "formName";


  /**
   * Key used to store the initialFocus on the RenderingContext
   * under the UIConstants.MARLIN_NAMESPACE. initialFocus is an attribute
   * of body and is an id indicating the component
   * which should have the initial focus.
   */
  public static final Object INITIAL_FOCUS_CONTEXT_PROPERTY = "initialFocus";

  
  //
  // parameter names
  //
  public static final String PARTIAL_PARAM         = "partial";
  public static final String PARTIAL_TARGETS_PARAM = "partialTargets";
  public static final String SIZE_PARAM            = "size";
  public static final String SOURCE_PARAM          = "source";
  public static final String STATE_PARAM           = "state";
  public static final String TYPE_PARAM            = "type";
  public static final String VALUE_PARAM           = "value";
  public static final String TARGETITEM_PARAM      = "targetItem";


  //
  // parameter values
  //
  // calendar, mobile dateField params
  public static final String EVENT_PARAM          = "event";
  public static final String LOC_PARAM            = "loc";
  public static final String MAX_VALUE_PARAM      = "maxValue";
  public static final String MIN_VALUE_PARAM      = "minValue";
  public static final String MONTH_PARAM          = "month";
  public static final String SCROLLED_VALUE_PARAM = "scrolledValue";
  public static final String YEAR_PARAM           = "year";
  
  
  //
  // Named Children
  //
  public static final String PATH_STAMP_CHILD = "pathStamp";

  
  //
  // Enumerated Values
  //

  // Horizontal alignment
  /**
   * Horizontal alignment constant for end alignment;  right
   * alignment will be used in left-to-right languages, left
   * alignment in right-to-left languages.
   */
  public static final String H_ALIGN_END = "end";
File Line
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 304
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 380
      if (ContainerUtils.isValueReference(labelAndAccessKey))
      {
        labelAndAccessKeyEval = _evalElStr(labelAndAccessKey);
      } else
      {
        labelAndAccessKeyEval = labelAndAccessKey;
      }

      String accessKey = null;
      if (labelAndAccessKeyEval == null ||
          (ampIdx = labelAndAccessKeyEval.indexOf('&')) == -1)
      {
        // String is null or a label w/o an accesskey
        label = labelAndAccessKeyEval;
      } else if (ampIdx == (labelAndAccessKeyEval.length() - 1))
      {
        // & is last character, strip it.
        label = labelAndAccessKeyEval.substring(0, ampIdx);
      } else
      {
        // We have a string with an accessKey somewhere
        char[] keyArray = labelAndAccessKeyEval.toCharArray();
        int len = labelAndAccessKeyEval.length();
        char[] keyArray2 = new char[len];
        int i, j = 0;
        boolean accessKeyFound = false;

        for (i = 0, j = 0; i < len; i++, j++)
        {
          if (keyArray[i] == '&')
          {
            i++;

            if (!accessKeyFound && keyArray[i] != '&')
            {
              // We have our accessKey
              accessKey = labelAndAccessKeyEval.substring(i, i + 1);
              accessKeyFound = true;
            }
          }

          keyArray2[j] = keyArray[i];
        }

        String label1 = new String(keyArray2, 0, j);
        label = label1;
      }
File Line
org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java 430
org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java 483
    int versionEndIndex = agent.indexOf("(");
    String version = agent.substring(versionStartIndex,versionEndIndex);
    agentObj.setAgentVersion(version);
    
    //parse agentName
    int agentNameStartIndex = agent.indexOf(":",versionEndIndex) +1;
    
    //find end of agentName (ie. when we see a semicolon
    int agentNameEndIndex = agentNameStartIndex;
    for (;agent.charAt(agentNameEndIndex)!=';' &&
          agent.charAt(agentNameEndIndex) !=')';
          agentNameEndIndex++);
    
    String agentName = agent.substring(agentNameStartIndex,agentNameEndIndex);
    agentObj.setAgent(agentName);
    
    if (agent.charAt(agentNameEndIndex) == ')')
      return;
    
    //now parse remaining request specific capabilities
    int capabilityNameStartIndex;
    int capabilityNameEndIndex;
    int capabilityValueStartIndex;
    int capabilityValueEndIndex = agentNameEndIndex;
    
    while(agent.charAt(capabilityValueEndIndex)!= ')')
    {
      capabilityNameStartIndex = capabilityValueEndIndex + 1;
      capabilityNameEndIndex = agent.indexOf(":",capabilityNameStartIndex);
      String capabilityName = agent.substring(capabilityNameStartIndex,capabilityNameEndIndex);
      capabilityValueStartIndex = capabilityNameEndIndex +1;
      capabilityValueEndIndex = agent.indexOf(";",capabilityValueStartIndex);
      if (capabilityValueEndIndex == -1)
      {
        capabilityValueEndIndex = agent.indexOf(")",capabilityValueEndIndex);
      }
      String capabilityValue = agent.substring(capabilityValueStartIndex,capabilityValueEndIndex);
      agentObj.__addRequestCapability(CapabilityKey.getCapabilityKey(capabilityName,true),capabilityValue);
    }
  }
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/desktop/TrainRenderer.java 100
org/apache/myfaces/trinidadinternal/renderkit/uix/ProcessRenderer.java 66
        Object sizeObject = requestMap.get("size");

        if ( valueObject != null)
        {
          int value = -1;

          try
          {
            value = Integer.parseInt(valueObject.toString());
          }
          catch ( NumberFormatException nfe)
          {
            _LOG.severe(nfe);
          }

          int size = 0;

          try
          {
            size = Integer.parseInt(sizeObject.toString());
          }
          catch ( NumberFormatException nfe)
          {
            _LOG.warning(nfe);
          }

          if (size < 0)
            size = 0;

          if ( value >= 0 )
          {
            UIXProcess process = (UIXProcess)component;
            Object oldPath = process.getRowKey();
            Object focusPath = process.getFocusRowKey();
            process.setRowKey(focusPath);
            UIComponent stamp = process.getNodeStamp();
            int index = process.getRowIndex();

            if (size == 0)
            {
              index = ProcessUtils.getBackIndex(process, stamp, index);
            }
            else
            {
              index = ProcessUtils.getNextIndex(process, stamp, index);
            }

            process.setRowIndex(index);
            new ActionEvent(stamp).queue();
            process.setRowKey(oldPath);
          }
        }
      }
    }
  }
File Line
org/apache/myfaces/trinidadinternal/image/xml/parse/BaseImageProviderRequestParser.java 415
org/apache/myfaces/trinidadinternal/util/nls/StringUtils.java 127
  public static String stripMnemonic(String string)
  {
    if (string == null)
    {
      return null;
    }

    int length = string.length();

    // Single character (or empty) strings can't have a mnemonic
    if (length <= 1)
      return string;

    StringBuffer buffer = null;
    int i = 0;

    while (i < length)
    {
      int index = string.indexOf(_MNEMONIC_INDICATOR, i);

      // We've reached the append.  Append the rest of the
      // string to the buffer, if one exists, then exit
      if ((index < 0) || (index >= length - 1))
      {
        if (buffer != null)
          buffer.append(string.substring(i));

        break;
      }

      if (buffer == null)
      {
        // If the string starts with an ampersand, but not a double
        // ampersand, then we just want to return
        // stripMnemonic(string.substring(1)).  This is basically
        // what we do here, only I've optimized the tail recursion away.
        if ((index == 0) && (string.charAt(1) != _MNEMONIC_INDICATOR))
        {
          string = string.substring(1);
          length--;
          continue;
        }
        else
        {
          // Allocate the buffer.  We can reserve only space
          // (length - 1), because, by now, we know there's at least
          // 1 ampersand
          buffer = new StringBuffer(length - 1);
        }
      }

      // Append the bits of the string before the ampersand
      buffer.append(string.substring(i, index));

      // And append the character after the ampersand
      buffer.append(string.charAt(index + 1));

      // And skip to after that character
      i = index + 2;
    }

    // If we never allocated a buffer, then there's no mnemonic
    // at all, and we can just return the whole string
    if (buffer == null)
      return string;

    return new String(buffer);
  }

  private static final char _MNEMONIC_INDICATOR = '&';
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyCheckboxRenderer.java 217
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneRadioRenderer.java 220
    rw.writeAttribute("type", "radio", null);
    rw.writeAttribute("name", id, null);
    rw.writeAttribute("id", subid, null);
    rw.writeAttribute("value", itemValue, null);
    rw.writeAttribute("accesskey", accessKey, null);
    if (isSelected)
      rw.writeAttribute("checked", Boolean.TRUE, null);
    if (isDisabled || item.isDisabled())
      rw.writeAttribute("disabled", Boolean.TRUE, null);

    // =-=AEW Render all the Javascript needed on a per-item basis.
    // We could optimize SelectOneRadio a bit by gathering
    // up the "form event handlers" in one pass (seems to be about
    // 8% slower this way)
    // render the events only if the browser supports JavaScript
    if (supportsScripting(rc))
    {
      rw.writeAttribute("onclick", itemOnclick, null);
      renderItemFormEventHandlers(context, component, bean);
    }

    rw.endElement("input");

    // And render the label
    rw.startElement("label", null);
    rw.writeAttribute("for", subid, null);

    // For reasons that aren't especially clear to me, we're getting
    // passed the empty string for our title.
    String description = item.getDescription();
    if ((description != null) && !"".equals(description))
      rw.writeAttribute("title", description, null);

    rw.writeText(item.getLabel(), null);
    rw.endElement("label");

    return true;
  }

  @Override
  protected void renderId(
File Line
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 189
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 314
      if (labelAndAccessKeyEval == null ||
          (ampIdx = labelAndAccessKeyEval.indexOf('&')) == -1)
      {
        // String is null or a label w/o an accesskey
        label = labelAndAccessKeyEval;
      } else if (ampIdx == (labelAndAccessKeyEval.length() - 1))
      {
        // & is last character, strip it.
        label = labelAndAccessKeyEval.substring(0, ampIdx);
      } else
      {
        // We have a string with an accessKey somewhere
        char[] keyArray = labelAndAccessKeyEval.toCharArray();
        int len = labelAndAccessKeyEval.length();
        char[] keyArray2 = new char[len];
        int i, j = 0;
        boolean accessKeyFound = false;

        for (i = 0, j = 0; i < len; i++, j++)
        {
          if (keyArray[i] == '&')
          {
            i++;

            if (!accessKeyFound && keyArray[i] != '&')
            {
              // We have our accessKey
              accessKey = labelAndAccessKeyEval.substring(i, i + 1);
              accessKeyFound = true;
            }
          }

          keyArray2[j] = keyArray[i];
        }

        String label1 = new String(keyArray2, 0, j);
        label = label1;
      }
      return (accessKey != null)? accessKey.charAt(0):'\0';
File Line
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 389
org/apache/myfaces/trinidadinternal/menu/ImmutableItemNode.java 231
      if (labelAndAccessKeyEval == null ||
          (ampIdx = labelAndAccessKeyEval.indexOf('&')) == -1)
      {
        // String is null or a label w/o an accesskey
        label = labelAndAccessKeyEval;
      } else if (ampIdx == (labelAndAccessKeyEval.length() - 1))
      {
        // & is last character, strip it.
        label = labelAndAccessKeyEval.substring(0, ampIdx);
      } else
      {
        // We have a string with an accessKey somewhere
        char[] keyArray = labelAndAccessKeyEval.toCharArray();
        int len = labelAndAccessKeyEval.length();
        char[] keyArray2 = new char[len];
        int i, j = 0;
        boolean accessKeyFound = false;

        for (i = 0, j = 0; i < len; i++, j++)
        {
          if (keyArray[i] == '&')
          {
            i++;

            if (!accessKeyFound && keyArray[i] != '&')
            {
              // We have our accessKey
              accessKey = labelAndAccessKeyEval.substring(i, i + 1);
              accessKeyFound = true;
            }
          }

          keyArray2[j] = keyArray[i];
        }

        String label1 = new String(keyArray2, 0, j);
        label = label1;
      }
File Line
org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java 155
org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java 294
              if ((i + 1 < length) && (text.charAt(i + 1) == checkChar))
                i++;
            }            
          }
        }
      }
      else if (ch <= 0xff)
      {
        // character is in the high ISO range, so use HTML entity
        buffIndex = _addToBuffer(out, buff, buffIndex, _sISO8859_1_Entities[ch - 0xA0]);
      }
      else if (Character.isHighSurrogate(ch)) 
      {
        // Some languages' characters need to use supplementary characters. For UTF-16, a "surrogate pair" is required 
        // to represent a single supplementary character. high surrogate range is (ch >= 0xD800 && ch <= 0xDBFF)
        // Here we check if the character is a high surrogate (the following char will be a low surrogate).
        // We then encode the surrogate pair.
        // If we don't do this, then surrogate characters will not display correctly . E.g., if we encoded each
        // character separately we might have '&#55360;&#56320;', and Firefox can't recognize these 2 decimal values as 
        // one supplementary character. Instead we need to use a single supplementary decimal value &#131072;.
        int surrogateCodePoint = Character.codePointAt(text, i);

        buffIndex =
          _writeDecRef(out, buff, buffIndex, surrogateCodePoint);
        // only increase i if a valid surrogate code point is returned 
        if (Character.isSupplementaryCodePoint(surrogateCodePoint))
        {
          i++;
        }
        //else
        //{
          // DO NOT BLOW UP. We have a bug in outputFormatted+surrogates, and we don't want to blow up.
          // blow up if invalid utf-16 characters encountered
          //throw new IllegalArgumentException(
          //  _LOG.getMessage("INVALID_SURROGATE_CHAR", new Object[] { ch, surrogateCodePoint, i }));
        //}
      }
      else if (ch < 0xfffe) // characters fffe and ffff are considered outside of unicode
      {
        // character is outside of the ISO range
        if (isBodyText)
        {
          // See above for what _UNICODE_LINE_BREAK means...
          if (ch == _UNICODE_LINE_BREAK)
            buffIndex = _addToBuffer(out, buff, buffIndex, "<br>");
          else if (ch == _UNICODE_HYPHENATION_POINT)
            buffIndex = _addToBuffer(out, buff, buffIndex, "<wbr>");
          else
            buffIndex = _writeDecRef(out, buff, buffIndex, ch);
        }
        else
        {
          buffIndex = _writeDecRef(out, buff, buffIndex, ch);         
        }
      }
    }

    // flush the buffer, since the caller doesn't try to maintain the buffer index betweeen calls
    _flushBuffer(out, buff, buffIndex);
  }

  /**
   * Writes the output as a decimal escape.  This is the same size or smaller than the hex
   * equivalent and works on versions of Netscape before 4.74. See bug #1491321.
   * ch - the character to write out. This could be a character code point in the case of surrogate characters.
   * Character code points are integers between 0 and 1,114,111.
   * <p>
   */
  static private int _writeDecRef(
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/MessageBoxRenderer.java 252
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/MessageBoxRenderer.java 276
      pattern = getTranslatedString(context, "af_messages.LIST_FORMAT_private");
      description = formatString(context, pattern, parameters);
    }
    else
    {
      description = "";
    }

    // get (or generate) the current child
    currentChild = _generateChild(msg, currentChild);
    currentChild.render(context);

    if (isTextFormatted(summary))
      renderFormattedText(context, description);
    else if (description != null)
      writer.writeText(description, null);

    return currentChild;
  }

  private BaseMutableUINode _generateChild(
    MessageWrapper   msg,
    BaseMutableUINode cachedChild)
  {
    if (cachedChild == null)
      cachedChild = new BaseMutableUINode(MARLIN_NAMESPACE, LINK_NAME);

    // link text
    String label = msg.getLabel();
    cachedChild.setAttributeValue(TEXT_ATTR, label);

    String anchor = null;
    String summary = null;

    if (label != null)
    {
      // If the text is null, no need to actually collect these values
      anchor = MessageUtils.getAnchor(msg.getId().toString());
      if (anchor != null)
        anchor = "#"+anchor;

      summary = msg.getSummary();
    }

    // However, we always have to update the anchor and description because
    // they were possibly set the last time this link was used. Even if they
    // don't render in the page, they'll be in the HTML.
    cachedChild.setAttributeValue(DESTINATION_ATTR, anchor);
    cachedChild.setAttributeValue(LONG_DESC_ATTR, summary);
    return cachedChild;
  }

  private String _getMessageTextStyle(
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/MenuListRenderer.java 201
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/MenuListRenderer.java 196
    String style = PdaHtmlLafUtils.getStringAttributeValue(context,
                                                     node,
                                                     LIST_STYLE_ATTR);
    if (LIST_STYLE_LOWER_ALPHA.equals(style) ||
        LIST_STYLE_UPPER_ALPHA.equals(style) ||
        LIST_STYLE_DECIMAL.equals(style)
    )
    {
      writer.endElement("ol");
    }
    else
    {
      writer.endElement("ul");
    }
    super.postrender( context, node);
  }

  @Override
  protected void renderIndexedChild(
    UIXRenderingContext context,
    UINode           node,
    int              childIndex
    ) throws IOException
  {

    UINode child = node.getIndexedChild(context, childIndex);
    boolean selected = isSelected(context, child);

    renderNode(context, child, selected);
  }

  protected void renderNode(
    UIXRenderingContext context,
    UINode           node,
    boolean          selected
    ) throws IOException
  {
    if (selected )
    {
      // set the selected property to true
      StyledItemUtils.setSelected(context, true);
    }

    ResponseWriter writer = context.getResponseWriter();
    writer.startElement( LIST_ITEM_ELEMENT, null );
    writer.startElement(SPAN_ELEMENT, null);
    if ( StyledItemUtils.isSelected(context, node) )
      renderStyleClassAttribute(context, AF_MENU_LIST_SELECTED_STYLE_CLASS);
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/InstallLafIconProvider.java 86
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/IconArrayLafIconProvider.java 98
    IconArrayLafIconProvider iconProvider
    )
  {
    int maxIndex = iconProvider._icons.length;
    _icons = new Icon[maxIndex];

    
    // copy the icon array of the iconProvider passed in
    System.arraycopy(iconProvider._icons,
                     0,
                     _icons,
                     0 ,
                     maxIndex);

  }

  /*
  * icons are put into array of icons at the index specified by the
  * corresponding iconKey.
  */

  private void _setIcons(
    Object[] iconInfo
    )
  {
    int numIcons =  iconInfo.length / 2;

    IconKey[] keys = new IconKey[ numIcons ];
    Icon[] icons = new Icon[ numIcons ];

    for (int i = 0; i < keys.length;  i ++)
    {
      keys[i] = (IconKey)iconInfo[i * 2];
      icons[i] = (Icon)iconInfo[(i * 2) + 1];
    }

    //
    // Assign the values
    //
    for (int i = 0; i < numIcons; i++)
    {
      if ( keys[i] != null )
        _icons[ keys[i].getKeyIndex()] = icons[i];
    }
  }

  /**
   * Returns the URI to the icon indentified by the icon key
   */
  @Override
  public String getIconURI(
    UIXRenderingContext context,
    IconKey          iconKey
    )
  {
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/ShowItemRenderer.java 38
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ShowItemRenderer.java 35
@Deprecated
public class ShowItemRenderer extends LinkRenderer 
{
  @Override
  protected void renderIndexedChild(
    UIXRenderingContext context,
    UINode           node,
    int              currVisChildIndex,
    int              prevVisChildIndex,
    int              nextVisChildIndex,
    int              ithRenderedChild
    ) throws IOException
  {
    //  Do nothing here, my parent will take care of rendering my children
    //  if I have my 'selected' attribute set to true.
  }
  
  // Returns the partial change script that is usually rendered for onClick
  @Override
  protected String getPartialChangeScript(
    UIXRenderingContext context,
    UINode           node
    )
  {
    String partialTargets = getAncestorPartialTargets(context);
    String sourceParam = BaseLafUtils.getStringAttributeValue(context,
                                                        node, ID_ATTR);
    String formName = getParentFormName(context);
     
    // Lets render fullpage submit if PPR is not enabled
    if (partialTargets == null)
    {
      String fullPageSubmitScript = XhtmlLafUtils.
                                        getFullPageSubmitScript(formName, "0",
                                                                SHOW_EVENT,
                                                                sourceParam);

      FormValueRenderer.addNeededValue(context, formName, EVENT_PARAM,
                                        SOURCE_PARAM, null,null);
      return fullPageSubmitScript;
    }
     
    String validate = 
              Boolean.TRUE.equals(SubTabBarUtils.isUnvalidated(context)) ? 
               "0" : "1"; 
   
    String partialChangeScript = XhtmlLafUtils.
                                   getPartialPageSubmitScript(formName,
                                                              validate,
                                                              partialTargets,
                                                              SHOW_EVENT,
                                                              sourceParam);
                                                               
    FormValueRenderer.addNeededValue(context, formName, EVENT_PARAM,
                                     PARTIAL_TARGETS_PARAM, SOURCE_PARAM,
                                     PARTIAL_PARAM);
    return partialChangeScript;
  }
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/MenuListRenderer.java 119
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TabBarRenderer.java 82
  }


 protected UIXHierarchy getHierarchyBase(
    UIXRenderingContext context,
    UINode           node
  )
  {
    return (UIXHierarchy) node.getUIComponent();
  }


  protected UINode getStamp(
    UIXRenderingContext context,
    UINode           node
    )
  {
    return node.getNamedChild(context, NODE_STAMP_CHILD);
  }


  protected boolean setNewPath(
    UIXRenderingContext context,
    UINode           node,
    UIXHierarchy    component
  )
  {
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);
    return ModelRendererUtils.setNewPath(component, startDepth,
                                         ((UIXNavigationLevel)component).getFocusRowKey());


  }

  /**
   * @todo - deal with rendered=false on model nodes
   */
  @Override
  protected void renderContent(
    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {

    UIXHierarchy component = getHierarchyBase(context, node);
    UINode stamp = getStamp(context, node);

    if(stamp != null)
    {

      // Save the current key
      Object oldPath = component.getRowKey();
      boolean isNewPath = setNewPath(context, node, component);
      if (isNewPath)
      {

        int size = component.getRowCount();
        int rowIndex = component.getRowIndex();
File Line
org/apache/myfaces/trinidadinternal/image/cache/ColorizedIconNameProvider.java 34
org/apache/myfaces/trinidadinternal/image/cache/FlippedIconNameProvider.java 34
public class FlippedIconNameProvider implements NameProvider
{
  public String getName(
      ImageContext context, 
      Map<Object, Object> properties)
  {
    String name = (String)properties.get(ImageConstants.NAME_KEY);

    if (name == null)
    {
      String source = (String)properties.get(ImageConstants.SOURCE_KEY);

      // Get just the file name out of the imageName
      int lastSepIndex = source.lastIndexOf(File.separatorChar);
      if ((lastSepIndex == -1) && (File.separatorChar != '/'))
        lastSepIndex = source.lastIndexOf('/');

      int dotIndex = source.lastIndexOf('.');
      if ((dotIndex == -1) || (dotIndex <= lastSepIndex))
        dotIndex = source.length();

      name = source.substring(lastSepIndex+1, dotIndex);
    }

    // Tack on a "-r" suffix if this is a RTL image
    String directionName = "";
    if (CacheUtils.getReadingDirection(context, properties) ==
         LocaleUtils.DIRECTION_RIGHTTOLEFT)
    {
      directionName = "-r";
    }

    return _PREFIX + name + directionName;
  }

  static private final String _PREFIX = "f";
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/GlobalHeaderRenderer.java 307
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/TabBarRenderer.java 281
        super.renderChild( context, node);
        writer.endElement("span");
      }
    }
  }

  private boolean _isSelected(
          UIXRenderingContext context,
          UINode           node
          )
  {
    Object selectedAttr  = node.getAttributeValue(context, SELECTED_ATTR);

    if (selectedAttr == null)
    {
      selectedAttr = context.getLocalProperty(0, _SELECTED_KEY, null);
      if (selectedAttr != null)
        return true;

      return false;
    }

    return ((Boolean)selectedAttr).booleanValue();
  }


  protected UIXHierarchy getHierarchyBase(
      UIXRenderingContext context,
      UINode           node
  )
  {
    return (UIXHierarchy) node.getUIComponent();
  }


  protected UINode getStamp(
    UIXRenderingContext context,
    UINode           node
  )
  {
    return node.getNamedChild(context, NODE_STAMP_CHILD);
  }


  protected boolean setNewPath(
    UIXRenderingContext context,
    UINode           node,
    UIXHierarchy    component
  )
  {
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);
    return ModelRendererUtils.setNewPath(component, startDepth,
                                           ((UIXNavigationLevel)component).getFocusRowKey());

  }
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TreeRenderer.java 242
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java 186
    UIXHierarchy     tree)
  {
    tree.setRowKey(null);
    return true;
  }  
  
 
  private boolean _isShownSelected(
    UIXHierarchy         tree,
    Map<Object, Boolean> selectedPaths,
    Object               currPath
  )
  {

    boolean selected = false;
    if (tree instanceof UIXTree)
      selected = ((UIXTree)tree).getSelectedRowKeys().isContained();
      
    if (selected)
      return true;
      
    Object value = selectedPaths.get(currPath);
    
    if (value != null)
      return true;
      
    return false;
  }

  protected Map<Object, Boolean> getSelectedPaths(Object focusPath)
  {
    if ( focusPath == null)
      return new HashMap<Object, Boolean>(0);
      
    Map<Object, Boolean> selectedPaths = 
      new HashMap<Object, Boolean>(1);
    
    selectedPaths.put(focusPath, Boolean.TRUE);
    return selectedPaths;
  }

  protected RowKeySet getExpandedRowKeys(UIXHierarchy tree)
  {
    return ((UIXTree)tree).getDisclosedRowKeys();    
  }
  
  protected String getConnectingBackgroundIcon(
File Line
org/apache/myfaces/trinidadinternal/menu/GroupNode.java 115
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 90
    List<MenuNode> children = getChildren();

    // Traverse the list. Do the following:
    //    o get Node from Model's hashMap of nodes and ids
    //    o check attributes (rendered, disabled, readOnly)
    //    o if they are ok, return the node
    for (int i=0; i < Array.getLength(idrefList); i++)
    {
      Iterator<MenuNode> childIter = children.iterator();

      // All node "id" attribute values had the node's
      // system hashcode id appended to the id when
      // placed in the model's idNodeMap.
      //
      // Each id in the idreflist of a group node does
      // NOT have this node sys id appended it to it
      // and needs to or we won't find the group's
      // ref node.
      //
      // Since group nodes can only point to one of
      // its children, we iterate through them, get
      // their sys id and append it to idref until
      // we find a match (or not).
      while (childIter.hasNext())
      {
        MenuNode childNode = childIter.next();
        String modelId = childNode.getModelId();

        // Need to append mode's sys id here to create a
        // unique id.
        String refNodeId = idrefList[i] + modelId;

        refNode = (MenuNode) getRootModel().getNode(refNodeId);

        // if nothing found, move on to the next child
        if (refNode != null)
         break;
      }

      if (refNode == null)
        continue;

      // Check the attributes of the found node
      if (   !refNode.getRendered()
          ||  refNode.getDisabled()
          ||  refNode.getReadOnly()
          || !refNode.getVisible()
         )
      {
        refNode = null;
        continue;
      }

      // Ok, we have a valid RefNode
      break;
    }

    // If no valid node is found,
    // log an error
    if (refNode == null)
    {
        _LOG.severe("GroupNode " + getLabel() + " refers to no valid node.\n");
        return null;
    }

    return refNode;
  }

  public final String getLabel()
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java 2414
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessChoiceBarRenderer.java 660
    context.getResponseWriter().writeText(chars, 0, 1);
  }

  /**
   * Writes the separator between two elements
   */
  private void _renderSpacerCell(
    UIXRenderingContext context
    ) throws IOException
  {
    ResponseWriter writer = context.getResponseWriter();

    writer.startElement("td", null);
    renderItemSpacer(context);
    writer.endElement("td");
  }
  /*
   * render the "td".
   * we only want to render the ID in the "td" if renderAsTable is false.
   * we only render the baseID if isBaseID is true. Otherwise we render the
   * subID.
   * This logic is so for the Visual Editor to know
   * the pieces are one UINode. See bug 2222541.
   */
  private void _renderStartTableCell(
    UIXRenderingContext context,
    UINode           node,
    ResponseWriter   writer,
    boolean          renderAsTable,
    boolean          isBaseID
    ) throws IOException
  {

    writer.startElement("td", null);
    if (!renderAsTable)
    {
      if (isBaseID)
      {
        renderID(context, node);
      }
    }
  }

  // Gets the encoded partial targets for the specified node
  private static String _getPartialTargets(
    UIXRenderingContext context,
    UINode           node
    )
  {
    if (!supportsPartialRendering(context))
      return null;

    String[] partialTargets = (String[])node.getAttributeValue(context,
                                               PARTIAL_TARGETS_ATTR);

    // Convert the partial targets to the encoded form
    return PartialPageRendererUtils.encodePartialTargets(partialTargets);
  }

  private String _getIDForFocus(
    UIXRenderingContext context,
    UINode           node
File Line
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/ButtonRenderer.java 39
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/ResetButtonRenderer.java 39
{
  /**
   * Tests whether the button should be rendered as an image.
   */
  @Override
  protected boolean doRenderImageContent(
    UIXRenderingContext context,
    UINode           node
    )
  {
    // Check with superclass first (screen reader mode).
    if (!super.doRenderImageContent(context, node))
      return false;

    // We only render buttons as images if we have all
    // of the button icons. 
    return SimpleButtonUtils.doRenderImageButton(context);
  }

  /**
   * Creates the ImageProviderRequest to use when looking up the
   * button image.
   */ 
  @Override
  protected ImageProviderRequest createImageProviderRequest(
    UIXRenderingContext context,
    Object       name,
    Object       text,
    Color        foreground,
    Color        background,
    Color        surroundingColor,
    FontProxy    font,
    boolean      disabled,
    boolean      textAntialias,
    boolean      startRounded,
    boolean      endRounded,
    char         accessKey
    )
  {
    return SimpleButtonUtils.createButtonRequest(
                        context,
                        (name != null)
                          ? name.toString()
                          : null,
                        (text != null)
                          ? text.toString()
                          : null,
                        foreground,
                        background,
                        surroundingColor,
                        font,
                        disabled,
                        textAntialias,
                        accessKey);
  }

  /**
   * Returns the name of the server-side style for styling
   * button text.
   */
  @Override
  protected String getServerStyleName(
    UIXRenderingContext context,
    UINode           node,
    boolean          disabled
    )
  {
    return SimpleButtonUtils.getButtonStyleName(disabled);
  }
}
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyRenderer.java 330
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneRenderer.java 233
  }

  //
  // ENCODE BEHAVIOR
  //
  /*
   */
  @Override
  protected void encodeAllAsElement(
    FacesContext     context,
    RenderingContext rc,
    UIComponent      component,
    FacesBean        bean
    ) throws IOException
  {
    Converter converter = getConverter(component, bean);
    if ( converter == null)
      converter = getDefaultConverter(context, component, bean);
    boolean valuePassThru = getValuePassThru(component, bean);

    if (isAutoSubmit(component, bean))
      AutoSubmitUtils.writeDependencies(context, rc);

    // Only add in validators and converters when we're in valuePassThru
    // mode; otherwise, there's not enough on the client to even consider
    FormData fData = rc.getFormData();
    if (fData != null)
    {
      ((CoreFormData) fData).addOnSubmitConverterValidators(component,
                      valuePassThru ? converter : null,
                      valuePassThru ? getValidators(component, bean) : null,
                      getClientId(context, component),
                      isImmediate(component, bean),
                      getRequired(component, bean),
                      getRequiredMessageKey());
    }

    List<SelectItem> selectItems = getSelectItems(component, converter, false);
File Line
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 494
org/apache/myfaces/trinidadinternal/menu/MenuNode.java 778
  }
  /**
   * _joinLabelAndAccessKey - takes a string label and string accessKey
   * and combines them into a single labelAndAccessKey string.
   *
   * @param label - String with node's label.
   * @param accessKey - One character String which is the label's accessKey.
   * @return
   */
  private String _joinLabelAndAccessKey(String label, String accessKey)
  {
    char[] keyArray  = label.toCharArray();
    int len          = label.length();
    int lentimes2    = len*2;
    char[] keyArray2 = new char[lentimes2];
    int i, j = 0;
    boolean accessKeyFound = false;

    // find the first occurrence of a single Ampersand
    for (i=0, j=0; i < len; i++, j++)
    {
      // AccessKey
      if (   keyArray[i] == accessKey.charAt(0)
          && !accessKeyFound
         )
      {
        keyArray2[j] = '&';
        j++;
        accessKeyFound = true;
      }

      keyArray2[j] = keyArray[i];

      // Ampersand as regular character
      // double it up.
      if (keyArray[i] == '&')
      {
        j++;
        keyArray2[j] = keyArray[i];
      }
    }

    String combinedLabel = new String(keyArray2, 0, j);
    return combinedLabel;
  }

  /**
   * _splitLabelAndAccessKey - takes a string containing a label
   * and an accessKey and breaks separates it and sets the label
   * and the accessKey separately.
   *
   * @param labelAndAccessKey - String holding both a label and
   * accessKey.
   */
  private void _splitLabelAndAccessKey(String labelAndAccessKey)
File Line
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/MessageBoxRenderer.java 392
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SideBarRenderer.java 434
                                AF_PANEL_SIDE_BAR_END_BACKGROUND_ICON_NAME);

      icons = new IconData(bottomStart,
                           bottomEnd,
                           bottomBackground,
                           topStart,
                           topEnd,
                           topBackground,
                           startBackground,
                           endBackground);

      // Stash away the IconData so that we don't have to re-create
      // it on the next render
      skin.setProperty(_ICONS_KEY, icons);
    }

    return icons;
  }

  // A class that we use for storing Icon-related info
  private static class IconData
  {
    public final Icon bottomStart;
    public final Icon bottomEnd;
    public final Icon bottomBackground;
    public final Icon topStart;
    public final Icon topEnd;
    public final Icon topBackground;
    public final Icon startBackground;
    public final Icon endBackground;

    public IconData(
      Icon bottomStart,
      Icon bottomEnd,
      Icon bottomBackground,
      Icon topStart,
      Icon topEnd,
      Icon topBackground,
      Icon startBackground,
      Icon endBackground
      )
    {
      this.bottomStart = bottomStart;
      this.bottomEnd = bottomEnd;
      this.bottomBackground = bottomBackground;
      this.topStart = topStart;
      this.topEnd = topEnd;
      this.topBackground = topBackground;
      this.startBackground = startBackground;
      this.endBackground = endBackground;
    }
  }

  // Keys for looking up IconData properties on the Skin
  private static final Object _ICONS_KEY = new Object();
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectRangeChoiceBarRenderer.java 837
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java 1458
    boolean maxUnknown = (maxValue == MAX_VALUE_UNKNOWN);

    // Zero-indexed block index.
    long blockIndex = (value - minValue + blockSize - 1L) /
                         blockSize;

    // sometimes a record set won't start on a multiple of blockSize. So
    // remember to add any offset:
    // this can safely be an int because it is an index into the blockSize,
    // which is itself an int:
    int offset = (int) (value - (minValue + (blockIndex * blockSize)));
    if (offset < 0)
      offset = offset + blockSize;

    // Total number of blocks (again, zero-indexed)
    long maxBlockIndex;
    if (maxUnknown)
      maxBlockIndex = blockIndex + 1;
    else
    {
      maxBlockIndex = (maxValue - minValue - offset) / blockSize;
      if (offset > 0)
        maxBlockIndex++;
    }

    // Calculate the first block that should be shown.  The order goes:
    // Group 0:            0-28 + More
    // Group 1:Previous + 29-56 + More
    // Group 2:Previous + 57-84 + More
    // etc..
    long firstBlockIndex;

    // If everything is visible, or we're in the first group, start at zero.
    if ((maxBlockIndex <= (_MAX_VISIBLE_OPTIONS - 1L)) ||
        (blockIndex <= (_MAX_VISIBLE_OPTIONS - 2L)))
      firstBlockIndex = 0;
    else
      firstBlockIndex = ((blockIndex - 1L) / (_MAX_VISIBLE_OPTIONS - 2L)) *
                        (_MAX_VISIBLE_OPTIONS - 2L);

    // And we always show a total of 30 groups (or straight to the end)
    long lastBlockIndex = firstBlockIndex + (_MAX_VISIBLE_OPTIONS - 1L);
    if (lastBlockIndex > maxBlockIndex)
      lastBlockIndex = maxBlockIndex;
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormInputRenderer.java 163
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/InputLabelAndMessageRenderer.java 206
    if(labelShowRequired(component, bean))
    {
      requiredStyleClass = SkinSelectors.STATE_REQUIRED;
    }

    List<String> parsedStyleClasses =
      OutputUtils.parseStyleClassList(styleClass);
    int userStyleClassCount;
    if (parsedStyleClasses == null)
      userStyleClassCount = (styleClass == null) ? 0 : 1;
    else
      userStyleClassCount = parsedStyleClasses.size();

    String[] styleClasses = new String[userStyleClassCount + 4];
    int i=0;
    if (parsedStyleClasses != null)
    {
      while (i < userStyleClassCount)
      {
        styleClasses[i] = parsedStyleClasses.get(i);
        i++;
      }
    }
    else if (styleClass != null)
    {
      styleClasses[i++] = styleClass;
    }

    styleClasses[i++] = contentStyleClass;
    styleClasses[i++] = disabledStyleClass;
    styleClasses[i++] = readOnlyStyleClass;
    styleClasses[i++] = requiredStyleClass;

    renderStyleClasses(context, rc, styleClasses);
File Line
org/apache/myfaces/trinidadinternal/validator/DateTimeRangeValidator.java 111
org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java 74
    String messageDetailMax = this.getMessageDetailMaximum();
    String messageDetailMin = this.getMessageDetailMinimum();
    String messageDetailRange = this.getMessageDetailNotInRange();
    String hintMax = this.getHintMaximum();
    String hintMin = this.getHintMinimum();
    String hintRange = this.getHintNotInRange();
    
    Map<String, String> cMessages = null;
    if(messageDetailMax != null || messageDetailMin != null || messageDetailRange != null || hintMax != null || hintMin != null|| hintRange != null)
    {
      cMessages = new HashMap<String, String>();
      cMessages.put("max", messageDetailMax);
      cMessages.put("min", messageDetailMin);
      cMessages.put("range", messageDetailRange);
      cMessages.put("hintMax", hintMax);
      cMessages.put("hintMin", hintMin);
      cMessages.put("hintRange", hintRange);
    }
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyCheckboxRenderer.java 73
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneRadioRenderer.java 74
    int              selectedIndex,
    Converter        converter,
    boolean          valuePassThru
    ) throws IOException
  {
    ResponseWriter writer = context.getResponseWriter();
    writer.startElement("span", component);
    renderId(context, component);
    // Render all generic attributes, except styles (they go on the item),
    // and onclick (also on the item, see below)
    renderAllAttributes(context, rc, component, bean, false /*no styles*/);

    boolean applyFieldSet = _applyFieldSetWrapper(rc);
    if (applyFieldSet)
    {
      String shortDesc = getShortDesc(component, bean);
      if (shortDesc == null)
      {
        applyFieldSet = false;
      }
      else
      {
        writer.startElement("fieldset", null);
        writer.writeAttribute("style", "border:none;margin:0px;padding:0px;", null);
        writer.startElement("legend", null);
        renderStyleClass(context, rc,
                         SkinSelectors.HIDDEN_LABEL_STYLE_CLASS);
        writer.writeText(shortDesc, "shortDesc");
        writer.endElement("legend");
      }
    }

    encodeSelectItems(context, rc, component, bean,
                      selectItems, selectedIndex, converter,
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectBooleanRadioRenderer.java 191
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlRenderer.java 508
    rw.writeAttribute("ondblclick", getOndblclick(component, bean),
        "ondblclick");
    rw.writeAttribute("onkeydown", getOnkeydown(component, bean),
        "onkeydown");
    rw.writeAttribute("onkeyup", getOnkeyup(component, bean), "onkeyup");
    rw.writeAttribute("onkeypress", getOnkeypress(component, bean),
        "onkeypress");
    rw.writeAttribute("onmousedown", getOnmousedown(component, bean),
        "onmousedown");
    rw.writeAttribute("onmousemove", getOnmousemove(component, bean),
        "onmousemove");
    rw.writeAttribute("onmouseout", getOnmouseout(component, bean),
        "onmouseout");
    rw.writeAttribute("onmouseover", getOnmouseover(component, bean),
        "onmouseover");
    rw.writeAttribute("onmouseup", getOnmouseup(component, bean),
        "onmouseup");
  }
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/GlobalHeaderRenderer.java 65
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/TabBarRenderer.java 84
      renderStyleClassAttribute(context, _TAB_BAR_STYLE_CLASS);
  }

  @Override
  protected void renderContent(
      UIXRenderingContext context,
      UINode           node
      ) throws IOException
  {
    boolean initialLinkSelectedStatus = LinkUtils.isSelected(context);

    UIXHierarchy component = getHierarchyBase(context, node);
    UINode stamp = getStamp(context, node);

    if(stamp != null)
    {

      // Save the current key
      Object oldPath = component.getRowKey();
      boolean isNewPath = setNewPath(context, node, component);

      if (isNewPath)
      {
        int size = component.getRowCount();
        int rowIndex = component.getRowIndex();

        for (int i = 0; i < size; i++)
        {
          component.setRowIndex(i);
          renderStamp(context, stamp,i == rowIndex);

          if ( i < (size - 1))
            renderBetweenIndexedChildren(context,node,i);
File Line
org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java 396
org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java 410
        buff[buffIndex++] = (char)('0' + (i / 100000));
        i = i % 100000;      
        buff[buffIndex++] = (char)('0' + (i / 10000));
        i = i % 10000;
        buff[buffIndex++] = (char)('0' + (i / 1000));
        i = i % 1000;
        buff[buffIndex++] = (char)('0' + (i / 100));
        i = i % 100;
        buff[buffIndex++] = (char)('0' + (i / 10));
        i = i % 10;
        buff[buffIndex++] = (char)('0' + i);
      }      
      else if (i > 10000)
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlRenderer.java 838
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafRenderer.java 1272
          renderID(context, id, false);
      }

      // write a reference to the transparent gif function
      writer.write("t(");

      if ((width != null) || (height != null))
      {
        String widthParam = "void 0";

        if (width != null)
        {
          widthParam = width;

          if (needsQuoting)
          {
            writer.write("'");
          }
        }

        writer.write(widthParam);

        if (needsQuoting && (width != null))
        {
          writer.write("'");
        }

        if (height != null)
        {
          writer.write(",");

          if (needsQuoting)
          {
            writer.write("'");
          }

          writer.write(height);

          if (needsQuoting)
          {
            writer.write("'");
          }
        }
      }

      writer.write(")");

      writer.endElement("script");
    }
  }
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectManyCheckboxRenderer.java 158
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneRadioRenderer.java 161
                           i, selectedIndex == i, disabled,
                           renderedOne && isVertical,
                           itemOnclick))
      {
        renderedOne = true;
      }
    }
  }

  protected boolean encodeSelectItem(
    FacesContext     context,
    RenderingContext rc,
    UIComponent      component,
    SelectItem       item,
    Converter        converter,
    boolean          valuePassThru,
    Object           accessKey,
    int              index,
    boolean          isSelected,
    boolean          isDisabled,
    boolean          renderBreak,
    String           itemOnclick
    ) throws IOException
  {
    if (item == null)
      return false;

    String id = rc.getCurrentClientId();
    if (id == null)
      return false;

    // Create the per-item ID, necessary for generating the <label>
    // tag.  We use "parentid:_[index]"
    StringBuffer subidBuffer = new StringBuffer(id.length() + 4);
    subidBuffer.append(id);
    subidBuffer.append(":_");
    subidBuffer.append(IntegerUtils.getString(index));
    String subid = subidBuffer.toString();

    Object itemValue = getItemValue(context,
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/desktop/DesktopTableRenderer.java 641
org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaTableRenderer.java 558
  }

  /**
   * @todo Reconsider our choice of style for this element!
   */
  private void _renderTableHeader(
    FacesContext          context,
    RenderingContext      rc,
    TableRenderingContext tContext,
    UIComponent           component
    ) throws IOException
  {
    // implement header facet on table: see bug 3788610
    ResponseWriter writer = context.getResponseWriter();
    UIComponent header = getFacet(component, CoreTable.HEADER_FACET);
    if (header != null)
    {
      writer.startElement("thead", null);
      writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
      writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
      writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE,
        tContext.getActualColumnCount(), null);
      renderStyleClass(context, rc, SkinSelectors.AF_COLUMN_SORTABLE_HEADER_ICON_STYLE_CLASS);

      encodeChild(context, header);

      writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
      writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
      writer.endElement("thead");
    }
  }
File Line
org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java 143
org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java 1330
  private static String _trimQuotes(String in)
  {
    if ( in == null )
      return in;

    boolean startsWithDoubleQuote = in.startsWith( "\"" );
    boolean startsWithSingleQuote = in.startsWith( "\'" );
    boolean endsWithDoubleQuote = in.endsWith( "\"" );
    boolean endsWithSingleQuote = in.endsWith( "\'" );
    
    if (( startsWithDoubleQuote && endsWithSingleQuote ) ||
       ( startsWithSingleQuote && endsWithDoubleQuote ))
    {
      if (_LOG.isWarning())
        _LOG.warning("ERR_PARSING", in);
    }
                                                          
    if ( startsWithDoubleQuote && endsWithDoubleQuote )
      return in.substring( 1, in.length() - 1 );
    if ( startsWithSingleQuote && endsWithSingleQuote )
      return in.substring( 1, in.length() - 1 );
    
    return in;
  }
  
  // Returns the uri portion of the url property value
  private static String _getURIString(String propertyValue)
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelAccordionRenderer.java 61
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ShowDetailItemRenderer.java 56
    _disclosedKey = type.findKey("disclosed");
  }

  @SuppressWarnings("unchecked")
  @Override
  protected void decode(
    FacesContext facesContext,
    UIComponent  component,
    @SuppressWarnings("unused")
    FacesBean    facesBean,
    String       clientId)
  {
    Map<String, String> parameters =
      facesContext.getExternalContext().getRequestParameterMap();

    Object event = parameters.get(XhtmlConstants.EVENT_PARAM);
    if (XhtmlConstants.HIDE_EVENT.equals(event) ||
        XhtmlConstants.SHOW_EVENT.equals(event))
    {
      Object source = parameters.get(XhtmlConstants.SOURCE_PARAM);
      String id = clientId == null ? component.getClientId(facesContext) : clientId;

      if (id.equals(source))
      {
        boolean isDisclosed = XhtmlConstants.SHOW_EVENT.equals(event);
File Line
org/apache/myfaces/trinidadinternal/agent/parse/CapabilitiesNodeParser.java 131
org/apache/myfaces/trinidadinternal/agent/parse/ComponentNodeParser.java 91
    ArrayList<IncludeNode> nodesWithRefList = new ArrayList<IncludeNode>(_includeNodes.size());
    ArrayList<IncludeNode> nodesWithSrcList = new ArrayList<IncludeNode>(_includeNodes.size());
    for (int i = 0; i < _includeNodes.size(); i++)
    {
      IncludeNode node = _includeNodes.get(i);
      if (node.__getRefId() != null)
        nodesWithRefList.add(node);
      else
        nodesWithSrcList.add(node);
    }
    IncludeNode[] nodesWithRef = 
            nodesWithRefList.toArray(new IncludeNode[nodesWithRefList.size()]);
    IncludeNode[] nodesWithSrc = 
            nodesWithSrcList.toArray(new IncludeNode[nodesWithSrcList.size()]);
    return new DeviceComponentNode(_type, nodesWithRef, nodesWithSrc);    
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/LinkDataObject.java 53
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/LinkDataObject.java 164
    for (int childIndex = 0; childIndex < indexedChildCount; childIndex++)
    {
      UINode child = parent.getIndexedChild(context, childIndex);
      // needed for TrainRenderer. It is important to know what child index
      // this is, not just the index of the visible children.
      BaseLafUtils.setRenderingProperty(context,
                                        _CURRENT_INDEX_KEY,
                                        childIndex);

      if ((child != null) &&
          !Boolean.FALSE.equals(
             child.getAttributeValue(context, UIConstants.RENDERED_ATTR)))
      {
        context.pushChild(child, null, childIndex);
        context.pushRenderedChild(context, child);

        try
        {
          child.render(context);
        }
        finally
        {
          context.popRenderedChild(context);
          context.popChild();
        }
      }
      BaseLafUtils.setRenderingProperty(context, _CURRENT_INDEX_KEY, null);
    }

    BaseLafUtils.setRenderingProperty(context, _DATA_OBJECT_LIST_KEY, null);
    __setDataObjectUsedMode(context, false);

    return list;
  }
File Line
org/apache/myfaces/trinidadinternal/binding/AccessKeyBinding.java 62
org/apache/myfaces/trinidadinternal/binding/StripAccessKeyBinding.java 55
    return StringUtils.stripMnemonic(text);
  }

  @Override
  public void setValue(ELContext context, Object value)
  {
    throw new PropertyNotWritableException();
  }

  @Override
  public Class<?> getType(ELContext context)
  {
    return Character.class;
  }

  @Override
  public Class<?> getExpectedType()
  {
    return Character.class;
  }

  @Override
  public boolean isReadOnly(ELContext context)
  {
    return true;
  }

  @Override
  public boolean isLiteralText()
  {
    return false;
  }

  @Override
  public String getExpressionString()
  {
    return null;
  }

  public int hashCode()
  {
    return 0;
  }

  public boolean equals(Object o)
  {
    return (o == this);
  }

  private ValueExpression _base;
  private static final long serialVersionUID = 1L;
}
File Line
org/apache/myfaces/trinidadinternal/util/StateUtils.java 335
org/apache/myfaces/trinidadinternal/util/StateUtils.java 489
    public static byte[] decrypt(byte[] secure, ExternalContext ctx)
    {
        if (ctx == null)
        {
            throw new NullPointerException("ExternalContext ctx");
        }

        testConfiguration(ctx);
                
        SecretKey secretKey = (SecretKey) getSecret(ctx);
        String algorithm = findAlgorithm(ctx);
        String algorithmParams = findAlgorithmParams(ctx);
        byte[] iv = findInitializationVector(ctx);
        
        SecretKey macSecretKey = (SecretKey) getMacSecret(ctx);
        String macAlgorithm = findMacAlgorithm(ctx);

        try
        {
            // keep local to avoid threading issue
            Mac mac = Mac.getInstance(macAlgorithm);
            mac.init(macSecretKey);
            Cipher cipher = Cipher.getInstance(algorithm + "/"
                    + algorithmParams);
            if (iv != null)
            {
                IvParameterSpec ivSpec = new IvParameterSpec(iv);
                cipher.init(Cipher.DECRYPT_MODE, secretKey, ivSpec);
File Line
org/apache/myfaces/trinidadinternal/io/HtmlResponseWriter.java 552
org/apache/myfaces/trinidadinternal/io/XhtmlResponseWriter.java 402
      _out.write('>');
      _closeStart = false;
    }
  }


  /**
   * Flushes out any pending element, celaring the pending
   * entry.
   */
  private void _outputPendingElements() throws IOException
  {
    String pendingElement = _pendingElement;

    if (pendingElement != null)
    {
      // we clear the pending element BEFORE calling
      // startElementImpl to prevent _startElementImpl's indirect call
      // to _markPendingElements from pushing our element onto
      // the skipped stack, imbalancing the stack
      _pendingElement = null;

      // start the pending element
      _startElementImpl(pendingElement);
    }
  }

  /**
   * If an element is pending, push it onto the stack of skipped
   * elements because it doesn't have any attributes
   */
  private void _markPendingElements()
  {
    String pendingElement = _pendingElement;
    if (pendingElement != null)
    {
      _pushSkippedElement();
      _pendingElement = null;
    }
  }


  /**
   * Retrieves the name of the last output element.  If it is null,
   * that element was skipped and thus its end tag should be suppressed
   * as well
   */
  private String _popSkippedElement()
  {
    int size = _skippedElements.size();
    if (size == 0)
      return null;

    return _skippedElements.remove(size - 1);
  }

  /**
   * Marks the skipped element so that the output of its
   * end tag can also be suppressed
   */
  private void _pushSkippedElement()
  {
    _skippedElements.add(null);
  }


  /**
   * Marks that we have outputted a real element so that the ordering of
   * the outputted and skipped elements can be maintained.  This
   * also aids debuggin by ensuring that the element being ended matches
   * the actual ouputted name.
   */
  private void _pushOutputtedElement(
    String name
    )
  {
    _skippedElements.add(name);
  }
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TrinidadRenderingConstants.java 241
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java 287
  public static final String COLOR_PALETTE_TRANSPARENT_ICON_NAME = "cpt.gif";
  
  // 'xc' stands for uiX Composite
  // -= Simon =-
  // FIXME: Should it be renamed to remove UIX reference?
  public static final String COMPOSITE_ID_EXTENSION = "__xc_";
  
  // context property to indicate that form elements are repeated and the
  // data needs to be kept in sync
  public static final Object REPEAT_PROPERTY = new Object();


  //Constants for Non JavaScript browser support
  public static final String NO_JS_PARAMETER_KEY = "_parameterkey";
  public static final String NO_JS_INPUT_IMAGE_KEY = "_inputImagekey";
  public static final String MULTIPLE_VALUE_PARAM = "multipleValueParam";
  public static final String NO_JS_PARAMETER_KEY_BUTTON = "Go";
  public static final String NO_JS_PARAMETER_BACK_BUTTON = "Back";
  public static final String NO_JS_PARAMETER_NEXT_BUTTON = "Next";
  
  public static final String NON_JS_BROWSER = "_noJavaScript";
  public static final String NON_JS_BROWSER_TRUE = "true";
  public static final String NON_JS_DETAIL_DISCLOSED_ICON = "-";
  public static final String NON_JS_DETAIL_UNDISCLOSED_ICON = "+";
  public static final String NON_JS_ASC_ICON = "v";
  public static final String NON_JS_DESC_ICON = "^";
  
  // Maximum width of a narrow-screen PDA device in pixels
  public static final int NARROW_SCREEN_PDA_MAX_WIDTH = 240; 
  
  // The name of the hidden parameter that stores the value of the 
  // request-header, UA-pixels. This hidden paramter is rendered only 
  // for windows mobile.
  public static final String WINDOWS_MOBILE_UAPIXELS = "uapixels";
     
}
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/PageMenuButtonsRenderer.java 31
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/PageMenuButtonsRenderer.java 32
@Deprecated
public class PageMenuButtonsRenderer extends GlobalButtonBarRenderer
{
  @Override
  protected UIXHierarchy getHierarchyBase(
    UIXRenderingContext context,
    UINode           node
  )
  {
    UINode pageNode = context.getParentContext().getAncestorNode(0);
    return (UIXPage) pageNode.getUIComponent();
  }

  @Override
  protected UINode getStamp(
    UIXRenderingContext context,
    UINode           node
    )
  {
    UINode pageNode = context.getParentContext().getAncestorNode(0);
    return getNamedChild(context, pageNode, NODE_STAMP_CHILD);
  }

  @Override
  protected boolean setNewPath(
    UIXRenderingContext context,
    UINode           node,
    UIXHierarchy      component
  )
  {
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);
    return PageRendererUtils.setNewPath(context, component, startDepth);
  }
}
File Line
org/apache/myfaces/trinidadinternal/menu/ImmutableGroupNode.java 48
org/apache/myfaces/trinidadinternal/menu/ImmutableItemNode.java 51
  public ImmutableItemNode(ItemNode node)
  {
    _icon = node.getIconProperty();
    _focusViewId = node.getFocusViewIdProperty();
    _renderedStr = node.getRenderedProperty();
    _disabledStr = node.getDisabledProperty();
    _visibleStr = node.getVisibleProperty();
    _readOnlyStr = node.getReadOnlyProperty();
    _handlerId = node.getHandlerIdProperty();
    _bundleKey = node.getBundleKeyProperty();
    _bundleName = node.getBundleNameProperty();
    _accessKey = node.getAccessKeyProperty();
    _id = node.getIdProperty();
    _modelId = node.getModelIdProperty();
    _uniqueId = node.getUniqueIdProperty();
    _labelAndAccessKey = node.getLabelAndAccessKeyProperty();
    _defaultFocusPathStr = node.getDefaultFocusPathProperty();

    // Root Menu model's Request Map Key
    _rootModelKey = node.getRootModelKeyProperty();

    _rootId = node.getRootIdProperty();
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java 648
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessUtils.java 201
                                            UIConstants.GOTO_EVENT);
    String encodedSource =
      XhtmlLafUtils.getFormEncodedParameter(formEncoder, form, sourceKey, name);

    String encodedPartialTargets =
      XhtmlLafUtils.getFormEncodedParameter(formEncoder, form,
                                            partialTargetsKey,
                                            partialTargets);

    int initialSize = _CHOICE_ON_CHANGE_FORM_START.length() +
                          form.length()                         +
                          13                                    +
                          encodedSource.length()                         +
                          _CHOICE_ON_CHANGE_FORM_END.length();

    // Make room for partialTargets if we've got any
    if (encodedPartialTargets != null)
      initialSize += (encodedPartialTargets.length() + 2);

    StringBuffer buffer = new StringBuffer(initialSize);
    buffer.append(_CHOICE_ON_CHANGE_FORM_START);
    buffer.append(form);
    buffer.append("','");
    buffer.append(encodedGotoEvent);
    buffer.append("','");
    buffer.append(encodedSource);
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ProcessUtils.java 154
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessUtils.java 279
    UIXCollection component,
    UIComponent    stamp,
    int            startIndex
  )
  {
    int i = startIndex + 1;
    int rowCount = component.getRowCount();
    while (i < rowCount)
    {
      component.setRowIndex(i);
      boolean disabled = Boolean.TRUE.equals(
        stamp.getAttributes().get("disabled")); 
      boolean readOnly = Boolean.TRUE.equals(
        stamp.getAttributes().get("readOnly")); 
      boolean rendered = stamp.isRendered();

      // if this node is rendered and not disabled and not readOnly
      // then it can be used as the back button node.
      if (!disabled && !readOnly && rendered)    
      {
        component.setRowIndex(startIndex);
        return i;
      }
        
      i++;
    }
    
    component.setRowIndex(startIndex);
    return NO_INDEX;
  }

  public static void renderNavSubmitScript(
File Line
org/apache/myfaces/trinidadinternal/style/CSSStyle.java 52
org/apache/myfaces/trinidadinternal/style/UnmodifiableStyle.java 59
  }
  
  /**
   * Converts the style to a String suitable for use as an inline style
   * attribute value.
   */
  @Override
  public String toInlineString()
  {
    String inline = _inline;

    if (inline != null)
      return inline;
    
    Map<String, String> properties = getProperties();
    StringBuffer buffer = new StringBuffer(_DEFAULT_BUFFER_SIZE);
    boolean first = true;   
    
    for (Map.Entry<String, String> entrySet : properties.entrySet())
    {

      if (first)
        first = false;
      else
        buffer.append(";");
      String name = entrySet.getKey();
      String value = entrySet.getValue();
      buffer.append(name);
      buffer.append(":");
      buffer.append(value);
    }

    inline = buffer.toString();
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandButtonRenderer.java 214
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoButtonRenderer.java 249
    rc.setCurrentClientId(null);
  }

  /**
   * Override to return any state-based (selected, disabled, etc.)
   * CSS style markers.  HINT: use an immutable, cached List&lt;String>
   * for better performance.
   */
  protected List<String> getStateStyleClasses(
    FacesContext     context,
    RenderingContext rc,
    UIComponent      component,
    FacesBean        bean)
  {
    if (getDisabled(component, bean))
      return _DISABLED_STATE_LIST;
    return null;
  }

  // FIXME: move this implementation to XhtmlRenderer
  @Override
  protected void renderStyleAttributes(
    FacesContext     context,
    RenderingContext rc,
    UIComponent      component,
    FacesBean        bean,
    String           defaultStyleClass
    ) throws IOException
  {
    String styleClass = getStyleClass(component, bean);
    // -= Simon =-
    // FIXME: How come inlineStyle is never read
    //String inlineStyle = getInlineStyle(bean);
    List<String> stateStyleClasses = getStateStyleClasses(context, rc, component, bean);

    if ((styleClass==null) &&
        (defaultStyleClass != null) &&
        (stateStyleClasses == null))
    {
      renderStyleClass(context, rc, defaultStyleClass);
    }
    else
    {
File Line
org/apache/myfaces/trinidadinternal/share/url/EncoderUtils.java 703
org/apache/myfaces/trinidadinternal/share/url/EncoderUtils.java 781
            out.write(ch);
          }
        }
        else
        {
          if (buf == null)
          {
            buf = new ByteArrayOutputStream(_MAX_BYTES_PER_CHAR);

            if (encoding != null)
              writer = new OutputStreamWriter(buf, encoding);
            else
              writer = new OutputStreamWriter(buf);
            charArray = new char[1];
          }

          // convert to external encoding before hex conversion
          try
          {
            // An inspection of OutputStreamWriter reveals
            // that write(char) always allocates a one element
            // character array.  We can reuse our own.
            charArray[0] = ch;
            writer.write(charArray, 0, 1);
            writer.flush();
          }
          catch(IOException e)
          {
            buf.reset();
            continue;
          }

          byte[] ba = buf.toByteArray();
          for (int j = 0; j < ba.length; j++)
          {
            _writeDoubleHex(out, ba[j] + 256);
File Line
org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java 798
org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java 867
        agentObj.setAgentVersion(agent.substring(operaIndex + 6,firstSpace));
      }

      int paren = agent.indexOf('(');

      if (paren >= 0)
      {
        // try to determine the OS
        if (agent.indexOf("Win", paren) > 0)
        {
          agentObj.setPlatform(Agent.PLATFORM_WINDOWS);
        }
        else if (agent.indexOf("Mac", paren) > 0)
        {
          agentObj.setPlatform(Agent.PLATFORM_MACOS);
        }
        else if (agent.indexOf("Linux", paren) > 0)
        {
          agentObj.setPlatform(Agent.PLATFORM_LINUX);
        }
        else if (agent.indexOf("Sun", paren) > 0)
        {
          agentObj.setPlatform(Agent.PLATFORM_SOLARIS);
        }
      }
    }
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/PanelTabbedRenderer.java 102
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PanelTabbedRenderer.java 79
                     PdaHtmlLafConstants.LINK_CONTAINER_PARTIAL_TARGETS_PROPERTY);
    
    if (partialTargets != null)
      setPartialTargets(context, null);
    
    ResponseWriter writer = context.getResponseWriter();
    writer.startElement( DIV_ELEMENT, null );
    renderStyleClassAttribute(context,
                              AF_SHOW_ONE_TAB_BODY_STYLE_CLASS);
    int selectedChildIndex = _getResolvedSelectedIndex(context, node);
    //Render the content for the selected showItem
    if (selectedChildIndex != -1)
      super.renderContent(
             context, node.getIndexedChild(context, selectedChildIndex));
    writer.endElement( DIV_ELEMENT );
    
    if (partialTargets != null)
      setPartialTargets(context, partialTargets);
  }

  @Override
  protected void postrender(
    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {
    Object position = node.getAttributeValue(context, POSITION_ATTR);
    if (POSITION_BELOW.equals(position))
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/PageMenuListRenderer.java 38
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/PageMenuTabsRenderer.java 37
{
  @Override
  protected UIXHierarchy getHierarchyBase(
    UIXRenderingContext context,
    UINode           node
  )
  {
    UINode pageNode = context.getParentContext().getAncestorNode(0);
    return (UIXPage) pageNode.getUIComponent();
  }

  @Override
  protected UINode getStamp(
    UIXRenderingContext context,
    UINode           node
    )
  {
    UINode pageNode = context.getParentContext().getAncestorNode(0);
    return getNamedChild(context, pageNode, NODE_STAMP_CHILD);
  }

  @Override
  protected boolean setNewPath(
    UIXRenderingContext context,
    UINode           node,
    UIXHierarchy      component
  )
  {
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);
    return PageRendererUtils.setNewPath(context, component, startDepth);
  }
}
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/PageMenuListRenderer.java 38
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/PageMenuBarRenderer.java 35
{
  @Override
  protected UIXHierarchy getHierarchyBase(
    UIXRenderingContext context,
    UINode           node
  )
  {
    UINode pageNode = context.getParentContext().getAncestorNode(0);
    return (UIXPage) pageNode.getUIComponent();
  }

  @Override
  protected UINode getStamp(
    UIXRenderingContext context,
    UINode           node
    )
  {
    UINode pageNode = context.getParentContext().getAncestorNode(0);
    return getNamedChild(context, pageNode, NODE_STAMP_CHILD);
  }

  @Override
  protected boolean setNewPath(
    UIXRenderingContext context,
    UINode           node,
    UIXHierarchy    component
  )
  {
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);
    return PageRendererUtils.setNewPath(context, component, startDepth);
  }
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GlobalHeaderRenderer.java 191
org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/GlobalHeaderRenderer.java 195
    renderItemStyleAttrs(context, node, index, selected);

    // Render the tab link
    super.renderIndexedChild( context, node, index);

    writer.endElement(TABLE_DATA_ELEMENT);
  }


    protected void renderStamp(
    UIXRenderingContext context,
    UINode           stamp,
    boolean          selected
    )throws IOException
  {
    ResponseWriter writer = context.getResponseWriter();

    // Start the table cell
    writer.startElement(TABLE_DATA_ELEMENT, null);
    // todo - the index isn't used so putting -1 for now
    renderItemStyleAttrs(context, stamp, -1, selected);

    //Record the selected status so that in case this child happens to be
    //  a link, some special aspects like accessibility are taken care of.
    LinkUtils.setSelected(context, selected);

    stamp.render(context);

    writer.endElement(TABLE_DATA_ELEMENT);
  }

  /**
   * Override of renderBetweenIndexedChildren() which
   * renders the separator Icon.
   */
    @Override
  protected void renderBetweenIndexedChildren(
    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {
    renderBetweenNodes(context);
  }

/**
   * Override of renderBetweenIndexedChildren() which
   * renders the separator Icon.
   */
  protected void renderBetweenNodes(
    UIXRenderingContext context
    ) throws IOException
  {
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/PanelTabbedRenderer.java 169
org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PanelTabbedRenderer.java 136
            PdaHtmlLafConstants.LINK_CONTAINER_PARTIAL_TARGETS_PROPERTY,
                        partialTargets);
  }

  /**
   * Returns the index of the first avilable showItem child that has its
   *  'selected' property set to true.
   * If none of children are selected, the index of first such child that is
   *  enabled is returned.
   * Returns -1 if both of these fail.
   *
   * @todo pudupa: XhtmlLafRenderer.getResolvedSelectedIndex() is not a clear
   *   reusable code for 3.0, consolidate for code reuse at a later stage when
   *   the selection model (whether parent has this info or the children) is clear.
   */
  private static int _getResolvedSelectedIndex(
    UIXRenderingContext context,
    UINode parentNode)
  {
    int childCount = parentNode.getIndexedChildCount(context);
    int firstEnabledChildIndex = -1;
    for (int childIndex=0; childIndex<childCount; childIndex++)
    {
      UINode childNode = parentNode.getIndexedChild(context, childIndex);
      
      if (Boolean.TRUE.equals(
            childNode.getAttributeValue(context, DISCLOSED_ATTR)))
      {
        return childIndex;
      }
      if (firstEnabledChildIndex == -1  &&
          !Boolean.TRUE.equals(
              childNode.getAttributeValue(context, DISABLED_ATTR)))
      {
        firstEnabledChildIndex = childIndex;
      }
    }

    return firstEnabledChildIndex;
  }
}
File Line
org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java 398
org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java 424
        buff[buffIndex++] = (char)('0' + (i / 10000));
        i = i % 10000;
        buff[buffIndex++] = (char)('0' + (i / 1000));
        i = i % 1000;
        buff[buffIndex++] = (char)('0' + (i / 100));
        i = i % 100;
        buff[buffIndex++] = (char)('0' + (i / 10));
        i = i % 10;
        buff[buffIndex++] = (char)('0' + i);
      }
      else if (i > 1000)
File Line
org/apache/myfaces/trinidadinternal/uinode/UIXComponentUINode.java 217
org/apache/myfaces/trinidadinternal/uinode/UIXComponentUINode.java 278
  public void postrenderInternal(UIXRenderingContext context, UINode dataNode)
    throws IOException
  {
    Renderer renderer = null;

    try
    {
      renderer = getRenderer(context, dataNode);
    }
    catch( UndeclaredThrowableException e )
    {
      if (_LOG.isWarning())
        _LOG.warning(e.getMessage());
      return;
    }

    assert(renderer instanceof PreAndPostRenderer);

    // =-=AEW PUSH-POP-CATCH???
    if (renderer != null)
    {
      // See if we need to push/pop ourselves.  This should only
      // happen in two cases:
      //   - We're the root of the tree.
      //   - We're a private bean, and a Renderer called render() directly
      //     instead of using composite widgets.
      boolean pushAndPop = (context.getRenderedAncestorNode(0) != dataNode);
      if (pushAndPop)
      {
        context.pushChild(dataNode, null, -1);
        context.pushRenderedChild(context, dataNode);
      }

      try
      {
        ((PreAndPostRenderer) renderer).postrender(context, dataNode);
File Line
org/apache/myfaces/trinidadinternal/config/upload/UploadActionRequestWrapper.java 70
org/apache/myfaces/trinidadinternal/config/upload/UploadResourceRequest.java 78
      return;
    }
    
    _manager.setCharacterEncoding(encoding);
    _response.setRenderParameters(_manager.getParameterMap());

    // Let the UploadedFiles know, so it can fix up filenames
    UploadedFiles.setCharacterEncoding(this, encoding);
  }

  @Override
  public String getParameter(String param)
  {
    return _manager.getParameter(param);
  }

  @Override
  public Map<String, String[]> getParameterMap()
  {
    return _manager.getParameterMap();
  }

  @Override
  public Enumeration<String> getParameterNames()
  {
    return _manager.getParameterNames();
  }

  @Override
  public String[] getParameterValues(String param)
  {
    return _manager.getParameterValues(param);
  }

  private UploadRequestManager _manager;
  private ActionResponse _response;
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java 135
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java 159
    if ((returnValue instanceof Date) || fac.isConvertible(returnValue, Date.class))
    {
      FacesBean bean = getFacesBean(component);
      Converter converter = getConverter(component, bean);
      if (converter == null)
        converter = getDefaultConverter(context, component, bean);

      if (converter != null)
      {
        returnValue = converter.getAsString(context,
                                            component,
                                            returnValue);
      }
      else
      {
        returnValue = returnValue.toString();
      }

      event = new ReturnEvent(component,
                              returnValue,
                              event.getReturnParameters());
    }

    event.queue();
  }

  @Override
  protected void encodeAllAsElement(
    FacesContext     context,
    RenderingContext rc,
    UIComponent      component,
    FacesBean        bean
    ) throws IOException
  {

    if (!_dateScriptletsRegistered)
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ProcessUtils.java 85
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessUtils.java 247
    UIXCollection component,
    UIComponent    stamp,
    int            startIndex
  )
  {
    int i = startIndex - 1;
    while (i >= 0)
    {
      component.setRowIndex(i);
      boolean disabled = Boolean.TRUE.equals(
        stamp.getAttributes().get("disabled")); 
      boolean readOnly = Boolean.TRUE.equals(
        stamp.getAttributes().get("readOnly")); 
      boolean rendered = stamp.isRendered();

      // if this node is rendered and not disabled and not readOnly
      // then it can be used as the back button node.
      if (!disabled && !readOnly && rendered)    
      {
        component.setRowIndex(startIndex);
        return i;
      }
        
      i--;
    }
    
    component.setRowIndex(startIndex);
    return NO_INDEX;
  }


  public static int getNextIndex(
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java 112
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafConstants.java 493
  public static final String TABLE_BORDER_0001_STYLE =  "OraTableBorder0001";
  public static final String TABLE_BORDER_0010_STYLE =  "OraTableBorder0010";
  public static final String TABLE_BORDER_0011_STYLE =  "OraTableBorder0011";
  public static final String TABLE_BORDER_0100_STYLE =  "OraTableBorder0100";
  public static final String TABLE_BORDER_0101_STYLE =  "OraTableBorder0101";
  public static final String TABLE_BORDER_0110_STYLE =  "OraTableBorder0110";
  public static final String TABLE_BORDER_0111_STYLE =  "OraTableBorder0111";
  public static final String TABLE_BORDER_1000_STYLE =  "OraTableBorder1000";
  public static final String TABLE_BORDER_1001_STYLE =  "OraTableBorder1001";
  public static final String TABLE_BORDER_1010_STYLE =  "OraTableBorder1010";
  public static final String TABLE_BORDER_1011_STYLE =  "OraTableBorder1011";
  public static final String TABLE_BORDER_1100_STYLE =  "OraTableBorder1100";
  public static final String TABLE_BORDER_1101_STYLE =  "OraTableBorder1101";
  public static final String TABLE_BORDER_1110_STYLE =  "OraTableBorder1110";
  public static final String TABLE_BORDER_1111_STYLE =  "OraTableBorder1111";

  // HIDE SHOW STYLES
  public static final String HIDE_SHOW_DISCLOSED_SYMBOL_STYLE_CLASS =
File Line
org/apache/myfaces/trinidadinternal/agent/parse/CapabilitiesDocument.java 222
org/apache/myfaces/trinidadinternal/agent/parse/CapabilitiesDocument.java 264
    IncludeNode[] uriIncludes = dcNode.__getIncludesByUri();
    Object[][] uriCaps = null;
    if (uriIncludes != null)
    {
      uriCaps = new Object[uriIncludes.length][];
      for (int i = 0; i < uriIncludes.length; i++)
      {
        assert (uriIncludes[i].__getSrcUrl() != null);
        uriCaps[i] = _getCapabilities(uriIncludes[i].__getSrcUrl());
        assert (uriCaps[i] != null);
      }
    }

    return _mergeCaps(refCaps, uriCaps);
  }


  /**
   * get capabilties of node using a node refid
   */
  private Object[][] _getCapabilities(Agent agent,
                                      CapabilitiesNode[] capNodes,
File Line
org/apache/myfaces/trinidadinternal/image/laf/browser/ButtonPainter.java 85
org/apache/myfaces/trinidadinternal/image/laf/browser/CompositeButtonPainter.java 228
                    topHeight, bottomHeight);
  }

  public static Color getDefaultForeground(
    ImageContext context,
    boolean      disabled
    )
  {
    // First, try to get the color from the StyleMap
    String styleName = (disabled) ? _DISABLED_STYLE_NAME : _STYLE_NAME;
    Color color = BlafImageUtils.__getNamedForeground(context, styleName);

    // If we didn't get a color from the style, just use defaults
    if (color == null)
      color = (disabled) ? _DEFAULT_DISABLED_FOREGROUND : _DEFAULT_FOREGROUND;

    return color;
  }

  public static Color getDefaultBackground(
    ImageContext context,
    boolean     disabled
    )
  {
    // First, try to get the color from the StyleMap
    String styleName = (disabled) ? _DISABLED_STYLE_NAME : _STYLE_NAME;
    Color color = BlafImageUtils.__getNamedBackground(context, styleName);

    // If we didn't get a color from the style, just use defaults
    if (color == null)
      color = _DEFAULT_BACKGROUND;

    return color;
  }

  public static FontProxy getDefaultFont()
  {
    return _DEFAULT_FONT_PROXY;
  }
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TabBarRenderer.java 81
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/GlobalButtonBarRenderer.java 48
    super.prerender(context, node);
  }


  protected UIXHierarchy getHierarchyBase(
    UIXRenderingContext context,
    UINode           node
  )
  {
    return (UIXHierarchy) node.getUIComponent();
  }


  protected UINode getStamp(
    UIXRenderingContext context,
    UINode           node
    )
  {
    return node.getNamedChild(context, NODE_STAMP_CHILD);
  }


  protected boolean setNewPath(
    UIXRenderingContext context,
    UINode           node,
    UIXHierarchy    component
  )
  {
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);
    return ModelRendererUtils.setNewPath(component, startDepth,
                                         ((UIXNavigationLevel)component).getFocusRowKey());
  }

  @Override
  protected void renderContent(
    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {
File Line
org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java 125
org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java 263
              if (ch == '&' && !isBodyText && (i + 1 < length) && (text.charAt(i + 1) == '{'))
                buffIndex = _addToBuffer(out, buff, buffIndex, ch);
              else
              {
                // not weird & attribute case, so write the entity
                buffIndex = _addToBuffer(out, buff, buffIndex, entity);
              }
            }
          }
          else
          {            
            // low part of entities. Null entry means we have a carriage return or line feed
            String entity = entities[ch];
            
            if (entity != null)
            {
              buffIndex = _addToBuffer(out, buff, buffIndex, entity);
            }
            else
            {
              buffIndex = _flushBuffer(out, buff, buffIndex);
              
              // handle carriage return/line feed
              
              // write out a newline
              _println(out);
              
              // collapse combinations of carriage return/line feed or line feed/carriage return
              // together
              char checkChar = (char)((ch == 0xD) ? 0xA : 0xD);
  
              if ((i + 1 < length) && (text.charAt(i + 1) == checkChar))
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/MenuListRenderer.java 119
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/GlobalButtonBarRenderer.java 49
  }


  protected UIXHierarchy getHierarchyBase(
    UIXRenderingContext context,
    UINode           node
  )
  {
    return (UIXHierarchy) node.getUIComponent();
  }


  protected UINode getStamp(
    UIXRenderingContext context,
    UINode           node
    )
  {
    return node.getNamedChild(context, NODE_STAMP_CHILD);
  }


  protected boolean setNewPath(
    UIXRenderingContext context,
    UINode           node,
    UIXHierarchy    component
  )
  {
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);
    return ModelRendererUtils.setNewPath(component, startDepth,
                                         ((UIXNavigationLevel)component).getFocusRowKey());
  }

  @Override
  protected void renderContent(
    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {
File Line
org/apache/myfaces/trinidadinternal/validator/DateRestrictionValidator.java 52
org/apache/myfaces/trinidadinternal/validator/DateTimeRangeValidator.java 53
  }

  @Override
  public void validate(
    FacesContext context,
    UIComponent  component,
    Object       value) throws ValidatorException
  {
    if (value == null)
      return;
    
    if (!(value instanceof Date))
    {
      GenericConverterFactory fac = GenericConverterFactory.getCurrentInstance();
      value = fac.convert(value, Date.class);
    }
    super.validate(context, component, value);
  }
  
  
  public Collection<String> getClientImportNames()
  {
    return _IMPORT_NAMES;
  }

  public String getClientScript(
   FacesContext context,
   UIComponent component)
  {
    return null;
  }


  /**
   * @todo this should have not_in_range messages, not just max and min!
   * @todo Format these numbers properly.
   */
  public String getClientValidation(
    FacesContext context,
    UIComponent component)
  {
File Line
org/apache/myfaces/trinidadinternal/skin/parse/SkinAdditionParser.java 67
org/apache/myfaces/trinidadinternal/skin/parse/SkinMetadataParser.java 79
    if ((_bundleName != null) && (_translationSourceExpression != null))
    {
      _LOG.severe("BOTH_BUNDLENAME_TRANSLATIONSOURCE_SET");
      _translationSourceExpression = null;
    }

    if (_translationSourceExpression != null &&
        !(_translationSourceExpression.startsWith("#{") &&
        _translationSourceExpression.endsWith("}")))
    {
      _LOG.severe("TRANSLATION_SOURCE_NOT_EL");
      _translationSourceExpression = null;
    }

    Object isMetaInf = context.getProperty(SKIN_NAMESPACE, META_INF);

    if (isMetaInf != null && _styleSheetName != null
      && Boolean.parseBoolean(isMetaInf.toString()) && !(_styleSheetName.startsWith("/")))
      _styleSheetName = META_INF_DIR.concat(_styleSheetName);
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TreeRenderer.java 1088
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java 762
      writer.endElement(IMAGE_ELEMENT);
    }
  }





  // add a boolean flag to the chain of icons.
  // the chain is rendered before each icon
  private Boolean[] _appendIcon(
    Boolean[] prepend,
    Boolean isLine
    )
  {
    int currLength = prepend.length;

    if (prepend[currLength - 1] != null)
    {
      // resize, incrementing should be fine
      Boolean[] newBools = new Boolean[currLength +  _DEFAULT_TREE_INCREMENT];
      System.arraycopy(prepend, 0, newBools, 0, currLength);
      prepend = newBools;
    }

    for (int i = 0; i < currLength; i++)
    {
      if (prepend[i] == null)
      {
        prepend[i] = isLine;
        break;
      }
    }

    return prepend;
  }


  private void _prependIcons(
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TreeRenderer.java 101
org/apache/myfaces/trinidadinternal/renderkit/uix/TreeRenderer.java 68
    if (!component.getClientId(context).equals(source))
      return;

    TreeUtils.decodeExpandEvents(parameters, component, Collections.emptyList());
    String currencyStrParam = 
      source + NamingContainer.SEPARATOR_CHAR + SELECTED_PARAM;
    String currencyStr = parameters.get(currencyStrParam);
    if ((currencyStr != null) && (!"".equals(currencyStr)))
    {
      UIXTree tree = (UIXTree) component;
      Object oldPath = tree.getRowKey();
      tree.setClientRowKey(currencyStr);
      tree.getSelectedRowKeys().clear();
      tree.getSelectedRowKeys().add();
      tree.setRowKey(oldPath);
    }
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaNavigationPaneRenderer.java 203
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java 906
    writeInlineStyles(rw, toString(itemData.get("inlineStyle")),
      appendedStyle); // user's style + what we must have on top of it
    rw.writeAttribute("title", itemData.get("shortDesc"), null);
    StringBuilder itemStyleClass = new StringBuilder();
    String userStyleClass = toString(itemData.get("styleClass"));
    if (userStyleClass != null)
    {
      itemStyleClass.append(userStyleClass);
      itemStyleClass.append(" "); // more style classes are appended below
    }

    // Assign the event handlers:
    boolean isDisabled = getBooleanFromProperty(itemData.get("isDisabled"));
    boolean isActive = getBooleanFromProperty(itemData.get("isActive"));
    if (isActive)
    {
      if (isDisabled)
      {
File Line
org/apache/myfaces/trinidadinternal/io/HtmlResponseWriter.java 394
org/apache/myfaces/trinidadinternal/io/XhtmlResponseWriter.java 299
      XMLEscapes.writeText(_out, text, off, len);
    }
  }

  @Override
  public void write(char cbuf[], int off, int len) throws IOException
  {
    _closeStartIfNecessary();
    _out.write(cbuf, off, len);
  }

  @Override
  public void write(String str) throws IOException
  {
    _closeStartIfNecessary();
    _out.write(str);
  }

  @Override
  public void write(int c) throws IOException
  {
    _closeStartIfNecessary();
    _out.write((char) c);
  }


  @Override
  public ResponseWriter cloneWithWriter(Writer writer)
  {
    try
    {
      return new XhtmlResponseWriter(writer, getContentType(),
File Line
org/apache/myfaces/trinidadinternal/image/xml/parse/FontParser.java 179
org/apache/myfaces/trinidadinternal/style/util/CSSUtils.java 778
  }

  // Strips whitespace from start/end of the string
  private static String _stripWhitespace(String str)
  {
    if (str == null)
      return null;

    int length = str.length();
    int startIndex = 0;

    while (startIndex < length)
    {
      if (Character.isWhitespace(str.charAt(startIndex)))
        startIndex++;
      else
        break;
    }

    int endIndex = length;
    while (endIndex > 0)
    {
      if (Character.isWhitespace(str.charAt(endIndex - 1)))
        endIndex--;
      else
        break;
    }

    if ((startIndex == 0) && (endIndex == length))
      return str;
File Line
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java 2191
org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessUtils.java 140
    int bufferSize = _LINK_ON_CHANGE_FORM_START.length() +
                     form.length() +
                     34 +
                     encodedGotoEvent.length() +
                     encodedSource.length() +
                     encodedValue.length() +
                     encodedSize.length();

    if (partialTargets != null)
      bufferSize += (partialTargets.length() + 2);

    StringBuffer buffer = new StringBuffer(bufferSize);
    buffer.append(_LINK_ON_CHANGE_FORM_START);
    buffer.append(form);
    buffer.append("', '");
    buffer.append(encodedGotoEvent);
    buffer.append("', '");
    buffer.append(encodedSource);
    if (doValidate)
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/TreeRenderer.java 1005
org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java 664
    {
      tree.enterContainer();
      int childCount = tree.getRowCount();

      if (childCount > 0)
      {
        // prepare the prepended icons for the child nodes
        prepend = _appendIcon(prepend,
                              (isLastSibling)
                                ? Boolean.FALSE
                                : Boolean.TRUE);
        Boolean[] currClone;


        ++nodeDepth; // increment the depth of the child from the root

        int oldIndex = tree.getRowIndex();
        for (int i = 0; i < childCount; i++)
        {
          currClone = new Boolean[prepend.length];
          System.arraycopy(prepend, 0, currClone, 0, prepend.length);

          tree.setRowIndex(i);
          _renderNode(context,
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java 306
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java 369
  }

  @Override
  protected String getLaunchOnclick(
    FacesContext     context,
    RenderingContext rc,
    UIComponent      component,
    FacesBean        bean
    ) throws IOException
  {
    // If the field has an action, use the default behavior.  Or,
    // if the field doesn't support launching a window at all,
    // use the default behavior.
    if ((getActionExpression(component, bean) != null) ||
        !Boolean.TRUE.equals(
            rc.getAgent().getCapabilities().get(TrinidadAgent.CAP_MULTIPLE_WINDOWS)))
      return super.getLaunchOnclick(context, rc, component, bean);

    String id = rc.getCurrentClientId();
    if ((id == null) || (rc.getFormData() == null))
      return null;
File Line
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormElementRenderer.java 269
org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/GoLinkRenderer.java 198
  }

  protected String getOnblur(
    UIComponent component,
    FacesBean   bean)
  {
    if (_onblurKey == null)
      return null;

    return XhtmlUtils.getClientEventHandler(FacesContext.getCurrentInstance(), component,
             "blur", null, toString(bean.getProperty(_onblurKey)), null);
  }

  protected String getOnfocus(
    UIComponent component,
    FacesBean   bean)
  {
    if (_onfocusKey == null)
      return null;

    return XhtmlUtils.getClientEventHandler(FacesContext.getCurrentInstance(), component,
             "focus", null, toString(bean.getProperty(_onfocusKey)), null);
  }

  protected String getTargetFrame(
File Line
org/apache/myfaces/trinidadinternal/image/laf/browser/ButtonImageRenderer.java 215
org/apache/myfaces/trinidadinternal/image/laf/browser/CompositeButtonImageRenderer.java 249
    }

    @Override
    protected PaintContext getPaintContext()
    {
      return _context;
    }

    private Integer _getMnemonicIndex()
    {
      Object o = super.getPaintData(ImageConstants.ACCESS_KEY_KEY);
      if (!(o instanceof Character))
        return null;

      char c = ((Character)o).charValue();

      String text = (String)super.getPaintData(ImageConstants.TEXT_KEY);
      if (text == null)
        return null;

      int index = BlafImageUtils.__getMnemonicIndex(text, c);
      if (index < 0)
        return null;

      return index;
    }

    private PaintContext _context;