@Override @FormData public void setAnordnungsTage(Gueltigkeitstage anordnungsTage) { m_anordnungsTage = anordnungsTage; propertySupport.setProperty(PROP_ANORDNUNGSTAGE, anordnungsTage); }
@Override protected void handleScoutPropertyChange(String name, Object newValue) { if ((name.equals(ITagesfilterField.PROP_FP)) || (name.equals(ITagesfilterField.PROP_ANORDNUNGSTAGE)) || (name.equals(ITagesfilterField.PROP_OPTIONSTAGE)) || (name.equals(ITagesfilterField.PROP_UNSELEKTIERBAR))) { System.out.println("Updating Tagesfilter because of property: " + name); updateKalenderFromScout(); } else { System.out.println("No need to update Tagesfilter because of property: " + name); } super.handleScoutPropertyChange(name, newValue); }
P_UIFacade.selectionChanged(Date date, boolean selection) { Gueltigkeitstage at = getAnordnungsTage(); at.modify(date, selection); setAnordnungsTage(); } @Override @FormData public void setAnordnungsTage(Gueltigkeitstage anordnungsTage) { m_anordnungsTage = anordnungsTage; propertySupport.setProperty(PROP_ANORDNUNGSTAGE, anordnungsTage); }
@Override @FormData public void setAnordnungsTage(Gueltigkeitstage anordnungsTage) { m_anordnungsTage = new Gueltigkeitstage(anordnungsTage); propertySupport.setProperty(PROP_ANORDNUNGSTAGE, anordnungsTage); }
public boolean BasicPropertySupport.setProperty(String name, Object newValue, Object defaultOldValueWhenNull) { Object oldValue = m_props.get(name); // this will return the reference to the object stored with the last call, which is the same as the reference to the new object if (oldValue == null) { oldValue = defaultOldValueWhenNull; } m_props.put(name, newValue); if (CompareUtility.equals(oldValue, newValue)) { // returns true if oldValue == newValue // no change return false; } else { firePropertyChangeImpl(name, oldValue, newValue); return true; } }
You are probably right. If your "Gueltigkeitstage" is mutable and you change some of the field values, the reference is kept but the value represented by the bean is different. Without seeing the case I can not tell.
CompareUtility.equals(oldValue, newValue) => goes on oldValue.equals(newValue) not on "oldValue == newValue" (this utility function also handle some wired cases).