use of org.eclipse.draw2d.FreeformLayer in project archi by archimatetool.
the class DiagramUtilsTests method testCreateImage_Is_Scaled.
@Test
public void testCreateImage_Is_Scaled() {
IFigure rootFigure = new FreeformLayer();
org.eclipse.draw2d.geometry.Rectangle rect1 = new org.eclipse.draw2d.geometry.Rectangle(0, 0, 1000, 1000);
rootFigure.setBounds(rect1);
IFigure childFigure1 = new Figure();
org.eclipse.draw2d.geometry.Rectangle rect2 = new org.eclipse.draw2d.geometry.Rectangle(100, 100, 300, 200);
childFigure1.setBounds(rect2);
rootFigure.add(childFigure1);
Image img = DiagramUtils.createImage(rootFigure, 1, 0);
assertEquals(new Rectangle(0, 0, 300, 200), img.getBounds());
img.dispose();
img = DiagramUtils.createImage(rootFigure, 0.25, 0);
assertEquals(new Rectangle(0, 0, 75, 50), img.getBounds());
img.dispose();
img = DiagramUtils.createImage(rootFigure, 5, 0);
assertEquals(new Rectangle(0, 0, 1500, 1000), img.getBounds());
img.dispose();
}
use of org.eclipse.draw2d.FreeformLayer in project archi by archimatetool.
the class DiagramUtilsTests method testCreateImage_FigureWithChildren.
@Test
public void testCreateImage_FigureWithChildren() {
IFigure rootFigure = new FreeformLayer();
org.eclipse.draw2d.geometry.Rectangle rect1 = new org.eclipse.draw2d.geometry.Rectangle(0, 0, 1000, 1000);
rootFigure.setBounds(rect1);
// Blank View is minimum 100 x 100
Image img = DiagramUtils.createImage(rootFigure, 1, 0);
assertEquals(new Rectangle(0, 0, 100, 100), img.getBounds());
img.dispose();
IFigure childFigure1 = new Figure();
org.eclipse.draw2d.geometry.Rectangle rect2 = new org.eclipse.draw2d.geometry.Rectangle(90, 90, 230, 190);
childFigure1.setBounds(rect2);
rootFigure.add(childFigure1);
IFigure childFigure2 = new Figure();
org.eclipse.draw2d.geometry.Rectangle rect3 = new org.eclipse.draw2d.geometry.Rectangle(120, 150, 230, 190);
childFigure2.setBounds(rect3);
rootFigure.add(childFigure2);
img = DiagramUtils.createImage(rootFigure, 1, 0);
assertEquals(new Rectangle(0, 0, 260, 250), img.getBounds());
img.dispose();
}
use of org.eclipse.draw2d.FreeformLayer in project gemoc-studio by eclipse.
the class TimelineWindowEditPart method createFigure.
@Override
protected IFigure createFigure() {
final LineLayout layout = new LineLayout();
layout.setHorizontal(false);
layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT);
layout.setMinorAlignment(FlowLayout.ALIGN_TOPLEFT);
layout.setMinorSpacing(SPACING);
layout.setMargin(MARGIN);
FreeformLayer res = new FreeformLayer();
res.setLayoutManager(layout);
return res;
}
use of org.eclipse.draw2d.FreeformLayer in project cubrid-manager by CUBRID.
the class DiagramPart method createFigure.
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
* @return figure
*/
protected IFigure createFigure() {
Figure figure = new FreeformLayer();
figure.setLayoutManager(new FreeformLayout());
return figure;
}
use of org.eclipse.draw2d.FreeformLayer in project cubrid-manager by CUBRID.
the class DashboardPart method createFigure.
/**
* create a new figure used by DashboardPart
*
* @return FreeformLayer with FreeformLayout
*/
protected IFigure createFigure() {
Figure figure = new FreeformLayer();
figure.setLayoutManager(new FreeformLayout());
return figure;
}
Aggregations