org.codehaus.groovy.grails.web.pages
Class TagLibraryLookup

java.lang.Object
  extended by org.codehaus.groovy.grails.web.pages.TagLibraryLookup
All Implemented Interfaces:
org.codehaus.groovy.grails.plugins.support.aware.GrailsApplicationAware, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class TagLibraryLookup
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware, org.codehaus.groovy.grails.plugins.support.aware.GrailsApplicationAware, org.springframework.beans.factory.InitializingBean

Looks up tag library instances.

Since:
1.1

Field Summary
protected  org.springframework.context.ApplicationContext applicationContext
           
protected  org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication
           
protected  java.util.Map<java.lang.String,org.codehaus.groovy.grails.web.taglib.NamespacedTagDispatcher> namespaceDispatchers
           
protected  java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> tagNamespaces
           
protected  java.util.Map<java.lang.String,java.util.Set<java.lang.String>> tagsThatReturnObjectForNamespace
           
 
Constructor Summary
TagLibraryLookup()
           
 
Method Summary
 void afterPropertiesSet()
           
 boolean doesTagReturnObject(java.lang.String namespace, java.lang.String tagName)
           
 java.util.Set<java.lang.String> getAvailableNamespaces()
           
 boolean hasNamespace(java.lang.String namespace)
          Returns whether the given namespace is in use
 org.codehaus.groovy.grails.web.taglib.NamespacedTagDispatcher lookupNamespaceDispatcher(java.lang.String namespace)
          Looks up a namespace dispatcher for the given namespace
 groovy.lang.GroovyObject lookupTagLibrary(java.lang.String namespace, java.lang.String tagName)
          Looks up a tag library for the given namespace and tag name.
protected  void putTagLib(java.util.Map<java.lang.String,java.lang.Object> tags, java.lang.String name, org.codehaus.groovy.grails.commons.GrailsTagLibClass taglib)
           
 void registerTagLib(org.codehaus.groovy.grails.commons.GrailsTagLibClass taglib)
          Registers a tag library for lookup.
protected  void registerTagLibraries()
           
protected  void registerTemplateNamespace()
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setGrailsApplication(org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applicationContext

protected org.springframework.context.ApplicationContext applicationContext

grailsApplication

protected org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication

tagNamespaces

protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> tagNamespaces

namespaceDispatchers

protected java.util.Map<java.lang.String,org.codehaus.groovy.grails.web.taglib.NamespacedTagDispatcher> namespaceDispatchers

tagsThatReturnObjectForNamespace

protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> tagsThatReturnObjectForNamespace
Constructor Detail

TagLibraryLookup

public TagLibraryLookup()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

setGrailsApplication

public void setGrailsApplication(org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication)
Specified by:
setGrailsApplication in interface org.codehaus.groovy.grails.plugins.support.aware.GrailsApplicationAware

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

registerTagLibraries

protected void registerTagLibraries()

registerTemplateNamespace

protected void registerTemplateNamespace()

registerTagLib

public void registerTagLib(org.codehaus.groovy.grails.commons.GrailsTagLibClass taglib)
Registers a tag library for lookup. Each of the tags in the library is mapped by namespace:name to the taglib bean. If the taglib has already been registered, this method will override the existing information and update the tags to use the new version.

Parameters:
taglib - The taglib descriptor class.

putTagLib

protected void putTagLib(java.util.Map<java.lang.String,java.lang.Object> tags,
                         java.lang.String name,
                         org.codehaus.groovy.grails.commons.GrailsTagLibClass taglib)

lookupTagLibrary

public groovy.lang.GroovyObject lookupTagLibrary(java.lang.String namespace,
                                                 java.lang.String tagName)
Looks up a tag library for the given namespace and tag name.

Parameters:
namespace - The tag library namespace
tagName - The tag name
Returns:
The tag library or null if it wasn't found

doesTagReturnObject

public boolean doesTagReturnObject(java.lang.String namespace,
                                   java.lang.String tagName)

lookupNamespaceDispatcher

public org.codehaus.groovy.grails.web.taglib.NamespacedTagDispatcher lookupNamespaceDispatcher(java.lang.String namespace)
Looks up a namespace dispatcher for the given namespace

Parameters:
namespace - The namespace
Returns:
The NamespacedTagDispatcher

hasNamespace

public boolean hasNamespace(java.lang.String namespace)
Returns whether the given namespace is in use

Parameters:
namespace - The namespace
Returns:
True if it is in use

getAvailableNamespaces

public java.util.Set<java.lang.String> getAvailableNamespaces()
Returns:
The namespaces available