bom tweak

anti-aliasing made as configurable item
This commit is contained in:
bancika
2011-01-17 22:28:43 +00:00
parent e866762b05
commit b9aeaff6da
7 changed files with 15 additions and 14 deletions
@@ -64,7 +64,7 @@ public class Presenter implements IPlugInPort {
private static final Logger LOG = Logger.getLogger(Presenter.class);
public static final VersionNumber CURRENT_VERSION = new VersionNumber(3, 0, 1);
public static final String DEFAULTS_KEY = "default.";
public static final String DEFAULTS_KEY_PREFIX = "default.";
public static final String METRIC_KEY = "metric";
public static final int ICON_SIZE = 32;
@@ -783,7 +783,7 @@ public class Presenter implements IPlugInPort {
String className = component.getClass().getName();
LOG.debug("Default property value set for " + className + ":" + propertyName);
ConfigurationManager.getInstance().writeValue(
DEFAULTS_KEY + className + ":" + propertyName, value);
DEFAULTS_KEY_PREFIX + className + ":" + propertyName, value);
}
}
@@ -792,7 +792,7 @@ public class Presenter implements IPlugInPort {
LOG.info(String.format("setProjectDefaultPropertyValue(%s, %s)", propertyName, value));
LOG.debug("Default property value set for " + Project.class.getName() + ":" + propertyName);
ConfigurationManager.getInstance().writeValue(
DEFAULTS_KEY + Project.class.getName() + ":" + propertyName, value);
DEFAULTS_KEY_PREFIX + Project.class.getName() + ":" + propertyName, value);
}
@Override
@@ -1031,7 +1031,7 @@ public class Presenter implements IPlugInPort {
// Override with default values if available.
for (PropertyWrapper property : properties) {
Object defaultValue = ConfigurationManager.getInstance().readObject(
DEFAULTS_KEY + object.getClass().getName() + ":" + property.getName(), null);
DEFAULTS_KEY_PREFIX + object.getClass().getName() + ":" + property.getName(), null);
if (defaultValue != null) {
property.setValue(cloner.deepClone(defaultValue));
property.writeTo(object);
@@ -25,6 +25,8 @@ import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.utils.Constants;
import com.diyfever.gui.miscutils.ConfigurationManager;
/**
* Utility that deals with painting {@link Project} on the {@link Graphics2D}
* and keeps areas taken by each drawn component.
@@ -34,7 +36,7 @@ import org.diylc.utils.Constants;
public class ProjectPainter {
public static final int CONTROL_POINT_SIZE = 7;
public static boolean ENABLE_ANTIALIASING = true;
public static final String ANTIALIASING_KEY = "anti-aliasing";
public static boolean DEBUG_COMPONENT_AREAS = false;
// Keeps Area object of each drawn component.
@@ -43,6 +45,9 @@ public class ProjectPainter {
// determine which components are invalidated when they are not in the map.
private Map<IDIYComponent<?>, ComponentState> lastDrawnStateMap;
public boolean antiAliasing = ConfigurationManager.getInstance().readBoolean(
ANTIALIASING_KEY, true);
public ProjectPainter() {
super();
componentAreaMap = new HashMap<IDIYComponent<?>, Area>();
@@ -58,7 +63,7 @@ public class ProjectPainter {
}
G2DWrapper g2dWrapper = new G2DWrapper(g2d);
if (drawOptions.contains(DrawOption.ANTIALIASING) && ENABLE_ANTIALIASING) {
if (drawOptions.contains(DrawOption.ANTIALIASING) && antiAliasing) {
g2d
.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);