use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntity method notifyChanged.
protected final void notifyChanged(Object oldValue, Object newValue) {
if (newValue == oldValue || (newValue != null && oldValue != null && newValue.equals(oldValue)))
return;
FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
wGetEntityChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
wGetCompoundChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntity method notifyRequested.
protected final Date notifyRequested(Date value) {
if (requestNotificationDisabled)
return value;
FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
Date result = wGetEntityRequestEventHandler().notifyRequested(this, fd, value);
return wGetCompoundRequestEventHandler().notifyRequested(this, fd, result);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntity method notifyRequested.
protected final double notifyRequested(double value) {
if (requestNotificationDisabled)
return value;
FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
double result = wGetEntityRequestEventHandler().notifyRequested(this, fd, value);
return wGetCompoundRequestEventHandler().notifyRequested(this, fd, result);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntity method notifyRequested.
@SuppressWarnings("unchecked")
protected final <E extends IEntity> E notifyRequested(int index, E value) {
if (requestNotificationDisabled)
return value;
FeatureDescriptor fd = CommonsFeatureDescriptorEnum.composite_element;
IEntity value0 = value.wGetAdaptee(false);
IEntity result = wGetEntityRequestEventHandler().notifyRequested(this, fd, index, value0);
result = wGetCompoundRequestEventHandler().notifyRequested(this, fd, index, result);
return result == value0 ? value : (E) result;
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractEntity method notifyChanged.
protected final void notifyChanged(FeatureDescriptor fd, IEntity oldValue, IEntity newValue, boolean isContainment) {
if (oldValue == null)
oldValue = NullEntity.instance;
final IEntity oldValue0 = oldValue.wGetAdaptee(false);
final IEntity newValue0 = newValue.wGetAdaptee(false);
if (newValue0 == oldValue0)
return;
final InternalIEntity internalOldValue = (InternalIEntity) oldValue;
final InternalIEntity internalNewValue = (InternalIEntity) newValue;
EntityDescriptor<?> thisEd = wGetEntityDescriptor();
FeatureDescriptor oppositeFd;
if (thisEd.has(fd))
// getOppositeFeatureDescriptor(fd);
oppositeFd = thisEd.getEntityFeatureDescriptor(fd).getOppositeFeatureDescriptor();
else {
EntityDescriptor<?> oppositeEd = newValue.wGetEntityDescriptor();
oppositeFd = oppositeEd.getDirectFeatureDescriptor(fd);
if (oppositeFd != null)
thisEd = oppositeEd.getEntityDescriptor(oppositeFd);
}
if (oppositeFd != null) {
final EntityDescriptor<?> featureEd = thisEd.getEntityDescriptor(fd);
final boolean isToMany = featureEd.isToManyRelationship();
final boolean wasToManyImpl = isToMany && Matcher.matchImpl(featureEd, oldValue);
final boolean isToManyImpl = isToMany && Matcher.matchImpl(featureEd, newValue);
if (wasToManyImpl)
for (int i = 0, size = oldValue.wSize(); i < size; i++) oldValue.wGet(i).wRemove(oppositeFd, this);
else
oldValue.wRemove(oppositeFd, this);
if (isToManyImpl)
for (int i = 0, size = newValue.wSize(); i < size; i++) newValue.wGet(i).wAdd(oppositeFd, this, true);
else
newValue.wAdd(oppositeFd, this, true);
}
if (isContainment) {
internalOldValue.wRemoveParent(this);
internalNewValue.wSetModel(wGetActualModel());
internalNewValue.wSetParent(this);
} else {
internalOldValue.wRemoveInverseAdjacent(this);
if (!EntityUtils.hasParent(newValue))
internalNewValue.wSetModel(wGetActualModel());
internalNewValue.wAddInverseAdjacent(this);
}
wGetEntityChangeEventHandler().notifyChanged(this, fd, oldValue0, newValue0);
wGetCompoundChangeEventHandler().notifyChanged(this, fd, oldValue0, newValue0);
}
Aggregations