From b669e054ac679ce93635dfd2946ec12f3b2a269d Mon Sep 17 00:00:00 2001 From: Eric Tobias Date: Mon, 26 Oct 2015 15:05:32 +0100 Subject: [PATCH] 2.1.0 - Added SpatialEvent and its listener. --- CHANGELOG.txt | 10 +++ TULIP/Readme.txt => README.txt | 0 TULIP/.settings/org.eclipse.jdt.ui.prefs | 2 +- .../list/itis/dkd/tui/event/ContextEvent.java | 16 ++-- .../list/itis/dkd/tui/event/SpatialEvent.java | 75 +++++++++++++++++++ .../dkd/tui/event/SpatialEventListener.java | 39 ++++++++++ 6 files changed, 136 insertions(+), 6 deletions(-) create mode 100644 CHANGELOG.txt rename TULIP/Readme.txt => README.txt (100%) create mode 100644 TULIP/src/lu/list/itis/dkd/tui/event/SpatialEvent.java create mode 100644 TULIP/src/lu/list/itis/dkd/tui/event/SpatialEventListener.java diff --git a/CHANGELOG.txt b/CHANGELOG.txt new file mode 100644 index 0000000..4259b9e --- /dev/null +++ b/CHANGELOG.txt @@ -0,0 +1,10 @@ +2.1.0 + ++ Adding event broadcaster for TUI context events. ++ Added spatial handler to handle spatial positioning of tangibles. + + +2.0.0 + ++ Added abstraction layer (Adapter) to decouple core from the tangible protocol (TUIO) ++ Added network abstraction layer and implemented concrete examples (Bluetooth, Wifi, and Serial IO) \ No newline at end of file diff --git a/TULIP/Readme.txt b/README.txt similarity index 100% rename from TULIP/Readme.txt rename to README.txt diff --git a/TULIP/.settings/org.eclipse.jdt.ui.prefs b/TULIP/.settings/org.eclipse.jdt.ui.prefs index 3cf7d84..392b945 100644 --- a/TULIP/.settings/org.eclipse.jdt.ui.prefs +++ b/TULIP/.settings/org.eclipse.jdt.ui.prefs @@ -69,7 +69,7 @@ org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates= +org.eclipse.jdt.ui.text.custom_code_templates= sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true diff --git a/TULIP/src/lu/list/itis/dkd/tui/event/ContextEvent.java b/TULIP/src/lu/list/itis/dkd/tui/event/ContextEvent.java index a4bd39a..2003283 100644 --- a/TULIP/src/lu/list/itis/dkd/tui/event/ContextEvent.java +++ b/TULIP/src/lu/list/itis/dkd/tui/event/ContextEvent.java @@ -27,7 +27,7 @@ import java.util.EventObject; * * @author Eric TOBIAS [eric.tobias@list.lu] * @since 1.0 - * @version 1.0.2 + * @version 2.0.42 */ @NonNullByDefault public class ContextEvent extends EventObject { @@ -74,9 +74,9 @@ public class ContextEvent extends EventObject { * Enumeration denoting all context types that are captured by the enclosing * {@link ContextEvent} class. * - * @author Eric TOBIAS [eric.tobias@tudor.lu] - * @since 5 Mar 2014 - * @version 1 + * @author Eric TOBIAS [eric.tobias@list.lu] + * @since 1.0 + * @version 2.0.42 */ public enum ContextType { /** A cursor is dropped into the context. */ @@ -90,6 +90,12 @@ public class ContextEvent extends EventObject { /** An object is moved within the context. */ OBJECT_MOVE, /** An object is lifted from the context. */ - OBJECT_LIFT; + OBJECT_LIFT, + /** A blob is dropped from the context. */ + BLOB_DROP, + /** A blob is moved from the context. */ + BLOB_MOVE, + /** A blob is lifted from the context. */ + BLOB_LIFT; } } \ No newline at end of file diff --git a/TULIP/src/lu/list/itis/dkd/tui/event/SpatialEvent.java b/TULIP/src/lu/list/itis/dkd/tui/event/SpatialEvent.java new file mode 100644 index 0000000..8590bff --- /dev/null +++ b/TULIP/src/lu/list/itis/dkd/tui/event/SpatialEvent.java @@ -0,0 +1,75 @@ +/** + * Copyright Luxembourg Institute of Science and Technology, 2015. All rights reserved. + * + * This file is part of TULIP. + * + * TULIP is free software: you can redistribute it and/or modify it under the terms of the GNU + * Lesser General Public License as published by the Free Software Foundation, version 3 of the + * License. + * + * TULIP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser + * General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with TULIP. If + * not, see . + */ +package lu.list.itis.dkd.tui.event; + +import lu.list.itis.dkd.dbc.annotation.NonNullByDefault; +import lu.list.itis.dkd.tui.adapter.TangibleObject; +import lu.list.itis.dkd.tui.utility.Point; +import lu.list.itis.dkd.tui.utility.ScreenCoordinates; + +import com.google.common.base.Preconditions; + +import java.util.EventObject; + +/** + * Class used to disseminate spatial events. Events are to be triggered when elements in the spatial + * domain of the interface are added, removed, or moved. The event contains a source, usually the + * tangible object that is the root of the spatial (dis)placement and the location the event was + * triggered on, and the type of even.
+ *
+ * + * Note that the location is expressed as {@link ScreenCoordinates}. + * + * @author Eric Tobias [eric.tobias@list.lu] + * @since 2.1 + * @version 2.1.0 + */ +@NonNullByDefault +public class SpatialEvent extends EventObject { + + private static final long serialVersionUID = 7414656845719882078L; + + protected Point location; + + /** + * Constructor initializing all fields. + * + * @param source + * The source of the {@link SpatialEvent}, that is, the tangible object that triggered + * the event. + * @param location + * The location the event was triggered on. Note that the location must be expressed in + * {@link ScreenCoordinates}. + * @ore location.getState().getClass() == ScreenCoordinates.class + */ + public SpatialEvent(TangibleObject source, Point location) { + super(source); + + Preconditions.checkArgument(location.getState().getClass().equals(ScreenCoordinates.class), "The location must be given in screen coordinates!"); //$NON-NLS-1$ + + this.location = location; + } + + /** + * Simple getter method for location. + * + * @return The value of location. + */ + public Point getLocation() { + return location; + } +} \ No newline at end of file diff --git a/TULIP/src/lu/list/itis/dkd/tui/event/SpatialEventListener.java b/TULIP/src/lu/list/itis/dkd/tui/event/SpatialEventListener.java new file mode 100644 index 0000000..0a96371 --- /dev/null +++ b/TULIP/src/lu/list/itis/dkd/tui/event/SpatialEventListener.java @@ -0,0 +1,39 @@ +/** + * Copyright Luxembourg Institute of Science and Technology, 2015. All rights reserved. + * + * This file is part of TULIP. + * + * TULIP is free software: you can redistribute it and/or modify it under the terms of the GNU + * Lesser General Public License as published by the Free Software Foundation, version 3 of the + * License. + * + * TULIP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser + * General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with TULIP. If + * not, see . + */ +package lu.list.itis.dkd.tui.event; + +import lu.list.itis.dkd.dbc.annotation.NonNullByDefault; + +import java.util.EventListener; + +/** + * Interface specifying the contract for {@link SpatialEventListener} instances. + * + * @author Eric Tobias [eric.tobias@list.lu] + * @since 2.1 + * @version 2.1.0 + */ +@NonNullByDefault +public interface SpatialEventListener extends EventListener { + /** + * Method invoked when the context is changed. + * + * @param event + * The event holding the source and location of the spacial happening. + */ + public void spaceUpdated(SpatialEvent event); +} \ No newline at end of file -- GitLab