use of org.eclipse.draw2d.Border in project tdi-studio-se by Talend.
the class ZoneContentLayout method layout.
@Override
public void layout(IFigure parent) {
Rectangle vBounds = null;
if (parent.getParent() instanceof Viewport) {
vBounds = ((Viewport) parent.getParent()).getBounds();
}
int wHint = -1;
int hHint = -1;
if (isHorizontal()) {
hHint = parent.getClientArea(Rectangle.SINGLETON).height;
} else {
wHint = parent.getClientArea(Rectangle.SINGLETON).width;
}
List children = parent.getChildren();
int numChildren = children.size();
Rectangle clientArea = transposer.t(parent.getClientArea());
int x = clientArea.x;
int y = clientArea.y;
int availableHeight = clientArea.height;
Dimension[] prefSizes = new Dimension[numChildren];
Dimension[] minSizes = new Dimension[numChildren];
IFigure child;
int totalHeight = 0;
int totalMinHeight = 0;
int prefMinSumHeight = 0;
int connSize = 0;
// boolean isLookupConnMax = true;
for (int i = 0; i < numChildren; i++) {
child = (IFigure) children.get(i);
prefSizes[i] = transposer.t(getChildPreferredSize(child, wHint, hHint));
minSizes[i] = transposer.t(getChildMinimumSize(child, wHint, hHint));
totalHeight += prefSizes[i].height;
totalMinHeight += minSizes[i].height;
if (child instanceof AbstractTableContainer) {
connSize = getLookupConnectionSize((AbstractTableContainer) child);
}
}
totalHeight += (numChildren - 1) * spacing;
totalMinHeight += (numChildren - 1) * spacing;
prefMinSumHeight = totalHeight - totalMinHeight;
int defaultSize = DEFAULT_OFFSET;
for (int i = 0; i < numChildren; i++) {
int amntShrinkCurrentHeight = 0;
int prefHeight = prefSizes[i].height;
int minHeight = minSizes[i].height;
int prefWidth = prefSizes[i].width;
int minWidth = minSizes[i].width;
child = (IFigure) children.get(i);
Rectangle newBounds = new Rectangle(x, y, prefWidth, prefHeight);
if (connSize > 0) {
newBounds = new Rectangle(x + (connSize - 1) * defaultSize, y, prefWidth, prefHeight);
}
Border border = parent.getBorder();
Insets insets = border.getInsets(child);
if (vBounds != null) {
newBounds.width = vBounds.width - insets.left - insets.right;
if (connSize > 0) {
newBounds.width = newBounds.width - (connSize - 1) * defaultSize;
}
}
newBounds.height -= amntShrinkCurrentHeight;
child.setBounds(transposer.t(newBounds));
prefMinSumHeight -= (prefHeight - minHeight);
y += newBounds.height + spacing;
}
}
use of org.eclipse.draw2d.Border in project tdi-studio-se by Talend.
the class TalendDrawerFigure method getTitleBorder.
protected Border getTitleBorder() {
Insets insets = cssStyleSetting.getTitleMarginBorder().getInsets(null);
Border talendTitleBorder = new MarginBorder(insets.top, insets.left + customizedCSSStyleSetting.getXOffset() * childLevel, insets.bottom, insets.right);
return talendTitleBorder;
}
use of org.eclipse.draw2d.Border in project tdi-studio-se by Talend.
the class BusinessDiagramEditor method selectionChanged.
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
super.selectionChanged(part, selection);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
JobSettingsView view = (JobSettingsView) page.findView(JobSettingsView.ID);
getDiagramEditorInput().getItem().getProperty().eAdapters().remove(dirtyListener);
if (view == null) {
return;
}
if (!(selection instanceof IStructuredSelection)) {
return;
}
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
if (!(selection instanceof IStructuredSelection)) {
return;
} else if (firstElement instanceof RepositoryNode) {
return;
}
// for Find Assignment
if (((IStructuredSelection) selection).size() > 0) {
DiagramEditPart diagramEditPart = getDiagramEditPart();
if (diagramEditPart instanceof BusinessProcessEditPart) {
BusinessProcessEditPart processPart = (BusinessProcessEditPart) diagramEditPart;
for (Object object : processPart.getChildren()) {
if (object instanceof BusinessItemShapeEditPart) {
BusinessItemShapeEditPart shapEditPart = (BusinessItemShapeEditPart) object;
IFigure figure = shapEditPart.getFigure();
for (Object child : figure.getChildren()) {
if (child instanceof BusinessItemShapeFigure) {
BusinessItemShapeFigure shapFigure = (BusinessItemShapeFigure) child;
Border border = shapFigure.getBorder();
if (border != null) {
shapFigure.setDrawFrame(false);
shapFigure.revalidate();
shapFigure.repaint();
}
}
}
}
}
}
}
// to refresh the jobsettings view
if (((IStructuredSelection) selection).size() > 1) {
view.cleanDisplay();
} else {
if (firstElement instanceof BusinessItemShapeEditPart || firstElement instanceof BaseBusinessItemRelationShipEditPart || firstElement instanceof NoteEditPart || firstElement instanceof NoteAttachmentEditPart) {
view.refresh(false, firstElement);
} else if (firstElement instanceof BusinessProcessEditPart || firstElement instanceof CompartmentEditPart) {
view.refresh(true, this);
}
}
getDiagramEditorInput().getItem().getProperty().eAdapters().add(dirtyListener);
}
use of org.eclipse.draw2d.Border in project dbeaver by serge-rider.
the class FigureEditorLocator method relocate.
/**
* expands the size of the control by 1 pixel in each direction
*/
@Override
public void relocate(CellEditor celleditor) {
Border border = figure.getBorder();
// Insets insets = border.getInsets(figure);
Dimension borderSize = border.getPreferredSize(figure);
Text text = (Text) celleditor.getControl();
Rectangle rect = figure.getBounds().getCopy();
figure.translateToAbsolute(rect);
text.setBackground(figure.getBackgroundColor());
text.setBounds(rect.x + borderSize.width, rect.y + borderSize.height, rect.width - borderSize.width * 2, rect.height - borderSize.height * 2);
}
use of org.eclipse.draw2d.Border in project dbeaver by dbeaver.
the class FigureEditorLocator method relocate.
/**
* expands the size of the control by 1 pixel in each direction
*/
@Override
public void relocate(CellEditor celleditor) {
Border border = figure.getBorder();
// Insets insets = border.getInsets(figure);
Dimension borderSize = border.getPreferredSize(figure);
Text text = (Text) celleditor.getControl();
Rectangle rect = figure.getBounds().getCopy();
figure.translateToAbsolute(rect);
text.setBackground(figure.getBackgroundColor());
text.setBounds(rect.x + borderSize.width, rect.y + borderSize.height, rect.width - borderSize.width * 2, rect.height - borderSize.height * 2);
}
Aggregations