Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  // Copyright 2004, 2005 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
 package org.apache.tapestry.spec;
 
 import  org.apache.hivemind.Locatable;
 import  org.apache.hivemind.LocationHolder;
 import  org.apache.hivemind.Resource;
 
 import java.util.List;
 import java.util.Set;

A specification for a component, as read from an XML specification file.

A specification consists of

  • An implementing class
  • An optional template
  • An optional description
  • A set of contained components
  • Bindings for the properties of each contained component
  • A set of named assets
  • Definitions for helper beans
  • Any reserved names (used for HTML attributes)

From this information, an actual component may be instantiated and initialized. Instantiating a component is usually a recursive process, since to initialize a container component, it is necessary to instantiate and initialize its contained components as well.

Author(s):
glongman@intelligentworks.com
See also:
org.apache.tapestry.IComponent
IContainedComponent
IComponentSpecification
org.apache.tapestry.engine.IPageLoader
 
 public interface IComponentSpecification extends IPropertyHolder,
         LocationHolder, Locatable, IEventListener
 {

    

Throws:
IllegalArgumentException if the name already exists.
 
     void addAsset(String nameIAssetSpecification asset);

    

Throws:
IllegalArgumentException if the id is already defined.
 
     void addComponent(String idIContainedComponent component);

    
Adds the parameter. The parameter name and aliases are added as a reserved name. The code assumes that the parameter specification will not be subsequently changed.

Throws:
IllegalArgumentException if the name already exists.
 
     void addParameter(IParameterSpecification spec);

    
Returns true if the component is allowed to wrap other elements (static HTML or other components). The default is true.

See also:
setAllowBody(boolean)
 
     boolean getAllowBody();

    
Returns true if the component allows informal parameters (parameters not formally defined). Informal parameters are generally used to create additional HTML attributes for an HTML tag rendered by the component. This is often used to specify JavaScript event handlers or the class of the component (for Cascarding Style Sheets).

The default value is true.

See also:
setAllowInformalParameters(boolean)
 
     boolean getAllowInformalParameters();

    
Returns the IAssetSpecificationwith the given name, or null if no such specification exists.

See also:
addAsset(String,IAssetSpecification)
    IAssetSpecification getAsset(String name);

    
Returns a List of the String names of all assets, in alphabetical order.
    List getAssetNames();

    
Returns the specification of a contained component with the given id, or null if no such contained component exists.

See also:
addComponent(String, IContainedComponent)
Returns the class name to be used when instantiating the component, or null if no class name was provided in the specification (in which case, a system of defaults will be used to determine the class name).
    String getComponentClassName();

    
Returns an List of the String names of the IContainedComponents for this component.

See also:
addComponent(String, IContainedComponent)
    List getComponentIds();

    
Returns the specification of a parameter with the given name, or null if no such parameter exists.

See also:
addParameter(IParameterSpecification)
Returns an unordered collection of IParameterSpecification, for all parameters that are required. This includes only "real" parameters, not aliases.

Since:
4.0
Returns a List of of String names of all parameters. This list is in alphabetical order.

See also:
addParameter(IParameterSpecification)
    void setAllowBody(boolean value);
    void setAllowInformalParameters(boolean value);
    void setComponentClassName(String value);

    

Throws:
IllegalArgumentException if the bean already has a specification.
Since:
1.0.4
    void addBeanSpecification(String nameIBeanSpecification specification);

    
Returns the IBeanSpecificationfor the given name, or null if not such specification exists.

Since:
1.0.4
Returns an unmodifiable collection of the names of all beans.
    Collection getBeanNames();

    
Adds the value as a reserved name. Reserved names are not allowed as the names of informal parameters. Since the comparison is caseless, the value is converted to lowercase before being stored.

Since:
1.0.5
    void addReservedParameterName(String value);

    
Returns true if the value specified is in the reserved name list. The comparison is caseless. All formal parameters are automatically in the reserved name list, as well as any additional reserved names specified in the component specification. The latter refer to HTML attributes generated directly by the component.

Since:
1.0.5
    boolean isReservedParameterName(String value);

    
Returns the documentation for this component.

Since:
1.0.9
    String getDescription();

    
Sets the documentation for this component.

Since:
1.0.9
    void setDescription(String description);

    
Returns the XML Public Id for the specification file, or null if not applicable.

This method exists as a convienience for the Spindle plugin. A previous method used an arbitrary version string, the public id is more useful and less ambiguous.

Since:
2.2
    String getPublicId();

    

Since:
2.2 *
    void setPublicId(String publicId);

    
Returns true if the specification is known to be a page specification and not a component specification. Earlier versions of the framework did not distinguish between the two, but starting in 2.2, there are seperate XML entities for pages and components. Pages omit several attributes and entities related to parameters, as parameters only make sense for components.

Since:
2.2
    boolean isPageSpecification();

    

Since:
2.2 *
    void setPageSpecification(boolean pageSpecification);

    

Since:
3.0 *
    Resource getSpecificationLocation();

    

Since:
3.0 *
    void setSpecificationLocation(Resource specificationLocation);

    
Adds a new property specification. The name of the property must not already be defined (and must not change after being added).

Since:
3.0
Returns a sorted, immutable list of the names of all org.apache.tapestry.spec.IPropertySpecifications.

Since:
3.0
Returns the named org.apache.tapestry.spec.IPropertySpecification, or null if no such specification exist.

Since:
3.0
See also:
addPropertySpecification(IPropertySpecification)
Adds a InjectSpecification.

Since:
4.0
    void addInjectSpecification(InjectSpecification spec);

    
Returns the list of InjectSpecification. Will return an empty list if no specifications have been added.

Since:
4.0
    List getInjectSpecifications();

    
Returns true if the component is deprecated. Deprecated components generate a warning when used.

Since:
4.0
    boolean isDeprecated();

    

Since:
4.0
    void setDeprecated(boolean deprecated);

    
Returns a Set of Strings; the reserved parameter names for the component. This combines explicit reserved names with formal parameter names. Each parameter name in the Set will be all lower case (to facilitate a caseless comparison).

Since:
4.0
Returns:
an unmodifiable set (of String), possibly empty
New to GrepCode? Check out our FAQ X