Search in sources :

Example 1 with UnderColumnLayout

use of org.whole.lang.ui.layout.UnderColumnLayout 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 2 with UnderColumnLayout

use of org.whole.lang.ui.layout.UnderColumnLayout in project whole by wholeplatform.

the class AttributeDownFigure method initFigure.

@Override
protected void initFigure() {
    initContentPanes(3);
    EntityFigure headerFigure = new EntityFigure(new RowLayout().withSpacing(8));
    headerFigure.add(createContentPane(0));
    // headerFigure.addParenthesis(" (");
    headerFigure.add(createContentPane(1));
    // headerFigure.addParenthesis(")");
    EntityFigure shapeFigure0 = new EntityFigure(new UnderColumnLayout().withSpacing(4).withMarginLeft(12).withMinorAlignment(Alignment.CENTER));
    shapeFigure0.add(headerFigure);
    shapeFigure0.add(createContentPane(2));
    add(shapeFigure = shapeFigure0);
}
Also used : UnderColumnLayout(org.whole.lang.ui.layout.UnderColumnLayout) EntityFigure(org.whole.lang.ui.figures.EntityFigure) RowLayout(org.whole.lang.ui.layout.RowLayout)

Aggregations

UnderColumnLayout (org.whole.lang.ui.layout.UnderColumnLayout)2 List (java.util.List)1 Graphics (org.eclipse.draw2d.Graphics)1 IFigure (org.eclipse.draw2d.IFigure)1 CompositeFigure (org.whole.lang.ui.figures.CompositeFigure)1 EntityFigure (org.whole.lang.ui.figures.EntityFigure)1 RowLayout (org.whole.lang.ui.layout.RowLayout)1