|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.jsp.tagext.TagSupport | +--javax.servlet.jsp.tagext.BodyTagSupport | +--javawebparts.taglib.uiwidgets.SwapperTag
This class is a custom tag that renders the Swapper UI widget. A Swapper
has two boxes separated by four buttons, one button to swap an element from
the left box to the right, one to swap from right to left, one to swap all
items from the left to the right and one to swap all from right to left.
It also has two buttons next to the right box that allows items to be moved
up or down in the list. The left box is considered the "source" box and
it is meant for the user to construct a list on the right from the items
on the left.
This tag renders all necessary HTML and Javascript for this widget, including
the function JWP_UIWT_getList(), which can be called to retrieve the list
on either side of the swapper. Pass it the ID that you set in the tag
iteself, and optionally the constant JWP_UIWT_LEFT or JWP_UIWT_RIGHT to
specify which side you want (if you don't pass a second parameter you will
get the list on the right). This function returns an array of strings.
Here is an example to simply display the list on the right:
alert(JWP_UIWT_getList("swapper1"));
The contents of the tag (i.e., between the opening and closing tag) is for
you to fill out. It should be the HTML for the <option> elements
of a <select> tag. These options will be populated in the left box
of the swapper initially. You can use whatever techniques you like to
generate this markup, or it can of course be static. See the usage example
below for an illustration of how this all fits together (this is the same
usage example demonstrated in the sample app).
This tag uses the following attributes:
Field Summary | |
private java.lang.String |
boxClass
The stylesheet class of the boxes of the Swapper. |
private java.lang.String |
boxHeight
The height, in number of items, of the two boxes of the Swapper. |
private java.lang.String |
boxStyle
The style of the two boxes of the Swapper. |
private java.lang.String |
boxWidth
The width, in pixels, of the two boxes of the Swapper. |
private java.lang.String |
buttonClass
The stylesheet class of all the buttons of the Swapper. |
private java.lang.String |
buttonStyle
The style of all the buttons of the Swapper. |
private java.lang.String |
divClass
The stylesheet class of the the Swapper belongs in. |
private java.lang.String |
divStyle
The style of the element the Swapper is in. |
private static java.lang.String |
FUNCTIONS_DECLARED_ATTRIBUTE
|
private java.lang.String |
id
The ID of the the Swapper is in. |
private static org.apache.commons.logging.Log |
log
Log instance. |
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
bodyContent |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
pageContext |
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
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 | |
SwapperTag()
|
Method Summary | |
int |
doEndTag()
Render widget code. |
int |
doStartTag()
Render widget code. |
private void |
outputFunctions(java.lang.StringBuffer out)
Writes the <script> containing the JavaScript function to the passed in StringBuffer. |
void |
setBoxClass(java.lang.String inBoxClass)
Mutator for boxClass field. |
void |
setBoxHeight(java.lang.String inBoxHeight)
Mutator for boxHeight field. |
void |
setBoxStyle(java.lang.String inBoxStyle)
Mutator for boxStyle field. |
void |
setBoxWidth(java.lang.String inBoxWidth)
Mutator for boxWidth field. |
void |
setButtonClass(java.lang.String inButtonClass)
Mutator for buttonClass field. |
void |
setButtonStyle(java.lang.String inButtonStyle)
Mutator for buttonStyle field. |
void |
setDivClass(java.lang.String inDivClass)
Mutator for divClass field. |
void |
setDivStyle(java.lang.String inDivStyle)
Mutator for divStyle field. |
void |
setId(java.lang.String inID)
Mutator for ID field. |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
getParent, setPageContext, setParent |
Field Detail |
private static final java.lang.String FUNCTIONS_DECLARED_ATTRIBUTE
private static org.apache.commons.logging.Log log
private java.lang.String id
private java.lang.String boxWidth
private java.lang.String boxHeight
private java.lang.String divStyle
private java.lang.String boxStyle
private java.lang.String buttonStyle
private java.lang.String divClass
private java.lang.String boxClass
private java.lang.String buttonClass
Constructor Detail |
public SwapperTag()
Method Detail |
public void setId(java.lang.String inID)
setId
in class javax.servlet.jsp.tagext.TagSupport
inID
- ID.public void setBoxWidth(java.lang.String inBoxWidth)
inBoxWidth
- boxWidth.public void setBoxHeight(java.lang.String inBoxHeight)
inBoxHeight
- boxHeight.public void setDivStyle(java.lang.String inDivStyle)
inDivStyle
- divStyle.public void setBoxStyle(java.lang.String inBoxStyle)
inBoxStyle
- setBoxStyle.public void setButtonStyle(java.lang.String inButtonStyle)
inButtonStyle
- buttonStyle.public void setDivClass(java.lang.String inDivClass)
inDivClass
- divClass.public void setBoxClass(java.lang.String inBoxClass)
inBoxClass
- boxClass.public void setButtonClass(java.lang.String inButtonClass)
inButtonClass
- buttonClass.public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- If anything goes wrongprivate void outputFunctions(java.lang.StringBuffer out)
out
- the StringBuffer to write to.public int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- If anything goes wrong
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |