KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > webapp > taglib > core > menu > context > ItemLabelTag


1 package com.blandware.atleap.webapp.taglib.core.menu.context;
2
3 import javax.servlet.jsp.JspException JavaDoc;
4 import javax.servlet.jsp.JspTagException JavaDoc;
5 import javax.servlet.jsp.tagext.JspFragment JavaDoc;
6 import javax.servlet.jsp.tagext.SimpleTagSupport JavaDoc;
7 import java.io.IOException JavaDoc;
8
9 /**
10  * <p>Renders label for menu item. This tag is used to render additional label
11  * for context menu item, which must not appear on page.
12  * <br />
13  * This tag is only valid when nested within <em>itemEnabled</em> or
14  * <em>itemDisabled</em> tag.
15  * </p>
16  * <p/>
17  * <p><a HREF="MenuItemLabelTag.java.htm"><i>View Source</i></a></p>
18  *
19  * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com">&lt;sergey.zubtcovskii@blandware.com&gt;</a>
20  * @version $Revision: 1.3 $ $Date: 2005/09/21 13:46:05 $
21  * @see ItemTag
22  * @see ItemLinkTag
23  * @jsp.tag name="itemLabel"
24  * body-content="scriptless"
25  */

26 public class ItemLabelTag extends SimpleTagSupport JavaDoc {
27
28     /**
29      * Creates new instance of ItemEnabledTag
30      */

31     public ItemLabelTag() {
32     }
33
34     /**
35      * Processes the tag
36      *
37      * @throws JspException
38      * @throws IOException
39      */

40     public void doTag() throws JspException JavaDoc, IOException JavaDoc {
41         // search for parent ItemPart
42
ItemPart part = (ItemPart) findAncestorWithClass(this, ItemPart.class);
43         if ( part == null ) {
44             throw new JspTagException JavaDoc("This tag is only valid when nested within 'itemEnabled' or 'itemDisabled' tag");
45         }
46
47         if ( part.getRenderingFlag() == ItemPart.FLAG_RENDER_TO_MENU ) {
48             // obtain and invoke body content
49
JspFragment JavaDoc body = getJspBody();
50             if ( body != null ) {
51                 body.invoke(null);
52             }
53         }
54
55     }
56
57 }
58
Popular Tags