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 Details

  • Constructor Details

    • StylableTag

      protected StylableTag(String defaultClass)
      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

      public void setPageContext(PageContext pageContext)
      Reset the dynamic attributes to make sure old ones are not included in case the tag object is reused.
      Specified by:
      setPageContext in interface Tag
      Overrides:
      setPageContext in class TagSupport
      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

      public void setClazz(String clazz)
    • getClazz

      public String getClazz()
    • setSubclass

      public void setSubclass(String subclass)
    • getSubclass

      public String getSubclass()
    • setStyle

      public void setStyle(String style)
    • getStyle

      public String getStyle()
    • setDynamicAttribute

      public void setDynamicAttribute(String uri, String name, Object value)
      Specified by:
      setDynamicAttribute in interface DynamicAttributes
    • getDynamicActionAttributes

      public Iterator<DynamicActionAttribute> 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 interface DynamicActionAttributes
      Returns:
      An iterator or null
    • getFullClass

      public String getFullClass(String... extraClasses)
      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

      protected String getIdPrefix()
      Optional prefix to include in the 'id' attribute. See addIdAndStyles(StringBuilder, String...).
      Returns:
      The default implementation return an empty string
      Since:
      3.3
    • getDynamicAttribute

      protected DynamicActionAttribute getDynamicAttribute(String name)
      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

      protected void addIdAndStyles(StringBuilder sb, String... extraClasses)
      Add id, class and style attributes the the stringbuilder.
    • setMoreDynamicAttributes

      protected void setMoreDynamicAttributes(Iterator<DynamicActionAttribute> moreAttributes)
    • addDynamicAttributes

      protected void addDynamicAttributes(StringBuilder sb)