Class EditChangeManager


  • public class EditChangeManager
    extends java.lang.Object
    Defines a class to keep history of edit changes. The main attributes are: cached fetures: current set of abstract features new features: contains keys (String) of new features removed features: contains keys (String) of removed features modified features: contains keys (String) of modified features change events: contains a list of change events update change list: contains the updates of each feature to allow identify which attributes have changed. This class is used by the data set edit classes, and in general the user does not create an instance of this class in its application.
    • Constructor Detail

      • EditChangeManager

        public EditChangeManager​(java.util.Hashtable<java.lang.String,​AbstractFeature> features,
                                 AbstractDataSet dataSet)
        Constructor
        Parameters:
        features - feature set from a edit data set
    • Method Detail

      • setFeatures

        public void setFeatures​(java.util.Hashtable<java.lang.String,​AbstractFeature> features)
        Set the current feature set.
        Parameters:
        features -
      • clearChanges

        public void clearChanges()
        Clears all changes.
      • getFeature

        public AbstractFeature getFeature​(java.lang.String key)
        Gets the abstract feature.
        Parameters:
        key - feature key.
        Returns:
      • removeFeature

        public boolean removeFeature​(java.lang.String key)
                              throws java.lang.Exception
        Registers that feature is removed.
        Parameters:
        key - feature key
        Returns:
        Throws:
        java.lang.Exception
      • addFeature

        public boolean addFeature​(java.lang.String key,
                                  AbstractFeature feature)
                           throws java.lang.Exception
        Registers the addition of a new feature.
        Parameters:
        key - feture key value
        feature - abstract feature object
        Throws:
        java.lang.Exception
      • updateFeature

        public boolean updateFeature​(java.lang.String key,
                                     java.lang.Object newObject,
                                     int updateType)
                              throws java.lang.Exception
        Registers an update in the feature. The update may be a change on the spatial attribute, a change on a single non-spatial attribute, or a change in multiple non-spatial attributes. Spatial change: object type is of one spatial class (JGeometry, AnnotationText, ...). Attribute change: object type is of Field class. Multi attribute change: object type is of Field[] elements.
        Parameters:
        key - feature key value
        newObject - change object
        updateType - defines the type of update change
        Returns:
        Throws:
        java.lang.Exception
      • isNewFeature

        public boolean isNewFeature​(java.lang.String key)
        Parameters:
        key -
        Returns:
      • getNewFeatures

        public java.lang.String[] getNewFeatures()
        Returns:
      • isRemovedFeature

        public boolean isRemovedFeature​(java.lang.String key)
        Parameters:
        key -
        Returns:
      • getRemovedFeatures

        public java.lang.String[] getRemovedFeatures()
        Returns:
      • getModifiedFeatures

        public java.lang.String[] getModifiedFeatures()
        Returns:
      • isModifiedFeature

        public boolean isModifiedFeature​(java.lang.String key)
        Parameters:
        key -
        Returns:
      • hasChanges

        public boolean hasChanges()
        Returns if any feature has been modified or removed, or if new Geometries has been added.
        Returns:
      • undo

        public void undo​(EditChangeEvent change)
        Restores the last edit operation.
      • redo

        public void redo​(EditChangeEvent change)
        Restores the last edit operation.
      • hasSpatialAttributeChanged

        public boolean hasSpatialAttributeChanged​(java.lang.String key)
        Returns if spatial attribute of modified feature has changed. For new and removed features this method returns false.
        Parameters:
        key -
        Returns:
      • getChangedAttributesOfModifiedFeature

        public java.lang.String[] getChangedAttributesOfModifiedFeature​(java.lang.String key)
        Returns the attribute names of modified features that have the values changed. For new and removed features this method returns null.
        Parameters:
        key -
        Returns:
      • setHoldLayerUpdate

        public void setHoldLayerUpdate​(boolean holdLayerUpdate)
      • isHoldLayerUpdate

        public boolean isHoldLayerUpdate()