org.meshcms.core
Class ModuleDescriptor

java.lang.Object
  extended byorg.meshcms.core.ModuleDescriptor

public class ModuleDescriptor
extends java.lang.Object

Stores the description of a module when read from the page.


Field Summary
static java.lang.String ARGUMENT_ID
          Argument parameter.
static java.lang.String LOCATION_ID
          Location parameter.
static java.lang.String PARAMETERS_ID
          Advanced parameters.
static java.lang.String TEMPLATE_ID
          Template parameter.
static java.lang.String TITLE_ID
           
 
Constructor Summary
ModuleDescriptor()
          Creates a new empty instance.
ModuleDescriptor(java.lang.String data)
          Creates a new instance and calls init(java.lang.String).
 
Method Summary
 java.lang.String getAdvancedParam(java.lang.String paramName, java.lang.String defaultValue)
          Returns the value of the requested advanced parameter.
 java.util.Properties getAdvancedParams()
          Returns the advanced parameters as a Properties object.
 java.lang.String getArgument()
          Returns the name of the module argument.
 java.lang.String getCSSAttribute(java.lang.String paramName)
           
 java.lang.String getDateFormat()
          Returns the date format of the module.
 java.text.DateFormat getDateFormat(java.util.Locale locale, java.lang.String paramName)
          Returns format to be used to display the date.
 java.lang.String getFullCSSAttribute(java.lang.String paramName)
          Convenience method to get full HTML class attribute (e.g.
 java.lang.String getLocation()
          Returns the name of the module location.
 Path getModuleArgumentDirectoryPath(WebSite webSite, boolean allowCurrentPath)
          Returns the folder path to be used as argument for the module.
 Path getModuleArgumentPath(boolean allowCurrentPath)
          Returns the path passed as argument.
 Path getModuleDataPath(WebSite webSite)
           
 java.io.File[] getModuleFiles(WebSite webSite, boolean allowCurrentDir)
          Returns the files to be passed to the module.
 Path getModulePath()
          Returns the path of the module.
 Path getPagePath()
          Returns the path of the page that contains the module.
 java.lang.String getStyle()
          Returns the CSS style to be applied to the module.
 java.lang.String getTemplate()
          Returns the name of the module template.
 java.lang.String getTitle()
           
 void init(java.lang.String data)
          Parses the given String to get location, template and argument.
 boolean isValid()
          Checks if this module descriptor has been initialized correctly.
 void parseParameters(java.lang.String data)
          Parses the given string using the new format (version 3.0).
 void setAdvancedParam(java.lang.String paramName, java.lang.String value)
           
 void setAdvancedParams(java.util.Properties advancedParams)
          Sets the advanced parameters values.
 void setArgument(java.lang.String s)
          Sets the name of the module argument.
 void setDateFormat(java.lang.String dateFormat)
          Sets the date format of the module.
 void setLocation(java.lang.String location)
          Sets the name of the module location.
 void setModulePath(Path modulePath)
          Sets the path of the module.
 void setPagePath(Path pagePath)
          Sets the path of the page that contains the module.
 void setStyle(java.lang.String style)
          Sets the CSS style to be applied to the module.
 void setTemplate(java.lang.String template)
          Sets the name of the module template.
 void setTitle(java.lang.String title)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCATION_ID

public static final java.lang.String LOCATION_ID
Location parameter.

See Also:
Constant Field Values

ARGUMENT_ID

public static final java.lang.String ARGUMENT_ID
Argument parameter.

See Also:
Constant Field Values

TEMPLATE_ID

public static final java.lang.String TEMPLATE_ID
Template parameter.

See Also:
Constant Field Values

PARAMETERS_ID

public static final java.lang.String PARAMETERS_ID
Advanced parameters.

See Also:
Constant Field Values

TITLE_ID

public static final java.lang.String TITLE_ID
See Also:
Constant Field Values
Constructor Detail

ModuleDescriptor

public ModuleDescriptor()
Creates a new empty instance.


ModuleDescriptor

public ModuleDescriptor(java.lang.String data)
Creates a new instance and calls init(java.lang.String).

Method Detail

init

public void init(java.lang.String data)
Parses the given String to get location, template and argument.


parseParameters

public void parseParameters(java.lang.String data)
Parses the given string using the new format (version 3.0).


isValid

public boolean isValid()
Checks if this module descriptor has been initialized correctly. This is true if both location and template are not null.


getLocation

public java.lang.String getLocation()
Returns the name of the module location.

See Also:
setLocation(java.lang.String)

setLocation

public void setLocation(java.lang.String location)
Sets the name of the module location. Each in a page needs a location name which is unique within the page itself.


getTemplate

public java.lang.String getTemplate()
Returns the name of the module template.


setTemplate

public void setTemplate(java.lang.String template)
Sets the name of the module template.


getArgument

public java.lang.String getArgument()
Returns the name of the module argument.

See Also:
setArgument(String)

setArgument

public void setArgument(java.lang.String s)
Sets the name of the module argument. The argument is set to null if that String is equal to PageAssembler.EMPTY.


getAdvancedParams

public java.util.Properties getAdvancedParams()
Returns the advanced parameters as a Properties object.


getAdvancedParam

public java.lang.String getAdvancedParam(java.lang.String paramName,
                                         java.lang.String defaultValue)
Returns the value of the requested advanced parameter.


setAdvancedParam

public void setAdvancedParam(java.lang.String paramName,
                             java.lang.String value)

setAdvancedParams

public void setAdvancedParams(java.util.Properties advancedParams)
Sets the advanced parameters values.


getPagePath

public Path getPagePath()
Returns the path of the page that contains the module.


setPagePath

public void setPagePath(Path pagePath)
Sets the path of the page that contains the module.


getModulePath

public Path getModulePath()
Returns the path of the module.


getModuleDataPath

public Path getModuleDataPath(WebSite webSite)

setModulePath

public void setModulePath(Path modulePath)
Sets the path of the module.


getDateFormat

public java.lang.String getDateFormat()
Returns the date format of the module.


setDateFormat

public void setDateFormat(java.lang.String dateFormat)
Sets the date format of the module.


getStyle

public java.lang.String getStyle()
Returns the CSS style to be applied to the module.


setStyle

public void setStyle(java.lang.String style)
Sets the CSS style to be applied to the module.


getModuleFiles

public java.io.File[] getModuleFiles(WebSite webSite,
                                     boolean allowCurrentDir)
Returns the files to be passed to the module.

Parameters:
allowCurrentDir - if true and the argument parameter is null, the files included in the same folder of the page are returned

getModuleArgumentPath

public Path getModuleArgumentPath(boolean allowCurrentPath)
Returns the path passed as argument.

Parameters:
allowCurrentPath - if true and the argument parameter is null, the page path is returned

getModuleArgumentDirectoryPath

public Path getModuleArgumentDirectoryPath(WebSite webSite,
                                           boolean allowCurrentPath)
Returns the folder path to be used as argument for the module.

Parameters:
allowCurrentPath - if true and the argument parameter is null, the path of the page is returned

getFullCSSAttribute

public java.lang.String getFullCSSAttribute(java.lang.String paramName)
Convenience method to get full HTML class attribute (e.g. class="stylename". The value is searched in the given advanced parameter or, alternatively, in the value of the "style" tag attribute. If both are unavailable, an empty string is returned.


getCSSAttribute

public java.lang.String getCSSAttribute(java.lang.String paramName)

getDateFormat

public java.text.DateFormat getDateFormat(java.util.Locale locale,
                                          java.lang.String paramName)
Returns format to be used to display the date. The value is searched in the given advanced parameter or, alternatively, in the value of the "date" tag attribute. If both are unavailable, null is returned.


getTitle

public java.lang.String getTitle()

setTitle

public void setTitle(java.lang.String title)