]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman/src/org/splat/simer/NewStudyAction.java
Salome HOME
Menus are improved
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / NewStudyAction.java
index 1a89f79a373e070b86bb9d533ba737dfad607887..df6211e979c82f639a6af9b9be6f51f00a883723 100644 (file)
@@ -32,6 +32,12 @@ public class NewStudyAction extends Action {
         * Injected scenario service.
         */
        private ScenarioService _scenarioService;
+       
+       /**
+        * Value of the menu property. 
+        * It can be: none, create, open, study, knowledge, sysadmin, help.
+        */
+       private String _menuProperty;
 
        // ==============================================================================================================================
        // Action methods
@@ -48,6 +54,9 @@ public class NewStudyAction extends Action {
                                ApplicationSettings.getCurrentLocale());
                title = locale.getString("label.study") + " "
                                + String.valueOf(number + 1);
+               
+               setMenuProperty("create");
+               initializationScreenContext(_menuProperty);
 
                return SUCCESS;
        }
@@ -65,8 +74,13 @@ public class NewStudyAction extends Action {
                                throw new Exception();
                        if (valid == 0) {
                                value = input[1].trim();
-                               if (value.length() == 0)
+                               if (value.length() == 0) {
+                                       
+                                       setMenuProperty("create");
+                                       initializationScreenContext(_menuProperty);
+                                       
                                        return INPUT; // No need to reinitialize the list of existing products
+                               }
                        }
                        sprop.setTitle(title).setManager(getConnectedUser());
                        sprop.checkValidity();
@@ -77,6 +91,10 @@ public class NewStudyAction extends Action {
                                        .selectType("product");
                        contelm = getSimulationContextService()
                                        .selectSimulationContextsWhere(cprop.setType(product));
+                       
+                       setMenuProperty("create");
+                       initializationScreenContext(_menuProperty);
+                       
                        return INPUT; // Title empty, simply wait for input without error message
                }
                try {
@@ -104,9 +122,15 @@ public class NewStudyAction extends Action {
                        // Update of the session
                        number += 1;
                        open(study); // Opens the study,
+                       
+                       setMenuProperty("study");
+                       initializationScreenContext(_menuProperty);
+                       
                        return SUCCESS;
                } catch (Exception error) {
                        logger.error("Unable to save the study, reason:", error);
+                       setMenuProperty("none");
+                       initializationScreenContext(_menuProperty);
                        return ERROR;
                }
        }
@@ -194,4 +218,20 @@ public class NewStudyAction extends Action {
        public void setScenarioService(ScenarioService scenarioService) {
                _scenarioService = scenarioService;
        }
+       
+       /**
+        * Get the menuProperty.
+        * @return the menuProperty
+        */
+       public String getMenuProperty() {
+               return _menuProperty;
+       }
+
+       /**
+        * Set the menuProperty.
+        * @param menuProperty the menuProperty to set
+        */
+       public void setMenuProperty(String menuProperty) {
+               this._menuProperty = menuProperty;
+       }
 }
\ No newline at end of file