Package net.sf.basedb.clients.web.taglib
Class StylableTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
net.sf.basedb.clients.web.taglib.StylableTag
- All Implemented Interfaces:
Serializable
,DynamicAttributes
,IterationTag
,JspTag
,Tag
,DynamicActionAttributes
- Direct Known Subclasses:
Body
,Button
,Button
,ButtonGroup
,ColumnDef
,ColumnSubtitles
,Data
,Form
,Header
,HeaderRow
,Headers
,Help
,HideableSection
,Icon
,Input
,Label
,Menu
,Menuitem
,Menuseparator
,Navigator
,Panel
,Path
,PathElement
,PresetSelector
,Row
,Rows
,Select
,Submenu
,TabControl
,Table
,Toolbar
,Zoom
public abstract class StylableTag
extends TagSupport
implements DynamicAttributes, DynamicActionAttributes
Generic tag class for tags that want to support
id, class and style of the main html object they
use. The class can be specified as a main class and
a subclass which is added instead of replacing the
main class.
- Since:
- 3.1
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2014-10-22 18:41:55 +0200 (on, 22 okt 2014) $
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
private Map<String,
DynamicActionAttribute> private static final long
private String
private String
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
-
Constructor Summary
ModifierConstructorDescriptionprotected
StylableTag
(String defaultClass) Create a new stylable tag. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
addIdAndStyles
(StringBuilder sb, String... extraClasses) Add id, class and style attributes the the stringbuilder.getClazz()
Get an iterator that return all dynamic attributes.protected DynamicActionAttribute
getDynamicAttribute
(String name) Get the dynamic attribute for the given namegetFullClass
(String... extraClasses) Get the full class (eg. main and subclass) as a single string.protected String
Optional prefix to include in the 'id' attribute.getStyle()
protected void
Initialize default attributes.void
void
setDynamicAttribute
(String uri, String name, Object value) protected void
setMoreDynamicAttributes
(Iterator<DynamicActionAttribute> moreAttributes) void
setPageContext
(PageContext pageContext) Reset the dynamic attributes to make sure old ones are not included in case the tag object is reused.void
void
setSubclass
(String subclass) Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setParent, setValue
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
clazz
-
subclass
-
style
-
dynamicAttributes
-
-
Constructor Details
-
StylableTag
Create a new stylable tag.- Parameters:
defaultClass
- The default class to use if the tag doesn't override with it's own value
-
-
Method Details
-
setPageContext
Reset the dynamic attributes to make sure old ones are not included in case the tag object is reused.- Specified by:
setPageContext
in interfaceTag
- Overrides:
setPageContext
in classTagSupport
- Since:
- 3.3
-
initDefaultAttributes
protected void initDefaultAttributes()Initialize default attributes. Can be called multiple times (once before each tag is used/re-used). This default implementation does nothing.- Since:
- 3.3.2
-
setClazz
-
getClazz
-
setSubclass
-
getSubclass
-
setStyle
-
getStyle
-
setDynamicAttribute
- Specified by:
setDynamicAttribute
in interfaceDynamicAttributes
-
getDynamicActionAttributes
Description copied from interface:DynamicActionAttributes
Get an iterator that return all dynamic attributes. If no dynamic attributes have been defined, the method may return null or an iterator that doesn't return any elements.- Specified by:
getDynamicActionAttributes
in interfaceDynamicActionAttributes
- Returns:
- An iterator or null
-
getFullClass
Get the full class (eg. main and subclass) as a single string.- Parameters:
extraClasses
- Additional classes that should also be added- Returns:
- The combined class or null if no class has been set
-
getIdPrefix
Optional prefix to include in the 'id' attribute. SeeaddIdAndStyles(StringBuilder, String...)
.- Returns:
- The default implementation return an empty string
- Since:
- 3.3
-
getDynamicAttribute
Get the dynamic attribute for the given name- Parameters:
name
- The name of the attribute- Returns:
- A DynamicActionAttribute object or null if no attribute with that name has been set
-
addIdAndStyles
Add id, class and style attributes the the stringbuilder. -
setMoreDynamicAttributes
-
addDynamicAttributes
-