Search in sources :

Example 1 with IEntityStyling

use of org.whole.lang.ui.notations.styledtree.styling.IEntityStyling in project whole by wholeplatform.

the class AdaptiveEntityPart method createFigure.

protected IFigure createFigure() {
    IEntityStyling entityStyling = getEntityStyling();
    INotationStyling notationStyling = entityStyling.getNotationStyling();
    switch(entityStyling.getKind()) {
        case DATA:
            switch(notationStyling.getEmbeddingStyle(stylingFactory, (IEntityPart) getParent(), getModelEntity())) {
                case TABLE_CELL:
                // TODO
                case NONE:
                default:
                    return new DataNodeFigure(entityStyling);
            }
        case SIMPLE:
            return new SimpleTableNodeWithBranchesFigure(true, entityStyling);
        case COMPOSITE:
        default:
            if (entityStyling.getLayoutStyle().equals(LayoutStyle.COMPOSITE_TABLE))
                return new CompositeTableFigure(entityStyling);
            else
                return new NodeWithCompositeBranchFigure(entityStyling);
    }
}
Also used : NodeWithCompositeBranchFigure(org.whole.lang.ui.notations.styledtree.figures.NodeWithCompositeBranchFigure) DataNodeFigure(org.whole.lang.ui.notations.styledtree.figures.DataNodeFigure) IEntityStyling(org.whole.lang.ui.notations.styledtree.styling.IEntityStyling) CompositeTableFigure(org.whole.lang.ui.notations.styledtree.figures.CompositeTableFigure) SimpleTableNodeWithBranchesFigure(org.whole.lang.ui.notations.styledtree.figures.SimpleTableNodeWithBranchesFigure) INotationStyling(org.whole.lang.ui.notations.styledtree.styling.INotationStyling)

Example 2 with IEntityStyling

use of org.whole.lang.ui.notations.styledtree.styling.IEntityStyling 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 IEntityStyling

use of org.whole.lang.ui.notations.styledtree.styling.IEntityStyling 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)

Aggregations

IEntityStyling (org.whole.lang.ui.notations.styledtree.styling.IEntityStyling)3 IEntity (org.whole.lang.model.IEntity)1 EntityKinds (org.whole.lang.reflect.EntityKinds)1 IEntityPart (org.whole.lang.ui.editparts.IEntityPart)1 LiteralDataEntityPart (org.whole.lang.ui.editparts.LiteralDataEntityPart)1 LiteralTextualEntityPart (org.whole.lang.ui.editparts.LiteralTextualEntityPart)1 PlaceHolderPart (org.whole.lang.ui.editparts.PlaceHolderPart)1 CompositeTableFigure (org.whole.lang.ui.notations.styledtree.figures.CompositeTableFigure)1 DataNodeFigure (org.whole.lang.ui.notations.styledtree.figures.DataNodeFigure)1 NodeWithCompositeBranchFigure (org.whole.lang.ui.notations.styledtree.figures.NodeWithCompositeBranchFigure)1 SimpleTableNodeWithBranchesFigure (org.whole.lang.ui.notations.styledtree.figures.SimpleTableNodeWithBranchesFigure)1 EntityStyling (org.whole.lang.ui.notations.styledtree.styling.EntityStyling)1 LayoutStyle (org.whole.lang.ui.notations.styledtree.styling.EntityStyling.LayoutStyle)1 INotationStyling (org.whole.lang.ui.notations.styledtree.styling.INotationStyling)1