Search in sources :

Example 21 with FreeformLayer

use of org.eclipse.draw2d.FreeformLayer in project archi by archimatetool.

the class FreeformGraphicalRootEditPart method createLayers.

/**
 * Creates the top-most set of layers on the given layered pane.
 *
 * @param layeredPane
 *            the parent for the created layers
 */
protected void createLayers(LayeredPane layeredPane) {
    layeredPane.add(createGridLayer(), GRID_LAYER);
    layeredPane.add(getPrintableLayers(), PRINTABLE_LAYERS);
    layeredPane.add(new FreeformLayer(), HANDLE_LAYER);
    layeredPane.add(new FeedbackLayer(), FEEDBACK_LAYER);
    layeredPane.add(new GuideLayer(), GUIDE_LAYER);
}
Also used : FreeformLayer(org.eclipse.draw2d.FreeformLayer)

Example 22 with FreeformLayer

use of org.eclipse.draw2d.FreeformLayer in project archi by archimatetool.

the class AbstractDiagramPart method createFigure.

@Override
protected IFigure createFigure() {
    FreeformLayer figure = new FreeformLayer();
    // Provide an edge when in negative space
    // Causes snap to grid problems when in negative space
    figure.setBorder(new MarginBorder(5));
    figure.setLayoutManager(new FreeformLayout());
    // Have to add this if we want Animation to work on figures!
    AnimationUtil.addFigureForAnimation(figure);
    // Anti-aliasing
    setAntiAlias();
    return figure;
}
Also used : FreeformLayout(org.eclipse.draw2d.FreeformLayout) MarginBorder(org.eclipse.draw2d.MarginBorder) FreeformLayer(org.eclipse.draw2d.FreeformLayer)

Example 23 with FreeformLayer

use of org.eclipse.draw2d.FreeformLayer in project archi by archimatetool.

the class AbstractContainerFigure method getMainFigure.

/**
 * @return The main figure to draw on
 */
public IFigure getMainFigure() {
    if (fMainFigure == null) {
        fMainFigure = new FreeformLayer();
        fMainFigure.setLayoutManager(new XYLayout());
        // Have to add this if we want Animation to work on figures
        AnimationUtil.addFigureForAnimation(fMainFigure);
    }
    return fMainFigure;
}
Also used : XYLayout(org.eclipse.draw2d.XYLayout) FreeformLayer(org.eclipse.draw2d.FreeformLayer)

Example 24 with FreeformLayer

use of org.eclipse.draw2d.FreeformLayer in project archi by archimatetool.

the class AbstractExportProviderTests method runOnceBeforeEachTest.

public void runOnceBeforeEachTest() {
    shell = new Shell();
    rootFigure = new FreeformLayer();
    rootFigure.setBounds(new Rectangle(0, 0, 500, 500));
}
Also used : Shell(org.eclipse.swt.widgets.Shell) Rectangle(org.eclipse.draw2d.geometry.Rectangle) FreeformLayer(org.eclipse.draw2d.FreeformLayer)

Example 25 with FreeformLayer

use of org.eclipse.draw2d.FreeformLayer in project archi by archimatetool.

the class DiagramUtilsTests method testGetMinimumBounds_FreeformLayer.

@Test
public void testGetMinimumBounds_FreeformLayer() {
    IFigure rootFigure = new FreeformLayer();
    org.eclipse.draw2d.geometry.Rectangle rect1 = new org.eclipse.draw2d.geometry.Rectangle(0, 0, 1000, 1000);
    rootFigure.setBounds(rect1);
    assertNull(DiagramUtils.getMinimumBounds(rootFigure));
    IFigure childFigure = new Figure();
    org.eclipse.draw2d.geometry.Rectangle rect2 = new org.eclipse.draw2d.geometry.Rectangle(10, 10, 50, 50);
    childFigure.setBounds(rect2);
    rootFigure.add(childFigure);
    childFigure = new Figure();
    org.eclipse.draw2d.geometry.Rectangle rect3 = new org.eclipse.draw2d.geometry.Rectangle(200, 220, 100, 100);
    childFigure.setBounds(rect3);
    rootFigure.add(childFigure);
    assertEquals(new org.eclipse.draw2d.geometry.Rectangle(10, 10, 290, 310), DiagramUtils.getMinimumBounds(rootFigure));
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle) FreeformLayer(org.eclipse.draw2d.FreeformLayer) IFigure(org.eclipse.draw2d.IFigure) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure) Test(org.junit.Test)

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