Example usage for java.util Observable deleteObserver

List of usage examples for java.util Observable deleteObserver

Introduction

In this page you can find the example usage for java.util Observable deleteObserver.

Prototype

public synchronized void deleteObserver(Observer o) 

Source Link

Document

Deletes an observer from the set of observers of this object.

Usage

From source file:com.android.aft.AFApplicationHelper.activity.AFFragmentActivity.java

protected void removeObservers() {
    for (final Observable obs : mLstObservables) {
        obs.deleteObserver(this);
    }//from  w  w  w  .j a va  2s.  co  m
}

From source file:ca.sfu.federation.model.Behavior.java

/**
 * Stop listening for changes from the environment. 
 *//*from   ww w  .  ja  v  a2s .c  o  m*/
public void release() {
    if (context instanceof Observable) {
        Observable observable = (Observable) this.context;
        observable.deleteObserver(this);
    }
}

From source file:ca.sfu.federation.model.ParametricModel.java

/**
 * Remove all Elements from the Systolic Array.
 *//*from   w  w  w .  java2  s .  com*/
public void clearAll() {
    // stop listening for changes on elements
    Iterator e = this.elements.iterator();
    while (e.hasNext()) {
        INamed named = (INamed) e.next();
        if (named instanceof Observable) {
            Observable o = (Observable) named;
            o.deleteObserver(this);
        }
    }
    // clear collections
    this.elements.clear();
    this.updateOrder.clear();
    // notify observers
    this.setChanged();
    this.notifyObservers(Integer.valueOf(ApplicationContext.EVENT_ELEMENT_DELETE_REQUEST));
}

From source file:ca.sfu.federation.model.ParametricModel.java

/**
 * Remove a NamedObject from the Context.
 *
 * @param Named The NamedObject to be removed.
 * @throws IllegalArgumentException The NamedObject does not exist in the
 * Context./*from  w w w  .  j  ava2s.co m*/
 */
public void remove(INamed Named) throws IllegalArgumentException {
    String itemName = Named.getName();
    LinkedHashMap elementsByName = (LinkedHashMap) this.getElementMap();
    if (elementsByName.containsKey(itemName)) {
        // stop listening on the NamedObject
        if (Named instanceof Observable) {
            Observable o = (Observable) Named;
            o.deleteObserver(this);
        }
        // remove the NamedObject from the collection
        this.elements.remove(Named);
        // notify observers
        this.setChanged();
        this.notifyObservers(Integer.valueOf(ApplicationContext.EVENT_ELEMENT_DELETED));
    } else {
        throw new IllegalArgumentException(
                "The object '" + itemName + "' does not exist in the current Context.");
    }
}

From source file:ca.sfu.federation.model.Assembly.java

/**
 * Remove all Elements from the Systolic Array.
 *///from  w  w  w  . j a v a 2  s. c o m
public void clearAll() {
    // stop listening for changes on elements
    Iterator it = this.elements.iterator();
    while (it.hasNext()) {
        INamed named = (INamed) it.next();
        if (named instanceof Observable) {
            Observable o = (Observable) named;
            o.deleteObserver(this);
        }
    }
    // clear collections
    this.elements.clear();
    // notify observers
    this.setChanged();
    this.notifyObservers(Integer.valueOf(ApplicationContext.EVENT_ELEMENT_DELETE_REQUEST));
}

From source file:ca.sfu.federation.model.Assembly.java

/**
 * Remove a NamedObject from the Context.
 * @param Named The NamedObject to be removed.
 * @throws IllegalArgumentException The NamedObject does not exist in the Context.
 *///from   w w  w  .j  a v a2s  . c  o m
@Override
public void remove(INamed Named) throws IllegalArgumentException {
    String childname = Named.getName();
    LinkedHashMap elementsByName = (LinkedHashMap) this.getElementMap();
    if (elementsByName.containsKey(childname)) {
        // stop listening on the NamedObject
        if (Named instanceof Observable) {
            Observable o = (Observable) Named;
            o.deleteObserver(this);
        }
        // remove the NamedObject from the collection
        this.elements.remove(Named);
        // notify observers
        this.setChanged();
        this.notifyObservers(Integer.valueOf(ApplicationContext.EVENT_ELEMENT_DELETED));
    } else {
        throw new IllegalArgumentException(
                "The object '" + childname + "' does not exist in the current Context.");
    }
}

From source file:ca.sfu.federation.model.Scenario.java

/**
 * Remove a NamedObject from the Scenario.
 * @param Named NamedObject to be removed.
 *//*  www .  j  a  v  a  2 s.c  o  m*/
public void remove(INamed Named) {
    boolean found = false;
    // if the object exists in the collection
    if (this.transactional.containsKey(Named.getName())) {
        found = true;
        // stop observing the object
        if (Named instanceof Observable) {
            Observable o = (Observable) Named;
            o.deleteObserver(this);
        }
        // remove the object from the collection
        this.transactional.remove(Named.getName());
    } else if (this.contextual.containsKey(Named.getName())) {
        found = true;
        // stop observing the object
        if (Named instanceof Observable) {
            Observable o = (Observable) Named;
            o.deleteObserver(this);
        }
        // remove the object from the collection
        this.contextual.remove(Named.getName());
    }
    // notify observers
    if (found) {
        this.setChanged();
        this.notifyObservers(Integer.valueOf(ApplicationContext.EVENT_ELEMENT_DELETED));
    }
}

From source file:de.hshannover.f4.trust.visitmeta.gui.GraphConnection.java

/**
 * Remove all nodes and edges from the graph.
 *///from  w  w  w. j  a  va2s .  c o m
public void clearGraph() {
    LOGGER.trace("Method clearGraph() called.");
    for (Observable vObserbale : mObservables.keySet()) {
        vObserbale.deleteObserver(this);
    }
    mObservables.clear();
    mGraphPanel.clearGraph();
}