Commit 021e1ccc authored by Eric Tobias's avatar Eric Tobias

2.1.4 Added more documentation on changes in Point.

parent ccb95be9
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
+ Changed update method to return whether the underlying data structure have indeed been changed. + Changed update method to return whether the underlying data structure have indeed been changed.
+ Added PositionChangeListener. + Added PositionChangeListener.
+ Added method for fetching the position of the lowest ID handle from the BaseWidget. + 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 2.1.3
......
...@@ -46,15 +46,12 @@ import javax.swing.JComponent; ...@@ -46,15 +46,12 @@ import javax.swing.JComponent;
* *
* @author Eric TOBIAS [eric.tobias@list.lu] * @author Eric TOBIAS [eric.tobias@list.lu]
* @since 1.0 * @since 1.0
* @version 2.0.3 * @version 2.1.4
*/ */
@NonNullByDefault @NonNullByDefault
public abstract class TangibleApplication { public abstract class TangibleApplication {
protected static Properties properties = new Properties(); 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. */ /** A {@link Logger} to log all messages during execution. */
protected static final Logger logger = Logger.getLogger(TangibleApplication.class.getSimpleName()); protected static final Logger logger = Logger.getLogger(TangibleApplication.class.getSimpleName());
...@@ -95,13 +92,6 @@ public abstract class TangibleApplication { ...@@ -95,13 +92,6 @@ public abstract class TangibleApplication {
} }
properties = PropertiesFetcher.fetchProperties(); 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); configureLogger(logger);
interfaceManager = new TangibleInterfaceManager(this, logger, properties); interfaceManager = new TangibleInterfaceManager(this, logger, properties);
...@@ -206,7 +196,7 @@ public abstract class TangibleApplication { ...@@ -206,7 +196,7 @@ public abstract class TangibleApplication {
* The value to set interfaceManager to. * The value to set interfaceManager to.
*/ */
public void setInterfaceManager(TangibleInterfaceManager interfaceManager) { public void setInterfaceManager(TangibleInterfaceManager interfaceManager) {
this.interfaceManager = interfaceManager; TangibleApplication.interfaceManager = interfaceManager;
} }
/** /**
......
...@@ -22,6 +22,8 @@ import lu.list.itis.dkd.dbc.annotation.Nullable; ...@@ -22,6 +22,8 @@ import lu.list.itis.dkd.dbc.annotation.Nullable;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import java.awt.geom.Point2D.Float; 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 * 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; ...@@ -30,7 +32,7 @@ import java.awt.geom.Point2D.Float;
* *
* @author Eric TOBIAS [eric.tobias@list.lu] * @author Eric TOBIAS [eric.tobias@list.lu]
* @since 1.0 * @since 1.0
* @version 1.0.2 * @version 2.1.4
*/ */
@NonNullByDefault @NonNullByDefault
public class Point extends Float { public class Point extends Float {
...@@ -272,28 +274,33 @@ public class Point extends Float { ...@@ -272,28 +274,33 @@ public class Point extends Float {
* @param point * @param point
* The initialTranslation values to addition to this point's values. * The initialTranslation values to addition to this point's values.
* @return If point == null, the method will return this instance. Otherwise, a new * @return If point == null, the method will return this instance. Otherwise, a new
* {@link Point} instance such that:<br> * {@link Point} instance such that:<br/>
* <code> x = this.x + point.x<br> * <code> x = this.x + point.x<br/>
* y = this.y + point.y<br> * y = this.y + point.y<br/>
* angle = this.angle + point.angle</code>. * angle = this.angle + point.angle<br/>
* @pre point.state equal to state iff point != null * state = this.state</code>.<br/>
* <br/>
* 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) { public Point add(@Nullable Point point) {
if (point == null) { if (point == null) {
return this; return this;
} }
switch (state.getClass().getSimpleName()) { switch (state.getClass().getSimpleName()) {
case "TableCoordinates": case "TableCoordinates": //$NON-NLS-1$
point.toTableCoordinates(); point.toTableCoordinates();
break; break;
case "ScreenCoordinates": case "ScreenCoordinates": //$NON-NLS-1$
point.toScreenCoordinates(); point.toScreenCoordinates();
break; break;
case "CameraCoordinates": case "CameraCoordinates": //$NON-NLS-1$
point.toCameraCoordinates(); point.toCameraCoordinates();
break; break;
default: 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; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment