mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
This commit is contained in:
+6
-18
@@ -58,7 +58,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
private static final Logger LOG = Logger.getLogger(Presenter.class);
|
private static final Logger LOG = Logger.getLogger(Presenter.class);
|
||||||
|
|
||||||
public static final VersionNumber CURRENT_VERSION = new VersionNumber(0, 0, 0);
|
public static final VersionNumber CURRENT_VERSION = new VersionNumber(0, 0, 0);
|
||||||
public static final String DEFAULTS_KEY = "defaults";
|
public static final String DEFAULTS_KEY = "default.";
|
||||||
public static final String METRIC_KEY = "metric";
|
public static final String METRIC_KEY = "metric";
|
||||||
|
|
||||||
public static final int CONTROL_POINT_SENSITIVITY = 4;
|
public static final int CONTROL_POINT_SENSITIVITY = 4;
|
||||||
@@ -642,16 +642,11 @@ public class Presenter implements IPlugInPort {
|
|||||||
@Override
|
@Override
|
||||||
public void setDefaultPropertyValue(String propertyName, Object value) {
|
public void setDefaultPropertyValue(String propertyName, Object value) {
|
||||||
LOG.debug(String.format("setDefaultPropertyValue(%s, %s)", propertyName, value));
|
LOG.debug(String.format("setDefaultPropertyValue(%s, %s)", propertyName, value));
|
||||||
Map<String, Object> defaultMap = (Map<String, Object>) ConfigurationManager.getInstance()
|
|
||||||
.getConfigurationItem(DEFAULTS_KEY);
|
|
||||||
if (defaultMap == null) {
|
|
||||||
defaultMap = new HashMap<String, Object>();
|
|
||||||
ConfigurationManager.getInstance().setConfigurationItem(DEFAULTS_KEY, defaultMap);
|
|
||||||
}
|
|
||||||
for (IDIYComponent component : selectedComponents) {
|
for (IDIYComponent component : selectedComponents) {
|
||||||
String className = component.getClass().getName();
|
String className = component.getClass().getName();
|
||||||
LOG.debug("Default property value set for " + className + ":" + propertyName);
|
LOG.debug("Default property value set for " + className + ":" + propertyName);
|
||||||
defaultMap.put(className + ":" + propertyName, value);
|
ConfigurationManager.getInstance().setConfigurationItem(
|
||||||
|
DEFAULTS_KEY + className + ":" + propertyName, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,10 +667,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
for (IDIYComponent<?> component : selectedComponents) {
|
for (IDIYComponent<?> component : selectedComponents) {
|
||||||
Area componentArea = componentAreaMap.get(component);
|
Area componentArea = componentAreaMap.get(component);
|
||||||
if (componentArea != null) {
|
if (componentArea != null) {
|
||||||
LOG.warn("Area added!" + componentArea.getBounds());
|
|
||||||
area.add(componentArea);
|
area.add(componentArea);
|
||||||
} else {
|
|
||||||
LOG.warn("No area!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double width = area.getBounds2D().getWidth();
|
double width = area.getBounds2D().getWidth();
|
||||||
@@ -758,13 +750,9 @@ public class Presenter implements IPlugInPort {
|
|||||||
componentType.getInstanceClass());
|
componentType.getInstanceClass());
|
||||||
// Override with default values if available.
|
// Override with default values if available.
|
||||||
for (PropertyWrapper property : properties) {
|
for (PropertyWrapper property : properties) {
|
||||||
Object defaultValue = null;
|
Object defaultValue = ConfigurationManager.getInstance().getConfigurationItem(
|
||||||
Map<String, Object> defaultMap = (Map<String, Object>) ConfigurationManager
|
DEFAULTS_KEY + componentType.getInstanceClass().getName() + ":"
|
||||||
.getInstance().getConfigurationItem(DEFAULTS_KEY);
|
+ property.getName());
|
||||||
if (defaultMap != null) {
|
|
||||||
defaultValue = defaultMap.get(componentType.getInstanceClass().getName() + ":"
|
|
||||||
+ property.getName());
|
|
||||||
}
|
|
||||||
if (defaultValue != null) {
|
if (defaultValue != null) {
|
||||||
property.setValue(cloner.deepClone(defaultValue));
|
property.setValue(cloner.deepClone(defaultValue));
|
||||||
property.writeTo(component);
|
property.writeTo(component);
|
||||||
|
|||||||
Reference in New Issue
Block a user