001 /* 002 * $Header: /usr/local/cvs/java-tools/environment/eclipse/code-templates.xml,v 003 * 1.2 2004/03/31 18:20:53 keith Exp $ $Revision: 1749 $ $Date: 2004/03/31 004 * 18:20:53 $ 005 * 006 * Copyright Computer Science Innovations (CSI), 2003. All rights reserved. 007 */ 008 package org.springframework.richclient.application.event; 009 010 import org.springframework.context.ApplicationEvent; 011 import org.springframework.core.style.ToStringCreator; 012 013 /** 014 * Application event that communicates lifecycle changes in application objects. 015 * 016 * @author Keith Donald 017 */ 018 public class LifecycleApplicationEvent extends ApplicationEvent { 019 private String eventType; 020 021 public static final String CREATED = "lifecycleEvent.created"; 022 023 public static final String MODIFIED = "lifecycleEvent.modified"; 024 025 public static final String DELETED = "lifecycleEvent.deleted"; 026 027 public LifecycleApplicationEvent(String eventType, Object source) { 028 super(source); 029 this.eventType = eventType; 030 } 031 032 public Object getObject() { 033 return getSource(); 034 } 035 036 public boolean objectIs(Class clazz) { 037 if (clazz.isAssignableFrom(getSource().getClass())) 038 return true; 039 040 return false; 041 } 042 043 public String getEventType() { 044 return eventType; 045 } 046 047 public String toString() { 048 return new ToStringCreator(this).toString(); 049 } 050 }