== Specifying Component Metadata ==

There are two formats that you can use to specify component metadata.  Both approaches will require that related classes (super classes, property classes, imports, and other dependencies) be compiled and in the class path.  The code generator needs to reflect on these classes to fill in information about your component.

In the following table, all constants are of class ^String^ unless otherwise noted.
<div class="simple_table">
{|
| &#160; |class="row_label" 
! Constant !! XPath !! Default Value !
|-
! Class Name !class="row_label"
| CLASS_NAME || /component/@className || '''''required''''' |
|-
! Package !class="row_label"
| PACKAGE || /component/@package || '''''required''''' |
|-
! Component Type !class="row_label"
| COMPONENT_TYPE || /component/@type || '''''required''''' |
|-
! Component Family !class="row_label"
| COMPONENT_FAMILY || /component/@family || '''''required''''' |
|-
! Default Renderer Type !class="row_label"
| DEFAULT_RENDERER_TYPE || /component/@rendererType || '''''required''''' |
|-
! Component Super Class !class="row_label"
| SUPER_CLASS <br/> (^Class&lt;? extends UIComponent&gt;^) || /component/@superClass || ^UIComponentBase^ |
|-
! Is component abstract? !class="row_label"
| ABSTRACT (^boolean^) || /component/@abstract || ''false'' |
|-
! Implemented Interfaces !class="row_label"
| IMPLEMENTS (^Class[]^) || /component/interface || '''none''' |
|-
! Required Imports !class="row_label"
| IMPORTS (^Class[]^) || /component/import || see [#imports imports] below|
|-
! Extra Constants !class="row_label"
| Non-Reserved String Constants are passed through. || /component/constant || '''none''' |
|-
! Extra Properties !class="row_label"
| Any constants of type ^PropertyInfo^ || /component/property || '''none''' (See [[HtmlRenderer]]) |
|-
! Renderer Package !class="row_label"
| RENDERER_PACKAGE || /component/renderer/@package || The component's package |
|-
! Renderer Class Name !class="row_label"
| RENDERER_CLASS_NAME || /component/renderer/@className || 'Html' + Component's class name + 'Renderer' |
|-
! Is renderer abstract? !class="row_label"
| RENDERER_ABSTRACT (^boolean^) || /component/renderer/@abstract || ''false'' |
|-
! [[HtmlRender]] template !class="row_label"
| TEMPLATE || /component/renderer/@template || '''''required''''' |
|-
! Head Template !class="row_label"
| HEAD_TEMPLATE || /component/renderer/@headTemplate || '-head' appended to the name part of template. e.g. 'MyComponent-head.xhtml' |
|-
! Template encoding !class="row_label"
| TEMPLATE_ENCODING || /component/@templateEncoding || UTF-8 |
|-
! Resources (Scripts &amp; CSS) !class="row_label"
| INCLUDES (^ResourceInfo[]^) || /component/renderer/resource || '''none''' (see [[RequiresResources]]) |
|-
! Renderer Interfaces !class="row_label"
| RENDERER_IMPLEMENTS (^Class[]^) || /component/renderer/interface || '''none''' (Always implements [[RequiresResources]]) |
|-
! Render-Only Attributes !class="row_label"
| RENDER_ATTRIBS (^String[]^) || /component/renderer/attribute || '''none''' (See [[HtmlRenderer]]) |
|-
! faces-config.xml to update !class="row_label"
| FACES_CONFIG || /component/config/@facesConfig || '''none''' |
|-
! Taglib.xml to update !class="row_label"
| TAGLIB_XML || /component/config/@taglibXml || '''none''' |
|-
! .tld file to update !class="row_label"
| TLD || /component/config/@tldFile || '''none''' |
|-
! Class to register in config files. !class="row_label"
| REGISTER_CLASS || /component/config/@registerClass || The generated component class. (See [[ConfigurationUpdater]]) |
|-
! Class to register as the renderer. !class="row_label"
| REGISTER_RENDERER || /component/config/@registerRenderer || The generated renderer class. (See [[ConfigurationUpdater]]) |
|-
! TLD Short Name !class="row_label"
| SHORT_NAME  || /component/config/@libraryShortName || the second part of the component package name |
|-
! Namespace/URI !class="row_label"
| NAMESPACE || /component/config/@namespace || 1st 3 parts of the package name reversed (as the domain name) + '/components' |
|-
! Tag name !class="row_label"
| TAG_NAME || /component/config/@tagName || Component class name, 1st letter to lowercase. |
|-
! Tag Super Class !class="row_label"
| TAG_SUPER <br/>(^Class&lt;? extends UIComponentELTag&gt;^) || /component/tag/@superClass ||  '''Must''' be a ''subclass'' of ^UIComponentELTag^. Use ^com.jsftoolkit.base.TagBase^ if you don't want to add anything. |
|}
</div>

==== Imports ====

By default, the super class, any implemented interfaces, and specified properties' classes are all imported (unless they are in the same package as the generated class).  Other imports only need to be specified for user specified code strings. e.g. if you specify a property's default value to be something like ^"new MyClass()"^, then you will need to import ^MyClass^.

=== Class of Constants ===

The advantage of the class of constants approach is that you can utilize inheritance and refactoring tools to make the metadata more maintainable.

=== XML File ===

The XML file DTD is:
<<

<!ELEMENT component ((import|interface|constant|property)*,renderer?,config?,tag?)>
<!ATTLIST component 
	package CDATA #REQUIRED
	className CDATA #REQUIRED
	family CDATA #REQUIRED
	type CDATA #REQUIRED	
	rendererType CDATA #REQUIRED	
	superClass CDATA #IMPLIED	
	abstract (true|false) "false"
>
<!-- Names a Java import   -->
<!ELEMENT import (#PCDATA) > 
<!-- Names a Java interfaces   -->
<!ELEMENT interface (#PCDATA) > 
<!-- Describes a public class constant -->
<!ELEMENT constant EMPTY > 
<!-- All constants are String constants. All of the core constants
 are defined automatically. e.g. COMPONENT_FAMILY -->
<!ATTLIST constant
	name CDATA #REQUIRED
	value CDATA #REQUIRED
>
<!-- A property without a type (class) specified indicates a property that is a member of
 a super class. e.g. value on a class that extends UIOutput. -->
<!ELEMENT property EMPTY > 
<!ATTLIST property
	type CDATA #IMPLIED
	name CDATA #REQUIRED
	defaultValue CDATA #IMPLIED
	required (true|false) "false"
>
<!ELEMENT renderer (resource|interface|attribute)* >
<!ATTLIST renderer
	package CDATA #IMPLIED
	className CDATA #IMPLIED
	abstract (true|false) "false"
	template CDATA #REQUIRED
	headTemplate CDATA #IMPLIED
	templateEncoding CDATA "UTF-8"
>
<!ELEMENT resource EMPTY >
<!ATTLIST resource
	id ID #REQUIRED
	defaultResource CDATA #REQUIRED
	encoding CDATA "UTF-8"
	filter CDATA #IMPLIED
	type (style|script) "style"
>
<!ELEMENT attribute (#PCDATA) >
<!ELEMENT config EMPTY >
<!ATTLIST config
	facesConfig CDATA #IMPLIED
    taglibXml CDATA #IMPLIED
    tldFile CDATA #IMPLIED
	registerClass CDATA #IMPLIED    
	registerRenderer CDATA #IMPLIED
    tagName CDATA #IMPLIED
    namespace CDATA #IMPLIED
    libraryShortName CDATA #IMPLIED
>
<!ELEMENT tag (import|interface)>
<!ATTLIST tag
	package CDATA #IMPLIED
	className CDATA #IMPLIED
	abstract (true|false) "false"
	superClass CDATA #IMPLIED
>

>>
