private void prepareLayerPropertiesModified() { for (AbstractMementoOriginalProperties memento : this.modifiedLayersMap.values()) { if (memento.isChanged()) { this.add(memento); } } this.modifiedLayersMap.clear(); }
/** * The properties are copied only the first time, in this way we can save only the layers * effectively modified from the original one */ @Override public AbstractMementoOriginalProperties copyOriginalProperties(GPBeanTreeModel element) { AbstractMementoOriginalProperties mementoOriginalProperties = null; if (!this.modifiedLayersMap.containsKey(element)) { mementoOriginalProperties = MementoSaveBuilder.generateMementoOriginalProperties(element); mementoOriginalProperties.copyOriginalProperties(element); } return mementoOriginalProperties; }
private int countLayerPropertiesModified() { int count = 0; System.out.println("Memento Counting: "); System.out.println("Memento Counting: " + this.modifiedLayersMap.values()); for (AbstractMementoOriginalProperties memento : this.modifiedLayersMap.values()) { System.out.println("Memento changed: " + memento.isChanged()); if (memento.isChanged()) { count++; } } return count; }
/** * The properties are copied only the first time, in this way we can save only the layers * effectively modified from the original one */ @Override public void putOriginalPropertiesInCache(AbstractMementoOriginalProperties memento) { boolean treeInitialized = (Boolean) Registry.get(UserSessionEnum.TREE_LOADED.name()); if (treeInitialized) { if (memento != null && !this.modifiedLayersMap.containsKey(memento.getRefBaseElement())) { this.modifiedLayersMap.put(memento.getRefBaseElement(), memento); if (super.peek() == null) { this.observable.setChanged(); this.observable.notifyObservers(LayerEvents.SAVE_CACHE_NOT_EMPTY); /*System.out.println("Event SAVE_CACHE_NOT_EMPTY notified to " + this.observable.countObservers() + " observers");*/ } } } }