/* (non-Javadoc)
  * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
  */
 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
   this.viewer = (TableViewer) viewer;
   if (oldInput != null) {
     ((Observable) oldInput).deleteObserver(this);
   }
   if (newInput != null) {
     this.messages = (MessageCollector) newInput;
     messages.addObserver(this);
   }
 }
 /**
  * Defines the constraint which is applied to the list model elements
  *
  * @param constraint the constraint to set
  * @throws IllegalArgumentException if constraint is null
  */
 public final void setConstraint(Constraint constraint) {
   Assert.notNull(constraint);
   if (!constraint.equals(this.constraint)) {
     if (this.constraint instanceof Observable) {
       ((Observable) constraint).deleteObserver(this);
     }
     this.constraint = constraint;
     if (constraint instanceof Observable) {
       ((Observable) constraint).addObserver(this);
     }
     fireContentsChanged(this, -1, -1);
   }
 }
 protected void disableEndObjectObserving(/*ShapeGraphicalRepresentation<?> anEndObject*/ ) {
   if (
   /*anEndObject != null &&*/ enabledEndObjectObserving) {
     /*anEndObject.deleteObserver(this);
     if (!isDeserializing()) {
     	for (Object o : anEndObject.getAncestors())
     		if (getGraphicalRepresentation(o) != null) getGraphicalRepresentation(o).deleteObserver(this);
     }*/
     for (Observable o : observedEndObjects) {
       o.deleteObserver(this);
     }
     enabledEndObjectObserving = false;
   }
 }
 @Override
 public void update(Observable o, Object arg) {
   parkingTime--;
   if (parkingTime == 0 && parkingSlot != null) {
     LOG.debug("Car {} leaves {}", id, parkingSlot);
     parkingSlotProvider.getObject(parkingSlot).clear();
     parkingSlot = null;
     o.deleteObserver(this);
     putData = false;
     parkingTime = -1;
     heuristic = heuristic.copy();
     setChanged();
     notifyObservers(CarState.Free);
   }
   if ((o instanceof Street) && (arg instanceof Long)) {
     if (putData) {
       Integer distance =
           parkingSlot == null ? -1 : parkingSlotProvider.getObject(parkingSlot).getDistance();
       // Write the data set to the database. -1 since the decision is made in the previous click
       simulationDataCollector.putCarData(id, distance, (Long) arg - 1);
       putData = false;
     }
   }
 }
Exemple #5
0
 @Override
 protected void removeNotify() {
   if (notifier != null) {
     notifier.deleteObserver(observer);
   }
 }
 @Override
 public void deleteObserver(Observer o) {
   super.deleteObserver(o);
   obs.remove(o);
 }
 @Override
 public void deleteObserver(Observer o) {
   observable.deleteObserver(o);
 }
Exemple #8
0
 /**
  * Delete observer.
  *
  * @param o the o
  */
 public void deleteObserver(final Observer o) {
   if (observable != null) {
     observable.deleteObserver(o);
   }
 }