KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > uitags > tag > formGuide > RemoveTag


1 /**
2  * Jan 31, 2006
3  *
4  * Copyright 2004 - 2005 uitags
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package net.sf.uitags.tag.formGuide;
19
20 import javax.servlet.jsp.JspException JavaDoc;
21
22 import net.sf.uitags.tag.AbstractUiTag;
23 import net.sf.uitags.tagutil.validation.RuntimeValidator;
24
25 /**
26  * Notifies {@link net.sf.uitags.tag.formGuide.FormGuideTag} of elements to remove.
27  *
28  * @author hgani
29  * @version $Id$
30  */

31 public class RemoveTag extends AbstractUiTag {
32   ///////////////////////////////
33
////////// Constants //////////
34
///////////////////////////////
35

36   /**
37    * Serial Version UID.
38    */

39   private static final long serialVersionUID = 100L;
40
41   /**
42    * Javascript callback for elements.
43    */

44   public static final String JavaDoc CALLBACK_METHOD = "removeElements";
45
46
47   ////////////////////////////
48
////////// Fields //////////
49
////////////////////////////
50

51   /**
52    * The "elementId" tag attribute
53    */

54   private String JavaDoc elementId;
55   /**
56    * The "widgetName" tag attribute
57    */

58   private String JavaDoc elementName;
59
60
61
62   //////////////////////////////////
63
////////// Constructors //////////
64
//////////////////////////////////
65

66   /**
67    * Default constructor.
68    */

69   public RemoveTag() {
70     super();
71   }
72
73
74
75   ///////////////////////////////////////////
76
////////// Tag attribute setters //////////
77
///////////////////////////////////////////
78

79   /**
80    * Tag attribute setter.
81    *
82    * @param val value of the tag attribute
83    */

84   public void setElementId(String JavaDoc val) {
85     this.elementId = val;
86   }
87
88   /**
89    * Tag attribute setter.
90    *
91    * @param val value of the tag attribute
92    */

93   public void setElementName(String JavaDoc val) {
94     this.elementName = val;
95   }
96
97
98   ///////////////////////////////
99
////////// Tag logic //////////
100
///////////////////////////////
101

102   /**
103    * Communicates with the parent tag ({@link FormGuideTag}).
104    *
105    * @return <code>EVAL_PAGE</code>
106    * @throws JspException to communicate error
107    */

108   public int doEndTag() throws JspException JavaDoc {
109     RuntimeValidator.assertAttributeExclusive(
110         "elementId", this.elementId, "elementName", this.elementName);
111     RuntimeValidator.assertEitherSpecified(
112         "elementId", this.elementId, "elementName", this.elementName);
113
114     FormGuideTag formGuideTag = (FormGuideTag) findParent(FormGuideTag.class);
115     formGuideTag.addJavascriptCallback(CALLBACK_METHOD,
116         InsertTag.CALLBACK_METHOD, this.elementId, this.elementName);
117
118     return EVAL_PAGE;
119   }
120 }
121
Popular Tags