Search in sources :

Example 41 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class AbstractEntity method notifyAdded.

protected final void notifyAdded(int index, IEntity newValue, boolean isContainment) {
    IEntity owner = wGetOwner();
    if (!EntityUtils.isNull(owner) && EntityUtils.isNotResolver(owner)) {
        EntityDescriptor<?> ownerEd = owner.wGetEntityDescriptor();
        FeatureDescriptor ownerFd = owner.wGetFeatureDescriptor(this);
        // was      	isContainment = !ownerEd.getEntityFeatureDescriptor(ownerFd).isReference();
        FeatureDescriptor oppositeFd;
        EntityDescriptor<?> oppositeEd;
        if (ownerEd.has(ownerFd)) {
            // ownerEd.getEntityDescriptor(ownerFd);
            oppositeEd = ownerFd.getEntityDescriptor();
            // ownerEd.getOppositeFeatureDescriptor(ownerFd);
            oppositeFd = ownerFd.getOppositeFeatureDescriptor();
        } else {
            oppositeEd = newValue.wGetEntityDescriptor();
            oppositeFd = oppositeEd.getDirectFeatureDescriptor(ownerFd);
            if (oppositeFd != null)
                ownerEd = oppositeEd.getEntityDescriptor(oppositeFd);
        }
        final EntityDescriptor<?> featureEd = ownerEd.getEntityDescriptor(ownerFd);
        final boolean isToMany = featureEd.isToManyRelationship();
        final boolean isToManyImpl = isToMany && Matcher.matchImpl(featureEd, this);
        if (oppositeFd != null && isToManyImpl)
            newValue.wAdd(oppositeFd, owner, true);
    }
    final InternalIEntity internalNewValue = (InternalIEntity) newValue;
    if (isContainment) {
        internalNewValue.wSetModel(wGetActualModel());
        internalNewValue.wSetParent(this);
    } else {
        if (!EntityUtils.hasParent(newValue))
            internalNewValue.wSetModel(wGetActualModel());
        internalNewValue.wAddInverseAdjacent(this);
    }
    FeatureDescriptor fd = CommonsFeatureDescriptorEnum.composite_element;
    IEntity newValue0 = newValue.wGetAdaptee(false);
    wGetEntityChangeEventHandler().notifyAdded(this, fd, index, newValue0);
    wGetCompoundChangeEventHandler().notifyAdded(this, fd, index, newValue0);
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 42 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class AbstractEntity method notifyChanged.

protected final void notifyChanged(short oldValue, short newValue) {
    if (newValue == oldValue)
        return;
    FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
    wGetEntityChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
    wGetCompoundChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 43 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class AbstractEntity method notifyChanged.

protected final void notifyChanged(long oldValue, long newValue) {
    if (newValue == oldValue)
        return;
    FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
    wGetEntityChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
    wGetCompoundChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 44 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class AbstractEntity method notifyRequested.

protected final long notifyRequested(long value) {
    if (requestNotificationDisabled)
        return value;
    FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
    long result = wGetEntityRequestEventHandler().notifyRequested(this, fd, value);
    return wGetCompoundRequestEventHandler().notifyRequested(this, fd, result);
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 45 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class AbstractEntityAdapter method wSet.

public void wSet(FeatureDescriptor fd, IEntity value) {
    FeatureDescriptor adapteeFeatureDescriptor = wGetAdapteeFeatureDescriptor(fd);
    // if (adapteeFeatureDescriptor == null)
    // throw new IllegalArgumentException("The feature: "+fd+" is not supported by the adaptee: "+adaptee.wGetEntityDescriptor());
    wGetAdaptee(false).wSet(adapteeFeatureDescriptor == null ? fd : adapteeFeatureDescriptor, value);
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Aggregations

FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)100 IEntity (org.whole.lang.model.IEntity)43 InternalIEntity (org.whole.lang.model.InternalIEntity)6 ILanguageKit (org.whole.lang.reflect.ILanguageKit)6 HashSet (java.util.HashSet)5 IContributionItem (org.eclipse.jface.action.IContributionItem)5 ActionsVisibleWhen (org.whole.lang.e4.ui.expressions.ActionsVisibleWhen)5 VisibilityExpression (org.whole.lang.e4.ui.expressions.VisibilityExpression)5 ActionsCompositeContributionItem (org.whole.lang.e4.ui.menu.ActionsCompositeContributionItem)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 HashMap (java.util.HashMap)3 IBindingManager (org.whole.lang.bindings.IBindingManager)3 ITransactionScope (org.whole.lang.bindings.ITransactionScope)3 IdentityRequestEventHandler (org.whole.lang.events.IdentityRequestEventHandler)3 IMappingStrategy (org.whole.lang.xsd.codebase.IMappingStrategy)3 IEntityFactory (org.whole.lang.factories.IEntityFactory)2 ArrayType (org.whole.lang.pojo.model.ArrayType)2 CollectionType (org.whole.lang.pojo.model.CollectionType)2 MapType (org.whole.lang.pojo.model.MapType)2