From 021e1ccc69d29417a53a5ef54c9bbcdbb57b59f0 Mon Sep 17 00:00:00 2001 From: Eric Tobias Date: Tue, 10 Nov 2015 13:48:32 +0100 Subject: [PATCH] 2.1.4 Added more documentation on changes in Point. --- CHANGELOG.txt | 4 ++- .../itis/dkd/tui/TangibleApplication.java | 14 ++-------- .../lu/list/itis/dkd/tui/utility/Point.java | 27 ++++++++++++------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 71fa890..ed58f73 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,7 +4,9 @@ + Changed update method to return whether the underlying data structure have indeed been changed. + Added PositionChangeListener. + Added method for fetching the position of the lowest ID handle from the BaseWidget. -+ Added methods to filter the list of widgets returned by getLeftMostWidget. ++ Added methods to filter the list of widgets returned by getLeftMostWidget ++ Changed the InterfaceManager reference in the TangibleApplication to be static. Changed related getter as well. ++ Abolished precondition from Point on the add method. The parameterized point will see its coordinate system changed to that of the calling point rather then checking a precondition and failing if the coordinate system states are different. 2.1.3 diff --git a/TULIP/src/lu/list/itis/dkd/tui/TangibleApplication.java b/TULIP/src/lu/list/itis/dkd/tui/TangibleApplication.java index 7804e70..5568b06 100644 --- a/TULIP/src/lu/list/itis/dkd/tui/TangibleApplication.java +++ b/TULIP/src/lu/list/itis/dkd/tui/TangibleApplication.java @@ -46,15 +46,12 @@ import javax.swing.JComponent; * * @author Eric TOBIAS [eric.tobias@list.lu] * @since 1.0 - * @version 2.0.3 + * @version 2.1.4 */ @NonNullByDefault public abstract class TangibleApplication { protected static Properties properties = new Properties(); - /** The URI of the properties file as qualified from this file. */ - private static String propertiesFileURI = "properties.properties"; //$NON-NLS-1$ - /** A {@link Logger} to log all messages during execution. */ protected static final Logger logger = Logger.getLogger(TangibleApplication.class.getSimpleName()); @@ -95,13 +92,6 @@ public abstract class TangibleApplication { } properties = PropertiesFetcher.fetchProperties(); - // try (FileInputStream inputStream = new FileInputStream(new File(propertiesFileURI))) { - // properties.load(inputStream); - // } catch (IOException ioe) { - // logger.log(Level.SEVERE, "The properties file or values thereof could not be loaded!", - // ioe); //$NON-NLS-1$ - // System.exit(42); - // } configureLogger(logger); interfaceManager = new TangibleInterfaceManager(this, logger, properties); @@ -206,7 +196,7 @@ public abstract class TangibleApplication { * The value to set interfaceManager to. */ public void setInterfaceManager(TangibleInterfaceManager interfaceManager) { - this.interfaceManager = interfaceManager; + TangibleApplication.interfaceManager = interfaceManager; } /** diff --git a/TULIP/src/lu/list/itis/dkd/tui/utility/Point.java b/TULIP/src/lu/list/itis/dkd/tui/utility/Point.java index 0af4997..01867bf 100644 --- a/TULIP/src/lu/list/itis/dkd/tui/utility/Point.java +++ b/TULIP/src/lu/list/itis/dkd/tui/utility/Point.java @@ -22,6 +22,8 @@ import lu.list.itis.dkd.dbc.annotation.Nullable; import com.google.common.base.Preconditions; import java.awt.geom.Point2D.Float; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Class modelling a coordinate as a point holding floating point coordinates and a state for @@ -30,7 +32,7 @@ import java.awt.geom.Point2D.Float; * * @author Eric TOBIAS [eric.tobias@list.lu] * @since 1.0 - * @version 1.0.2 + * @version 2.1.4 */ @NonNullByDefault public class Point extends Float { @@ -272,28 +274,33 @@ public class Point extends Float { * @param point * The initialTranslation values to addition to this point's values. * @return If point == null, the method will return this instance. Otherwise, a new - * {@link Point} instance such that:
- * x = this.x + point.x
- * y = this.y + point.y
- * angle = this.angle + point.angle
. - * @pre point.state equal to state iff point != null + * {@link Point} instance such that:
+ * x = this.x + point.x
+ * y = this.y + point.y
+ * angle = this.angle + point.angle
+ * state = this.state
.
+ *
+ * Note that this method will convert the coordinate system of the parameterized point, + * using {@link CoordinateState}, and as such, the resulting point will use the system + * of this instance. */ public Point add(@Nullable Point point) { if (point == null) { return this; } + switch (state.getClass().getSimpleName()) { - case "TableCoordinates": + case "TableCoordinates": //$NON-NLS-1$ point.toTableCoordinates(); break; - case "ScreenCoordinates": + case "ScreenCoordinates": //$NON-NLS-1$ point.toScreenCoordinates(); break; - case "CameraCoordinates": + case "CameraCoordinates": //$NON-NLS-1$ point.toCameraCoordinates(); break; default: - System.err.println("This should never happen! State: " + state.toString()); + Logger.getLogger(Point.class.getSimpleName()).log(Level.SEVERE, "This should never happen! State: " + state.toString()); //$NON-NLS-1$ break; } -- GitLab