List of usage examples for java.beans PropertyChangeSupport PropertyChangeSupport
public PropertyChangeSupport(Object sourceBean)
From source file:com.toolsverse.mvc.model.ModelImpl.java
/** * Instantiates a new ModelImpl. The constructor reads the annotations and sets the values for the getter\setter\reader\writer\params attributes. *///from w w w . j a v a2s.c om public ModelImpl() { _updateDirtyOnChange = false; _silentUpdate = false; _isDirty = false; _suffix = null; _attributes = new LinkedHashMap<String, Attribute>(); _propertyChangeSupport = new PropertyChangeSupport(this); _subModels = new ArrayList<Model>(); Method[] methods = getClass().getMethods(); List<TypedKeyValue<Method, Annotation>> readers = new ArrayList<TypedKeyValue<Method, Annotation>>(); List<TypedKeyValue<Method, Annotation>> writers = new ArrayList<TypedKeyValue<Method, Annotation>>(); for (Method method : methods) { Annotation[] annotations = method.getDeclaredAnnotations(); if (annotations != null) for (Annotation annotation : annotations) { if (annotation instanceof Getter && isGetterMethod(method)) { Attribute attr = getAttribute(((Getter) annotation).name()); Object attrParams = getAttrParams(((Getter) annotation).paramsClass()); if (attr == null) { attr = new Attribute(method.getReturnType(), method.getName(), null, attrParams); _attributes.put(((Getter) annotation).name(), attr); } else { attr.setGetter(method.getName()); attr.setAttributeClass(method.getReturnType()); if (attr.getParams() == null && attrParams != null) attr.setParams(attrParams); } } else if (annotation instanceof Setter && isSetterMethod(method)) { Attribute attr = getAttribute(((Setter) annotation).name()); Object attrParams = getAttrParams(((Setter) annotation).paramsClass()); if (attr == null) { attr = new Attribute(method.getParameterTypes()[0], null, method.getName(), attrParams); _attributes.put(((Setter) annotation).name(), attr); } else { attr.setSetter(method.getName()); if (attr.getAttributeClass() == null) attr.setAttributeClass(method.getParameterTypes()[0]); if (attr.getParams() == null && attrParams != null) attr.setParams(attrParams); } } else if (annotation instanceof Reader && isReaderMethod(method)) { readers.add(new TypedKeyValue<Method, Annotation>(method, annotation)); } else if (annotation instanceof Writer && isWriterMethod(method)) { writers.add(new TypedKeyValue<Method, Annotation>(method, annotation)); } } } for (TypedKeyValue<Method, Annotation> keyValue : readers) { Attribute attr = getAttribute(((Reader) keyValue.getValue()).name()); Object attrParams = getAttrParams(((Reader) keyValue.getValue()).paramsClass()); if (attr == null) { attr = new Attribute(keyValue.getKey().getParameterTypes()[0], null, null, attrParams, keyValue.getKey().getName(), null); _attributes.put(((Reader) keyValue.getValue()).name(), attr); } else { attr.setReader(keyValue.getKey().getName()); if (attr.getAttributeClass() == null) attr.setAttributeClass(keyValue.getKey().getParameterTypes()[0]); if (attr.getParams() == null && attrParams != null) attr.setParams(attrParams); } } for (TypedKeyValue<Method, Annotation> keyValue : writers) { Attribute attr = getAttribute(((Writer) keyValue.getValue()).name()); Object attrParams = getAttrParams(((Writer) keyValue.getValue()).paramsClass()); if (attr == null) { attr = new Attribute(keyValue.getKey().getReturnType(), keyValue.getKey().getName(), null, attrParams); _attributes.put(((Writer) keyValue.getValue()).name(), attr); } else { attr.setWriter(keyValue.getKey().getName()); if (attr.getAttributeClass() == null) attr.setAttributeClass(keyValue.getKey().getParameterTypes()[0]); if (attr.getParams() == null && attrParams != null) attr.setParams(attrParams); } } }
From source file:com.kenai.redminenb.query.RedmineQuery.java
public RedmineQuery(String name, RedmineRepository repository, String urlParameters, boolean saved, boolean urlDef, boolean initControler) { this.name = name; this.repository = repository; this.saved = saved; this.urlParameters = urlParameters; // this.initialUrlDef = urlDef; // this.lastRefresh = repository.getIssueCache().getQueryTimestamp(getStoredQueryName()); this.issues = new HashSet<>(); this.support = new PropertyChangeSupport(this); /*/* ww w . j av a 2 s . co m*/ Map<String, RedmineQueryParameter> m = queryController.getSearchParameters(); StringBuilder sb = new StringBuilder(); for (Map.Entry<String, RedmineQueryParameter> e : m.entrySet()) { sb.append(e.getKey()); sb.append("="); sb.append(e.getValue().toString()); sb.append(";;"); } return sb.toString(); */ }
From source file:de.awtools.bean.EventMediator.java
/** * Konstruktor./*from w w w . j a v a 2s.c o m*/ * * @param sourceBean * Das Bean als Quelle der Events. */ public EventMediator(final Object sourceBean) { Validate.notNull(sourceBean); support = new PropertyChangeSupport(sourceBean); }
From source file:com.glweb.util.GlobalProperties.java
protected PropertyChangeSupport getPropertySupport() { if (null == _propertySupport) { _propertySupport = new PropertyChangeSupport(getInstance()); }// w w w .j ava 2 s .c o m return _propertySupport; }
From source file:BeanVector.java
/** * This contructs a new BeanVector with PropertyChangeEvent support. * @param indexPropertyName the property name of the parent object to fire events for * @param changeOwner the owner object that change events should "come from" *//*from w ww . j av a 2 s . co m*/ public BeanVector(String indexPropertyName, Object changeOwner) { this(); this.indexPropertyName = indexPropertyName; this.changes = new PropertyChangeSupport(changeOwner); }
From source file:BeanArrayList.java
/** * This contructs a new BeanArrayList with PropertyChangeEvent support. * @param indexPropertyName the property name of the parent object to fire events for * @param changeOwner the owner object that change events should "come from" *///from w w w . ja v a2s . c o m public BeanArrayList(String indexPropertyName, Object changeOwner) { this(); this.indexPropertyName = indexPropertyName; this.changes = new PropertyChangeSupport(changeOwner); }
From source file:no.ntnu.idi.socialhitchhiking.SocialHitchhikingApplication.java
@Override public void onCreate() { super.onCreate(); notifs = 0;/*from w ww .j a v a2 s . c o m*/ am = (AlarmManager) getSystemService(ALARM_SERVICE); keyMap = new HashMap<String, Boolean>(); keyMap.put("alarmService", false); keyMap.put("main", false); keyMap.put("inbox", false); props = new PropertyChangeSupport(this); newNotifications = false; settings = new SettingsManager(this); startJourneyReminder(); }
From source file:au.org.ala.delta.editor.model.EditorDataModel.java
public EditorDataModel(AbstractObservableDataSet dataSet) { super(dataSet); _propertyChangeSupport = new PropertyChangeSupport(this); _preferenceChangeListeners = new ArrayList<PreferenceChangeListener>(); _selectedState = -1;/*from ww w. j a v a2s. c om*/ _selectedCharacter = null; _selectedItem = null; _tempName = ""; _modified = false; EditorPreferences.addPreferencesChangeListener(this); }
From source file:com.anrisoftware.prefdialog.miscswing.multichart.freechart.FreechartXYChart.java
private Object resolveObject() { this.p = new PropertyChangeSupport(this); this.mouseScrollListener = new MouseWheelListener() { @Override//from w w w . j a v a2 s . com public void mouseWheelMoved(MouseWheelEvent e) { if (model == null) { return; } if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { int offset = model.getOffset(); setOffset(offset + e.getUnitsToScroll()); } } }; this.modelListener = new ChartModelListener() { @Override public void chartChanged(ChartModelEvent e) { updateChart(e); } }; return this; }
From source file:org.jfree.data.general.Series.java
/** * Creates a new series with the specified key and description. * * @param key the series key (<code>null</code> NOT permitted). * @param description the series description (<code>null</code> permitted). *///from w ww . j a v a 2s . c om protected Series(Comparable key, String description) { ParamChecks.nullNotPermitted(key, "key"); this.key = key; this.description = description; this.listeners = new EventListenerList(); this.propertyChangeSupport = new PropertyChangeSupport(this); this.vetoableChangeSupport = new VetoableChangeSupport(this); this.notify = true; }