Class AbstractDataset

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private DatasetGroup group
      The group that the dataset belongs to.
      private javax.swing.event.EventListenerList listenerList
      Storage for registered change listeners.
      private boolean notify
      A flag that can be used to temporarily suppress dataset change event notifications.
      private static long serialVersionUID
      For serialization.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractDataset()
      Constructs a dataset.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChangeListener​(DatasetChangeListener listener)
      Registers an object to receive notification of changes to the dataset.
      boolean canEqual​(java.lang.Object other)
      Ensures symmetry between super/subclass implementations of equals.
      java.lang.Object clone()
      Returns a clone of the dataset.
      boolean equals​(java.lang.Object obj)  
      protected void fireDatasetChanged()
      Notifies all registered listeners that the dataset has changed, provided that the notify flag has not been set to false.
      DatasetGroup getGroup()
      Returns the dataset group for the dataset.
      boolean getNotify()
      Returns the value of the notify flag.
      int hashCode()  
      boolean hasListener​(java.util.EventListener listener)
      Returns true if the specified object is registered with the dataset as a listener.
      protected void notifyListeners​(DatasetChangeEvent event)
      Notifies all registered listeners that the dataset has changed.
      private void readObject​(java.io.ObjectInputStream stream)
      Restores a serialized object.
      void removeChangeListener​(DatasetChangeListener listener)
      Deregisters an object so that it no longer receives notification of changes to the dataset.
      void setGroup​(DatasetGroup group)
      Sets the dataset group for the dataset.
      void setNotify​(boolean notify)
      Sets the notify flag, which controls whether or not the fireDatasetChanged() method notifies listeners.
      void validateObject()
      Validates the object.
      private void writeObject​(java.io.ObjectOutputStream stream)
      Handles serialization.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        For serialization.
        See Also:
        Constant Field Values
      • group

        private DatasetGroup group
        The group that the dataset belongs to.
      • listenerList

        private transient javax.swing.event.EventListenerList listenerList
        Storage for registered change listeners.
      • notify

        private boolean notify
        A flag that can be used to temporarily suppress dataset change event notifications.
    • Constructor Detail

      • AbstractDataset

        protected AbstractDataset()
        Constructs a dataset. By default, the dataset is assigned to its own group.
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • canEqual

        public boolean canEqual​(java.lang.Object other)
        Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.
        Parameters:
        other - Object
        Returns:
        true ONLY if the parameter is THIS class type
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • setGroup

        public void setGroup​(DatasetGroup group)
        Sets the dataset group for the dataset.
        Specified by:
        setGroup in interface Dataset
        Parameters:
        group - the group (null not permitted).
        See Also:
        getGroup()
      • getNotify

        public boolean getNotify()
        Returns the value of the notify flag. The default value is true. If this is false, calls to the fireDatasetChanged() method will NOT trigger a dataset change event.
        Returns:
        A boolean.
      • setNotify

        public void setNotify​(boolean notify)
        Sets the notify flag, which controls whether or not the fireDatasetChanged() method notifies listeners. Setting this flag to true will trigger a DatasetChangeEvent because there may be queued up changes.
        Parameters:
        notify - the new flag value.
      • fireDatasetChanged

        protected void fireDatasetChanged()
        Notifies all registered listeners that the dataset has changed, provided that the notify flag has not been set to false.
        See Also:
        addChangeListener(DatasetChangeListener)
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Returns a clone of the dataset. The cloned dataset will NOT include the DatasetChangeListener references that have been registered with this dataset.
        Overrides:
        clone in class java.lang.Object
        Returns:
        A clone.
        Throws:
        java.lang.CloneNotSupportedException - if the dataset does not support cloning.
      • writeObject

        private void writeObject​(java.io.ObjectOutputStream stream)
                          throws java.io.IOException
        Handles serialization.
        Parameters:
        stream - the output stream.
        Throws:
        java.io.IOException - if there is an I/O problem.
      • readObject

        private void readObject​(java.io.ObjectInputStream stream)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Restores a serialized object.
        Parameters:
        stream - the input stream.
        Throws:
        java.io.IOException - if there is an I/O problem.
        java.lang.ClassNotFoundException - if there is a problem loading a class.
      • validateObject

        public void validateObject()
                            throws java.io.InvalidObjectException
        Validates the object. We use this opportunity to call listeners who have registered during the deserialization process, as listeners are not serialized. This method is called by the serialization system after the entire graph is read. This object has registered itself to the system with a priority of 10. Other callbacks may register with a higher priority number to be called before this object, or with a lower priority number to be called after the listeners were notified. All listeners are supposed to have register by now, either in their readObject or validateObject methods. Notify them that this dataset has changed.
        Specified by:
        validateObject in interface java.io.ObjectInputValidation
        Throws:
        java.io.InvalidObjectException - If the object cannot validate itself.