Search in sources :

Example 1 with LayoutStyle

use of org.whole.lang.ui.notations.styledtree.styling.EntityStyling.LayoutStyle 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 2 with LayoutStyle

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

the class NotationStyling method getLayoutStyle.

public LayoutStyle getLayoutStyle(IStylingFactory stylingFactory, IEntityPart contextPart, IEntity entity) {
    IEntityStyling entityStyling = getEntityStyling(stylingFactory, contextPart, entity);
    LayoutStyle layoutStyle = entityStyling.getLayoutStyle();
    switch(layoutStyle) {
        case SIMPLE_TABLE:
        case COMPOSITE_TABLE:
            EmbeddingStyle embeddingStyle = getEmbeddingStyle(stylingFactory, contextPart, entity);
            return embeddingStyle.equals(EmbeddingStyle.NONE) ? layoutStyle : embeddingStyle.equals(EmbeddingStyle.TABLE_CELL) ? LayoutStyle.TABLE_CELL : LayoutStyle.TABLE_ROW;
        default:
            return layoutStyle;
    }
}
Also used : LayoutStyle(org.whole.lang.ui.notations.styledtree.styling.EntityStyling.LayoutStyle)

Example 3 with LayoutStyle

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

the class NotationStyling method isEmbedded.

public boolean isEmbedded(IStylingFactory stylingFactory, IEntityPart contextPart, IEntity entity) {
    if (!(contextPart instanceof IStyledPart))
        return false;
    IEntityStyling entityStyling = getEntityStyling(stylingFactory, contextPart, entity);
    LayoutStyle layoutStyle = entityStyling.getLayoutStyle();
    IEntity parentEntity = stylingFactory.getParentEntity(entity);
    IEntityPart parentContextPart = stylingFactory.getParentPart(contextPart);
    IEntityStyling parentEntityStyling = getEntityStyling(stylingFactory, parentContextPart, parentEntity);
    boolean embedChild = parentEntityStyling.embedChild(entity.wGetParent().wIndexOf(entity));
    if (embedChild)
        return true;
    else {
        LayoutStyle parentLayoutStyle = parentEntityStyling.getLayoutStyle();
        switch(parentLayoutStyle) {
            case COLUMN:
            case COMPOSITE_TABLE:
                return embedChild;
            case TABLE_CELL:
            case TABLE_ROW:
                return true;
            case TREE:
                return false;
            case SIMPLE_TABLE:
            default:
                return isEmbedded(stylingFactory, parentContextPart, parentEntity);
        }
    }
}
Also used : LayoutStyle(org.whole.lang.ui.notations.styledtree.styling.EntityStyling.LayoutStyle) IEntity(org.whole.lang.model.IEntity) IEntityPart(org.whole.lang.ui.editparts.IEntityPart)

Aggregations

LayoutStyle (org.whole.lang.ui.notations.styledtree.styling.EntityStyling.LayoutStyle)3 IEntity (org.whole.lang.model.IEntity)1 EntityKinds (org.whole.lang.reflect.EntityKinds)1 IEntityPart (org.whole.lang.ui.editparts.IEntityPart)1 EntityStyling (org.whole.lang.ui.notations.styledtree.styling.EntityStyling)1 IEntityStyling (org.whole.lang.ui.notations.styledtree.styling.IEntityStyling)1