Search in sources :

Example 1 with CompositeFigure

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

the class ChildrenBranchesFigure method createCompositeFigure.

protected IEntityFigure createCompositeFigure() {
    CompositeFigure figure = new CompositeFigure(false);
    // {
    // protected void paintFigure(Graphics g) {
    // super.paintFigure(g);
    // 
    // if (getChildren().isEmpty()) {
    // Rectangle b = getBounds().getResized(-1, -1);
    // 
    // g.setForegroundColor(FigureConstants.blueColor);
    // g.setLineStyle(SWT.LINE_CUSTOM);
    // g.setLineDash(new int[] {4,2});
    // g.drawRoundRectangle(b, 8, 8);
    // g.setLineStyle(SWT.LINE_SOLID);
    // g.setLineDash((int[]) null);
    // }
    // }
    // };
    // .withMinorAlignment(Alignment.MATHLINE)
    figure.getLayoutManager().withSpacing(4).withMarginLeft(0).withMarginRight(10);
    figure.setBorder(CompositePlaceHolderBorder.OPTIONAL_VERTICAL);
    return figure;
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure)

Example 2 with CompositeFigure

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

the class OutlineCompositeNodeFigure method paintConnections.

protected void paintConnections(Graphics graphics) {
    IFigure contentPane = getContentPane(getContentPanesSize() - 1);
    List<?> list = contentPane.getChildren();
    if (contentPane.isVisible() && !list.isEmpty()) {
        IFigure contentsFigure = (IFigure) list.get(0);
        Point[] children;
        if (contentsFigure instanceof CompositeFigure) {
            int compositeChildrenNumber = contentsFigure.getChildren().size();
            if (compositeChildrenNumber == 0)
                return;
            children = new Point[compositeChildrenNumber];
            for (int i = 0; i < compositeChildrenNumber; i++) {
                IFigure compositeChild = (IFigure) contentsFigure.getChildren().get(i);
                // calculate target point position
                Point targetLocation;
                if (compositeChild instanceof INodeFigure)
                    targetLocation = ((INodeFigure) compositeChild).getTargetAnchor(0).getLocation(null);
                else {
                    Rectangle compositeChildBounds = compositeChild.getBounds();
                    targetLocation = compositeChildBounds.getLeft();
                    if (compositeChild instanceof IEntityFigure)
                        targetLocation.y = compositeChildBounds.y + ((IEntityFigure) compositeChild).getAscent();
                    compositeChild.translateToAbsolute(targetLocation);
                }
                translateToRelative(targetLocation);
                children[i] = targetLocation;
            }
        } else {
            children = new Point[1];
            // calculate target point position
            Point targetLocation;
            if (contentsFigure instanceof INodeFigure)
                targetLocation = ((INodeFigure) contentsFigure).getTargetAnchor(0).getLocation(null);
            else {
                Rectangle compositeChildBounds = contentsFigure.getBounds();
                targetLocation = compositeChildBounds.getLeft();
                if (contentsFigure instanceof IEntityFigure)
                    targetLocation.y = compositeChildBounds.y + ((IEntityFigure) contentsFigure).getAscent();
                contentsFigure.translateToAbsolute(targetLocation);
            }
            translateToRelative(targetLocation);
            children[0] = targetLocation;
        }
        Point start = getSourceAnchor(0).getLocation(null);
        translateToRelative(start);
        graphics.setForegroundColor(ColorConstants.lightGray);
        graphics.setLineDash(new int[] { 1, 1 });
        DrawUtils.drawOutline(graphics, start, children);
    }
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) INodeFigure(org.whole.lang.ui.figures.INodeFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Point(org.eclipse.draw2d.geometry.Point) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with CompositeFigure

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

the class CompositeEntityTreeTableNoEmbeddingFigure method createCompositeFigure.

protected IEntityFigure createCompositeFigure() {
    CompositeFigure figure = new CompositeFigure(false);
    figure.getLayoutManager().withSpacing(4).withMarginLeft(DrawUtils.SPACING * 2).withMarginRight(2);
    figure.setBorder(null);
    return figure;
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure)

Example 4 with CompositeFigure

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

the class FeaturesPart method createFigure.

protected IFigure createFigure() {
    CompositeFigure f = new CompositeFigure(false);
    f.getLayoutManager().withSpacing(64);
    return f;
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure)

Example 5 with CompositeFigure

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

the class SubfeaturesRightPart method createFigure.

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

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