mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
save project default properties
This commit is contained in:
+11
-1
@@ -289,7 +289,17 @@ public interface IPlugInPort {
|
||||
* @param value
|
||||
* new default value, must not be null
|
||||
*/
|
||||
void setDefaultPropertyValue(String propertyName, Object value);
|
||||
void setSelectionDefaultPropertyValue(String propertyName, Object value);
|
||||
|
||||
/**
|
||||
* Sets default value for the specified property name for projects.
|
||||
*
|
||||
* @param propertyName
|
||||
* display name for property
|
||||
* @param value
|
||||
* new default value, must not be null
|
||||
*/
|
||||
void setProjectDefaultPropertyValue(String propertyName, Object value);
|
||||
|
||||
/**
|
||||
* @return a list of properties that are mutual for all the selected
|
||||
|
||||
+2
-2
@@ -198,7 +198,7 @@ class CanvasPanel extends JComponent implements Autoscroll {
|
||||
// Save default values.
|
||||
for (PropertyWrapper property : editor.getDefaultedProperties()) {
|
||||
if (property.getValue() != null) {
|
||||
plugInPort.setDefaultPropertyValue(property.getName(),
|
||||
plugInPort.setProjectDefaultPropertyValue(property.getName(),
|
||||
property.getValue());
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,7 @@ class CanvasPanel extends JComponent implements Autoscroll {
|
||||
// Save default values.
|
||||
for (PropertyWrapper property : editor.getDefaultedProperties()) {
|
||||
if (property.getValue() != null) {
|
||||
plugInPort.setDefaultPropertyValue(property.getName(),
|
||||
plugInPort.setSelectionDefaultPropertyValue(property.getName(),
|
||||
property.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -264,7 +264,7 @@ public class ClipboardManager implements IPlugIn, ClipboardOwner {
|
||||
// Save default values.
|
||||
for (PropertyWrapper property : editor.getDefaultedProperties()) {
|
||||
if (property.getValue() != null) {
|
||||
plugInPort.setDefaultPropertyValue(property.getName(), property.getValue());
|
||||
plugInPort.setProjectDefaultPropertyValue(property.getName(), property.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,7 +299,7 @@ public class ClipboardManager implements IPlugIn, ClipboardOwner {
|
||||
// Save default values.
|
||||
for (PropertyWrapper property : editor.getDefaultedProperties()) {
|
||||
if (property.getValue() != null) {
|
||||
plugInPort.setDefaultPropertyValue(property.getName(), property.getValue());
|
||||
plugInPort.setSelectionDefaultPropertyValue(property.getName(), property.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-3
@@ -829,8 +829,8 @@ public class Presenter implements IPlugInPort {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setDefaultPropertyValue(String propertyName, Object value) {
|
||||
LOG.info(String.format("setDefaultPropertyValue(%s, %s)", propertyName, value));
|
||||
public void setSelectionDefaultPropertyValue(String propertyName, Object value) {
|
||||
LOG.info(String.format("setSelectionDefaultPropertyValue(%s, %s)", propertyName, value));
|
||||
for (IDIYComponent component : selectedComponents) {
|
||||
String className = component.getClass().getName();
|
||||
LOG.debug("Default property value set for " + className + ":" + propertyName);
|
||||
@@ -839,6 +839,14 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProjectDefaultPropertyValue(String propertyName, Object value) {
|
||||
LOG.info(String.format("setProjectDefaultPropertyValue(%s, %s)", propertyName, value));
|
||||
LOG.debug("Default property value set for " + Project.class.getName() + ":" + propertyName);
|
||||
ConfigurationManager.getInstance().setConfigurationItem(
|
||||
DEFAULTS_KEY + Project.class.getName() + ":" + propertyName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMetric(boolean isMetric) {
|
||||
ConfigurationManager.getInstance().setConfigurationItem(Presenter.METRIC_KEY, isMetric);
|
||||
@@ -1104,7 +1112,8 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not apply selection properties", e);
|
||||
view.showMessage("Could not apply changes to the selection. Check the log for details.",
|
||||
view.showMessage(
|
||||
"Could not apply changes to the selection. Check the log for details.",
|
||||
"Error", JOptionPane.ERROR_MESSAGE);
|
||||
} finally {
|
||||
// Notify the listeners.
|
||||
|
||||
Reference in New Issue
Block a user