Search in sources :

Example 11 with Insets

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

the class RoundedTitleTabBorder method calculateInsets.

@Override
protected Insets calculateInsets(IFigure figure) {
    Insets insets = new Insets(LINE_WIDTH);
    Dimension textExtents = getTextExtents(figure);
    insets.top += textExtents.height;
    return insets;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Dimension(org.eclipse.draw2d.geometry.Dimension)

Example 12 with Insets

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

the class ParallelFigure 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 13 with Insets

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

the class UnderlineStyledBorder method getInsets.

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

Example 14 with Insets

use of org.eclipse.draw2d.geometry.Insets in project dbeaver by serge-rider.

the class ERDEditorPart method printDiagram.

public void printDiagram() {
    GraphicalViewer viewer = getGraphicalViewer();
    PrintDialog dialog = new PrintDialog(viewer.getControl().getShell(), SWT.NULL);
    PrinterData data = dialog.open();
    if (data != null) {
        IFigure rootFigure = rootPart.getLayer(ScalableFreeformRootEditPart.PRINTABLE_LAYERS);
        // EntityDiagramFigure diagramFigure = findFigure(rootFigure, EntityDiagramFigure.class);
        if (rootFigure != null) {
            PrintFigureOperation printOp = new PrintFigureOperation(new Printer(data), rootFigure);
            // Set print preferences
            DBPPreferenceStore store = ERDUIActivator.getDefault().getPreferences();
            printOp.setPrintMode(store.getInt(ERDUIConstants.PREF_PRINT_PAGE_MODE));
            printOp.setPrintMargin(new Insets(store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_TOP), store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_LEFT), store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_BOTTOM), store.getInt(ERDUIConstants.PREF_PRINT_MARGIN_RIGHT)));
            // Run print
            printOp.run("Print ER diagram");
        }
    }
// new PrintAction(this).run();
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) PrintDialog(org.eclipse.swt.printing.PrintDialog) PrinterData(org.eclipse.swt.printing.PrinterData) Printer(org.eclipse.swt.printing.Printer) PrintFigureOperation(org.eclipse.draw2d.PrintFigureOperation) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore) IFigure(org.eclipse.draw2d.IFigure)

Example 15 with Insets

use of org.eclipse.draw2d.geometry.Insets in project dbeaver by serge-rider.

the class EditableLabel method getSelectionRectangle.

private Rectangle getSelectionRectangle() {
    Rectangle bounds = getTextBounds().getCopy();
    bounds.expand(new Insets(2, 2, 0, 0));
    translateToParent(bounds);
    bounds.intersect(getBounds());
    return bounds;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Aggregations

Insets (org.eclipse.draw2d.geometry.Insets)39 Rectangle (org.eclipse.draw2d.geometry.Rectangle)17 Dimension (org.eclipse.draw2d.geometry.Dimension)14 IFigure (org.eclipse.draw2d.IFigure)10 Graphics (org.eclipse.draw2d.Graphics)5 List (java.util.List)4 AbstractBorder (org.eclipse.draw2d.AbstractBorder)4 MarginBorder (org.eclipse.draw2d.MarginBorder)3 PrintDialog (org.eclipse.swt.printing.PrintDialog)3 Printer (org.eclipse.swt.printing.Printer)3 PrinterData (org.eclipse.swt.printing.PrinterData)3 ExtendedViewportAutoexposeHelper (com.archimatetool.editor.diagram.util.ExtendedViewportAutoexposeHelper)2 Border (org.eclipse.draw2d.Border)2 PrintFigureOperation (org.eclipse.draw2d.PrintFigureOperation)2 Node (org.eclipse.draw2d.graph.Node)2 RootEditPart (org.eclipse.gef.RootEditPart)2 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 EntityPart (org.jkiss.dbeaver.ext.erd.part.EntityPart)2 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)1