Commit 343af673 authored by Nico Mack's avatar Nico Mack

Added support for cursorsEnabled and blobsEnabled properties

parent be394379
......@@ -73,6 +73,21 @@ public abstract class TangibleObjectManager {
/** The {@link Properties} instance holding properties relevant to the object manager. */
protected Properties objectManagerProperties = new Properties();
/**
* Specifies whether the object manager shall manage cursors or not. Can be changed with
* cursorsEnabled property in property file
*/
protected Boolean cursorsEnabled = true;
/**
* Specifies whether the object manager shall manage blobs or not. Can be changed with
* blobsEnabled property in property file
*/
protected Boolean blobsEnabled = true;
private static final String cursorsEnabledProperty = "cursorsEnabled"; //$NON-NLS-1$
private static final String blobsEnabledProperty = "blobsEnabled"; //$NON-NLS-1$
/**
* Constructor initialising several fields and setting up the list of managed tangibles.
*
......@@ -87,6 +102,12 @@ public abstract class TangibleObjectManager {
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.log(Level.INFO, "Enabled cursor property [" + cursorsEnabled + "]"); //$NON-NLS-2$
logger.log(Level.INFO, "Enabled blobs property [" + blobsEnabled + "]"); //$NON-NLS-1$
}
/**
......@@ -200,6 +221,10 @@ public abstract class TangibleObjectManager {
switch (tangibleObject.getType()) {
case CURSOR:
if (!cursorsEnabled)
break;
cursorMap.putIfAbsent(tangibleObject.getObjectId(), new BaseWidgetBuilder().withCorona(tangibleObject.getObjectId(), new ShadowBuilder(new Point()).withShape(ShapeFactory.buildCircle(5)).build()).build());
cursorMap.get(tangibleObject.getObjectId()).actionDrop(tangibleObject);
......@@ -215,6 +240,9 @@ public abstract class TangibleObjectManager {
break;
case BLOB:
if (!blobsEnabled)
break;
// TODO This line add a small shadow with each blob. This behaviour might not be
// desired but needs to be investigated. Opening issue #27.
blobMap.putIfAbsent(tangibleObject.getObjectId(), new BaseWidgetBuilder().withCorona(tangibleObject.getObjectId(), new ShadowBuilder(new Point()).withShape(ShapeFactory.buildCircle(5)).build()).build());
......@@ -239,7 +267,7 @@ public abstract class TangibleObjectManager {
switch (tangibleObject.getType()) {
case CURSOR:
if (cursorMap.containsKey(tangibleObject.getObjectId())) {
if (cursorsEnabled && cursorMap.containsKey(tangibleObject.getObjectId())) {
cursorMap.remove(tangibleObject.getObjectId()).actionLift(tangibleObject);
}
......@@ -253,7 +281,7 @@ public abstract class TangibleObjectManager {
}
break;
case BLOB:
if (blobMap.containsKey(tangibleObject.getObjectId())) {
if (blobsEnabled && blobMap.containsKey(tangibleObject.getObjectId())) {
blobMap.remove(tangibleObject.getObjectId()).actionLift(tangibleObject);
}
break;
......@@ -275,6 +303,9 @@ public abstract class TangibleObjectManager {
switch (tangibleObject.getType()) {
case CURSOR:
if (!cursorsEnabled)
break;
if (cursorMap.containsKey(tangibleObject.getObjectId())) {
cursorMap.get(tangibleObject.getObjectId()).actionMove(tangibleObject);
} else {
......@@ -289,6 +320,10 @@ public abstract class TangibleObjectManager {
}
break;
case BLOB:
if (!blobsEnabled)
break;
if (blobMap.containsKey(tangibleObject.getObjectId())) {
blobMap.get(tangibleObject.getObjectId()).actionMove(tangibleObject);
} else {
......
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