001: /*
002: * Created on Dec 24, 2003
003: *
004: * To change the template for this generated file go to
005: * Window>Preferences>Java>Code Generation>Code and Comments
006: */
007: package org.xdev.base.xssl;
008:
009: import java.util.EventListener;
010: import java.util.HashMap;
011:
012: import org.xdev.base.core.BASE;
013:
014: /**
015: * @author AYegorov
016: *
017: * To change the template for this generated type comment go to
018: * Window>Preferences>Java>Code Generation>Code and Comments
019: */
020: public abstract class XSSLEventListener extends XSSLActionIterator
021: implements EventListener {
022: public static final int LISTENER_START_EVENT = 26;
023: public static final int LISTENER_PROCESS_START_EVENT = 27;
024: public static final int LISTENER_PROCESS_END_EVENT = 28;
025: public static final int LISTENER_START_END = 29;
026:
027: protected Object eventObject = null;
028:
029: /**
030: * @param id
031: */
032: public XSSLEventListener(String id) {
033: this (id, new HashMap());
034: // XXX Auto-generated constructor stub
035: }
036:
037: /**
038: * @param id
039: * @param properties
040: */
041: public XSSLEventListener(String id, HashMap properties) {
042: super (id, properties);
043: this .setProperty(XSSLActionIterator.EXECUTE_FLAG, "false");
044: // XXX Auto-generated constructor stub
045: }
046:
047: protected Object preProcessEvent(java.util.EventObject event) {
048:
049: Object obj = null;
050:
051: try {
052: this .issueTrigger(XSSLEventListener.LISTENER_START_EVENT);
053:
054: this .logDebug("Processing event: " + this .getClass());
055:
056: try {
057: this
058: .issueTrigger(XSSLEventListener.LISTENER_PROCESS_START_EVENT);
059:
060: obj = (this .eventObject = this .processEvent(event));
061:
062: this .issueTrigger(
063: XSSLEventListener.LISTENER_PROCESS_END_EVENT,
064: obj);
065:
066: this .logDebug("Event returned object: " + obj);
067:
068: this .setReference(obj);
069:
070: this .execute();
071: } catch (Exception ex) {
072: this .setException(ex);
073: this .logDebug(BASE.getValueFromObject(ex));
074: }
075:
076: this .issueTrigger(XSSLEventListener.LISTENER_START_END);
077: } catch (Exception ex) {
078: this .logError(ex);
079: }
080:
081: return obj;
082: }
083:
084: /* (non-Javadoc)
085: * @see org.xdev.base.xssl.XSSLReturn#getValue()
086: */
087: public Object getObjectValue() {
088: return this .eventObject;
089: }
090:
091: protected void set() throws Exception {
092: }
093:
094: /* (non-Javadoc)
095: * @see org.xdev.base.xssl.XSSLActionIterator#invoke(org.xdev.base.xssl.XSSLAction)
096: */
097: protected void invoke(XSSLAction component) throws Exception {
098: }
099:
100: protected abstract Object processEvent(java.util.EventObject event)
101: throws Exception;
102:
103: /**
104: * @return Returns the eventObject.
105: */
106: public Object getEventObject() {
107: return eventObject;
108: }
109:
110: /**
111: * @param eventObject The eventObject to set.
112: */
113: public void setEventObject(Object eventObject) {
114: this .eventObject = eventObject;
115: }
116:
117: /**
118: * @return Returns the lISTENER_PROCESS_END_EVENT.
119: */
120: public static int getLISTENER_PROCESS_END_EVENT() {
121: return LISTENER_PROCESS_END_EVENT;
122: }
123:
124: /**
125: * @return Returns the lISTENER_PROCESS_START_EVENT.
126: */
127: public static int getLISTENER_PROCESS_START_EVENT() {
128: return LISTENER_PROCESS_START_EVENT;
129: }
130:
131: /**
132: * @return Returns the lISTENER_START_END.
133: */
134: public static int getLISTENER_START_END() {
135: return LISTENER_START_END;
136: }
137:
138: /**
139: * @return Returns the lISTENER_START_EVENT.
140: */
141: public static int getLISTENER_START_EVENT() {
142: return LISTENER_START_EVENT;
143: }
144: }
|