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;
}
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;
}
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);
}
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;
}
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);
}
Aggregations