2.17.2: 2011-06-17

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

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

public class Select
extends TagSupport

This tag is used to display a selection list of items. The list can be linked to a selection popup and has options for the current item and recently used items.

Example:

   <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
   <base:select 
        id="protocol"
        required="false"
        current="<%=currentProtocol%>"
        denied="false"
        recent="<%=recentProtocols%>"
        onselect="selectProtocolOnClick()"
   />
 

Syntax:

   <base:select
      id=...
      clazz=...
      style=...
      required=true|false
      current=...
      denied=true|false
      recent=...
      selectrecent=true|false
      defaultitem=...
      selectdefault=true|false
      onselect=...
      onchange=...
      newitem=true|false
      visible=true|false
      disabled=true|false
   >

Attribute Default value Required Description
id - yes The ID of the selection list. The value of this attribute goes directly into the standard name attribute of a <select> tag.
clazz no The value if this attribute goes directly into the standard HTML class attribute. This allows you to apply different styles to different selection lists.
style - no The value if this attribute goes directly into the standard HTML style attribute. This allows you to apply different styles to different selection lists.
required false no If a value must be selected or not. If FALSE is specified the option - none - will be included.
current null yes The current item that is selected. It should be a BasicItem.
denied false no If null is passed as the current item, this parameter should be TRUE if the reason is that the logged in user is denied read access, FALSE otherwise.
recent no A list of recently used items. The should be of the same type as the current item.
selectrecent true no If no current has been specified and it is a new item then, if this parameter is TRUE the first recently used value is selected. If this parameter is FALSE, no item is selected.
defaultitem no Default value set e.g. for a project.
selectdefault true no If no current or recent has been specified and it is a new item then, if this parameter is TRUE the default value is selected. If this parameter is FALSE, no item is selected.
onchange no A javascript statement that is executed when the another item in the list is selected.
onselect no If specified, a Select button is added and linked to this javascript call.
newitem false no If the parent item is a new item or an already saved item. This affects the ID of the current item that is used in the list. For existing values the ID is negative, which means that the link doesn't have to change unless another item is selected.
visible true no If the selection list should be visible or not.
disabled false no If the selection list should be enabled or not.

Version:
2.0
Author:
Nicklas
See Also:
Serialized Form

Field Summary
private  String clazz
          Optional class attribute
private  BasicItem current
          The currently selected item.
private  BasicItem defaultitem
          The project default value
private  boolean denied
          If the logged in user was denied access to the current item.
private  boolean disabled
          If the selection list should be enabled or not.
private  boolean newItem
          If the link is from a new item or an old item.
private  String onChange
          JavaScript statement.
private  String onSelect
          JavaScript statement.
private  List<? extends BasicItem> recent
          List of recently used items.
private  boolean required
          If a value is required or not.
private  boolean selectdefault
          If the default item should be selected for new items with no current or recently used items.
private  boolean selectRecent
          If we can select the most recently used item for new items with nu current item.
private static long serialVersionUID
           
private  String style
          Optional style attribute
private  boolean tryGetDirectoryPath
           
private  String unselectedText
          Text to display that for the "unselected" option
private  boolean visible
          If the select list 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
Select()
           
 
Method Summary
 int doStartTag()
           
 String getClazz()
           
 BasicItem getCurrent()
           
 BasicItem getDefaultitem()
           
private  String getName(BasicItem item)
           
 String getOnchange()
           
 String getOnselect()
           
 List<? extends BasicItem> getRecent()
           
 boolean getSelectdefault()
           
 boolean getSelectrecent()
           
 String getStyle()
           
 String getUnselectedtext()
           
 boolean isDenied()
           
 boolean isDisabled()
           
 boolean isNewitem()
           
 boolean isRequired()
           
 boolean isVisible()
           
 void setClazz(String clazz)
           
 void setCurrent(BasicItem current)
           
 void setDefaultitem(BasicItem defaultitem)
           
 void setDenied(boolean denied)
           
 void setDisabled(boolean disabled)
           
 void setNewitem(boolean newItem)
           
 void setOnchange(String onChange)
           
 void setOnselect(String onSelect)
           
 void setRecent(List<? extends BasicItem> recent)
           
 void setRequired(boolean required)
           
 void setSelectdefault(boolean selectdefault)
           
 void setSelectrecent(boolean selectRecent)
           
 void setStyle(String style)
           
 void setUnselectedtext(String unselectedText)
           
 void setVisible(boolean visible)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, 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

clazz

private String clazz
Optional class attribute


style

private String style
Optional style attribute


required

private boolean required
If a value is required or not.


current

private transient BasicItem current
The currently selected item.


denied

private boolean denied
If the logged in user was denied access to the current item.


recent

private transient List<? extends BasicItem> recent
List of recently used items.


selectRecent

private boolean selectRecent
If we can select the most recently used item for new items with nu current item.


defaultitem

private transient BasicItem defaultitem
The project default value


selectdefault

private boolean selectdefault
If the default item should be selected for new items with no current or recently used items.


onChange

private String onChange
JavaScript statement.


onSelect

private String onSelect
JavaScript statement.


newItem

private boolean newItem
If the link is from a new item or an old item.


visible

private boolean visible
If the select list should be visible or not.


disabled

private boolean disabled
If the selection list should be enabled or not.


unselectedText

private String unselectedText
Text to display that for the "unselected" option


tryGetDirectoryPath

private boolean tryGetDirectoryPath
Constructor Detail

Select

public Select()
Method Detail

setClazz

public void setClazz(String clazz)

getClazz

public String getClazz()

setStyle

public void setStyle(String style)

getStyle

public String getStyle()

setRequired

public void setRequired(boolean required)

isRequired

public boolean isRequired()

setCurrent

public void setCurrent(BasicItem current)

getCurrent

public BasicItem getCurrent()

setDenied

public void setDenied(boolean denied)

isDenied

public boolean isDenied()

setRecent

public void setRecent(List<? extends BasicItem> recent)

getRecent

public List<? extends BasicItem> getRecent()

setSelectrecent

public void setSelectrecent(boolean selectRecent)

getSelectrecent

public boolean getSelectrecent()

setDefaultitem

public void setDefaultitem(BasicItem defaultitem)

getDefaultitem

public BasicItem getDefaultitem()

setSelectdefault

public void setSelectdefault(boolean selectdefault)

getSelectdefault

public boolean getSelectdefault()

setOnchange

public void setOnchange(String onChange)

getOnchange

public String getOnchange()

setOnselect

public void setOnselect(String onSelect)

getOnselect

public String getOnselect()

setNewitem

public void setNewitem(boolean newItem)

isNewitem

public boolean isNewitem()

setVisible

public void setVisible(boolean visible)

isVisible

public boolean isVisible()

setDisabled

public void setDisabled(boolean disabled)

isDisabled

public boolean isDisabled()

setUnselectedtext

public void setUnselectedtext(String unselectedText)

getUnselectedtext

public String getUnselectedtext()

doStartTag

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

getName

private String getName(BasicItem item)

2.17.2: 2011-06-17