Search in sources :

Example 11 with CompositeFigure

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

the class OrPart method createFigure.

protected IFigure createFigure() {
    border = new RoundBracketsBorder() {

        @Override
        protected void setBracketsStyle(Graphics g) {
            g.setForegroundColor(FigureConstants.contentLighterColor);
        }
    };
    return new CompositeFigure(false) {

        protected void paintFigure(Graphics g) {
            super.paintFigure(g);
            g.setForegroundColor(ColorConstants.lightGray);
            g.setLineStyle(SWT.LINE_CUSTOM);
            g.setLineDash(new int[] { 1, 1 });
            drawFixedSizeRowSeparators(g);
            g.setLineStyle(SWT.LINE_SOLID);
            g.setLineDash((int[]) null);
        }
    };
}
Also used : Graphics(org.eclipse.draw2d.Graphics) CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) RoundBracketsBorder(org.whole.lang.ui.figures.RoundBracketsBorder)

Example 12 with CompositeFigure

use of org.whole.lang.ui.figures.CompositeFigure 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 13 with CompositeFigure

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

the class BlockPart method createFigure.

protected IFigure createFigure() {
    IFigure figure = new // StringSeparatedCompositeColumnFigure("",
    CompositeFigure(new OverColumnLayout().withMarginTop(5).withMarginBottom(5).withSpacing(13));
    figure.setBorder(new BlockBracketsBorder());
    return figure;
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) OverColumnLayout(org.whole.lang.ui.layout.OverColumnLayout) BlockBracketsBorder(org.whole.lang.queries.ui.figures.BlockBracketsBorder) IFigure(org.eclipse.draw2d.IFigure)

Example 14 with CompositeFigure

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

the class SubfeaturesDownPart method createFigure.

protected IFigure createFigure() {
    CompositeFigure f = new CompositeFigure(true);
    f.getLayoutManager().withMinorAlignment(Alignment.MATHLINE);
    return f;
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure)

Example 15 with CompositeFigure

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

the class TextualFigurePart method createFigure.

protected IFigure createFigure() {
    return new CompositeFigure(false) {

        {
            setBackgroundColor(FigureConstants.templateLanguageColor);
            setBorder(new CompoundBorder(new LineBorder(), getBorder()));
        }
    };
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) LineBorder(org.eclipse.draw2d.LineBorder) CompoundBorder(org.eclipse.draw2d.CompoundBorder)

Aggregations

CompositeFigure (org.whole.lang.ui.figures.CompositeFigure)18 Graphics (org.eclipse.draw2d.Graphics)5 IFigure (org.eclipse.draw2d.IFigure)5 IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)3 RoundBracketsBorder (org.whole.lang.ui.figures.RoundBracketsBorder)3 Point (org.eclipse.draw2d.geometry.Point)2 TableFigure (org.whole.lang.ui.figures.TableFigure)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 CompoundBorder (org.eclipse.draw2d.CompoundBorder)1 LineBorder (org.eclipse.draw2d.LineBorder)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 IEntity (org.whole.lang.model.IEntity)1 BlockBracketsBorder (org.whole.lang.queries.ui.figures.BlockBracketsBorder)1 EntityDescriptorEnum (org.whole.lang.reflect.EntityDescriptorEnum)1 FeatureDescriptorEnum (org.whole.lang.reflect.FeatureDescriptorEnum)1 ILanguageKit (org.whole.lang.reflect.ILanguageKit)1 AbstractCompositePart (org.whole.lang.ui.editparts.AbstractCompositePart)1 CurlyBracketsBorder (org.whole.lang.ui.figures.CurlyBracketsBorder)1 EntityFigure (org.whole.lang.ui.figures.EntityFigure)1