Search in sources :

Example 1 with PlaceHolderFigure

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

the class BindingsScopeFigure method paintFigure.

protected void paintFigure(Graphics g) {
    super.paintFigure(g);
    Rectangle bounds = getBounds();
    Rectangle cb0 = getContentPane(0).getBounds();
    Rectangle cb1 = getContentPane(1).getBounds();
    g.setBackgroundColor(FigureConstants.templateLanguageColor);
    if (getContentPane(1).getChildren().get(0) instanceof PlaceHolderFigure)
        g.fillRectangle(bounds.x, cb1.y, bounds.width, bounds.bottom() - cb1.y);
    int oldAlpha = g.getAlpha();
    g.setAlpha(FigureConstants.templateLanguageAlpha);
    g.fillRectangle(bounds.x, cb0.y, bounds.width, cb1.y - bounds.y - 1);
    g.setAlpha(oldAlpha);
    g.setForegroundColor(ColorConstants.lightGray);
    g.drawLine(bounds.x, cb1.y - 1, bounds.right() - 1, cb1.y - 1);
    g.setForegroundColor(ColorConstants.gray);
    g.drawRectangle(bounds.x, cb0.y, bounds.width - 1, bounds.bottom() - cb0.y - 1);
    if (getContentPane(2).isVisible()) {
        Rectangle cb2 = getContentPane(2).getBounds();
        g.setForegroundColor(ColorConstants.black);
        int x = cb2.getCenter().x;
        g.drawLine(x, cb0.y, x, cb2.bottom() - NESTED_SCOPE_SPACING);
    }
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) PlaceHolderFigure(org.whole.lang.ui.figures.PlaceHolderFigure)

Example 2 with PlaceHolderFigure

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

the class AbstractOutlineSimpleNodeFigure method paintConnections.

@SuppressWarnings("unchecked")
protected void paintConnections(Graphics graphics) {
    if (isContentVisible()) {
        List<IFigure> contents = getContents();
        int featureNumber = contents.size();
        if (featureNumber == 0)
            return;
        Point start = getSourceAnchor(0).getLocation(null);
        List<Point> childrenLocations = new ArrayList<Point>(featureNumber);
        for (int i = 0; i < featureNumber; i++) {
            IFigure childfigure = contents.get(i);
            List<IFigure> children = childfigure.getChildren();
            if (!childfigure.isVisible() || children.isEmpty())
                continue;
            IFigure featureChild = (IFigure) children.get(0);
            // calculate target point position
            if (featureChild instanceof PlaceHolderFigure)
                addChildrenLocations(start, childrenLocations, featureChild);
            else if (featureChild instanceof CompositeFigure) {
                for (Object child : ((IFigure) featureChild).getChildren()) addChildrenLocations(start, childrenLocations, (IFigure) child);
            } else
                addChildrenLocations(start, childrenLocations, featureChild);
        }
        if (childrenLocations.isEmpty())
            return;
        translateToRelative(start);
        graphics.setForegroundColor(ColorConstants.lightGray);
        graphics.setLineDash(new int[] { 1, 1 });
        DrawUtils.drawOutline(graphics, start, childrenLocations.toArray(new Point[0]));
    }
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) ArrayList(java.util.ArrayList) Point(org.eclipse.draw2d.geometry.Point) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure) PlaceHolderFigure(org.whole.lang.ui.figures.PlaceHolderFigure)

Aggregations

PlaceHolderFigure (org.whole.lang.ui.figures.PlaceHolderFigure)2 ArrayList (java.util.ArrayList)1 IFigure (org.eclipse.draw2d.IFigure)1 Point (org.eclipse.draw2d.geometry.Point)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 CompositeFigure (org.whole.lang.ui.figures.CompositeFigure)1