Search in sources :

Example 71 with Insets

use of org.eclipse.draw2d.geometry.Insets in project archi by archimatetool.

the class ImageBorder method setImage.

public void setImage(Image img) {
    image = img;
    imageSize = new Dimension(image);
    imgInsets = new Insets();
    imgInsets.left = imageSize.width;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Dimension(org.eclipse.draw2d.geometry.Dimension)

Example 72 with Insets

use of org.eclipse.draw2d.geometry.Insets in project archi by archimatetool.

the class VerticalPlacement method visit.

@SuppressWarnings("deprecation")
@Override
void visit(DirectedGraph g) {
    Insets pad;
    int currentY = g.getMargin().top;
    int row, rowHeight;
    g.rankLocations = new int[g.ranks.size() + 1];
    for (row = 0; row < g.ranks.size(); row++) {
        g.rankLocations[row] = currentY;
        Rank rank = g.ranks.getRank(row);
        rowHeight = 0;
        rank.topPadding = rank.bottomPadding = 0;
        for (int n = 0; n < rank.size(); n++) {
            Node node = rank.getNode(n);
            pad = g.getPadding(node);
            rowHeight = Math.max(node.height, rowHeight);
            rank.topPadding = Math.max(pad.top, rank.topPadding);
            rank.bottomPadding = Math.max(pad.bottom, rank.bottomPadding);
        }
        currentY += rank.topPadding;
        rank.setDimensions(currentY, rowHeight);
        currentY += rank.height + rank.bottomPadding;
    }
    g.rankLocations[row] = currentY;
    g.size.height = currentY;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets)

Example 73 with Insets

use of org.eclipse.draw2d.geometry.Insets in project archi by archimatetool.

the class BlockFlow method postValidate.

/**
 * @see org.eclipse.draw2d.text.FlowFigure#postValidate()
 */
@SuppressWarnings("deprecation")
@Override
public void postValidate() {
    Rectangle newBounds = getBlockBox().toRectangle();
    newBounds.crop(new Insets(getTopMargin(), getLeftMargin(), getBottomMargin(), getRightMargin()));
    setBounds(newBounds);
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Example 74 with Insets

use of org.eclipse.draw2d.geometry.Insets in project yamcs-studio by yamcs.

the class ScrollBarFigureLayout method layoutButtons.

/**
 * Places the buttons and returns the Rectangle into which the track should be placed. The track consists of the
 * pageup, pagedown, and thumb figures. The Rectangle returned should be transposed correctly, that is, it should be
 * vertically oriented. Users of the rectangle will re-transpose it for horizontal use.
 *
 * @param scrollBar
 *            the scrollbar whose buttons are being layed out
 * @return the Rectangle into which the track should be placed
 */
protected Rectangle layoutButtons(ScrollbarFigure scrollBar) {
    var bounds = transposer.t(scrollBar.getClientArea());
    var buttonSize = new Dimension(bounds.width, Math.min(bounds.width, bounds.height / 2));
    if (up != null) {
        up.setBounds(transposer.t(new Rectangle(bounds.getTopLeft(), buttonSize)));
    }
    if (down != null) {
        var r = new Rectangle(bounds.x, bounds.bottom() - buttonSize.height, buttonSize.width, buttonSize.height);
        down.setBounds(transposer.t(r));
    }
    var trackBounds = bounds.getCropped(new Insets((up == null) ? 0 : buttonSize.height, 0, (down == null) ? 0 : buttonSize.height, 0));
    return trackBounds;
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Dimension(org.eclipse.draw2d.geometry.Dimension)

Example 75 with Insets

use of org.eclipse.draw2d.geometry.Insets in project statecharts by Yakindu.

the class GroupStatesIntoCompositeRefactoring method setCompositeStateLayoutConstraint.

/**
 * Iterates through all {@link StateEditPart}s of the current selection and
 * computes layout constraints for the composite node.
 *
 * @param compositeStateNode
 *            node of the composite state
 */
protected void setCompositeStateLayoutConstraint(Node compositeStateNode) {
    Rectangle newbounds = null;
    for (GraphicalEditPart editPart : getContextObjects()) {
        Rectangle childBounds = editPart.getFigure().getBounds();
        if (newbounds == null)
            newbounds = childBounds.getCopy();
        newbounds.union(childBounds);
    }
    newbounds.expand(new Insets(PADDING, PADDING, PADDING, PADDING));
    Bounds bounds = NotationFactory.eINSTANCE.createBounds();
    bounds.setX(newbounds.x);
    bounds.setY(newbounds.y);
    bounds.setWidth(newbounds.width);
    bounds.setHeight(newbounds.height);
    compositeStateNode.setLayoutConstraint(bounds);
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Bounds(org.eclipse.gmf.runtime.notation.Bounds) Rectangle(org.eclipse.draw2d.geometry.Rectangle) GraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart) IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)

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