1 19 20 package org.netbeans.modules.xml.xam.ui.category; 21 22 import java.beans.PropertyChangeListener ; 23 import java.beans.PropertyChangeSupport ; 24 25 30 public abstract class AbstractCategoryPane implements CategoryPane { 31 32 protected PropertyChangeSupport changeSupport; 33 34 private Category currentCategory; 35 36 39 public AbstractCategoryPane() { 40 changeSupport = new PropertyChangeSupport (this); 41 } 42 43 public void addPropertyChangeListener(PropertyChangeListener listener) { 44 changeSupport.addPropertyChangeListener(listener); 45 } 46 47 public void addPropertyChangeListener(String name, PropertyChangeListener listener) { 48 changeSupport.addPropertyChangeListener(name, listener); 49 } 50 51 public Category getCategory() { 52 return currentCategory; 53 } 54 55 public void removePropertyChangeListener(PropertyChangeListener listener) { 56 changeSupport.removePropertyChangeListener(listener); 57 } 58 59 public void removePropertyChangeListener(String name, PropertyChangeListener listener) { 60 changeSupport.removePropertyChangeListener(name, listener); 61 } 62 63 public void setCategory(Category category) { 64 if (category == null) { 65 throw new IllegalArgumentException ("category cannot be null"); 66 } 67 Category oldcat = currentCategory; 68 currentCategory = category; 69 changeSupport.firePropertyChange(PROP_CATEGORY, oldcat, category); 70 } 71 } 72 | Popular Tags |