Search in sources :

Example 16 with IEntityFigure

use of org.whole.lang.ui.figures.IEntityFigure in project whole by wholeplatform.

the class GrammarBasedUIUtils method createCompositeFigure.

public static IEntityFigure createCompositeFigure(IEntity entity) {
    ILanguageKit lk = entity.wGetLanguageKit();
    EntityDescriptorEnum edEnum = lk.getEntityDescriptorEnum();
    FeatureDescriptorEnum fdEnum = lk.getFeatureDescriptorEnum();
    IEntity configuration = Matcher.findAncestor(edEnum.valueOf("CompositePart"), entity);
    IEntity multiline = configuration.wGet(fdEnum.valueOf("multiline"));
    boolean isMultiline = EntityUtils.safeBooleanValue(multiline, false);
    IEntity columns = configuration.wGet(fdEnum.valueOf("columns"));
    int columnsNum = EntityUtils.safeIntValue(columns, 0);
    IEntity separator = configuration.wGet(fdEnum.valueOf("separator"));
    IEntityFigure entityFigure;
    if (EntityUtils.isNotResolver(separator)) {
        String separatorText = GrammarBasedUIUtils.calculateSeparator(separator);
        CompositeFigure compositeFigure = isMultiline ? new StringSeparatedCompositeColumnFigure(separatorText, 10) : new StringSeparatedCompositeRowFigure(separatorText, 10);
        if (isMultiline)
            compositeFigure.getLayoutManager().withMinorAlignment(Alignment.LEADING);
        entityFigure = compositeFigure;
    } else if (columnsNum > 0) {
        TableFigure tableFigure = new TableFigure(columnsNum);
        tableFigure.setBorder(CompositePlaceHolderBorder.OPTIONAL_VERTICAL);
        entityFigure = tableFigure;
    } else
        entityFigure = new CompositeFigure(!isMultiline, true);
    return entityFigure;
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) StringSeparatedCompositeColumnFigure(org.whole.lang.ui.figures.StringSeparatedCompositeColumnFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) TableFigure(org.whole.lang.ui.figures.TableFigure) EntityDescriptorEnum(org.whole.lang.reflect.EntityDescriptorEnum) FeatureDescriptorEnum(org.whole.lang.reflect.FeatureDescriptorEnum) IEntity(org.whole.lang.model.IEntity) StringSeparatedCompositeRowFigure(org.whole.lang.ui.figures.StringSeparatedCompositeRowFigure) ILanguageKit(org.whole.lang.reflect.ILanguageKit)

Example 17 with IEntityFigure

use of org.whole.lang.ui.figures.IEntityFigure in project whole by wholeplatform.

the class GrammarBasedUIUtils method createSequenceFigure.

public static IEntityFigure createSequenceFigure(IEntity entity, ContentPaneFigure contentPaneFigure, boolean embed) {
    FeatureDescriptorEnum fdEnum = entity.wGetLanguageKit().getFeatureDescriptorEnum();
    IEntity multiline = entity.wGet(fdEnum.valueOf("multiline"));
    ICompositeEntityLayout layout = EntityUtils.safeBooleanValue(multiline, false) ? new ColumnLayout() : new RowLayout();
    // TODO complete optional behavior
    IEntity optional = entity.wGet(fdEnum.valueOf("optional"));
    IEntityFigure figure;
    if (embed) {
        contentPaneFigure.setLayoutManager(layout.withSpacing(5));
        figure = contentPaneFigure;
    } else
        figure = new EntityFigure(layout.withSpacing(5));
    IEntity childFigures = entity.wGet(fdEnum.valueOf("figures"));
    for (int i = 0, size = childFigures.wSize(); i < size; i++) addChildFigure(childFigures.wGet(i), contentPaneFigure, figure);
    return figure;
}
Also used : ICompositeEntityLayout(org.whole.lang.ui.layout.ICompositeEntityLayout) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) FeatureDescriptorEnum(org.whole.lang.reflect.FeatureDescriptorEnum) EntityFigure(org.whole.lang.ui.figures.EntityFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) IEntity(org.whole.lang.model.IEntity) ColumnLayout(org.whole.lang.ui.layout.ColumnLayout) RowLayout(org.whole.lang.ui.layout.RowLayout)

Example 18 with IEntityFigure

use of org.whole.lang.ui.figures.IEntityFigure in project whole by wholeplatform.

the class CompositeTableFigure method createTypeLabelFigure.

protected IEntityFigure createTypeLabelFigure() {
    IEntityFigure typeFigure = createContentPane(0, ViewportTracking.HORIZONTAL);
    typeFigure.getLayoutManager().withMargin(2, 4, 2, 8);
    return typeFigure;
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure)

Example 19 with IEntityFigure

use of org.whole.lang.ui.figures.IEntityFigure in project whole by wholeplatform.

the class XsiCompositeElementPart method createFigure.

@Override
protected IFigure createFigure() {
    boolean startOpened = !getContents().isEmpty();
    IEntityFigure figure = new XsiCompositeElementNodeFigure(startOpened, createLabel());
    if (isRoot)
        figure.setBorder(new MarginBorder(4, 8, 2, 4));
    return figure;
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) XsiCompositeElementNodeFigure(org.whole.lang.xsi.ui.figures.XsiCompositeElementNodeFigure) MarginBorder(org.eclipse.draw2d.MarginBorder)

Example 20 with IEntityFigure

use of org.whole.lang.ui.figures.IEntityFigure in project whole by wholeplatform.

the class InteractiveTreeSearch method prune.

public boolean prune(IFigure figure) {
    boolean value;
    if (figure instanceof IEntityFigure) {
        IEntityFigure entityFigure = (IEntityFigure) figure;
        value = entityFigure.isInteractiveInherited() ? peekInheritedInteractiveEdit(figure) : entityFigure.isInteractiveEdit();
    } else
        value = peekInheritedInteractiveEdit(figure);
    inheritedInteractiveStack.set(inheritedInteractiveStack.length(), value);
    return false;
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure)

Aggregations

IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)25 IFigure (org.eclipse.draw2d.IFigure)10 Rectangle (org.eclipse.draw2d.geometry.Rectangle)6 IEntity (org.whole.lang.model.IEntity)5 EntityFigure (org.whole.lang.ui.figures.EntityFigure)5 Point (org.eclipse.draw2d.geometry.Point)4 TableFigure (org.whole.lang.ui.figures.TableFigure)4 List (java.util.List)3 Graphics (org.eclipse.draw2d.Graphics)3 CompositeFigure (org.whole.lang.ui.figures.CompositeFigure)3 TableRowFigure (org.whole.lang.ui.figures.TableRowFigure)3 RowLayout (org.whole.lang.ui.layout.RowLayout)3 TableLayout (org.whole.lang.ui.layout.TableLayout)3 Dimension (org.eclipse.draw2d.geometry.Dimension)2 FeatureDescriptorEnum (org.whole.lang.reflect.FeatureDescriptorEnum)2 IGraphicalEntityPart (org.whole.lang.ui.editparts.IGraphicalEntityPart)2 INodeFigure (org.whole.lang.ui.figures.INodeFigure)2 StringSeparatedCompositeRowFigure (org.whole.lang.ui.figures.StringSeparatedCompositeRowFigure)2 ICompositeEntityLayout (org.whole.lang.ui.layout.ICompositeEntityLayout)2 Label (org.eclipse.draw2d.Label)1