Commit 78cfa8ea authored by mack's avatar mack

Revert "Switch from util.logging framework to log4js with log4j binding...

Revert "Switch from util.logging framework to log4js with log4j binding Removal of obsolete event logger"

This reverts commit 0ffaff20.
parent 0ffaff20
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="config"/>
<classpathentry excluding="main/java/|test/java/" kind="src" output="target/classes" path="src"/>
<classpathentry kind="src" output="target/test-classes" path="test"/>
<classpathentry excluding="main/java/|test/java/" kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
......@@ -14,5 +14,17 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
......@@ -15,17 +15,10 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonN
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
......@@ -34,7 +27,6 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
......
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
<Logger name="lu.list.itis.dkd.tui" level="info"/>
</Loggers>
</Configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<calibration>
<screen>
<x1>0</x1>
<y1>0</y1>
<?xml version="1.0" encoding="UTF-8"?>
<calibration>
<screen>
<x1>0</x1>
<y1>0</y1>
<!-- <x2>800</x2>
<y2>650</y2> -->
<x2>1280</x2>
<y2>800</y2>
</screen>
<camera>
<x1>0.06699997</x1>
<y1>-0.013999984</y1>
<x2>0.92900026</x2>
<y2>1.0049983</y2>
</camera>
<table>
<width>1001</width>
<height>751</height>
<circleSize>70</circleSize>
<triangleSize>80</triangleSize>
<squareSize>50</squareSize>
<rectangleWidth>40</rectangleWidth>
<rectangleHeight>20</rectangleHeight>
</table>
<window>
<y2>650</y2> -->
<x2>1280</x2>
<y2>800</y2>
</screen>
<camera>
<x1>0.06699997</x1>
<y1>-0.013999984</y1>
<x2>0.92900026</x2>
<y2>1.0049983</y2>
</camera>
<table>
<width>1001</width>
<height>751</height>
<circleSize>70</circleSize>
<triangleSize>80</triangleSize>
<squareSize>50</squareSize>
<rectangleWidth>40</rectangleWidth>
<rectangleHeight>20</rectangleHeight>
</table>
<window>
<!-- <x>1550</x>
<y>10</y> -->
<x>1</x>
<y>1</y>
<width>1280</width>
<height>600</height>
</window>
</calibration>
<y>10</y> -->
<x>1</x>
<y>1</y>
<width>1280</width>
<height>600</height>
</window>
</calibration>
......@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>lu.list.itis.dkd.tui</groupId>
<artifactId>tulip</artifactId>
<version>2.4.0</version>
<version>2.3.1</version>
<name>TULIP</name>
<description>A framework for tabletop tangible user interface applications.</description>
......@@ -74,39 +74,6 @@
<artifactId>SteelSeries</artifactId>
<version>3.9.30</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.23</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -24,17 +24,21 @@ import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.adapter.TangibleObject;
import lu.list.itis.dkd.tui.adapter.TuiAdapter;
import lu.list.itis.dkd.tui.logging.EventLogger;
import lu.list.itis.dkd.tui.utility.GlobalContext;
import lu.list.itis.dkd.tui.utility.IdMapper;
import lu.list.itis.dkd.tui.utility.PropertiesFetcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Properties;
import java.util.Vector;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComponent;
......@@ -52,12 +56,8 @@ import javax.swing.JComponent;
public abstract class TangibleApplication {
protected static Properties properties = new Properties();
static {
System.setProperty("log4j.configurationFile", "log4j2.xml"); //$NON-NLS-1$//$NON-NLS-2$
}
/** A {@link Logger} to log all messages during execution. */
protected static final Logger logger = LoggerFactory.getLogger(TangibleApplication.class.getSimpleName());
protected static final Logger logger = Logger.getLogger(TangibleApplication.class.getSimpleName());
/**
* An implementation of the {@link JComponent} handling all interactions with the visual
......@@ -97,38 +97,37 @@ public abstract class TangibleApplication {
properties = PropertiesFetcher.fetchProperties();
// configureLogger(logger);
// interfaceManager = new TangibleInterfaceManager(this, logger, properties);
interfaceManager = new TangibleInterfaceManager(this, properties);
configureLogger(logger);
interfaceManager = new TangibleInterfaceManager(this, logger, properties);
try {
adapter = (TuiAdapter) Class.forName(properties.getProperty("adapter.class")).getConstructor(TangibleInterfaceManager.class).newInstance(interfaceManager); //$NON-NLS-1$
} catch (InstantiationException e) {
logger.error("Cannot instantiate adapter. The adapter must be a concrete class, not an interface or abstract class and it must directly inherit from TuiAdapter! Check your properties file and set adapter.class accordingly."); //$NON-NLS-1$
logger.log(Level.SEVERE, "Cannot instantiate adapter. The adapter must be a concrete class, not an interface or abstract class and it must directly inherit from TuiAdapter! Check your properties file and set adapter.class accordingly."); //$NON-NLS-1$
System.exit(42);
} catch (IllegalAccessException e) {
logger.error("The currently executing method does not have access to the definition of the constructor."); //$NON-NLS-1$
logger.log(Level.SEVERE, "The currently executing method does not have access to the definition of the constructor."); //$NON-NLS-1$
System.exit(42);
} catch (IllegalArgumentException e) {
logger.error("A erroneous argument has been passed to the adapter."); //$NON-NLS-1$
logger.log(Level.SEVERE, "A erroneous argument has been passed to the adapter."); //$NON-NLS-1$
System.exit(42);
} catch (InvocationTargetException e) {
logger.error("An exception has been thrown in the constructor of the adapter."); //$NON-NLS-1$
logger.log(Level.SEVERE, "An exception has been thrown in the constructor of the adapter."); //$NON-NLS-1$
System.exit(42);
} catch (NoSuchMethodException e) {
logger.error("The called method was not found. Make sure your implementation supports the method."); //$NON-NLS-1$
logger.log(Level.SEVERE, "The called method was not found. Make sure your implementation supports the method."); //$NON-NLS-1$
System.exit(42);
} catch (SecurityException e) {
logger.error("Security violation."); //$NON-NLS-1$
logger.log(Level.SEVERE, "Security violation."); //$NON-NLS-1$
System.exit(42);
} catch (ClassNotFoundException e) {
logger.error("The class " + properties.getProperty("adapter.class") + " was not found. Check your spelling!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
logger.log(Level.SEVERE, "The class " + properties.getProperty("adapter.class") + " was not found. Check your spelling!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
System.exit(42);
}
GlobalContext.setGlobalContext(adapter);
IdMapper.initialise(properties);
// EventLogger.getInstance().initialise(properties);
EventLogger.getInstance().initialise(properties);
}
/**
......@@ -139,22 +138,18 @@ public abstract class TangibleApplication {
* The {@link Logger} instance to configure.
* @pre logger != null
*/
// public static void configureLogger(final Logger unconfiguredLogger) {
// Preconditions.checkArgument(unconfiguredLogger != null, "The provider logger must not be
// null!"); //$NON-NLS-1$
//
// if (Boolean.parseBoolean(properties.getProperty("logger.event.output.enabled"))) {
// //$NON-NLS-1$
// try {
// unconfiguredLogger.addHandler(new
// FileHandler(properties.getProperty("logger.event.output.location"), true)); //$NON-NLS-1$
// } catch (IOException e) {
// unconfiguredLogger.log(Level.SEVERE, "The logger could not be configured!", e); //$NON-NLS-1$
// }
// }
// unconfiguredLogger.setLevel(Level.parse(properties.getProperty("logger.level", "ALL")));
// //$NON-NLS-1$ //$NON-NLS-2$
// }
public static void configureLogger(final Logger unconfiguredLogger) {
Preconditions.checkArgument(unconfiguredLogger != null, "The provider logger must not be null!"); //$NON-NLS-1$
if (Boolean.parseBoolean(properties.getProperty("logger.event.output.enabled"))) { //$NON-NLS-1$
try {
unconfiguredLogger.addHandler(new FileHandler(properties.getProperty("logger.event.output.location"), true)); //$NON-NLS-1$
} catch (IOException e) {
unconfiguredLogger.log(Level.SEVERE, "The logger could not be configured!", e); //$NON-NLS-1$
}
}
unconfiguredLogger.setLevel(Level.parse(properties.getProperty("logger.level", "ALL"))); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* Method used to connect the application to the NUI device sending out events for the listener
......
......@@ -27,9 +27,6 @@ import lu.list.itis.dkd.tui.utility.TextHelper;
import com.google.common.base.Preconditions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
......@@ -44,6 +41,8 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.Line2D;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComponent;
import javax.swing.JFrame;
......@@ -61,6 +60,9 @@ public class TangibleInterfaceManager extends JComponent {
/** Generated serial version UID. */
private static final long serialVersionUID = -7359242913910334271L;
/** A {@link Logger} to log all messages during execution. */
protected Logger logger;
/** The {@link Properties} instance holding properties relevant to the interface. */
private Properties interfaceProperties = new Properties();
......@@ -91,9 +93,6 @@ public class TangibleInterfaceManager extends JComponent {
/** Index pointer used to switch between different configuration points. */
protected int configurationPoint = 0;
/** A {@link Logger} to log all messages during execution. */
protected static final Logger logger = LoggerFactory.getLogger(TangibleInterfaceManager.class.getSimpleName());
/** A reference to the hosting application to access different managers if needed. */
private volatile TangibleApplication tangibleApplication;
......@@ -107,10 +106,10 @@ public class TangibleInterfaceManager extends JComponent {
* @param properties
* The properties instance from which to load the default values from.
*/
public TangibleInterfaceManager(TangibleApplication applicationContext, Properties properties) {
public TangibleInterfaceManager(TangibleApplication applicationContext, Logger applicationLogger, Properties properties) {
tangibleApplication = applicationContext;
interfaceProperties = properties;
// logger = applicationLogger;
logger = applicationLogger;
windowWidth = Integer.parseInt(properties.getProperty("windowWidth")); //$NON-NLS-1$
windowHeight = Integer.parseInt(properties.getProperty("windowHeight")); //$NON-NLS-1$
......@@ -195,9 +194,9 @@ public class TangibleInterfaceManager extends JComponent {
* Method for toggling whether the application is verbose. The method will toggle between
* showing all logging messages and showing only messages with a level of {@link Level#SEVERE}.
*/
// public void toggleVerbose() {
// logger.setLevel(logger.getLevel().equals(Level.SEVERE) ? Level.ALL : Level.SEVERE);
// }
public void toggleVerbose() {
logger.setLevel(logger.getLevel().equals(Level.SEVERE) ? Level.ALL : Level.SEVERE);
}
/**
* Method to be called after changing calibration values. This method will require overriding in
......@@ -376,9 +375,9 @@ public class TangibleInterfaceManager extends JComponent {
fullscreen = !fullscreen;
showWindow();
break;
// case KeyEvent.VK_V:
// toggleVerbose();
// break;
case KeyEvent.VK_V:
toggleVerbose();
break;
case KeyEvent.VK_R:
reset();
break;
......@@ -388,7 +387,7 @@ public class TangibleInterfaceManager extends JComponent {
calibrationMode = true;
break;
default:
logger.info("The keypress could not be associated to a case!"); //$NON-NLS-1$
logger.log(Level.CONFIG, "The keypress could not be associated to a case!"); //$NON-NLS-1$
break;
}
}
......@@ -453,7 +452,7 @@ public class TangibleInterfaceManager extends JComponent {
Calibration.decreaseCameraRight(0.001f);
break;
default:
logger.warn("Keypress could not be mapped with current configurationPoint value!"); //$NON-NLS-1$
logger.log(Level.CONFIG, "Keypress could not be mapped with current configurationPoint value!"); //$NON-NLS-1$
break;
}
setBounds();
......@@ -475,7 +474,7 @@ public class TangibleInterfaceManager extends JComponent {
Calibration.decreaseCameraBottom(0.001f);
break;
default:
logger.warn("Keypress could not be mapped!"); //$NON-NLS-1$
logger.log(Level.CONFIG, "Keypress could not be mapped!"); //$NON-NLS-1$
break;
}
setBounds();
......@@ -497,7 +496,7 @@ public class TangibleInterfaceManager extends JComponent {
Calibration.increaseCameraBottom(0.001f);
break;
default:
logger.warn("Keypress could not be mapped!"); //$NON-NLS-1$
logger.log(Level.CONFIG, "Keypress could not be mapped!"); //$NON-NLS-1$
break;
}
setBounds();
......@@ -519,7 +518,7 @@ public class TangibleInterfaceManager extends JComponent {
Calibration.increaseCameraRight(0.001f);
break;
default:
logger.warn("Keypress could not be mapped with current configurationPoint value!"); //$NON-NLS-1$
logger.log(Level.CONFIG, "Keypress could not be mapped with current configurationPoint value!"); //$NON-NLS-1$
break;
}
setBounds();
......@@ -533,7 +532,7 @@ public class TangibleInterfaceManager extends JComponent {
break;
default:
logger.warn("Keypress" + event.getKeyChar() + "is not mapped!"); //$NON-NLS-1$ //$NON-NLS-2$
logger.log(Level.CONFIG, "Keypress" + event.getKeyChar() + "is not mapped!"); //$NON-NLS-1$ //$NON-NLS-2$
break;
}
}
......
......@@ -33,15 +33,13 @@ import lu.list.itis.dkd.tui.widget.corona.builder.ShadowBuilder;
import com.google.common.base.Preconditions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Properties;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Class managing all tangible objects (tangibles), their mapping, setup, initialisation, and the
......@@ -66,6 +64,8 @@ public abstract class TangibleObjectManager {
/** This dictionary stores all blobs detected by reacTIVision. */
protected volatile static ConcurrentHashMap<Integer, BaseWidget> blobMap = new ConcurrentHashMap<>();
/** A {@link Logger} to log all messages during execution. */
protected Logger logger;
/** A reference to the hosting application to access different managers if needed. */
protected volatile TangibleApplication tangibleApplication;
......@@ -88,26 +88,26 @@ public abstract class TangibleObjectManager {
private static final String cursorsEnabledProperty = "cursorsEnabled"; //$NON-NLS-1$
private static final String blobsEnabledProperty = "blobsEnabled"; //$NON-NLS-1$
/** A {@link Logger} to log all messages during execution. */
protected static final Logger logger = LoggerFactory.getLogger(TangibleObjectManager.class.getSimpleName());
/**
* Constructor initialising several fields and setting up the list of managed tangibles.
*
* @param applicationContext
* The {@link TangibleApplication} hosting this manager.
* @param applicationLogger
* The {@link Logger} to use for all logging purposes.
* @param properties
* The properties instance from which to load the default values from.
*/
public TangibleObjectManager(TangibleApplication applicationContext, Properties properties) {
public TangibleObjectManager(TangibleApplication applicationContext, Logger applicationLogger, Properties properties) {
objectManagerProperties = properties;
tangibleApplication = applicationContext;
logger = applicationLogger;
cursorsEnabled = Boolean.parseBoolean(properties.getProperty(cursorsEnabledProperty, Boolean.toString(true)));
blobsEnabled = Boolean.parseBoolean(properties.getProperty(blobsEnabledProperty, Boolean.toString(true)));
logger.info("Enabled cursor property [{}]", cursorsEnabled); //$NON-NLS-1$
logger.info("Enabled blobs property [{}]", blobsEnabled); //$NON-NLS-1$
logger.log(Level.INFO, "Enabled cursor property [" + cursorsEnabled + "]"); //$NON-NLS-2$
logger.log(Level.INFO, "Enabled blobs property [" + blobsEnabled + "]"); //$NON-NLS-1$
}
/**
......@@ -235,7 +235,7 @@ public abstract class TangibleObjectManager {
if (objectMap.containsKey(tangibleObject.getObjectId())) {
objectMap.get(tangibleObject.getObjectId()).actionDrop(tangibleObject);
} else {
logger.warn("The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
logger.log(Level.WARNING, "The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
}
break;
......@@ -250,7 +250,7 @@ public abstract class TangibleObjectManager {
blobMap.get(tangibleObject.getObjectId()).actionDrop(tangibleObject);
break;
default:
logger.warn("The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
logger.log(Level.WARNING, "The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
break;
}
}
......@@ -277,7 +277,7 @@ public abstract class TangibleObjectManager {
if (objectMap.containsKey(tangibleObject.getObjectId())) {
objectMap.get(tangibleObject.getObjectId()).actionLift(tangibleObject);
} else {
logger.warn("The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
logger.log(Level.WARNING, "The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
}
break;
case BLOB:
......@@ -286,7 +286,7 @@ public abstract class TangibleObjectManager {
}
break;
default:
logger.warn("The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
logger.log(Level.WARNING, "The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
break;
}
}
......@@ -309,14 +309,14 @@ public abstract class TangibleObjectManager {
if (cursorMap.containsKey(tangibleObject.getObjectId())) {
cursorMap.get(tangibleObject.getObjectId()).actionMove(tangibleObject);
} else {
logger.warn("The cursor could not be recognised!"); //$NON-NLS-1$
logger.log(Level.WARNING, "The cursor could not be recognised!"); //$NON-NLS-1$
}
break;
case OBJECT:
if (objectMap.containsKey(tangibleObject.getObjectId())) {
objectMap.get(tangibleObject.getObjectId()).actionMove(tangibleObject);
} else {
logger.warn("The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
logger.log(Level.WARNING, "The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
}
break;
case BLOB:
......@@ -327,11 +327,11 @@ public abstract class TangibleObjectManager {
if (blobMap.containsKey(tangibleObject.getObjectId())) {
blobMap.get(tangibleObject.getObjectId()).actionMove(tangibleObject);
} else {
logger.warn("The blob could not be recognised!"); //$NON-NLS-1$
logger.log(Level.WARNING, "The blob could not be recognised!"); //$NON-NLS-1$
}
break;
default:
logger.warn("The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
logger.log(Level.WARNING, "The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
break;
}
}
......
......@@ -22,13 +22,12 @@ package lu.list.itis.dkd.tui.adapter;
import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.TangibleApplication;
import lu.list.itis.dkd.tui.utility.Point;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Class which defines common attributes of a tangible object.
......@@ -55,7 +54,7 @@ public class TangibleObject implements Cloneable {
}
/** A {@link Logger} to log all messages during execution. */
protected static final Logger logger = LoggerFactory.getLogger(TangibleObject.class.getSimpleName());
protected static final Logger logger = Logger.getLogger(TangibleObject.class.getSimpleName());
/** The unique object ID number that is assigned to each tangible object. */
protected int objectId;
......@@ -121,7 +120,7 @@ public class TangibleObject implements Cloneable {
case 5:
return State.ROTATING;
default:
logger.warn("Unrecognised state identifier!"); //$NON-NLS-1$
logger.log(Level.WARNING, "Unrecognised state identifier!"); //$NON-NLS-1$
return null;
}
}
......@@ -154,7 +153,7 @@ public class TangibleObject implements Cloneable {
*
*/
public TangibleObject(TangibleObjectBuilder tangibleObjectBuilder) {
// TangibleApplication.configureLogger(logger);
TangibleApplication.configureLogger(logger);
this.objectId = tangibleObjectBuilder.objectId;
this.type = tangibleObjectBuilder.type;
......
......@@ -26,13 +26,13 @@ import lu.list.itis.dkd.tui.TangibleInterfaceManager;
import lu.list.itis.dkd.tui.TangibleObjectManager;
import lu.list.itis.dkd.tui.event.SpatialEvent;
import lu.list.itis.dkd.tui.event.SpatialEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lu.list.itis.dkd.tui.logging.EventLogger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComponent;
......@@ -47,8 +47,6 @@ import javax.swing.JComponent;
@NonNullByDefault
public abstract class TuiAdapter {
private static final Logger logger = LoggerFactory.getLogger(TuiAdapter.class.getSimpleName());
private List<SpatialEventListener> spatialEventListeners = new ArrayList<>();
/**
......@@ -155,26 +153,20 @@ public abstract class TuiAdapter {
* The operation to register.
*/
public synchronized void logInfo(TangibleObject tangibleObject, String operation) {
// switch (tangibleObject.getType()) {
// case BLOB:
// EventLogger.getInstance().addObjInfo(tangibleObject.getObjectId(), tangibleObject.getX(),
// tangibleObject.getY(), tangibleObject.getAngle(), operation,
// tangibleObject.getTotalMilliseconds());
// break;
// case CURSOR:
// EventLogger.getInstance().addCurInfo(tangibleObject.getObjectId(), tangibleObject.getX(),
// tangibleObject.getY(), operation, tangibleObject.getTotalMilliseconds());
// break;
// case OBJECT:
// EventLogger.getInstance().addObjInfo(tangibleObject.getObjectId(), tangibleObject.getX(),
// tangibleObject.getY(), tangibleObject.getAngle(), operation,
// tangibleObject.getTotalMilliseconds());
// break;
// default:
// logger.warn("A logging attempt was made for a tangible object that did not conform to any
// prescribed type. The type was:{}", tangibleObject.getType()); //$NON-NLS-1$
// break;
// }
switch (tangibleObject.getType()) {
case BLOB:
EventLogger.getInstance().addObjInfo(tangibleObject.getObjectId(), tangibleObject.getX(), tangibleObject.getY(), tangibleObject.getAngle(), operation, tangibleObject.getTotalMilliseconds());
break;
case CURSOR:
EventLogger.getInstance().addCurInfo(tangibleObject.getObjectId(), tangibleObject.getX(), tangibleObject.getY(), operation, tangibleObject.getTotalMilliseconds());
break;
case OBJECT:
EventLogger.getInstance().addObjInfo(tangibleObject.getObjectId(), tangibleObject.getX(), tangibleObject.getY(), tangibleObject.getAngle(), operation, tangibleObject.getTotalMilliseconds());
break;
default:
Logger.getLogger(TuiAdapter.class.getSimpleName()).log(Level.WARNING, "A logging attempt was made for a tangible object that did not conform to any prescribed type. The type was:" + tangibleObject.getType()); //$NON-NLS-1$
break;
}
}
/**
......
......@@ -26,13 +26,12 @@ import lu.list.itis.dkd.tui.TangibleObjectManager;
import lu.list.itis.dkd.tui.adapter.TangibleObject.Type;
import lu.list.itis.dkd.tui.event.SpatialEvent;
import lu.list.itis.dkd.tui.event.SpatialEvent.SpatialEventType;
import lu.list.itis.dkd.tui.logging.EventLogger;
import lu.list.itis.dkd.tui.utility.IdMapper;
import lu.list.itis.dkd.tui.utility.Point;
import com.google.common.base.Preconditions;
import org.apache.logging.log4j.EventLogger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Vector;
......
......@@ -43,7 +43,7 @@ public class TangibleApplicationBootstrapper extends TangibleApplication {
public TangibleApplicationBootstrapper(@Nullable String newPropertiesFileUri) throws BuildException {
super(newPropertiesFileUri);
objectManager = new TangibleObjectBootstrapper(this, properties, properties.getProperty("bootstrapping.root", "bootstrapping.xml")); //$NON-NLS-1$ //$NON-NLS-2$