use of org.eclipse.draw2d.geometry.Insets in project tdi-studio-se by Talend.
the class TableContainerLayout method calculatePreferredSize.
@Override
protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) {
Insets insets = container.getInsets();
if (isHorizontal()) {
wHint = -1;
if (hHint >= 0) {
hHint = Math.max(0, hHint - insets.getHeight());
}
} else {
hHint = -1;
if (wHint >= 0) {
wHint = Math.max(0, wHint - insets.getWidth());
}
}
List children = container.getChildren();
Dimension prefSize = calculateChildrenSize(children, wHint, hHint, true);
// Do a second pass, if necessary
if (wHint >= 0 && prefSize.width > wHint) {
prefSize = calculateChildrenSize(children, prefSize.width, hHint, true);
} else if (hHint >= 0 && prefSize.width > hHint) {
prefSize = calculateChildrenSize(children, wHint, prefSize.width, true);
}
prefSize.height += Math.max(0, children.size() - 1) * spacing;
return transposer.t(prefSize).expand(insets.getWidth(), insets.getHeight()).union(getBorderPreferredSize(container));
}
use of org.eclipse.draw2d.geometry.Insets in project dbeaver by dbeaver.
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;
}
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
* @since 2.0
*/
protected Rectangle layoutButtons(ScrollbarFigure scrollBar) {
Rectangle bounds = transposer.t(scrollBar.getClientArea());
Dimension 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) {
Rectangle r = new Rectangle(bounds.x, bounds.bottom() - buttonSize.height, buttonSize.width, buttonSize.height);
down.setBounds(transposer.t(r));
}
Rectangle 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 archi by archimatetool.
the class CanvasEditor method createRootEditPart.
@Override
protected void createRootEditPart(GraphicalViewer viewer) {
/*
* We'll have a Zoom Manager using ScalableFreeformRootEditPart
*/
RootEditPart rootPart = new ScalableFreeformRootEditPart() {
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
if (adapter == AutoexposeHelper.class) {
return new ExtendedViewportAutoexposeHelper(this, new Insets(50), false);
}
return super.getAdapter(adapter);
}
};
viewer.setRootEditPart(rootPart);
}
use of org.eclipse.draw2d.geometry.Insets in project archi by archimatetool.
the class SketchEditor method createRootEditPart.
@Override
protected void createRootEditPart(GraphicalViewer viewer) {
/*
* We'll have a Zoom Manager and a background image
*/
RootEditPart rootPart = new ScalableFreeformRootEditPart() {
@Override
protected ScalableFreeformLayeredPane createScaledLayers() {
// Insert Background Image behind Grid
// Note - background image is not on a Printable Layer, so won't print!
fScalableFreeformLayeredPane = super.createScaledLayers();
updateBackgroundImage();
return fScalableFreeformLayeredPane;
}
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
if (adapter == AutoexposeHelper.class) {
return new ExtendedViewportAutoexposeHelper(this, new Insets(50), false);
}
return super.getAdapter(adapter);
}
};
viewer.setRootEditPart(rootPart);
}
Aggregations