Search in sources :

Example 51 with Insets

use of org.eclipse.draw2d.geometry.Insets in project whole by wholeplatform.

the class PickControlFigure method createBorder.

protected AbstractBorder createBorder(final boolean isHorizontal) {
    return new AbstractBorder() {

        private final Insets /*static*/
        INSETS = new Insets(10, 10, 20, 10);

        public Insets getInsets(IFigure figure) {
            return INSETS;
        }

        public void paint(IFigure figure, Graphics graphics, Insets insets) {
            Rectangle rect = getPaintRectangle(figure, insets).resize(-1, -1);
            graphics.setForegroundColor(ColorConstants.lightGray);
            // graphics.setLineStyle(SWT.LINE_CUSTOM);
            // graphics.setLineDash(new int[] {8,3});
            graphics.drawRoundRectangle(rect, 10, 10);
        }
    };
}
Also used : Graphics(org.eclipse.draw2d.Graphics) Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle) AbstractBorder(org.eclipse.draw2d.AbstractBorder) IFigure(org.eclipse.draw2d.IFigure)

Example 52 with Insets

use of org.eclipse.draw2d.geometry.Insets in project whole by wholeplatform.

the class SequenceFigure method createBorder.

protected AbstractBorder createBorder(final boolean isHorizontal) {
    return new AbstractBorder() {

        private final Insets /*static*/
        INSETS = new Insets(10, 20, 10, 20);

        public Insets getInsets(IFigure figure) {
            return INSETS;
        }

        public void paint(IFigure figure, Graphics graphics, Insets insets) {
            Rectangle rect = getPaintRectangle(figure, insets).resize(-1, -1);
            graphics.setForegroundColor(ColorConstants.lightGray);
            // graphics.setLineStyle(SWT.LINE_CUSTOM);
            // graphics.setLineDash(new int[] {8,3});
            graphics.drawRoundRectangle(rect, 10, 10);
        }
    };
}
Also used : Graphics(org.eclipse.draw2d.Graphics) Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle) AbstractBorder(org.eclipse.draw2d.AbstractBorder) IFigure(org.eclipse.draw2d.IFigure)

Example 53 with Insets

use of org.eclipse.draw2d.geometry.Insets in project whole by wholeplatform.

the class SwitchControlFigure method createBorder.

protected AbstractBorder createBorder(final boolean isHorizontal) {
    return new AbstractBorder() {

        private final Insets /*static*/
        INSETS = new Insets(10, 10, 10, 10);

        public Insets getInsets(IFigure figure) {
            return INSETS;
        }

        public void paint(IFigure figure, Graphics graphics, Insets insets) {
            Rectangle rect = getPaintRectangle(figure, insets).resize(-1, -1);
            graphics.setForegroundColor(ColorConstants.lightGray);
            // graphics.setLineStyle(SWT.LINE_CUSTOM);
            // graphics.setLineDash(new int[] {8,3});
            graphics.drawRoundRectangle(rect, 10, 10);
        }
    };
}
Also used : Graphics(org.eclipse.draw2d.Graphics) Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle) AbstractBorder(org.eclipse.draw2d.AbstractBorder) IFigure(org.eclipse.draw2d.IFigure)

Example 54 with Insets

use of org.eclipse.draw2d.geometry.Insets in project whole by wholeplatform.

the class AbstractStyledBorder method getInsets.

public Insets getInsets(IFigure figure) {
    Insets insets = getInsets();
    int lw = getLineWidth();
    return new Insets(lw).add(insets);
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets)

Example 55 with Insets

use of org.eclipse.draw2d.geometry.Insets in project whole by wholeplatform.

the class EllipseStyledBorder method getInsets.

@Override
public Insets getInsets(IFigure figure) {
    Insets result = super.getInsets(figure);
    Rectangle bounds = figure.getBounds();
    if (bounds.width > 0 && bounds.height > 0) {
        int rectWidth = (int) (bounds.width / Math.sqrt(2));
        int rectHeight = (int) (bounds.height / Math.sqrt(2));
        int dw = (bounds.width - rectWidth) / 2;
        int dh = (bounds.height - rectHeight) / 2;
        result.top += dh;
        result.bottom += dh;
        result.left += dw;
        result.right += dw;
    }
    return result;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Aggregations

Insets (org.eclipse.draw2d.geometry.Insets)77 Rectangle (org.eclipse.draw2d.geometry.Rectangle)33 Dimension (org.eclipse.draw2d.geometry.Dimension)32 IFigure (org.eclipse.draw2d.IFigure)12 List (java.util.List)9 Graphics (org.eclipse.draw2d.Graphics)5 AbstractBorder (org.eclipse.draw2d.AbstractBorder)4 PrintDialog (org.eclipse.swt.printing.PrintDialog)4 Printer (org.eclipse.swt.printing.Printer)4 PrinterData (org.eclipse.swt.printing.PrinterData)4 MarginBorder (org.eclipse.draw2d.MarginBorder)3 PrintFigureOperation (org.eclipse.draw2d.PrintFigureOperation)3 Point (org.eclipse.draw2d.geometry.Point)3 Border (org.eclipse.draw2d.Border)2 ScrollBar (org.eclipse.draw2d.ScrollBar)2 ScrollPane (org.eclipse.draw2d.ScrollPane)2 Viewport (org.eclipse.draw2d.Viewport)2 Node (org.eclipse.draw2d.graph.Node)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 EntityPart (org.jkiss.dbeaver.ext.erd.part.EntityPart)2