Search in sources :

Example 1 with PlaceHolderPart

use of org.whole.lang.ui.editparts.PlaceHolderPart 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 2 with PlaceHolderPart

use of org.whole.lang.ui.editparts.PlaceHolderPart 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 3 with PlaceHolderPart

use of org.whole.lang.ui.editparts.PlaceHolderPart 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 4 with PlaceHolderPart

use of org.whole.lang.ui.editparts.PlaceHolderPart in project whole by wholeplatform.

the class CommonsPartFactoryVisitor method createEditPart.

public EditPart createEditPart(EditPart context, Object modelEntity) {
    IEntity entity = (IEntity) modelEntity;
    switch(entity.wGetEntityDescriptor().getOrdinal()) {
        case CommonsEntityDescriptorEnum.RootFragment_ord:
            return new RootFragmentPart();
        // return new StageUpFragmentVerbosePart();
        case CommonsEntityDescriptorEnum.SameStageFragment_ord:
            return new SameStageFragmentPart();
        case CommonsEntityDescriptorEnum.StageDownFragment_ord:
            return new StageDownFragmentPart();
        case CommonsEntityDescriptorEnum.StageUpFragment_ord:
            return new StageUpFragmentPart();
        case CommonsEntityDescriptorEnum.TemplateFragment_ord:
            return new TemplateFragmentPart();
        case CommonsEntityDescriptorEnum.BaseFragment_ord:
            return new BaseFragmentPart();
        case CommonsEntityDescriptorEnum.Phase_ord:
            return new VariableDataEntityPart();
        case CommonsEntityDescriptorEnum.Variable_ord:
            return new VariablePart();
        case CommonsEntityDescriptorEnum.InlineVariable_ord:
            return new InlineVariablePart();
        case CommonsEntityDescriptorEnum.VarName_ord:
            return new VariableDataEntityPart();
        case CommonsEntityDescriptorEnum.VarType_ord:
            return new VarTypePart();
        case CommonsEntityDescriptorEnum.Quantifier_ord:
            return new ContentLightDataEntityPart();
        case CommonsEntityDescriptorEnum.Resolver_ord:
        default:
            if (context != null) {
                IEntity parentEntity = ((IEntity) context.getModel()).wGetAdaptee(false);
                int index = parentEntity.wIndexOf(entity);
                if (index >= 0 && parentEntity.wGetFeatureDescriptor(index).isOptional())
                    return new PlaceHolderOptionalPart();
            }
            return new PlaceHolderPart();
    }
}
Also used : VariableDataEntityPart(org.whole.lang.ui.editparts.VariableDataEntityPart) IEntity(org.whole.lang.model.IEntity) ContentLightDataEntityPart(org.whole.lang.ui.editparts.ContentLightDataEntityPart) PlaceHolderOptionalPart(org.whole.lang.ui.editparts.PlaceHolderOptionalPart) PlaceHolderPart(org.whole.lang.ui.editparts.PlaceHolderPart)

Example 5 with PlaceHolderPart

use of org.whole.lang.ui.editparts.PlaceHolderPart in project whole by wholeplatform.

the class DefaultTextualPartFactory 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
                    return new CompositeColumnPart();
            case SIMPLE:
                return new SimpleEntityTextPart(ed);
        }
    return new PlaceHolderPart();
}
Also used : IEntity(org.whole.lang.model.IEntity) LiteralDataEntityPart(org.whole.lang.ui.editparts.LiteralDataEntityPart) CompositeEntityReferenceColumnPart(org.whole.lang.ui.notations.table.editparts.CompositeEntityReferenceColumnPart) CompositeColumnPart(org.whole.lang.ui.editparts.CompositeColumnPart) PlaceHolderPart(org.whole.lang.ui.editparts.PlaceHolderPart) LiteralTextualEntityPart(org.whole.lang.ui.editparts.LiteralTextualEntityPart)

Aggregations

IEntity (org.whole.lang.model.IEntity)7 PlaceHolderPart (org.whole.lang.ui.editparts.PlaceHolderPart)7 LiteralDataEntityPart (org.whole.lang.ui.editparts.LiteralDataEntityPart)5 LiteralTextualEntityPart (org.whole.lang.ui.editparts.LiteralTextualEntityPart)5 CompositeColumnPart (org.whole.lang.ui.editparts.CompositeColumnPart)1 CompositeColumnWithPlaceholderPart (org.whole.lang.ui.editparts.CompositeColumnWithPlaceholderPart)1 ContentLightDataEntityPart (org.whole.lang.ui.editparts.ContentLightDataEntityPart)1 IEntityPart (org.whole.lang.ui.editparts.IEntityPart)1 PlaceHolderOptionalPart (org.whole.lang.ui.editparts.PlaceHolderOptionalPart)1 VariableDataEntityPart (org.whole.lang.ui.editparts.VariableDataEntityPart)1 IEntityStyling (org.whole.lang.ui.notations.styledtree.styling.IEntityStyling)1 CompositeEntityReferenceColumnPart (org.whole.lang.ui.notations.table.editparts.CompositeEntityReferenceColumnPart)1