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