2.17.2: 2011-06-17

net.sf.basedb.clients.web.taglib
Class HideableSection

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by net.sf.basedb.clients.web.taglib.HideableSection
All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag

public class HideableSection
extends TagSupport

This tag is used to display a section on a web page that can be shown/hidden by the user by clicking on an icon on it's title.

Example:

   <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
   <base:section id="my.section" title="Click to hide/show">
   This is the contents of this section...
   </base:section>

Syntax:

   <base:section
      id=...
      clazz=...
      showclazz=...
      hideclazz=...
      style=...
      contentstyle=...
      title=...
      visible=...
      ontoggle=...
      initial=show|hide
      context=...
   >

Attribute Default value Required Description
id - no The ID of the section. The value of this attribute goes directly into the standard id attribute. This means that if you need a reference to the scetion object in your own JavaScript code, you may for example use the following code:

section = document.getElementById('<id>');

clazz note no The value if this attribute goes directly into the standard HTML class attribute both when the section contents is hidden or visible.
showclazz note no The value if this attribute goes directly into the standard HTML class attribute when the section contents is visible.
hideclazz note no The value if this attribute goes directly into the standard HTML class attribute when the section contents is hidden.
style - no The value if this attribute goes directly into the standard HTML style attribute. This allows you to apply different styles to different sections.
contentstyle - no The value if this attribute goes directly into the standard HTML style attribute of the content part. This allows you to apply different styles to different sections.
title no The title of the section.
visible true no If the section should be visible or not.
ontoggle HideableSection.toggle or HideableSection.toggleAndSendWithAjax no The javascript method to call when a user click the show/hide icon. If no context has been set the default value is HideableSection.toggle, otherwise it is HideableSection.toggleAndSendWithAjax. If no context is set the given method is called with the value of the id attribute as the only parameter. If a context is set the method is called with three parameters: id, context.getItemType().name() and context.getSubContext in that order.
initial show no If the value is hide the section is hidden, otherwise it is visible. This setting is ignored if a context is given.
context - no An optional ItemContext object. If given the initial atribute is ignored. The valus is instead taken from the context setting section.id where id is replaced with the value of the id attribute. This should have the value "1" to show the section or "0" to hide the section. If a context is given the default javascript method will also send an Ajax request to the web server which will update the setting in the context with a new value for the show/hide setting. Thus, all settings are remembered during a session and also when the user returns to the next session.

Version:
2.4
Author:
Nicklas
See Also:
Serialized Form

Field Summary
private  String clazz
          Optional class attribute
private  String contentStyle
          Optional style attribute for the content section
private  ItemContext context
           
private  String hideClass
           
private  String onToggle
          Javascript to call when showing/hiding section
private  Page page
          The parent <base:page> tag.
private static long serialVersionUID
           
private  String showClass
           
private  boolean showInitially
          If the section should be shown or hidden to start with.
private  String style
          Optional style attribute
private  String title
          The title of the section.
private  boolean visible
          If the section should be visible or not.
 
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
HideableSection()
           
 
Method Summary
 int doEndTag()
           
 int doStartTag()
           
 String getClazz()
           
 String getContentstyle()
           
 ItemContext getContext()
           
 String getHideclazz()
           
 String getInitial()
           
 String getOntoggle()
           
 String getShowclazz()
           
 String getStyle()
           
 String getTitle()
           
 boolean isVisible()
           
 void setClazz(String clazz)
           
 void setContentstyle(String contentStyle)
           
 void setContext(ItemContext context)
           
 void setHideclazz(String clazz)
           
 void setInitial(String initial)
           
 void setOntoggle(String onToggle)
           
 void setShowclazz(String clazz)
           
 void setStyle(String style)
           
 void setTitle(String title)
           
 void setVisible(boolean visible)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

page

private Page page
The parent <base:page> tag.


clazz

private String clazz
Optional class attribute


showClass

private String showClass

hideClass

private String hideClass

style

private String style
Optional style attribute


contentStyle

private String contentStyle
Optional style attribute for the content section


title

private String title
The title of the section.


visible

private boolean visible
If the section should be visible or not.


onToggle

private String onToggle
Javascript to call when showing/hiding section


showInitially

private boolean showInitially
If the section should be shown or hidden to start with.


context

private transient ItemContext context
Constructor Detail

HideableSection

public HideableSection()
Method Detail

setClazz

public void setClazz(String clazz)

getClazz

public String getClazz()

setShowclazz

public void setShowclazz(String clazz)

getShowclazz

public String getShowclazz()

setHideclazz

public void setHideclazz(String clazz)

getHideclazz

public String getHideclazz()

setStyle

public void setStyle(String style)

getStyle

public String getStyle()

setContentstyle

public void setContentstyle(String contentStyle)

getContentstyle

public String getContentstyle()

setTitle

public void setTitle(String title)

getTitle

public String getTitle()

setVisible

public void setVisible(boolean visible)

isVisible

public boolean isVisible()

setInitial

public void setInitial(String initial)

getInitial

public String getInitial()

setOntoggle

public void setOntoggle(String onToggle)

getOntoggle

public String getOntoggle()

setContext

public void setContext(ItemContext context)

getContext

public ItemContext getContext()

doStartTag

public int doStartTag()
               throws JspException
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Throws:
JspException

doEndTag

public int doEndTag()
             throws JspException
Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class TagSupport
Throws:
JspException

2.17.2: 2011-06-17