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
@@ -27,7 +27,7 @@ public class BomMaker {
Map<String, BomEntry> entryMap = new HashMap<String, BomEntry>();
for (IDIYComponent<?> component : components) {
String name = component.getName();
String value = component.getValue() == null ? "" : component.getValue().toString();
String value = component.getValue() == null ? null : component.getValue().toString();
if ((name != null) && (value != null)) {
String key = name + "|" + value;
if (entryMap.containsKey(key)) {
@@ -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);
@@ -8,17 +8,13 @@ import java.awt.Stroke;
public class Constants {
public static final int PIXELS_PER_INCH = 150;//Toolkit.getDefaultToolkit().getScreenResolution();
public static int GRIDS_PER_INCH = 8;
// public static Size GRID_SIZE = new Size(1d / GRIDS_PER_INCH, SizeUnit.in);
// public static final int GRID = 20;
public static Color CANVAS_COLOR = Color.white;
public static Color GRID_COLOR = new Color(240, 240, 240);
public static Color CONTROL_POINT_COLOR = Color.black;
public static Color SELECTED_CONTROL_POINT_COLOR = Color.blue;
public static Color CREATION_POINT_COLOR = Color.decode("#32CD32");
public static Font LABEL_FONT = new Font("Tahoma", Font.PLAIN, 11);
public static Font LABEL_FONT = new Font("Tahoma", Font.PLAIN, 12);
public static final Stroke BASIC_STROKE = new BasicStroke();
public static final Stroke DASHED_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,