1 /* EntryGroupChangeEvent.java 2 * 3 * created: Mon Dec 7 1998 4 * 5 * This file is part of Artemis 6 * 7 * Copyright (C) 1998,1999,2000 Genome Research Limited 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 2 12 * of the License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 * 23 * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/EntryGroupChangeEvent.java,v 1.1 2004-06-09 09:44:22 tjc Exp $ 24 */ 25 26 package uk.ac.sanger.artemis; 27 28 /** 29 * This event is sent when a change occurs in an EntryGroup. eg. an Entry 30 * is deleted or added. 31 * 32 * @author Kim Rutherford 33 * @version $Id: EntryGroupChangeEvent.java,v 1.1 2004-06-09 09:44:22 tjc Exp $ 34 **/ 35 36 public class EntryGroupChangeEvent extends ChangeEvent { 37 /** 38 * Event type - Entry removed. 39 **/ 40 public static final int ENTRY_DELETED = 1; 41 42 /** 43 * Event type - Entry added. 44 **/ 45 public static final int ENTRY_ADDED = 2; 46 47 /** 48 * Event type - Entry has been made active. 49 **/ 50 public static final int ENTRY_ACTIVE = 3; 51 52 /** 53 * Event type - Entry has been made inactive. 54 **/ 55 public static final int ENTRY_INACTIVE = 4; 56 57 /** 58 * Event type - There is now a different default Entry. 59 **/ 60 public static final int NEW_DEFAULT_ENTRY = 5; 61 62 /** 63 * Event type - This event means that the entry group is now not used by 64 * anything important. 65 **/ 66 public static final int DONE_GONE = 6; 67 68 /** 69 * Create a new EntryChangeEvent object. 70 * @param entry_group This EntryGroup object that this event refers to. 71 * @param entry This Entry object that this event refers to (if any). 72 * @param type This type of the event. 73 **/ EntryGroupChangeEvent(final EntryGroup entry_group, final Entry entry, final int type)74 public EntryGroupChangeEvent (final EntryGroup entry_group, 75 final Entry entry, 76 final int type) { 77 super (entry_group); 78 this.entry = entry; 79 this.type = type; 80 } 81 82 /** 83 * Return the type of this event ie. the type passed to the constructor. 84 **/ getType()85 public int getType () { 86 return type; 87 } 88 89 /** 90 * Return the target Entry object for this event. Will return null for 91 * DONE_GONE events. 92 **/ getEntry()93 public Entry getEntry () { 94 return entry; 95 } 96 97 /** 98 * This is a convenience method that returns the EntryGroup the generated 99 * this event. 100 **/ getEntryGroup()101 public EntryGroup getEntryGroup () { 102 return (EntryGroup) getSource (); 103 } 104 105 /** 106 * The Entry object that was passed to the constructor. 107 **/ 108 private Entry entry; 109 110 /** 111 * This is the type of this event (eg ENTRY_ADDED, ENTRY_DELETED, etc), as 112 * passed to the constructor 113 **/ 114 private int type; 115 } 116