001: /**
002: * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a>
003: * @version $Id: ActionBean.java 6385 2007-10-25 14:02:26Z wehrens $
004: */package org.gridsphere.provider.portletui.beans;
005:
006: import java.util.ArrayList;
007: import java.util.List;
008:
009: /**
010: * An <code>ActionBean</code> is an abstract visual bean that is responsible for creating
011: * <code>DefaultPortletAction</code> using a supplied <code>PortletURI</code> and is used by
012: * the <code>ActionLinkBean</code> and <code>ActionSubmitBean</code>
013: */
014: public abstract class ActionBean extends BaseComponentBean implements
015: TagBean {
016:
017: protected String action = null;
018: protected boolean isSecure = false;
019: protected String portletURI = null;
020: protected List<ParamBean> paramBeanList = new ArrayList<ParamBean>();
021: protected String label = null;
022: protected String layout = null;
023: protected String anchor = null;
024: protected String trackMe = null;
025: protected String extUrl = null;
026: protected String onClick = null;
027: protected String onMouseOver = null;
028: protected String onMouseOut = null;
029: protected String onSubmit = null;
030: protected String onReset = null;
031: protected boolean useAjax = false;
032:
033: /**
034: * Constructs default action bean
035: */
036: public ActionBean() {
037: }
038:
039: /**
040: * Constructs action bean with the supplied name
041: *
042: * @param name an identifying name
043: */
044: public ActionBean(String name) {
045: super (name);
046: }
047:
048: /**
049: * Returns the action specified by the onClick attribute
050: *
051: * @return the action specified by the onClick attribute
052: */
053: public String getOnClick() {
054: return onClick;
055: }
056:
057: /**
058: * Sets the action specified by the onClick attribute
059: *
060: * @param onClick the javascript action to perform
061: */
062: public void setOnClick(String onClick) {
063: this .onClick = onClick;
064: }
065:
066: /**
067: * Returns the action specified by the onReset attribute
068: *
069: * @return the action specified by the onReset attribute
070: */
071: public String getOnReset() {
072: return onReset;
073: }
074:
075: /**
076: * Sets the action specified by the onReset attribute
077: *
078: * @param onReset the javascript action to perform
079: */
080: public void setOnReset(String onReset) {
081: this .onReset = onReset;
082: }
083:
084: /**
085: * Returns the action specified by the onMouseOver attribute
086: *
087: * @return onMouseOver the javascript onMouseOver event
088: */
089: public String getOnMouseOver() {
090: return onMouseOver;
091: }
092:
093: /**
094: * Sets the action specified by the onMouseOver event
095: *
096: * @param onMouseOver the javascript onMouseOver event
097: */
098: public void setOnMouseOver(String onMouseOver) {
099: this .onMouseOver = onMouseOver;
100: }
101:
102: /**
103: * Returns the action specified by the onMouseOut attribute
104: *
105: * @return onMouseOver the javascript onMouseOut event
106: */
107: public String getOnMouseOut() {
108: return onMouseOut;
109: }
110:
111: /**
112: * Sets the action specified by the onMouseOut event
113: *
114: * @param onMouseOut the javascript onMouseOut event
115: */
116: public void setOnMouseOut(String onMouseOut) {
117: this .onMouseOut = onMouseOut;
118: }
119:
120: /**
121: * Returns the action specified by the onSubmit attribute
122: *
123: * @return the action specified by the onSubmit attribute
124: */
125: public String getOnSubmit() {
126: return onSubmit;
127: }
128:
129: /**
130: * Sets the action specified by the onSubmit attribute
131: *
132: * @param onSubmit the javascript action to perform
133: */
134: public void setOnSubmit(String onSubmit) {
135: this .onSubmit = onSubmit;
136: }
137:
138: /**
139: * Returns true if this action should only retrieve the portlet fragment using AJAX (XmlHttpRequest)
140: *
141: * @return true if this action should only retrieve the portlet fragment using AJAX (XmlHttpRequest)
142: */
143: public boolean getUseAjax() {
144: return useAjax;
145: }
146:
147: /**
148: * If true this action should only retrieve the portlet fragment using AJAX (XmlHttpRequest)
149: *
150: * @param useAjax true if this action should only retrieve the portlet fragment using AJAX (XmlHttpRequest)
151: */
152: public void setUseAjax(boolean useAjax) {
153: this .useAjax = useAjax;
154: }
155:
156: /**
157: * Sets the label identified with the portlet component to link to
158: *
159: * @param label the action link key
160: */
161: public void setLabel(String label) {
162: this .label = label;
163: }
164:
165: /**
166: * Returns the label identified with the portlet component to link to
167: *
168: * @return the label
169: */
170: public String getLabel() {
171: return label;
172: }
173:
174: /**
175: * Returns the layout id that identifies a layout descriptor to target
176: *
177: * @return the layout id that identifies a layout descriptor to target
178: */
179: public String getLayout() {
180: return layout;
181: }
182:
183: /**
184: * Sets the layout id that identifies a layout descriptor to target
185: *
186: * @param layout the layout id that identifies a layout descriptor to target
187: */
188: public void setLayout(String layout) {
189: this .layout = layout;
190: }
191:
192: /**
193: * Sets a label to track this action and persist in the DB
194: *
195: * @param trackMe a label for this action
196: */
197: public void setTrackme(String trackMe) {
198: this .trackMe = trackMe;
199: }
200:
201: /**
202: * Returns the tracking label for this action
203: *
204: * @return the tracking label
205: */
206: public String getTrackme() {
207: return trackMe;
208: }
209:
210: /**
211: * Returns the external url that this actionlink will redirect to
212: *
213: * @return the external url that this actionlink will redirect to
214: */
215: public String getExturl() {
216: return extUrl;
217: }
218:
219: /**
220: * Sets the external url that this actionlink will redirect to
221: *
222: * @param extUrl the external url that this actionlink will redirect to
223: */
224: public void setExturl(String extUrl) {
225: this .extUrl = extUrl;
226: }
227:
228: /**
229: * Sets the text that should be added at the end of generated URL
230: *
231: * @param anchor the action link key
232: */
233: public void setAnchor(String anchor) {
234: this .anchor = anchor;
235: }
236:
237: /**
238: * Returns the anchor used to identify text that should be added at the end of generated URL
239: *
240: * @return the anchor
241: */
242: public String getAnchor() {
243: return anchor;
244: }
245:
246: /**
247: * Sets the action link name used to identify an anchor
248: *
249: * @param name the action link name
250: */
251: public void setName(String name) {
252: this .name = name;
253: }
254:
255: /**
256: * Returns the action link name used to identify an anchor
257: *
258: * @return the action link name
259: */
260: public String getName() {
261: return name;
262: }
263:
264: /**
265: * If secure is true, then use https, otherwise use http
266: *
267: * @param isSecure if true use https, otherwise use http
268: */
269: public void setSecure(boolean isSecure) {
270: this .isSecure = isSecure;
271: }
272:
273: /**
274: * Returns true if this actiontag is secure e.g. https, flase otherwise
275: *
276: * @return true if this actiontag is secure, false otherwise
277: */
278: public boolean getSecure() {
279: return isSecure;
280: }
281:
282: /**
283: * Sets the uri for the link
284: *
285: * @param portletURI the portlet uri
286: */
287: public void setPortletURI(String portletURI) {
288: this .portletURI = portletURI;
289: }
290:
291: /**
292: * Returns the uri for the link
293: *
294: * @return returns the action
295: */
296: public String getPortletURI() {
297: return portletURI;
298: }
299:
300: /**
301: * Sets the action for the link
302: *
303: * @param action the action name
304: */
305: public void setAction(String action) {
306: this .action = action;
307: }
308:
309: /**
310: * Returns the action name
311: *
312: * @return returns the action name
313: */
314: public String getAction() {
315: return action;
316: }
317:
318: /**
319: * Sets the list of name value parameter beans
320: *
321: * @param paramBeanList a list containing <code>ActionParamBean</code>s
322: */
323: public void setParamBeanList(List<ParamBean> paramBeanList) {
324: this .paramBeanList = paramBeanList;
325: }
326:
327: /**
328: * Returns the list of name value parameter beans
329: *
330: * @return the list containing <code>ActionParamBean</code>s
331: */
332: public List<ParamBean> getParamBeanList() {
333: return paramBeanList;
334: }
335:
336: /**
337: * Adds an action parameter bean
338: *
339: * @param paramBean an action parameter bean
340: */
341: public void addParamBean(ParamBean paramBean) {
342: paramBeanList.add(paramBean);
343: }
344:
345: /**
346: * Creates and adds an action parameter bean
347: *
348: * @param paramName the parameter name
349: * @param paramValue the parameter value
350: */
351: public void addParamBean(String paramName, String paramValue) {
352: ParamBean paramBean = new ParamBean(paramName, paramValue);
353: paramBeanList.add(paramBean);
354: }
355:
356: /**
357: * Removes an action parameter bean
358: *
359: * @param paramBean the action parameter bean
360: */
361: public void removeParamBean(ParamBean paramBean) {
362: paramBeanList.remove(paramBean);
363: }
364:
365: }
|