Search in sources :

Example 16 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)

Example 17 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
            IPreferenceStore store = ERDActivator.getDefault().getPreferenceStore();
            printOp.setPrintMode(store.getInt(ERDConstants.PREF_PRINT_PAGE_MODE));
            printOp.setPrintMargin(new Insets(store.getInt(ERDConstants.PREF_PRINT_MARGIN_TOP), store.getInt(ERDConstants.PREF_PRINT_MARGIN_LEFT), store.getInt(ERDConstants.PREF_PRINT_MARGIN_BOTTOM), store.getInt(ERDConstants.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) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 18 with Insets

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

the class DirectedGraphLayoutVisitor method addEntityNode.

/**
     * Adds nodes to the graph object for use by the GraphLayoutAuto
     */
protected void addEntityNode(NodeEditPart nodeEditPart) {
    Node entityNode;
    if (nodeEditPart instanceof EntityPart && ((EntityPart) nodeEditPart).getTable().hasSelfLinks()) {
        entityNode = new Subgraph(nodeEditPart);
    } else {
        entityNode = new Node(nodeEditPart);
    }
    Dimension preferredSize = nodeEditPart.getFigure().getPreferredSize(400, 300);
    entityNode.width = preferredSize.width;
    entityNode.height = preferredSize.height;
    entityNode.setPadding(new Insets(20, 20, 10, 20));
    partToNodesMap.put(nodeEditPart, entityNode);
    graph.nodes.add(entityNode);
    if (entityNode instanceof Subgraph) {
        Node sourceAnchor = new Node("Fake node for source links", (Subgraph) entityNode);
        sourceAnchor.width = 0;
        sourceAnchor.height = 0;
        Node targetAnchor = new Node("Fake node for target links", (Subgraph) entityNode);
        targetAnchor.width = 0;
        targetAnchor.height = 0;
    }
/*
*/
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Dimension(org.eclipse.draw2d.geometry.Dimension) EntityPart(org.jkiss.dbeaver.ext.erd.part.EntityPart)

Example 19 with Insets

use of org.eclipse.draw2d.geometry.Insets in project tdi-studio-se by Talend.

the class LabelCenter method getFinalDisplayText.

public String getFinalDisplayText() {
    Dimension textSize = calculateTextSize(getText());
    Rectangle area = getClientArea();
    Insets i = getInsets();
    if (textSize.width >= area.width - i.left - i.right - OFFSET * 2) {
        return ELLIPSIS;
    }
    return text;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Dimension(org.eclipse.draw2d.geometry.Dimension)

Example 20 with Insets

use of org.eclipse.draw2d.geometry.Insets in project tdi-studio-se by Talend.

the class RowLayout method calculatePreferredSize.

@Override
protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) {
    TableLayout tableLayout = getTableLayout(container);
    IFigure containerFigure = getTableContainer(container);
    wHint = -1;
    hHint = -1;
    Insets insets = container.getInsets();
    List children = container.getChildren();
    Dimension prefSize = calculateChildrenSize(children, wHint, hHint, containerFigure.getBounds().width, tableLayout.getWeight());
    prefSize.height = FIXED_ROW_HEIGHT;
    return prefSize.expand(insets.getWidth(), insets.getHeight()).union(getBorderPreferredSize(container));
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) List(java.util.List) Dimension(org.eclipse.draw2d.geometry.Dimension) IFigure(org.eclipse.draw2d.IFigure)

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