Search in sources :

Example 6 with CompositeFigure

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

the class SequencePart method createFigure.

protected IFigure createFigure() {
    IFigure figure = new CompositeFigure(new ColumnLayout().withMarginTop(5).withMarginBottom(5).withSpacing(13));
    figure.setBorder(new CurlyBracketsBorder());
    return figure;
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) CurlyBracketsBorder(org.whole.lang.ui.figures.CurlyBracketsBorder) ColumnLayout(org.whole.lang.ui.layout.ColumnLayout) IFigure(org.eclipse.draw2d.IFigure)

Example 7 with CompositeFigure

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

the class WorkflowsDiagramPartFactoryVisitor method visit.

public void visit(FlowObjects entity) {
    if (context instanceof ParallelPart)
        part = new AbstractCompositePart() {

            protected IFigure createFigure() {
                CompositeFigure f = new CompositeFigure(true);
                f.getLayoutManager().withMinorAlignment(Alignment.LEADING);
                return f;
            }
        };
    else
        part = new AbstractCompositePart() {

            protected IFigure createFigure() {
                CompositeFigure f = new CompositeFigure(false);
                f.getLayoutManager().withSpacing(7).withMinorAlignment(Alignment.CENTER);
                return f;
            }
        };
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) AbstractCompositePart(org.whole.lang.ui.editparts.AbstractCompositePart)

Example 8 with CompositeFigure

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

the class TypesPart method createFigure.

protected IFigure createFigure() {
    return new CompositeFigure(new UnderColumnLayout().withMinorAlignment(Alignment.LEADING).withSpacing(6)) {

        @SuppressWarnings("unchecked")
        protected void paintFigure(Graphics g) {
            super.paintFigure(g);
            String separator = ",";
            int spacing = getLayoutManager().getSpacing();
            int fontAscent = FigureUtilities.getFontMetrics(getFont()).getHeight() / 2;
            int xOffset = FigureUtilities.getTextWidth(separator, getFont()) / 2;
            int yOffset = spacing * 5 / 6 + fontAscent + 1;
            int x = getClientArea().getCenter().x - xOffset;
            g.setForegroundColor(ColorConstants.lightGray);
            List<IFigure> children = (List<IFigure>) getChildren();
            for (int i = 1; i < children.size(); i++) {
                int y = children.get(i).getBounds().y;
                g.drawString(separator, x, y - yOffset);
            }
        }
    };
// return new StringSeparatedCompositeColumnFigure(",",
// new UnderColumnLayout().withMinorAlignment(Alignment.LEADING).withSpacing(8));
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) Graphics(org.eclipse.draw2d.Graphics) UnderColumnLayout(org.whole.lang.ui.layout.UnderColumnLayout) List(java.util.List) IFigure(org.eclipse.draw2d.IFigure)

Example 9 with CompositeFigure

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

the class AndPart method createFigure.

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

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

        protected void paintFigure(Graphics g) {
            super.paintFigure(g);
            g.setForegroundColor(FigureConstants.contentLighterColor);
            g.setLineStyle(SWT.LINE_CUSTOM);
            g.setLineDash(new int[] { 1, 3 });
            drawFixedSizeColumnSeparators(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 10 with CompositeFigure

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

the class UnionTypePart 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);
        }
    };
// return new StringSeparatedCompositeRowFigure("\u222a", 10) {
// @Override
// public Color getLocalForegroundColor() {
// return FigureConstants.contentColor;
// }
// };
}
Also used : Graphics(org.eclipse.draw2d.Graphics) CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) RoundBracketsBorder(org.whole.lang.ui.figures.RoundBracketsBorder)

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