Package net.sf.basedb.clients.web.taglib
Class Select
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
net.sf.basedb.clients.web.taglib.StylableTag
net.sf.basedb.clients.web.taglib.Select
- All Implemented Interfaces:
Serializable
,DynamicAttributes
,IterationTag
,JspTag
,Tag
,DynamicActionAttributes
public class Select extends StylableTag
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%>" />
Syntax:
<base:select id=... clazz=... style=... buttonclass=... buttonstyle=... buttontitle=... buttonicon=... required=true|false current=... denied=true|false recent=... selectrecent=true|false defaultitem=... selectdefault=true|false newitem=true|false visible=true|false disabled=true|false tabindex=... >
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.
|
buttonclass | buttonclass | no |
The value if this attribute goes directly into the standard HTML
class attribute for the "Select" button part. This allows you to
apply different styles to the button. If the button is disabled "_disabled" is
appended to the class name.
|
buttonstyle | - | no |
The value if this attribute goes directly into the standard HTML
style attribute for the "Select" button part. This allows you to
apply different styles to the button.
|
buttontitle | Select | no | The text on the "Select" button. |
buttonicon | select.png | no | The icon to use on the "Select" button. |
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. |
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. |
tabindex | 0 | no | Tab index value to control the focus order. Use -1 to disable tabbing to the control. |
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description private String
buttonclass
private String
buttonicon
private String
buttonstyle
private String
buttontitle
private BasicItem
current
The currently selected item.private List<? extends BasicItem>
defaultItems
The project default values.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 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 int
tabIndex
private boolean
tryGetDirectoryPath
private String
unselectedText
Text to display that for the "unselected" optionprivate 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
Constructors Constructor Description Select()
-
Method Summary
Modifier and Type Method Description int
doStartTag()
String
getButtonclass()
String
getButtonicon()
String
getButtonstyle()
String
getButtontitle()
BasicItem
getCurrent()
private String
getName(BasicItem item)
List<? extends BasicItem>
getRecent()
boolean
getSelectdefault()
boolean
getSelectrecent()
int
getTabindex()
String
getUnselectedtext()
boolean
isDenied()
boolean
isDisabled()
boolean
isNewitem()
boolean
isRequired()
boolean
isVisible()
void
setButtonclass(String clazz)
void
setButtonicon(String icon)
void
setButtonstyle(String style)
void
setButtontitle(String title)
void
setCurrent(BasicItem current)
void
setDefaultitem(BasicItem defaultitem)
void
setDefaultitems(List<? extends BasicItem> defaultItems)
void
setDenied(boolean denied)
void
setDisabled(boolean disabled)
void
setNewitem(boolean newItem)
void
setRecent(List<? extends BasicItem> recent)
void
setRequired(boolean required)
void
setSelectdefault(boolean selectdefault)
void
setSelectrecent(boolean selectRecent)
void
setTabindex(int tabIndex)
void
setUnselectedtext(String unselectedText)
void
setVisible(boolean visible)
Methods inherited from class net.sf.basedb.clients.web.taglib.StylableTag
addDynamicAttributes, addIdAndStyles, getClazz, getDynamicActionAttributes, getDynamicAttribute, getFullClass, getIdPrefix, getStyle, getSubclass, initDefaultAttributes, setClazz, setDynamicAttribute, setMoreDynamicAttributes, setPageContext, setStyle, setSubclass
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setParent, setValue
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
- Constant Field Values
-
buttonclass
-
buttonstyle
-
buttontitle
-
buttonicon
-
required
private boolean requiredIf a value is required or not. -
current
The currently selected item. -
denied
private boolean deniedIf the logged in user was denied access to the current item. -
recent
List of recently used items. -
selectRecent
private boolean selectRecentIf we can select the most recently used item for new items with nu current item. -
defaultItems
The project default values. -
selectdefault
private boolean selectdefaultIf the default item should be selected for new items with no current or recently used items. -
newItem
private boolean newItemIf the link is from a new item or an old item. -
visible
private boolean visibleIf the select list should be visible or not. -
disabled
private boolean disabledIf the selection list should be enabled or not. -
unselectedText
Text to display that for the "unselected" option -
tabIndex
private int tabIndex -
tryGetDirectoryPath
private boolean tryGetDirectoryPath
-
-
Constructor Details
-
Select
public Select()
-
-
Method Details
-
setButtonclass
- Since:
- 3.0
-
getButtonclass
- Since:
- 3.0
-
setButtonstyle
- Since:
- 3.0
-
getButtonstyle
- Since:
- 3.0
-
setButtontitle
- Since:
- 3.0
-
getButtontitle
- Since:
- 3.0
-
setButtonicon
- Since:
- 3.0
-
getButtonicon
- Since:
- 3.0
-
setRequired
public void setRequired(boolean required) -
isRequired
public boolean isRequired() -
setCurrent
-
getCurrent
-
setDenied
public void setDenied(boolean denied) -
isDenied
public boolean isDenied() -
setRecent
-
getRecent
-
setSelectrecent
public void setSelectrecent(boolean selectRecent) -
getSelectrecent
public boolean getSelectrecent() -
setDefaultitem
-
setDefaultitems
-
setSelectdefault
public void setSelectdefault(boolean selectdefault) -
getSelectdefault
public boolean getSelectdefault() -
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
-
getUnselectedtext
-
setTabindex
public void setTabindex(int tabIndex)- Since:
- 3.2
-
getTabindex
public int getTabindex() -
doStartTag
- Specified by:
doStartTag
in interfaceTag
- Overrides:
doStartTag
in classTagSupport
- Throws:
JspException
-
getName
-