001: /**
002: * $Id: TaskCommandTag.java,v 1.8 2003/08/26 22:24:02 amlan Exp $
003: * Copyright 2003 Sun Microsystems, Inc. All
004: * rights reserved. Use of this product is subject
005: * to license terms. Federal Acquisitions:
006: * Commercial Software -- Government Users
007: * Subject to Standard License Terms and
008: * Conditions.
009: *
010: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011: * are trademarks or registered trademarks of Sun Microsystems,
012: * Inc. in the United States and other countries.
013: */package com.sun.portal.wireless.taglibs.cal;
014:
015: import javax.servlet.jsp.*;
016: import javax.servlet.jsp.tagext.*;
017: import com.sun.comclient.calendar.RecurrencePattern;
018:
019: /**
020: * TaskCommandTag - base class for command tags that operate on task
021: *
022: * <b>Attributes:</b>
023: * <br><br>
024: * <ul>
025: * <li>name</li>
026: * <ul><li>the task to operate on; or EvenTag parent</li></ul>
027: * <li>modifier</li>
028: * <ul><li>modifier value for store/delete; defaults to
029: * <code>RecurrencePattern.THIS_INSTANCE</code></li></ul>
030: * </ul>
031: * @version 6.0
032: * @since 1.0
033: */
034:
035: public abstract class TaskCommandTag extends CalCommandTag {
036:
037: /**
038: * The modifier attribute; a string version of the
039: * JCAPI.Task modifiers for store/delete
040: */
041:
042: private String modifier = RecurrencePattern.THIS_INSTANCE;
043:
044: /**
045: * The default constructor
046: */
047:
048: public TaskCommandTag() {
049: super ();
050: }
051:
052: /**
053: * Get the modifier attribute
054: * <br><br>
055: * @return the modifier attribute
056: */
057:
058: public String getModifier() {
059: return modifier;
060: }
061:
062: /**
063: * Get the modifier attribute value
064: * <br><br>
065: * @return the modifier value
066: */
067:
068: public String getModifierValue(TaskBean task) {
069: return modifier;
070: }
071:
072: /**
073: * Find the Task to operate on.
074: * If the name attribute is specified then
075: * look in the page context. Otherwise search
076: * for a parent Task tag.
077: * <br><br>
078: * @return the Task to operate on
079: */
080:
081: public TaskBean findTask() {
082:
083: TaskBean task = null;
084: TaskTag tag;
085:
086: if (name != null) {
087: task = (TaskBean) pageContext.getAttribute(name);
088: } else {
089: tag = (TaskTag) findAncestorWithClass(this , TaskTag.class);
090: if (tag != null) {
091: task = (TaskBean) tag.getBean();
092: }
093: }
094: return task;
095: }
096:
097: /**
098: * Cleanup
099: */
100: public void release() {
101: super.release();
102: modifier = null;
103: }
104: }
|