mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
editable project properties
This commit is contained in:
+1
-2
@@ -109,8 +109,7 @@ public class ComponentProcessor {
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<PropertyWrapper> extractProperties(Class<? extends IDIYComponent> clazz) {
|
||||
public List<PropertyWrapper> extractProperties(Class<?> clazz) {
|
||||
if (propertyCache.containsKey(clazz)) {
|
||||
return cloner.deepClone(propertyCache.get(clazz));
|
||||
}
|
||||
|
||||
+37
@@ -1017,6 +1017,43 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PropertyWrapper> getProjectProperties() {
|
||||
List<PropertyWrapper> properties = ComponentProcessor.getInstance().extractProperties(
|
||||
Project.class);
|
||||
try {
|
||||
for (PropertyWrapper property : properties) {
|
||||
property.readFrom(currentProject);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not get project properties", e);
|
||||
return null;
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPropertiesToProject(List<PropertyWrapper> properties) {
|
||||
LOG.debug(String.format("applyPropertiesToProject(%s)", properties));
|
||||
Project oldProject = cloner.deepClone(currentProject);
|
||||
try {
|
||||
for (PropertyWrapper property : properties) {
|
||||
property.writeTo(currentProject);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not apply project properties", e);
|
||||
} finally {
|
||||
// Notify the listeners.
|
||||
if (!oldProject.equals(currentProject)) {
|
||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, cloner
|
||||
.deepClone(currentProject), "Edit Project");
|
||||
}
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
messageDispatcher.dispatchMessage(EventType.SELECTION_SIZE_CHANGED,
|
||||
calculateSelectionDimension());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNewComponentSlot(ComponentType componentType) {
|
||||
LOG.debug(String.format("setNewComponentSlot(%s)", componentType == null ? null
|
||||
|
||||
Reference in New Issue
Block a user