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);
}
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()));
}
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);
}
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();
}
Aggregations