1 20 21 package org.apache.directory.ldapstudio.browser.common.widgets; 22 23 24 import java.util.ArrayList ; 25 import java.util.Iterator ; 26 import java.util.List ; 27 28 29 36 public abstract class BrowserWidget 37 { 38 39 40 protected List <WidgetModifyListener> modifyListenerList; 41 42 43 46 protected BrowserWidget() 47 { 48 modifyListenerList = new ArrayList <WidgetModifyListener>( 3 ); 49 } 50 51 52 57 public void addWidgetModifyListener( WidgetModifyListener listener ) 58 { 59 if ( !modifyListenerList.contains( listener ) ) 60 { 61 modifyListenerList.add( listener ); 62 } 63 } 64 65 66 71 public void removeWidgetModifyListener( WidgetModifyListener listener ) 72 { 73 if ( modifyListenerList.contains( listener ) ) 74 modifyListenerList.remove( listener ); 75 } 76 77 78 81 protected void notifyListeners() 82 { 83 WidgetModifyEvent event = new WidgetModifyEvent( this ); 84 for ( Iterator <WidgetModifyListener> it = modifyListenerList.iterator(); it.hasNext(); ) 85 { 86 WidgetModifyListener listener = it.next(); 87 listener.widgetModified( event ); 88 } 89 } 90 91 } 92 | Popular Tags |