You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2022/11/25 15:23:35 UTC

[cayenne] branch master updated: CAY-2782 Modeler: save button becomes active on DataMap comment field focus

This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
     new 9418af428 CAY-2782 Modeler: save button becomes active on DataMap comment field focus
9418af428 is described below

commit 9418af4280d3204a7e8b8b4ccdcf6a6141511401
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Fri Nov 25 18:23:31 2022 +0300

    CAY-2782 Modeler: save button becomes active on DataMap comment field focus
---
 RELEASE-NOTES.txt                                             |  1 +
 .../java/org/apache/cayenne/modeler/editor/DataMapView.java   | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 80bbaf38b..e85c52879 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -42,3 +42,4 @@ CAY-2762 Modeler: Difference in toolbars colors on OSX
 CAY-2764 Split expressions do not work with DB relationships
 CAY-2765 dbimport: check excluded catalogs and schemas for the SQLServer
 CAY-2774 Overriding service ordering in DI List causes DIRuntimeException
+CAY-2782 Modeler: save button becomes active on DataMap comment field focus
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java
index 52c029ab6..d8c077d8c 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java
@@ -466,9 +466,14 @@ public class DataMapView extends JPanel {
         if (dataMap == null) {
             return;
         }
-
-        ObjectInfo.putToMetaData(eventController.getApplication().getMetaData(), dataMap, ObjectInfo.COMMENT, comment);
-        eventController.fireDataMapEvent(new DataMapEvent(this, dataMap));
+        String currentComment = getComment(dataMap);
+        if (currentComment == null) {
+            currentComment = "";
+        }
+        if (!currentComment.equals(comment)) {
+            ObjectInfo.putToMetaData(eventController.getApplication().getMetaData(), dataMap, ObjectInfo.COMMENT, comment);
+            eventController.fireDataMapEvent(new DataMapEvent(this, dataMap));
+        }
     }
 
     private String getComment(DataMap dataMap) {