use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class ColumnSash method outlineShape.
/*
* (non-Javadoc)
*
* @see org.eclipse.draw2d.Shape#outlineShape(org.eclipse.draw2d.Graphics)
*/
@Override
protected void outlineShape(Graphics graphics) {
float lineInset = Math.max(1.0f, getLineWidthFloat()) / 2.0f;
int inset1 = (int) Math.floor(lineInset);
int inset2 = (int) Math.ceil(lineInset);
Rectangle r = Rectangle.SINGLETON.setBounds(getBounds());
r.x += inset1;
r.y += inset1;
r.width -= inset1 + inset2;
r.height -= inset1 + inset2;
if (isMouseHover) {
graphics.setForegroundColor(ColorConstants.orange);
} else {
graphics.setForegroundColor(ColorConstants.buttonLightest);
}
int X = r.x + r.width / 2;
graphics.drawLine(X, r.y, X, r.y + r.height);
}
use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class TableEntityFigure method paintLines.
protected void paintLines(TableEntityFigure entity, Graphics graphics) {
graphics.drawLine(entity.getElementBounds().x, entity.getElementBounds().getBottom().y - 1, entity.getElementBounds().getRight().x, entity.getElementBounds().getBottom().y - 1);
List children = entity.getElement().getChildren();
for (int i = 0; i < children.size() - 1; i++) {
Figure child = (Figure) children.get(i);
Rectangle childBounds = child.getBounds();
graphics.drawLine(childBounds.getTopRight(), childBounds.getBottomRight());
}
// final Rectangle expBounds = getElementBounds();
// graphics.drawLine(expBounds.x + expBounds.width, expBounds.y, expBounds.x + expBounds.width, getBounds().y
// + getBounds().height);
// paintChildrenLines(this, graphics);
}
use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class ToolBarButtonImageFigure method paintFigure.
/**
* @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
*/
@Override
protected void paintFigure(Graphics graphics) {
if (isOpaque()) {
graphics.fillRectangle(getBounds());
}
if (getBorder() instanceof AbstractBackground) {
((AbstractBackground) getBorder()).paintBackground(this, graphics, NO_INSETS);
}
int x, y;
Rectangle area = getClientArea();
y = area.y;
x = area.x;
// }
if (getImage() != null) {
graphics.drawImage(getImage(), x, y);
x = x + size.width + iconTextGap;
}
if (getText() != null) {
graphics.drawText(getText(), x, y);
}
}
use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class RowSelectionEditPolicy method getLocatorFigure.
private IFigure getLocatorFigure(GraphicalEditPart owner) {
IFigure figure = owner.getFigure();
if (owner instanceof TableEntityPart) {
TableEntityFigure treeNodeFigure = (TableEntityFigure) figure;
// table figure to restrict the width
MapperTablePart abstractInOutTreePart = MapperUtils.getMapperTablePart((TableEntityPart) owner);
IFigure parentFigure = ((GraphicalEditPart) abstractInOutTreePart).getFigure();
Rectangle treeBounds = parentFigure.getBounds();
Rectangle rowBounds = treeNodeFigure.getElement().getBounds();
Rectangle treeNodeBounds = figure.getBounds();
figure = new Figure();
if (treeBounds.x + 1 != treeNodeBounds.x || treeNodeBounds.width > treeBounds.width) {
figure.setBounds(new Rectangle(treeBounds.x + 1, treeNodeBounds.y, treeBounds.width - 2, rowBounds.height));
return figure;
} else {
figure.setBounds(owner.getFigure().getBounds().getCopy());
figure.getBounds().height = rowBounds.height;
return figure;
}
} else if (figure instanceof VarEntityFigure) {
Rectangle copy = figure.getBounds().getCopy();
figure = new Figure();
figure.setBounds(copy);
return figure;
}
return owner.getFigure();
}
use of org.eclipse.draw2d.geometry.Rectangle in project tdi-studio-se by Talend.
the class TableTreeEntityFigure method getContents.
@Override
public TreeAnimatingLayer getContents() {
if (this.contentPane == null) {
contentPane = new TreeAnimatingLayer() {
public void setBounds(Rectangle rect) {
int x = bounds.x, y = bounds.y;
boolean resize = (rect.width != bounds.width) || (rect.height != bounds.height), translate = (rect.x != x) || (rect.y != y);
if (isVisible() && (resize || translate))
erase();
if (translate) {
int dx = rect.x - x;
int dy = rect.y - y;
primTranslate(dx, dy);
}
bounds.width = rect.width;
bounds.height = rect.height;
if (resize)
invalidate();
if (resize || translate) {
fireFigureMoved();
fireCoordinateSystemChanged();
repaint();
}
}
};
ToolbarLayout layout = new ToolbarLayout() {
@Override
public void layout(IFigure parent) {
TreeAnimation.recordInitialState(parent);
if (TreeAnimation.playbackState(parent)) {
return;
}
super.layout(parent);
}
@Override
protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) {
return super.calculatePreferredSize(container, wHint, hHint);
}
};
layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
contentPane.setLayoutManager(layout);
this.add(contentPane);
// ///////test
// contentPane.setOpaque(true);
// contentPane.setBackgroundColor(ColorConstants.yellow);
}
return contentPane;
}
Aggregations