Class EventSupport

    • Field Detail

      • LOG

        public static final org.apache.logging.log4j.Logger LOG
    • Method Detail

      • startLogEvents

        public void startLogEvents()
        All property change fires after this call will be cached until stopLogEvents invoked. Calls to this method can be nested. If this method is called 2 times stopLogEvents must be called 2 times to fire all accumulated events.
      • stopLogEvents

        public void stopLogEvents()
        Fires all events cached between startLogEvents and this call.
      • firePropertyChange

        public void firePropertyChange​(javax.jmi.reflect.RefBaseObject source,
                                       java.lang.String propertyName,
                                       @CheckForNull
                                       java.lang.Object oldValue,
                                       @CheckForNull
                                       java.lang.Object newValue)
      • fireInstanceDeletedEvent

        public void fireInstanceDeletedEvent​(javax.jmi.reflect.RefBaseObject source,
                                             java.lang.Object deleted,
                                             @CheckForNull
                                             java.lang.Object oldDirectContainer)
        Fires event about an instance delete.
        Parameters:
        source - source of the event.
        deleted - element that was deleted.
        oldDirectContainer - old direct container (feature data set or resource).
      • firePropertyChange

        public void firePropertyChange​(javax.jmi.reflect.RefBaseObject source,
                                       java.lang.String propertyName,
                                       @CheckForNull
                                       java.lang.Object oldValue,
                                       @CheckForNull
                                       java.lang.Object newValue,
                                       int index)
      • firePropertyChange

        public void firePropertyChange​(javax.jmi.reflect.RefBaseObject source,
                                       java.lang.String propertyName,
                                       @CheckForNull
                                       java.lang.Object oldValue,
                                       @CheckForNull
                                       java.lang.Object newValue,
                                       int index,
                                       int newIndex)
      • firePropertyChange

        public void firePropertyChange​(java.beans.PropertyChangeEvent evt)
        Fires property change event.
        Parameters:
        evt - event
      • addPropertyChangeListener

        public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener,
                                              @CheckForNull
                                              javax.jmi.reflect.RefObject attachTo)
        Description copied from interface: RepositoryListenerRegistry
        Adds listener for element. Listens all events for this element.
        Specified by:
        addPropertyChangeListener in interface RepositoryListenerRegistry
        Parameters:
        listener - listener to add
        attachTo - element to listen. Can be null. If null listens all repository elements.
      • addPropertyChangeListener

        public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener,
                                              @CheckForNull
                                              java.lang.String propertyName)
        Description copied from interface: RepositoryListenerRegistry
        Adds listener to all elements and listens only for one property change.
        Specified by:
        addPropertyChangeListener in interface RepositoryListenerRegistry
        Parameters:
        listener - listener to add
        propertyName - property name to listen
      • addPropertyChangeListener

        public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener,
                                              @CheckForNull
                                              javax.jmi.reflect.RefObject attachTo,
                                              java.util.List propertyNames)
        Description copied from interface: RepositoryListenerRegistry
        Adds listener to given element and listens only for given property change.
        Specified by:
        addPropertyChangeListener in interface RepositoryListenerRegistry
        Parameters:
        listener - listener to add
        attachTo - element to listen. Can be null. If null listens all repository elements.
        propertyNames - property names to listen.
      • addPropertyChangeListener

        public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener,
                                              @CheckForNull
                                              javax.jmi.reflect.RefObject attachTo,
                                              @CheckForNull
                                              java.lang.String propertyName)
        Description copied from interface: RepositoryListenerRegistry
        Adds listener to given element and listens only for given property change.
        Specified by:
        addPropertyChangeListener in interface RepositoryListenerRegistry
        Parameters:
        listener - listener
        attachTo - element which events listener want to listen. In case null it listens all events from repository
        propertyName - name of the property
      • removePropertyChangeListener

        public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener,
                                                 @CheckForNull
                                                 javax.jmi.reflect.RefObject removeFrom)
        Description copied from interface: RepositoryListenerRegistry
        Removes property change listener
        Specified by:
        removePropertyChangeListener in interface RepositoryListenerRegistry
        Parameters:
        listener - listener to remove.
        removeFrom - element from which listener can be removed. Can be null, then listener will be removed from all repository.
      • removePropertyChangeListener

        public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener,
                                                 javax.jmi.reflect.RefObject removeFrom,
                                                 java.util.List propertyNames)
        Description copied from interface: RepositoryListenerRegistry
        Removes property change listener
        Specified by:
        removePropertyChangeListener in interface RepositoryListenerRegistry
        Parameters:
        listener - listener to remove
        removeFrom - element from which remove listener. If null removes from all repository.
        propertyNames - property names from which remove listener.
      • removePropertyChangeListener

        public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener,
                                                 @CheckForNull
                                                 java.lang.String propertyName)
        Description copied from interface: RepositoryListenerRegistry
        Removes property change listener.
        Specified by:
        removePropertyChangeListener in interface RepositoryListenerRegistry
        Parameters:
        listener - listener
        propertyName - name of the property
      • removePropertyChangeListener

        public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener,
                                                 @CheckForNull
                                                 javax.jmi.reflect.RefObject removeFrom,
                                                 @CheckForNull
                                                 java.lang.String propertyName)
        Description copied from interface: RepositoryListenerRegistry
        Removes property change listener.
        Specified by:
        removePropertyChangeListener in interface RepositoryListenerRegistry
        Parameters:
        listener - listener
        removeFrom - element which events listener do not want to listen. In case null remove listeners all events from repository
        propertyName - name of the property
      • isEnableEventFiring

        public boolean isEnableEventFiring()
        Determines whether event firing is enabled. Given that event firing is enabled does not guarantee that events will be actually fired. Events may not be fired if event delivery has been stopped via stopEventDelivery()
        Returns:
        true if event firing is enabled, false otherwise
      • stopEventDelivery

        public void stopEventDelivery()
        Stops event delivery. Even non-masked event listeners will not receive events until event delivery is restored. UML2MetamodelConstants.EVENT_FIRE_STOP is fired to repository property change listeners if event firing was enabled before stopping event delivery
      • restoreEventDelivery

        public void restoreEventDelivery​(ModifiedElements modifiedElements)
        Restores event delivery. Non-masked event listeners will start getting events again. If event firing was not disabled via setEnableEventFiring(boolean) then other event listeners will start getting events and UML2MetamodelConstants.EVENT_FIRE_START will be fired for repository property change listeners
        Parameters:
        modifiedElements - provider for changed elements
      • invokeAfterTransaction

        public void invokeAfterTransaction​(java.lang.Runnable r)
        If at the current moment firing cached events, running runnable after these events are fired. Running now in other case.
        Parameters:
        r - Runnable to run.
      • getEventsCount

        public long getEventsCount()
        Returns:
        number of changes in repository since its creation. Any change in the model increase this counter;
      • getNonMaskedModelListeners

        public NonMaskedEventSupport getNonMaskedModelListeners()
        Returns:
        ModelListener which sends notification even event fire is disabled.
      • isModelCleanAfterEventsStopped

        public static boolean isModelCleanAfterEventsStopped​(java.beans.PropertyChangeEvent event)
        Parameters:
        event - event with name EVENT_FIRE_START
        Returns:
        true if model is the same when EVENT_FIRE_STOP and EVENT_FIRE_START events are fired.