org.apache.struts.tiles
クラス ComponentDefinition

java.lang.Object
  拡張org.apache.struts.tiles.ComponentDefinition
すべての実装インタフェース:
java.io.Serializable
直系の既知のサブクラス:
XmlDefinition

public class ComponentDefinition
extends java.lang.Object
implements java.io.Serializable

Definition of a template / component attributes. Attributes of a component can be defined with the help of this class. An instance of this class can be used as a bean, and passed to 'insert' tag.

関連項目:
直列化された形式

フィールドの概要
static java.lang.String ACTION
          Controller name type.
protected  java.util.Map attributes
          Attributes defined for the component.
protected  java.lang.String controller
          Associated Controller URL or classname, if defined
static java.lang.String CONTROLLER
          Controller name type.
private  Controller controllerInstance
          Controller associated to Definition.
protected  java.lang.String controllerType
          Associated Controller typename, if controllerName defined.
protected static org.apache.commons.logging.Log log
          Commons Logging instance.
protected  java.lang.String name
          Definition name
protected  java.lang.String path
          Component / template path (URL).
protected  java.lang.String role
          Role associated to definition.
static java.lang.String URL
          Controller name type.
 
コンストラクタの概要
ComponentDefinition()
          Constructor.
ComponentDefinition(ComponentDefinition definition)
          Copy Constructor.
ComponentDefinition(java.lang.String name, java.lang.String path, java.util.Map attributes)
          Constructor.
ComponentDefinition(XmlDefinition definition)
          Constructor.
 
メソッドの概要
static Controller createController(java.lang.String name, java.lang.String controllerType)
          Create a new instance of controller named in parameter.
static Controller createControllerFromClassname(java.lang.String classname)
          Create a controller from specified classname
 java.lang.Object getAttribute(java.lang.String key)
          Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
 java.util.Map getAttributes()
          Access method for the attributes property.
 java.lang.String getController()
          Get associated controller local URL.
 Controller getControllerInstance()
          Get controller instance.
 java.lang.String getControllerType()
          Get associated controller type.
 java.lang.String getName()
          Access method for the name property.
 Controller getOrCreateController()
          Get or create controller.
 java.lang.String getPage()
          Access method for the path property.
 java.lang.String getPath()
          Access method for the path property.
 java.lang.String getRole()
          Access method for the role property.
 java.lang.String getTemplate()
          Access method for the template property.
 void put(java.lang.String name, java.lang.Object content)
          Put an attribute in component / template definition.
 void put(java.lang.String name, java.lang.Object content, boolean direct)
          Put an attribute in template definition.
 void put(java.lang.String name, java.lang.Object content, boolean direct, java.lang.String role)
          Put an attribute in template definition.
 void put(java.lang.String name, java.lang.Object content, java.lang.String type, java.lang.String role)
          Put an attribute in template definition.
 void putAttribute(java.lang.String key, java.lang.Object value)
          Put a new attribute in this component
 void setController(java.lang.String url)
          Set associated controller URL.
 void setControllerClass(java.lang.String controller)
          Set associated controller name as a classtype, and controller type as "classname".
 void setControllerInstance(Controller controller)
          Set controller.
 void setControllerType(java.lang.String controllerType)
          Set associated controller type.
 void setControllerUrl(java.lang.String controller)
          Set associated controller name as an url, and controller type as "url".
 void setName(java.lang.String aName)
          Sets the value of the name property.
 void setPage(java.lang.String page)
          Sets the value of the path property.
 void setPath(java.lang.String aPath)
          Sets the value of the path property.
 void setRole(java.lang.String role)
          Sets the value of the role property.
 void setTemplate(java.lang.String template)
          Sets the value of the template property.
 java.lang.String toString()
          Returns a description of the attributes.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

log

protected static org.apache.commons.logging.Log log
Commons Logging instance.


name

protected java.lang.String name
Definition name


path

protected java.lang.String path
Component / template path (URL).


attributes

protected java.util.Map attributes
Attributes defined for the component.


role

protected java.lang.String role
Role associated to definition.


controller

protected java.lang.String controller
Associated Controller URL or classname, if defined


controllerType

protected java.lang.String controllerType
Associated Controller typename, if controllerName defined. Can be CONTROLLER, ACTION or URL, or null.


URL

public static final java.lang.String URL
Controller name type.

関連項目:
定数フィールド値

CONTROLLER

public static final java.lang.String CONTROLLER
Controller name type.

関連項目:
定数フィールド値

ACTION

public static final java.lang.String ACTION
Controller name type.

関連項目:
定数フィールド値

controllerInstance

private Controller controllerInstance
Controller associated to Definition. Lazy creation : only on first request

コンストラクタの詳細

ComponentDefinition

public ComponentDefinition()
Constructor.


ComponentDefinition

public ComponentDefinition(ComponentDefinition definition)
Copy Constructor. Create a new definition initialized with parent definition. Do a shallow copy : attributes are shared between copies, but not the Map containing attributes.


ComponentDefinition

public ComponentDefinition(XmlDefinition definition)
Constructor. Create a new definition initialized from a RawDefinition. Raw definitions are used to read definition from a data source (xml file, db, ...). A RawDefinition mainly contains properties of type String, while Definition contains more complex type (ex : Controller). Do a shallow copy : attributes are shared between objects, but not the Map containing attributes. OO Design issues : Actually RawDefinition (XmlDefinition) extends ComponentDefinition. This must not be the case. I have do it because I am lazy.

例外:
java.lang.InstantiationException - if an error occur while instanciating Controller : (classname can't be instanciated, Illegal access with instanciated class, Error while instanciating class, classname can't be instanciated.

ComponentDefinition

public ComponentDefinition(java.lang.String name,
                           java.lang.String path,
                           java.util.Map attributes)
Constructor.

メソッドの詳細

getName

public java.lang.String getName()
Access method for the name property.

戻り値:
the current value of the name property

setName

public void setName(java.lang.String aName)
Sets the value of the name property.

パラメータ:
aName - the new value of the name property

getPage

public java.lang.String getPage()
Access method for the path property.

戻り値:
The current value of the path property.

setPage

public void setPage(java.lang.String page)
Sets the value of the path property.

パラメータ:
page - the new value of the path property

getPath

public java.lang.String getPath()
Access method for the path property.

戻り値:
the current value of the path property

setPath

public void setPath(java.lang.String aPath)
Sets the value of the path property.

パラメータ:
aPath - the new value of the path property

getTemplate

public java.lang.String getTemplate()
Access method for the template property. Same as getPath()

戻り値:
the current value of the template property

setTemplate

public void setTemplate(java.lang.String template)
Sets the value of the template property. Same as setPath()

パラメータ:
template - the new value of the path property

getRole

public java.lang.String getRole()
Access method for the role property.

戻り値:
the current value of the role property

setRole

public void setRole(java.lang.String role)
Sets the value of the role property.

パラメータ:
role - the new value of the path property

getAttributes

public java.util.Map getAttributes()
Access method for the attributes property. If there is no attributes, return an empty map.

戻り値:
the current value of the attributes property

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.

戻り値:
requested attribute or null if not found

putAttribute

public void putAttribute(java.lang.String key,
                         java.lang.Object value)
Put a new attribute in this component

パラメータ:
key - String key for attribute
value - Attibute value.

put

public void put(java.lang.String name,
                java.lang.Object content)
Put an attribute in component / template definition. Attribute can be used as content for tag get.

パラメータ:
name - Attribute name
content - Attribute value

put

public void put(java.lang.String name,
                java.lang.Object content,
                boolean direct)
Put an attribute in template definition. Attribute can be used as content for tag get.

パラメータ:
name - Attribute name
content - Attribute value ?ソス
direct - Determines how content is handled by get tag: true means content is printed directly; false, the default, means content is included

put

public void put(java.lang.String name,
                java.lang.Object content,
                boolean direct,
                java.lang.String role)
Put an attribute in template definition. Attribute can be used as content for tag get.

パラメータ:
name - Attribute name
content - Attribute value
direct - Determines how content is handled by get tag: true means content is printed directly; false, the default, means content is included
role - Determine if content is used by get tag. If user is in role, content is used.

put

public void put(java.lang.String name,
                java.lang.Object content,
                java.lang.String type,
                java.lang.String role)
Put an attribute in template definition. Attribute can be used as content for tag get.

パラメータ:
name - Attribute name
content - Attribute value
type - attribute type: template, string, definition
role - Determine if content is used by get tag. If user is in role, content is used.

toString

public java.lang.String toString()
Returns a description of the attributes.


getControllerType

public java.lang.String getControllerType()
Get associated controller type. Type denote a fully qualified classname.


setControllerType

public void setControllerType(java.lang.String controllerType)
Set associated controller type. Type denote a fully qualified classname.

パラメータ:
controllerType - Typeof associated controller

setControllerUrl

public void setControllerUrl(java.lang.String controller)
Set associated controller name as an url, and controller type as "url". Name must be an url (not checked). Convenience method.

パラメータ:
controller - Controller url

setControllerClass

public void setControllerClass(java.lang.String controller)
Set associated controller name as a classtype, and controller type as "classname". Name denote a fully qualified classname Convenience method.

パラメータ:
controller - Controller classname.

getController

public java.lang.String getController()
Get associated controller local URL. URL should be local to webcontainer in order to allow request context followup. URL comes as a string.


setController

public void setController(java.lang.String url)
Set associated controller URL. URL should be local to webcontainer in order to allow request context followup. URL is specified as a string.

パラメータ:
url - Url called locally

getControllerInstance

public Controller getControllerInstance()
Get controller instance.

戻り値:
controller instance.

getOrCreateController

public Controller getOrCreateController()
                                 throws java.lang.InstantiationException
Get or create controller. Get controller, create it if necessary.

戻り値:
controller if controller or controllerType is set, null otherwise.
例外:
java.lang.InstantiationException - if an error occur while instanciating Controller : (classname can't be instanciated, Illegal access with instanciated class, Error while instanciating class, classname can't be instanciated.

setControllerInstance

public void setControllerInstance(Controller controller)
Set controller.


createController

public static Controller createController(java.lang.String name,
                                          java.lang.String controllerType)
                                   throws java.lang.InstantiationException
Create a new instance of controller named in parameter. If controllerType is specified, create controller accordingly. Otherwise, if name denote a classname, create an instance of it. If class is subclass of org.apache.struts.action.Action, wrap controller appropriately. Otherwise, consider name as an url.

パラメータ:
name - Controller name (classname, url, ...)
controllerType - Expected Controller type
戻り値:
org.apache.struts.tiles.Controller
例外:
java.lang.InstantiationException - if an error occur while instanciating Controller : (classname can't be instanciated, Illegal access with instanciated class, Error while instanciating class, classname can't be instanciated.

createControllerFromClassname

public static Controller createControllerFromClassname(java.lang.String classname)
                                                throws java.lang.InstantiationException
Create a controller from specified classname

パラメータ:
classname - Controller classname.
戻り値:
org.apache.struts.tiles.Controller
例外:
java.lang.InstantiationException - if an error occur while instanciating Controller : (classname can't be instanciated, Illegal access with instanciated class, Error while instanciating class, classname can't be instanciated.


このドキュメントは、Ja-Jakartaにより訳されました。コメントがある場合は、report@jajakarta.orgまでお願いします。
Copyright (C) 2000-2004 - Apache Software Foundation