001 package edu.nrao.sss.catalog; 002 003 /** 004 * A listener of events on a catalog group. The events are all related 005 * to the addition, removal, replacement, or movement of members of 006 * a group of catalog items. 007 * <p> 008 * <b>Version Info:</b> 009 * <table style="margin-left:2em"> 010 * <tr><td>$Revision: 591 $</td></tr> 011 * <tr><td>$Date: 2007-05-04 09:51:09 -0600 (Fri, 04 May 2007) $</td></tr> 012 * <tr><td>$Author: dharland $</td></tr> 013 * </table></p> 014 * 015 * @author David M. Harland 016 * @since 2006-11-01 017 */ 018 public interface CatalogItemGroupListener<I extends CatalogItem<I>, 019 G extends CatalogItemGroup<I,G,C>, 020 C extends Catalog<I,G,C>> 021 { 022 /** 023 * Called after {@code newMember} was added to {@code group}. 024 * 025 * @param group the group to which a new member was added. 026 * @param newMember the new member added to {@code group}. 027 * @param index the index at which the new member was added. 028 */ 029 public void memberAdded(G group, I newMember, int index); 030 031 /** 032 * Called after {@code formerMember} was removed from {@code group}. 033 * 034 * @param group the group from which a member was removed. 035 * @param formerMember the member removed from {@code group}. 036 * @param index the index at which the former member had been located. 037 */ 038 public void memberRemoved(G group, I formerMember, int index); 039 040 /** 041 * Called after {@code member} was moved from one location to another 042 * within {@code group}. 043 * <p> 044 * It is anticipated that most implementations of 045 * {@code CatalogItemGroup} will send this message only for the 046 * member that instigated the change in this list. For example, 047 * if the last member of the list was moved to the first position in 048 * the list, only one message will be sent, even though every member 049 * of the list is now in a new position. The message sent for this 050 * example would be for the member now in the first position.</p> 051 * 052 * @param group the group in which the movement occurred. 053 * @param member the member whose position changed. 054 * @param fromIndex the position at which the member had been located. 055 * @param toIndex the position at which the member is now located. 056 */ 057 public void memberMoved(G group, I member, int fromIndex, int toIndex); 058 059 /** 060 * Called after the member located at {@code index} was replaced by 061 * another member. 062 * 063 * @param group the group in which the replacement occurred. 064 * @param formerMember the member that had been located at {@code index}. 065 * @param newMember the member that is now located at {@code index}. 066 * @param index the position at which the replacement occurred. 067 */ 068 public void memberReplaced(G group, I formerMember, I newMember, int index); 069 070 /** 071 * Called after the members of this group were sorted. 072 * @param group the group whose members were sorted. 073 */ 074 public void membersSorted(G group); 075 076 /* Need this? 077 public void membersAdded(G group, int fromIndex, int toIndex); */ 078 079 /* Need this? 080 public void membersRemoved(G group, int fromIndex, int toIndex); */ 081 }