Search in sources :

Example 6 with EntityKinds

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

the class TestsLearningInterpreterVisitor method visit.

@Override
public void visit(HasKind entity) {
    Kind kind = entity.getKind();
    if (isLearning() && EntityUtils.isResolver(kind)) {
        EntityKinds entityKind = getBindings().wGet("evaluatedSubject").wGetEntityKind();
        Value entityKindValue = KindEnum.instance.valueOf(entityKind.name());
        Kind learntKind = TestsEntityFactory.instance.createKind(entityKindValue);
        putLearntEntity(kind, learntKind);
        setResultVisitor(GenericTraversalFactory.instance.identity());
    } else
        super.visit(entity);
}
Also used : HasKind(org.whole.lang.tests.model.HasKind) Kind(org.whole.lang.tests.model.Kind) Value(org.whole.lang.tests.model.KindEnum.Value) EntityKinds(org.whole.lang.reflect.EntityKinds)

Example 7 with EntityKinds

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

the class StyledTreePartFactory method createEntityStyling.

public static IEntityStyling createEntityStyling(IEntityPart contextPart, EntityDescriptor<?> ed) {
    EntityKinds kind = ed.getEntityKind();
    LayoutStyle layoutStyle = getLayoutStyle(ed);
    return new EntityStyling(ed.getURI(), kind, layoutStyle, getFeaturesStyling((kind.isComposite() && layoutStyle.equals(LayoutStyle.COMPOSITE_TABLE) ? ed.getEntityDescriptor(0) : ed).getEntityFeatureDescriptors()));
}
Also used : LayoutStyle(org.whole.lang.ui.notations.styledtree.styling.EntityStyling.LayoutStyle) EntityStyling(org.whole.lang.ui.notations.styledtree.styling.EntityStyling) IEntityStyling(org.whole.lang.ui.notations.styledtree.styling.IEntityStyling) EntityKinds(org.whole.lang.reflect.EntityKinds)

Example 8 with EntityKinds

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

the class DefaultWrapInTransformer method transform.

public void transform(IEntity oldEntity, IEntity newEntity) {
    EntityKinds newKind = newEntity.wGetEntityKind();
    if (newKind.isData())
        return;
    IEntity clone = EntityUtils.clone(oldEntity);
    if (featureDescriptor != null) {
        if (newEntity.wGetEntityDescriptor().getEntityDescriptor(featureDescriptor).isPlatformSupertypeOf(oldEntity.wGetEntityDescriptor()))
            newEntity.wSet(featureDescriptor, clone);
    } else if (newEntity.wGetEntityDescriptor().getEntityDescriptor(index).isPlatformSupertypeOf(oldEntity.wGetEntityDescriptor()))
        newEntity.wSet(index, clone);
}
Also used : IEntity(org.whole.lang.model.IEntity) EntityKinds(org.whole.lang.reflect.EntityKinds)

Example 9 with EntityKinds

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

the class DefaultOutlineUIProvider method getText.

public String getText(IEntity entity) {
    EntityKinds entityKind = entity.wGetEntityKind();
    StringBuilder tb = new StringBuilder();
    tb.append(entity.wGetEntityDescriptor().getName());
    if (entityKind.isComposite()) {
        tb.append('(');
        tb.append(entity.wSize());
        tb.append(')');
    } else if (entityKind.isData()) {
        try {
            tb.append(": ");
            tb.append(DataTypeUtils.getAsPresentationString(entity));
        } catch (IllegalArgumentException e) {
        }
    }
    return tb.toString();
}
Also used : EntityKinds(org.whole.lang.reflect.EntityKinds)

Aggregations

EntityKinds (org.whole.lang.reflect.EntityKinds)9 IEntity (org.whole.lang.model.IEntity)4 HashSet (java.util.HashSet)1 Value (org.whole.lang.queries.model.KindTestEnum.Value)1 EntityDescriptor (org.whole.lang.reflect.EntityDescriptor)1 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)1 HasKind (org.whole.lang.tests.model.HasKind)1 Kind (org.whole.lang.tests.model.Kind)1 Value (org.whole.lang.tests.model.KindEnum.Value)1 EntityStyling (org.whole.lang.ui.notations.styledtree.styling.EntityStyling)1 LayoutStyle (org.whole.lang.ui.notations.styledtree.styling.EntityStyling.LayoutStyle)1 IEntityStyling (org.whole.lang.ui.notations.styledtree.styling.IEntityStyling)1