| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.runtime.common.bean; |
| |
| import java.beans.PropertyChangeSupport; |
| |
| @SuppressWarnings("serial") |
| public class IdentityPropertyChangeSupport extends PropertyChangeSupport { |
| |
| // private Object source; |
| |
| public IdentityPropertyChangeSupport(Object source) { |
| super(source); |
| // this.source = source; |
| } |
| |
| // public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { |
| // if (oldValue == null || newValue == null || !valuesEqual(oldValue, newValue)) { |
| // firePropertyChange(new PropertyChangeEvent(source, propertyName, oldValue, newValue)); |
| // } |
| // } |
| // |
| // public void firePropertyChange(PropertyChangeEvent event) { |
| // Object oldValue = event.getOldValue(); |
| // Object newValue = event.getNewValue(); |
| // if (oldValue == null || newValue == null || !valuesEqual(oldValue, newValue)) { |
| // String name = event.getPropertyName(); |
| // |
| // PropertyChangeListener[] common = getPropertyChangeListeners(null); |
| // fireEvent(common, event); |
| // |
| // PropertyChangeListener[] named = (name != null) ? getPropertyChangeListeners(name) : null; |
| // fireEvent(named, event); |
| // } |
| // } |
| // |
| // public void fireIndexedPropertyChange(String propertyName, int index, Object oldValue, Object newValue) { |
| // if (oldValue == null || newValue == null || !valuesEqual(oldValue, newValue)) { |
| // firePropertyChange(new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index)); |
| // } |
| // } |
| // |
| // private boolean valuesEqual(Object oldValue, Object newValue) { |
| // if (isAnnotationPresent(oldValue.getClass())) { |
| // return oldValue == newValue; |
| // } |
| // return oldValue.equals(newValue); |
| // } |
| // |
| // protected boolean isAnnotationPresent(final Class<?> clazz) { |
| // if (clazz.isAnnotationPresent(EqualByIdentity.class)) { |
| // return true; |
| // } |
| // for (Class<?> i : clazz.getInterfaces()) { |
| // if (i.isAnnotationPresent(EqualByIdentity.class)) |
| // return true; |
| // } |
| // return false; |
| // } |
| // |
| // protected void fireEvent(PropertyChangeListener[] listeners, PropertyChangeEvent event) { |
| // if (listeners != null) { |
| // for (PropertyChangeListener listener : listeners) { |
| // listener.propertyChange(event); |
| // } |
| // } |
| // } |
| } |