org.opencms.frontend.templateone
Class CmsTemplateStyleSheet

java.lang.Object
  extended by org.opencms.jsp.CmsJspBean
      extended by org.opencms.jsp.CmsJspActionElement
          extended by org.opencms.frontend.templateone.CmsTemplateBase
              extended by org.opencms.frontend.templateone.CmsTemplateStyleSheet

public class CmsTemplateStyleSheet
extends CmsTemplateBase

Provides methods to build the dynamic CSS style sheet of template one.

Since:
6.0.0

Field Summary
static java.lang.String FILENAME_CONFIGFILE
          Default file name of the CSS configuration file.
static java.lang.String NODE_OPTIONALCONFIG
          Node name of the optional configuration nodes.
static java.lang.String PARAM_CONFIGFILE
          Request parameter name providing the configuration file URI.
static java.lang.String PROPERTY_CONFIGFILE
          Name of the property key to set the path to the configuration file.
 
Fields inherited from class org.opencms.frontend.templateone.CmsTemplateBase
ATTRIBUTE_ORIGINAL_URI
 
Fields inherited from class org.opencms.jsp.CmsJspActionElement
NOT_INITIALIZED
 
Constructor Summary
CmsTemplateStyleSheet()
          Empty constructor, required for every JavaBean.
CmsTemplateStyleSheet(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Constructor, with parameters.
 
Method Summary
static java.lang.String calculateHeight(java.lang.String value, int delta)
          Calculates the height of an element.
 java.lang.String getConfigValue(java.lang.String key, java.lang.String defaultValue)
          Returns the configuration value for the specified key from the configuration.
 java.lang.String getFontUnderline(java.lang.String key, java.lang.String defaultValue)
          Returns the CSS formatting String for underlining an element.
 java.lang.String getFontWeight(java.lang.String key, java.lang.String defaultValue)
          Returns the CSS formatting String for bold output of an element.
 java.lang.String getHeadlineSize(int headline)
          Returns the size of the headline with the given number.
 java.lang.String getOptionalConfigValue(java.lang.String key, java.lang.String defaultValue)
          Returns an optional configuration value for the specified key from the configuration.
 java.lang.String getResourcePath()
          Returns the substituted path to the modules resource folder.
 java.lang.String getTemplateWidth()
          Returns the width of the template to display depending on the configuration.
 void init(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Initialize this bean with the current page context, request and response.
 
Methods inherited from class org.opencms.frontend.templateone.CmsTemplateBase
getOriginalUri, initUri, isUriChanged
 
Methods inherited from class org.opencms.jsp.CmsJspActionElement
editable, editable, editable, editableManualClose, editableManualOpen, getContent, getContent, getMessages, getMessages, getMessages, getMessages, getNavigation, getNavigationUri, img, img, include, include, include, include, include, include, includeSilent, includeSilent, includeSilent, includeSilent, info, label, link, link, properties, properties, property, property, property, property, template, template, template, toAbsolute, user
 
Methods inherited from class org.opencms.jsp.CmsJspBean
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, isNotInitialized, isSupressingExceptions, setContentType, setStatus, setSupressingExceptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILENAME_CONFIGFILE

public static final java.lang.String FILENAME_CONFIGFILE
Default file name of the CSS configuration file.

See Also:
Constant Field Values

NODE_OPTIONALCONFIG

public static final java.lang.String NODE_OPTIONALCONFIG
Node name of the optional configuration nodes.

See Also:
Constant Field Values

PARAM_CONFIGFILE

public static final java.lang.String PARAM_CONFIGFILE
Request parameter name providing the configuration file URI.

See Also:
Constant Field Values

PROPERTY_CONFIGFILE

public static final java.lang.String PROPERTY_CONFIGFILE
Name of the property key to set the path to the configuration file.

See Also:
Constant Field Values
Constructor Detail

CmsTemplateStyleSheet

public CmsTemplateStyleSheet()
Empty constructor, required for every JavaBean.


CmsTemplateStyleSheet

public CmsTemplateStyleSheet(javax.servlet.jsp.PageContext context,
                             javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse res)
Constructor, with parameters.

Use this constructor for the template.

Parameters:
context - the JSP page context object
req - the JSP request
res - the JSP response
Method Detail

calculateHeight

public static java.lang.String calculateHeight(java.lang.String value,
                                               int delta)
Calculates the height of an element.

Parameters:
value - the old height value
delta - the delta to use
Returns:
the new height value

getConfigValue

public java.lang.String getConfigValue(java.lang.String key,
                                       java.lang.String defaultValue)
Returns the configuration value for the specified key from the configuration.

Parameters:
key - the key name to look up
defaultValue - the default value used when no value was found for the key
Returns:
the configuration value for the specified key

getFontUnderline

public java.lang.String getFontUnderline(java.lang.String key,
                                         java.lang.String defaultValue)
Returns the CSS formatting String for underlining an element.

Checks the value in the configuration file, if the value is "true", the text decoration will be underlined, otherwise none.

Parameters:
key - the key name to look up in the optional configuration
defaultValue - the default value used when no value was found for the key
Returns:
the CSS formatting String for underlining an element

getFontWeight

public java.lang.String getFontWeight(java.lang.String key,
                                      java.lang.String defaultValue)
Returns the CSS formatting String for bold output of an element.

Checks the value in the configuration file, if the value is "true", the font weight will be bold, otherwise normal.

Parameters:
key - the key name to look up in the optional configuration
defaultValue - the default value used when no value was found for the key
Returns:
the CSS formatting String for bold output of an element

getHeadlineSize

public java.lang.String getHeadlineSize(int headline)
Returns the size of the headline with the given number.

Parameters:
headline - the number of the heading element (1 to 6)
Returns:
the size of the headline with the given number

getOptionalConfigValue

public java.lang.String getOptionalConfigValue(java.lang.String key,
                                               java.lang.String defaultValue)
Returns an optional configuration value for the specified key from the configuration.

Parameters:
key - the key name to look up
defaultValue - the default value used when no value was found for the key
Returns:
the optional configuration value for the specified key

getResourcePath

public java.lang.String getResourcePath()
Returns the substituted path to the modules resource folder.

Returns:
the substituted path to the modules resource folder

getTemplateWidth

public java.lang.String getTemplateWidth()
Returns the width of the template to display depending on the configuration.

Returns:
the width of the template

init

public void init(javax.servlet.jsp.PageContext context,
                 javax.servlet.http.HttpServletRequest req,
                 javax.servlet.http.HttpServletResponse res)
Initialize this bean with the current page context, request and response.

It is required to call one of the init() methods before you can use the instance of this bean.

Overrides:
init in class org.opencms.jsp.CmsJspBean
Parameters:
context - the JSP page context object
req - the JSP request
res - the JSP response