]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java
Salome HOME
Show and Edit description functionalities are implemented
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / DisplayStudyStepAction.java
index f8523e137db8092e6a34c1d151f2caecf356ff73..4474f20d8088a6256cae95b1bd22c978edd1b8f9 100644 (file)
@@ -45,6 +45,11 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
         * Injected Step Service.
         */
        private StepService _stepService;
+       
+       /**
+        * Study description.
+        */
+       private String _descriptionValue;
 
        // ==============================================================================================================================
        // Action methods
@@ -102,6 +107,7 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
                        setMenu();
                }
                loadComments();
+               loadDescription();
                return res;
        }
 
@@ -198,6 +204,34 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
                }
        }
        
+       /**
+        * Loads description (if already loaded - reloads).
+        */
+       public void loadDescription() {
+               try {
+                       _descriptionValue = _studyService.getDescription(_openStudy.getIndex());
+               } catch(InvalidParameterException exception) {
+                       _descriptionValue = null;
+                       LOG.debug("Error while trying to add description: " + exception.getMessage());
+               }
+       }
+       
+       /**
+        * Sets study description.
+        * @return SUCCESS if succeeded, INPUT otherwise.
+        */
+       public String doSetDescription() {
+               String res = INPUT;
+               try {
+                       _studyService.setDescription(_openStudy.getIndex(), _descriptionValue);
+                       res = SUCCESS;
+               } catch(InvalidParameterException exception) {
+                       LOG.debug("Error while trying to add description: " + exception.getMessage());
+               }
+               loadDescription();
+               return res;
+       }
+       
        // ==============================================================================================================================
        // Getters
        // ==============================================================================================================================
@@ -300,4 +334,20 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
        public void setStepService(final StepService stepService) {
                _stepService = stepService;
        }
+       
+       /**
+        * Get the descriptionValue.
+        * @return the descriptionValue
+        */
+       public String getDescriptionValue() {
+               return _descriptionValue;
+       }
+
+       /**
+        * Set the descriptionValue.
+        * @param descriptionValue the descriptionValue to set
+        */
+       public void setDescriptionValue(final String descriptionValue) {
+               _descriptionValue = descriptionValue;
+       }
 }
\ No newline at end of file