Search in sources :

Example 11 with DockArea

use of org.osate.ge.internal.diagram.runtime.DockArea in project osate2 by osate.

the class DiagramUpdaterTest method checkElements.

private static void checkElements(final Collection<DiagramElement> elements, final TestBusinessObject parentBO, final DockArea parentDockArea, final EnumSet<CheckFlag> flags) {
    // Check the number of elements in the model
    assertThat(elements.size(), is(equalTo(parentBO.children.length)));
    // Check that each element in the model is in the element set
    for (final TestBusinessObject child : parentBO.children) {
        boolean foundBO = false;
        final RelativeBusinessObjectReference modelChildRef = child.getRelativeReference();
        for (final DiagramElement e : elements) {
            final RelativeBusinessObjectReference elementRef = ((TestBusinessObject) e.getBusinessObject()).getRelativeReference();
            if (elementRef.equals(modelChildRef)) {
                foundBO = true;
                break;
            }
        }
        assertThat("The diagram does not contain an element for the business object: " + child, foundBO);
    }
    // Finish checking each element
    for (final DiagramElement e : elements) {
        // Check the position of the element
        final TestBusinessObject testBo = (TestBusinessObject) e.getBusinessObject();
        if (flags.contains(CheckFlag.CHECK_POSITION)) {
            assertThat(e.getPosition(), is(equalTo(testBo.getTestPosition())));
        }
        final DockArea dockArea = getExpectedDockArea(testBo, parentDockArea);
        if (flags.contains(CheckFlag.CHECK_DOCK_AREA)) {
            assertThat(e.getDockArea(), is(equalTo(dockArea)));
        }
        // Check the children
        checkElements(e.getChildren(), (TestBusinessObject) e.getBusinessObject(), dockArea, flags);
    }
}
Also used : DiagramElement(org.osate.ge.internal.diagram.runtime.DiagramElement) TestBusinessObject(org.osate.ge.tests.unit.TestBusinessObject) DockArea(org.osate.ge.internal.diagram.runtime.DockArea) RelativeBusinessObjectReference(org.osate.ge.RelativeBusinessObjectReference)

Aggregations

DockArea (org.osate.ge.internal.diagram.runtime.DockArea)11 DiagramElement (org.osate.ge.internal.diagram.runtime.DiagramElement)9 Point (org.osate.ge.graphics.Point)7 DiagramNode (org.osate.ge.internal.diagram.runtime.DiagramNode)6 Dimension (org.osate.ge.graphics.Dimension)5 PortSide (org.eclipse.elk.core.options.PortSide)4 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)3 ImmutableList (com.google.common.collect.ImmutableList)3 Lists (com.google.common.collect.Lists)3 Collection (java.util.Collection)3 Collections (java.util.Collections)3 Comparator (java.util.Comparator)3 EnumSet (java.util.EnumSet)3 HashSet (java.util.HashSet)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 Entry (java.util.Map.Entry)3 Objects (java.util.Objects)3 Optional (java.util.Optional)3 Set (java.util.Set)3