Search in sources :

Example 1 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class SimpleEntityStyledTreePart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    IFeatureStyling[] featuresStyling = entityStyling.getFeaturesStyling();
    int size = featuresStyling.length;
    if (size == 0)
        return Collections.emptyList();
    else {
        IEntity entity = getModelEntity();
        EntityDescriptor<?> ed = entity.wGetEntityDescriptor();
        FeatureDescriptorEnum fdEnum = ed.getFeatureDescriptorEnum();
        List<IEntity> list = new ArrayList<IEntity>(size);
        for (int i = 0; i < size; i++) list.add(entity.wGet(ed.getEntityFeatureDescriptor(fdEnum.valueOf(featuresStyling[i].getName()))));
        return list;
    }
}
Also used : FeatureDescriptorEnum(org.whole.lang.reflect.FeatureDescriptorEnum) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList) IFeatureStyling(org.whole.lang.ui.notations.styledtree.styling.IFeatureStyling)

Example 2 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class DefaultOutlinePartFactory method createEditPart.

public EditPart createEditPart(EditPart context, Object modelEntity) {
    this.context = context;
    IEntity entity = (IEntity) modelEntity;
    if (entity.wIsAdapter())
        return part = new PlaceHolderPart();
    switch(entity.wGetEntityKind()) {
        case SIMPLE:
            return part = new OutlinePart(OutlineUIProvider.instance().getPartDataProvider(entity));
        default:
            return part = DefaultTextualPartFactory.instance().createEditPart(context, modelEntity);
    }
}
Also used : IEntity(org.whole.lang.model.IEntity) PlaceHolderPart(org.whole.lang.ui.editparts.PlaceHolderPart)

Example 3 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class StyledTreePartFactory method createEditPart.

public EditPart createEditPart(EditPart context, Object modelEntity) {
    IEntityPart contextPart = (IEntityPart) context;
    IEntity entity = (IEntity) modelEntity;
    EntityDescriptor<?> ed = entity.wGetEntityDescriptor();
    if (ed.equals(CommonsEntityDescriptorEnum.Resolver))
        return new PlaceHolderPart();
    else {
        IEntityStyling entityStyling = notationStyling.getEntityStyling(this, contextPart, entity);
        switch(ed.getEntityKind()) {
            case SIMPLE:
                return new SimpleEntityStyledTreePart(this, entityStyling);
            case COMPOSITE:
                return new CompositeEntityStyledTreePart(this, entityStyling);
            default:
            case DATA:
                // TODO test
                if (entity.wGetEntityDescriptor().getName().equals("SimpleName") && entity.wGetParent().wGetEntityDescriptor().getName().equals("Feature"))
                    entity.wGetEntityDescriptor();
                switch(notationStyling.getEmbeddingStyle(this, contextPart, entity)) {
                    case TABLE_CELL:
                        switch(// TODO replace with styling features
                        ed.getDataKind()) {
                            case STRING:
                                return new LiteralTextualEntityPart();
                            default:
                                return new LiteralDataEntityPart();
                        }
                    case NONE:
                    default:
                        return new DataEntityStyledTreePart(this, entityStyling);
                }
        }
    }
}
Also used : IEntity(org.whole.lang.model.IEntity) LiteralDataEntityPart(org.whole.lang.ui.editparts.LiteralDataEntityPart) IEntityStyling(org.whole.lang.ui.notations.styledtree.styling.IEntityStyling) PlaceHolderPart(org.whole.lang.ui.editparts.PlaceHolderPart) LiteralTextualEntityPart(org.whole.lang.ui.editparts.LiteralTextualEntityPart) IEntityPart(org.whole.lang.ui.editparts.IEntityPart)

Example 4 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class TablePartFactory method createEditPart.

public EditPart createEditPart(EditPart context, Object modelEntity) {
    IEntity entity = (IEntity) modelEntity;
    EntityDescriptor<?> ed = entity.wGetEntityDescriptor();
    if (!ed.equals(CommonsEntityDescriptorEnum.Resolver))
        switch(entity.wGetEntityKind()) {
            case DATA:
                switch(ed.getDataKind()) {
                    case STRING:
                        return new LiteralTextualEntityPart();
                    default:
                        return new LiteralDataEntityPart();
                }
            case COMPOSITE:
                if (ed.getEntityFeatureDescriptor(0).isReference())
                    return new CompositeEntityReferenceColumnPart(ed);
                else if (embedChildren(entity))
                    return new CompositeEntityTablePart(ed);
                else
                    return new CompositeColumnWithPlaceholderPart();
            case SIMPLE:
                if (isEmbedded(entity))
                    return new SimpleEntityTableRowPart(ed);
                else
                    return new SimpleEntityTablePart(ed);
        }
    return new PlaceHolderPart();
}
Also used : IEntity(org.whole.lang.model.IEntity) LiteralDataEntityPart(org.whole.lang.ui.editparts.LiteralDataEntityPart) PlaceHolderPart(org.whole.lang.ui.editparts.PlaceHolderPart) LiteralTextualEntityPart(org.whole.lang.ui.editparts.LiteralTextualEntityPart) CompositeColumnWithPlaceholderPart(org.whole.lang.ui.editparts.CompositeColumnWithPlaceholderPart)

Example 5 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class TreeRightPartFactory method createEditPart.

public EditPart createEditPart(EditPart context, Object modelEntity) {
    IEntity entity = (IEntity) modelEntity;
    EntityDescriptor<?> ed = entity.wGetEntityDescriptor();
    if (!ed.equals(CommonsEntityDescriptorEnum.Resolver))
        switch(entity.wGetEntityKind()) {
            case DATA:
                return createDataEntityPart(context, entity);
            case COMPOSITE:
                return createCompositeEntityPart(context, entity);
            case SIMPLE:
                return createSimpleEntityPart(context, entity);
        }
    return createPlaceHolderPart(context, entity);
}
Also used : IEntity(org.whole.lang.model.IEntity)

Aggregations

IEntity (org.whole.lang.model.IEntity)1407 ArrayList (java.util.ArrayList)604 Test (org.junit.Test)241 IBindingManager (org.whole.lang.bindings.IBindingManager)141 PathExpression (org.whole.lang.queries.model.PathExpression)68 ITemplateManager (org.whole.lang.templates.ITemplateManager)61 Grammar (org.whole.lang.grammars.model.Grammar)50 TestXmlGrammar (org.whole.lang.grammars.util.TestXmlGrammar)46 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)43 Model (org.whole.lang.models.model.Model)40 InternalIEntity (org.whole.lang.model.InternalIEntity)38 VisitException (org.whole.lang.visitors.VisitException)35 IEntityPartViewer (org.whole.lang.ui.viewers.IEntityPartViewer)30 ModelsModel (org.whole.lang.models.codebase.ModelsModel)27 WholeIllegalArgumentException (org.whole.lang.exceptions.WholeIllegalArgumentException)26 StreamPersistenceProvider (org.whole.lang.codebase.StreamPersistenceProvider)24 ModelBuilderOperation (org.whole.lang.builders.ModelBuilderOperation)22 XmlModel (org.whole.lang.models.codebase.XmlModel)22 MissingVariableException (org.whole.lang.visitors.MissingVariableException)22 IEntityPart (org.whole.lang.ui.editparts.IEntityPart)21