Salome HOME
Actions menu properties are refactored, unnecessary code is removed.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / EditScenarioPropertiesAction.java
index e2094b9b6ea8e8c9650f46612e2024bf21a4f9ff..e29124ff7fe621e1edaeebbdb5665a20aa0d15cc 100644 (file)
@@ -14,9 +14,14 @@ import org.splat.wapp.Constants;
 
 public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
 
-       private Scenario myscenario;
-       private String lasdate;
-       private String subject;
+       /**
+        * Serial version ID.
+        */
+       private static final long serialVersionUID = 4964740932426016171L;
+
+       private transient Scenario _myscenario;
+       private transient String _lasdate;
+       private transient String _subject;
 
        /**
         * The Scenario service.
@@ -28,43 +33,11 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
         */
        private ProjectElementService _projectElementService;
 
-       /**
-        * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help.
-        */
-       private String _menuProperty;
-
-       /**
-        * Value of the title bar property. It can be: study, knowledge.
-        */
-       private String _titleProperty;
-
-       /**
-        * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up
-        * menu also can be called. It is necessary for correct building the title bar.
-        */
-       private String _editDisabledProperty = "false";
-
-       /**
-        * Value of the tool bar property. It can be: none, standard, study, back.
-        */
-       private String _toolProperty;
-
-       /**
-        * Value of the left menu property. It can be: open, study, knowledge, scenario.
-        */
-       private String _leftMenuProperty;
-
-       /**
-        * Serial version ID.
-        */
-       private static final long serialVersionUID = 4964740932426016171L;
-
        // ==============================================================================================================================
        // Action methods
        // ==============================================================================================================================
 
        public String doInitialize() {
-               // -----------------------------
                ResourceBundle label = ResourceBundle.getBundle("labels",
                                getApplicationSettings().getCurrentLocale());
                ResourceBundle custom = ResourceBundle.getBundle("som",
@@ -75,17 +48,12 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
 
                _openStudy = getOpenStudy();
                step = _openStudy.getSelectedStep();
-               myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
-               lasdate = datstring.format(myscenario.getLastModificationDate());
-               subject = label.getString("label.study") + " " + _openStudy.getTitle();
+               _myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
+               _lasdate = datstring.format(_myscenario.getLastModificationDate());
+               _subject = label.getString("label.study") + " " + _openStudy.getTitle();
 
-               setMenuProperty(Constants.STUDY_MENU);
-               setTitleProperty(Constants.STUDY_MENU);
-               setEditDisabledProperty("true");
-               setToolProperty("back");
-               setLeftMenuProperty("open");
-               initializationFullScreenContext(_menuProperty, _titleProperty,
-                               _editDisabledProperty, _toolProperty, _leftMenuProperty);
+               initializationFullScreenContext(Constants.STUDY_MENU,
+                               Constants.STUDY_MENU, "true", "back", "open");
 
                return SUCCESS;
        }
@@ -103,26 +71,24 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
                _openStudy = getOpenStudy();
                _selection = _openStudy.getSelection();
                step = _openStudy.getSelectedStep();
-               myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
+               _myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
 
-               getScenarioService().checkin(myscenario.getIndex());
+               getScenarioService().checkin(_myscenario.getIndex());
                // TODO: Do it in the business service after moving to DTO instead of id parameter
                // or reread the scenario.
-               myscenario.setUser(null);
+               _myscenario.setUser(null);
 
                _openStudy.getMenu().refreshGivenStepItem(
-                               getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
+                               getProjectElementService().getFirstStep(_myscenario)); // For updating the scenario icon
 
-               setMenuProperty(Constants.STUDY_MENU);
                if ("true".equals(getWriteAccess())
                                && getUserRights().canCreateDocument()) {
                        setToolProperty(Constants.STUDY_MENU);
                } else {
-                       setToolProperty("standard");
+                       setToolProperty(Constants.STANDARD_MENU);
                }
-               setLeftMenuProperty(Constants.STUDY_MENU);
-               initializationFullScreenContext(_menuProperty, _toolProperty,
-                               _leftMenuProperty);
+               initializationFullScreenContext(Constants.STUDY_MENU,
+                               getToolProperty(), Constants.STUDY_MENU);
 
                return SUCCESS;
        }
@@ -138,16 +104,16 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
         */
        public User getAuthor() {
                User author;
-               if (myscenario.isCheckedout()) {
-                       author = myscenario.getUser();
+               if (_myscenario.isCheckedout()) {
+                       author = _myscenario.getUser();
                } else {
-                       author = myscenario.getAuthor();
+                       author = _myscenario.getAuthor();
                }
                return author;
        }
 
        public String getLastModificationDate() {
-               return lasdate;
+               return _lasdate;
        }
 
        public StepRights getSelectedStep() {
@@ -155,15 +121,15 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
        }
 
        public String getSubject() {
-               return subject;
+               return _subject;
        }
 
        public String getTitle() {
-               return myscenario.getTitle();
+               return _myscenario.getTitle();
        }
 
        public boolean isCheckedout() {
-               return myscenario.isCheckedout();
+               return _myscenario.isCheckedout();
        }
 
        /**
@@ -204,109 +170,4 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
                        final ProjectElementService projectElementService) {
                _projectElementService = projectElementService;
        }
-
-       /**
-        * Get the menuProperty.
-        * 
-        * @return the menuProperty
-        */
-       @Override
-       public String getMenuProperty() {
-               return _menuProperty;
-       }
-
-       /**
-        * Set the menuProperty.
-        * 
-        * @param menuProperty
-        *            the menuProperty to set
-        */
-       @Override
-       public void setMenuProperty(final String menuProperty) {
-               this._menuProperty = menuProperty;
-       }
-
-       /**
-        * Get the _titleProperty.
-        * 
-        * @return the _titleProperty
-        */
-       @Override
-       public String getTitleProperty() {
-               return _titleProperty;
-       }
-
-       /**
-        * Set the _titleProperty.
-        * 
-        * @param _titleProperty
-        *            the titleProperty to set
-        */
-       @Override
-       public void setTitleProperty(final String titleProperty) {
-               _titleProperty = titleProperty;
-       }
-
-       /**
-        * Get the editDisabledProperty.
-        * 
-        * @return the editDisabledProperty
-        */
-       @Override
-       public final String getEditDisabledProperty() {
-               return _editDisabledProperty;
-       }
-
-       /**
-        * Set the editDisabledProperty.
-        * 
-        * @param editDisabledProperty
-        *            the editDisabledProperty to set
-        */
-       @Override
-       public final void setEditDisabledProperty(final String editDisabledProperty) {
-               _editDisabledProperty = editDisabledProperty;
-       }
-
-       /**
-        * Get the toolProperty.
-        * 
-        * @return the toolProperty
-        */
-       @Override
-       public String getToolProperty() {
-               return _toolProperty;
-       }
-
-       /**
-        * Set the toolProperty.
-        * 
-        * @param toolProperty
-        *            the toolProperty to set
-        */
-       @Override
-       public void setToolProperty(final String toolProperty) {
-               _toolProperty = toolProperty;
-       }
-
-       /**
-        * Get the leftMenuProperty.
-        * 
-        * @return the leftMenuProperty
-        */
-       @Override
-       public String getLeftMenuProperty() {
-               return _leftMenuProperty;
-       }
-
-       /**
-        * Set the leftMenuProperty.
-        * 
-        * @param leftMenuProperty
-        *            the leftMenuProperty to set
-        */
-       @Override
-       public void setLeftMenuProperty(final String leftMenuProperty) {
-               _leftMenuProperty = leftMenuProperty;
-       }
 }
\ No newline at end of file