diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4259b9e8554292123b147b9337dd8309e31971cf..7b39bf3758c8777941bc5219560a33a166caea5d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,7 @@ +2.1.2 + ++ Added ShapeCorona and related builders. + 2.1.0 + Adding event broadcaster for TUI context events. diff --git a/TULIP/src/lu/list/itis/dkd/tui/space/SpatialMatrix.java b/TULIP/src/lu/list/itis/dkd/tui/space/SpatialMatrix.java index aa03abaf43eff5e2bc2fcc1dd363f48ce199a004..b10b98fd82b2cdbb5aabd3ebc301fee49418b711 100644 --- a/TULIP/src/lu/list/itis/dkd/tui/space/SpatialMatrix.java +++ b/TULIP/src/lu/list/itis/dkd/tui/space/SpatialMatrix.java @@ -160,7 +160,10 @@ public class SpatialMatrix { * object (by ID). The method will return a new list build from the sublist of the horizontal * space.
* To determine whether something is "left", the method will make a sub-list of all elements - * with a lower index in the list than the parameterized object. + * with a lower index in the list than the parameterized object.
+ * The returned list is to be read from left to right, that is, to be treated as if the object + * was added to the end. Hence, the first element is furthest away while the last element is + * closest. * * @param objectId * The object for which to retrieve all objects to the left of. @@ -169,12 +172,12 @@ public class SpatialMatrix { */ public synchronized List leftOf(int objectId) { int index = findHorizontalIndexFor(objectId); - return new ArrayList<>(horizontal.subList(index, horizontal.size())); + return new ArrayList<>(horizontal.subList(0, index)); } public synchronized List rightOf(int objectId) { - int index = findHorizontalIndexFor(objectId); - return new ArrayList<>(horizontal.subList(0, index)); + int index = findHorizontalIndexFor(objectId) + 1; + return new ArrayList<>(horizontal.subList(index, horizontal.size())); } public synchronized List above(int objectId) { @@ -183,8 +186,8 @@ public class SpatialMatrix { } public synchronized List below(int objectId) { - int index = findHorizontalIndexFor(objectId); - return new ArrayList<>(horizontal.subList(index, vertical.size())); + int index = findHorizontalIndexFor(objectId) + 1; + return new ArrayList<>(vertical.subList(index, vertical.size())); } String printLists() { diff --git a/TULIP/src/lu/list/itis/dkd/tui/space/SpatialPositioningManager.java b/TULIP/src/lu/list/itis/dkd/tui/space/SpatialPositioningManager.java index dcb50451fba652796734f4835769bdb133975bdd..e8a412c750195702ad60059a15d4831441f4d8bc 100644 --- a/TULIP/src/lu/list/itis/dkd/tui/space/SpatialPositioningManager.java +++ b/TULIP/src/lu/list/itis/dkd/tui/space/SpatialPositioningManager.java @@ -16,6 +16,7 @@ */ package lu.list.itis.dkd.tui.space; +import lu.list.itis.dkd.tui.TangibleObjectManager; import lu.list.itis.dkd.tui.event.SpatialEvent; import lu.list.itis.dkd.tui.event.SpatialEventListener; import lu.list.itis.dkd.tui.utility.PropertiesFetcher; @@ -68,6 +69,15 @@ public class SpatialPositioningManager implements SpatialEventListener { return INSTANCE; } + /** + * Simple getter method for spatialMatrix. + * + * @return The value of spatialMatrix. + */ + public SpatialMatrix getSpatialMatrix() { + return spatialMatrix; + } + /** * Method for configuring a {@link Logger} with several properties as given by the loader * properties file. @@ -89,10 +99,20 @@ public class SpatialPositioningManager implements SpatialEventListener { unconfiguredLogger.setLevel(Level.parse(properties.getProperty("logger.level"))); //$NON-NLS-1$ } - /** {@inheritDoc} */ + /** + * {@inheritDoc}
+ *
+ * + * The event will not be registered if the if of the tangible is not recognized by the + * {@link TangibleObjectManager}. + */ @Override public void spaceUpdated(SpatialEvent event) { + if (TangibleObjectManager.getWidget(event.getSource().getObjectId()) == null) { + return; + } + switch (event.getType()) { case UPDATE: spatialMatrix.update(event.getSource()); @@ -107,6 +127,15 @@ public class SpatialPositioningManager implements SpatialEventListener { logger.log(Level.SEVERE, "Spatial event type \"" + event.getType() + "\" not recognized!"); //$NON-NLS-1$ //$NON-NLS-2$ break; } - System.out.println(spatialMatrix.printLists()); + // System.out.println(spatialMatrix.printLists()); + // System.out.println("Left of " + event.getSource().getObjectId() + ": " + + // spatialMatrix.leftOf(event.getSource().getObjectId())); //$NON-NLS-1$ //$NON-NLS-2$ + // System.out.println("Right of " + event.getSource().getObjectId() + ": " + + // spatialMatrix.rightOf(event.getSource().getObjectId())); //$NON-NLS-1$ //$NON-NLS-2$ + // System.out.println("Above " + event.getSource().getObjectId() + ": " + + // spatialMatrix.above(event.getSource().getObjectId())); //$NON-NLS-1$ //$NON-NLS-2$ + // System.out.println("Below " + event.getSource().getObjectId() + ": " + + // spatialMatrix.below(event.getSource().getObjectId())); //$NON-NLS-1$ //$NON-NLS-2$ + } } \ No newline at end of file