Always check PropertyChangeSupport for null

This commit is contained in:
Marcel Kronfeld
2010-09-14 16:23:20 +00:00
parent 07451b5e61
commit 53d9762da5
20 changed files with 95 additions and 115 deletions

View File

@@ -150,10 +150,12 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
}
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -168,16 +168,13 @@ public class BigStringEditor implements PropertyEditor {
return m_Panel;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -472,16 +472,14 @@ implements PropertyEditor {
public Component getCustomEditor() {
return this;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -215,17 +215,13 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
return null;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -182,17 +182,13 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
return null;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -199,17 +199,13 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
return null;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -76,17 +76,13 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
return null;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -161,17 +161,13 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
return null;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -491,10 +491,12 @@ public class GenericObjectEditor implements PropertyEditor {
m_EditorComponent.m_okBut.setEnabled(false);
}
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}
/**

View File

@@ -364,10 +364,12 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/********************************* java.beans.PropertyChangeListener *************************/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}
/** This will wait for the GenericObjectEditor to finish

View File

@@ -430,10 +430,12 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/********************************* java.beans.PropertyChangeListener *************************/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}
/** This will wait for the GenericObjectEditor to finish

View File

@@ -397,17 +397,13 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
return null;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -206,17 +206,13 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
return null;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}

View File

@@ -59,10 +59,14 @@ public class MultiLineStringEditor implements PropertyEditor {
// This code uses the PropertyChangeSupport class to maintain a list of
// listeners interested in the edits we make to the value.
protected PropertyChangeSupport listeners = new PropertyChangeSupport(this);
public void addPropertyChangeListener(PropertyChangeListener l) {
if (listeners == null) listeners = new PropertyChangeSupport(this);
listeners.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
if (listeners == null) listeners = new PropertyChangeSupport(this);
listeners.removePropertyChangeListener(l);
}
}

View File

@@ -105,10 +105,12 @@ public class PropertySelectableList<T> implements java.io.Serializable {
// }
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}
}

View File

@@ -110,18 +110,14 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
m_support.addPropertyChangeListener(this);
}
/** Adds a PropertyChangeListener.
* @param l a value of type 'PropertyChangeListener'
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_support!=null) m_support.addPropertyChangeListener(l);
if (m_support == null) m_support = new PropertyChangeSupport(this);
m_support.addPropertyChangeListener(l);
}
/** Removes a PropertyChangeListener.
* @param l a value of type 'PropertyChangeListener'
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_support!=null) m_support.removePropertyChangeListener(l);
if (m_support == null) m_support = new PropertyChangeSupport(this);
m_support.removePropertyChangeListener(l);
}
/**

View File

@@ -120,16 +120,13 @@ public class StatisticsEditor implements PropertyEditor {
return m_Panel;
}
/**
*
*/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
/**
*
*/
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}
}

View File

@@ -426,10 +426,12 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit
/********************************* java.beans.PropertyChangeListener *************************/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}
/** This will wait for the GenericObjectEditor to finish

View File

@@ -401,10 +401,12 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito
/********************************* java.beans.PropertyChangeListener *************************/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}
/** This will wait for the GenericObjectEditor to finish

View File

@@ -41,10 +41,12 @@ public abstract class AbstractObjectEditor implements PropertyEditor, java.beans
/********************************* java.beans.PropertyChangeListener *************************/
public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l);
}
/** This will wait for the GenericObjectEditor to finish