public String createUniqueId(FacesContext context, String seed)
    {
        StringBuilder bld = null;
        
        // When prependId is set to false, it is necessary to append an unique
        // prefix to ensure the generated ids are unique, but that's only necessary
        // when no seed is provided. If a seed is provided, that one is already unique
        // for all the view, so the following logic is not necessary.
        if (!isPrependId() && seed==null )
        {
            bld = new StringBuilder();
            UniqueIdVendor parentUniqueIdVendor = _ComponentUtils.findParentUniqueIdVendor(this);
            if (parentUniqueIdVendor == null)
            {
                UIViewRoot viewRoot = context.getViewRoot();
                if (viewRoot != null)
                {
                    bld.append(viewRoot.createUniqueId());
                    bld.append('_');
                }
                else
                {
                    // The RI throws a NPE
                    String location = getComponentLocation(this);
                    throw new FacesException("Cannot create clientId. No id is assigned for component"
                            + " to create an id and UIViewRoot is not defined: "
                            + getPathToComponent(this)
                            + (location != null ? " created from: " + location : ""));
                }
            }
            else
            {
                bld.append(parentUniqueIdVendor.createUniqueId(context, null));
                bld.append('_');
            }
        }
        else
        {
            bld = _getSharedStringBuilder(context);
        }

        // Generate an identifier for a component. The identifier will be prefixed with
        // UNIQUE_ID_PREFIX, and will be unique within this UIViewRoot.
        if(seed==null)
        {
            Integer uniqueIdCounter = (Integer) getStateHelper().get(PropertyKeys.uniqueIdCounter);
            uniqueIdCounter = (uniqueIdCounter == null) ? 0 : uniqueIdCounter;
            getStateHelper().put(PropertyKeys.uniqueIdCounter, (uniqueIdCounter+1));
            return bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(uniqueIdCounter).toString();    
        }
        // Optionally, a unique seed value can be supplied by component creators
        // which should be included in the generated unique id.
        else
        {
            return bld.append(UIViewRoot.UNIQUE_ID_PREFIX).append(seed).toString();
        }
    }
public String createUniqueId ( FacesContext context , String seed ) { StringBuilder bld = null ; if ( ! isPrependId ( ) && seed == null ) { bld = new StringBuilder ( ) ; UniqueIdVendor parentUniqueIdVendor = _ComponentUtils . findParentUniqueIdVendor ( this ) ; if ( parentUniqueIdVendor == null ) { UIViewRoot viewRoot = context . getViewRoot ( ) ; if ( viewRoot != null ) { bld . append ( viewRoot . createUniqueId ( ) ) ; bld . append ( '_' ) ; } else { String location = getComponentLocation ( this ) ; throw new FacesException ( "Cannot create clientId. No id is assigned for component" + " to create an id and UIViewRoot is not defined: " + getPathToComponent ( this ) + ( location != null ? " created from: " + location : "" ) ) ; } } else { bld . append ( parentUniqueIdVendor . createUniqueId ( context , null ) ) ; bld . append ( '_' ) ; } } else { bld = _getSharedStringBuilder ( context ) ; } if ( seed == null ) { Integer uniqueIdCounter = ( Integer ) getStateHelper ( ) . get ( PropertyKeys . uniqueIdCounter ) ; uniqueIdCounter = ( uniqueIdCounter == null ) ? 0 : uniqueIdCounter ; getStateHelper ( ) . put ( PropertyKeys . uniqueIdCounter , ( uniqueIdCounter + 1 ) ) ; return bld . append ( UIViewRoot . UNIQUE_ID_PREFIX ) . append ( uniqueIdCounter ) . toString ( ) ; } else { return bld . append ( UIViewRoot . UNIQUE_ID_PREFIX ) . append ( seed ) . toString ( ) ; } }
{@inheritDoc}

@since 2.0