Search in sources :

Example 11 with FreeformLayer

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();
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle) FreeformLayer(org.eclipse.draw2d.FreeformLayer) Image(org.eclipse.swt.graphics.Image) IFigure(org.eclipse.draw2d.IFigure) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure) Test(org.junit.Test)

Example 12 with FreeformLayer

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();
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle) FreeformLayer(org.eclipse.draw2d.FreeformLayer) Image(org.eclipse.swt.graphics.Image) IFigure(org.eclipse.draw2d.IFigure) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure) Test(org.junit.Test)

Example 13 with FreeformLayer

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;
}
Also used : LineLayout(org.eclipse.gemoc.timeline.layout.LineLayout) FreeformLayer(org.eclipse.draw2d.FreeformLayer)

Example 14 with FreeformLayer

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;
}
Also used : FreeformLayout(org.eclipse.draw2d.FreeformLayout) FreeformLayer(org.eclipse.draw2d.FreeformLayer) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure)

Example 15 with FreeformLayer

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;
}
Also used : FreeformLayout(org.eclipse.draw2d.FreeformLayout) FreeformLayer(org.eclipse.draw2d.FreeformLayer) Figure(org.eclipse.draw2d.Figure) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

FreeformLayer (org.eclipse.draw2d.FreeformLayer)28 Figure (org.eclipse.draw2d.Figure)9 IFigure (org.eclipse.draw2d.IFigure)9 FreeformLayout (org.eclipse.draw2d.FreeformLayout)8 ScalableFreeformLayeredPane (org.eclipse.draw2d.ScalableFreeformLayeredPane)4 ConnectionLayer (org.eclipse.draw2d.ConnectionLayer)3 FreeformLayeredPane (org.eclipse.draw2d.FreeformLayeredPane)3 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 LineLayout (org.eclipse.gemoc.timeline.layout.LineLayout)3 Rectangle (org.eclipse.swt.graphics.Rectangle)3 Test (org.junit.Test)3 Label (org.eclipse.draw2d.Label)2 MarginBorder (org.eclipse.draw2d.MarginBorder)2 Image (org.eclipse.swt.graphics.Image)2 Shell (org.eclipse.swt.widgets.Shell)2 DelegatingLayout (org.eclipse.draw2d.DelegatingLayout)1 Graphics (org.eclipse.draw2d.Graphics)1 GridLayout (org.eclipse.draw2d.GridLayout)1 LayeredPane (org.eclipse.draw2d.LayeredPane)1 LineBorder (org.eclipse.draw2d.LineBorder)1