]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman/src/org/splat/simer/EditSimulationContextAction.java
Salome HOME
Actions menu properties are refactored, unnecessary code is removed.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / EditSimulationContextAction.java
index 036ea3abe5eebc65a2ce65cf3ae7e9f2e0161e72..f1a074041311a808b3b2cd0df51d8000eb6cb430 100644 (file)
@@ -10,9 +10,7 @@ import org.splat.dal.bo.som.Study;
 import org.splat.service.SimulationContextService;
 import org.splat.service.SimulationContextTypeService;
 import org.splat.service.StepService;
-import org.splat.service.StudyService;
 import org.splat.som.Step;
-import org.splat.wapp.Constants;
 
 /**
  * Action for simulation context selection or input.
@@ -48,10 +46,6 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
         * Context value.
         */
        private transient String _value = null;
-       /**
-        * Injected study service.
-        */
-       private StudyService _studyService;
        /**
         * Injected step service.
         */
@@ -65,32 +59,6 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
         */
        private SimulationContextTypeService _simulationContextTypeService;
 
-       /**
-        * 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;
-
-       /**
-        * 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;
-
-       /**
-        * 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";
-
        // ==============================================================================================================================
        // Action methods
        // ==============================================================================================================================
@@ -106,18 +74,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
                _openStudy = getOpenStudy();
                _contype = getInvolvedContexts();
 
-               setMenuProperty(Constants.STUDY_MENU);
-               setTitleProperty(Constants.STUDY_MENU);
-               if (Constants.TRUE.equals(getWriteAccess())
-                               && getUserRights().canCreateDocument()) {
-                       setToolProperty(Constants.STUDY_MENU);
-               } else {
-                       setToolProperty(Constants.STANDARD_MENU);
-               }
-
-               setLeftMenuProperty(Constants.STUDY_MENU);
-               initializationFullScreenContext(_menuProperty, _titleProperty,
-                               _editDisabledProperty, _toolProperty, _leftMenuProperty);
+               setMenu();
 
                if (_contype.isEmpty()) {
                        res = "create";
@@ -138,17 +95,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
                String res = "set";
                _openStudy = getOpenStudy();
 
-               setMenuProperty(Constants.STUDY_MENU);
-               setTitleProperty(Constants.STUDY_MENU);
-               if (Constants.TRUE.equals(getWriteAccess())
-                               && getUserRights().canCreateDocument()) {
-                       setToolProperty(Constants.STUDY_MENU);
-               } else {
-                       setToolProperty(Constants.STANDARD_MENU);
-               }
-               setLeftMenuProperty(Constants.STUDY_MENU);
-               initializationFullScreenContext(_menuProperty, _titleProperty,
-                               _editDisabledProperty, _toolProperty, _leftMenuProperty);
+               setMenu();
 
                int typid = Integer.valueOf(_selectype);
                if (typid == 0) {
@@ -162,7 +109,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
                        _contype = getInvolvedContexts();
                        _contelm = getSimulationContextService()
                                        .selectSimulationContextsWhere(cprop.setType(_type));
-                       
+
                        setAction("setContext");
                        setIndex(String.valueOf(getContextType().getIndex()));
                }
@@ -181,17 +128,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
                try {
                        _openStudy = getOpenStudy();
 
-                       setMenuProperty(Constants.STUDY_MENU);
-                       setTitleProperty(Constants.STUDY_MENU);
-                       if (Constants.TRUE.equals(getWriteAccess())
-                                       && getUserRights().canCreateDocument()) {
-                               setToolProperty(Constants.STUDY_MENU);
-                       } else {
-                               setToolProperty(Constants.STANDARD_MENU);
-                       }
-                       setLeftMenuProperty(Constants.STUDY_MENU);
-                       initializationFullScreenContext(_menuProperty, _titleProperty,
-                                       _editDisabledProperty, _toolProperty, _leftMenuProperty);
+                       setMenu();
 
                        if (_newtype.length() == 0 || _value.length() == 0) {
                                res = INPUT;
@@ -232,17 +169,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
        public String doDeleteContext() {
 
                String res = SUCCESS;
-               setMenuProperty(Constants.STUDY_MENU);
-               setTitleProperty(Constants.STUDY_MENU);
-               if (Constants.TRUE.equals(getWriteAccess())
-                               && getUserRights().canCreateDocument()) {
-                       setToolProperty(Constants.STUDY_MENU);
-               } else {
-                       setToolProperty(Constants.STANDARD_MENU);
-               }
-               setLeftMenuProperty(Constants.STUDY_MENU);
-               initializationFullScreenContext(_menuProperty, _titleProperty,
-                               _editDisabledProperty, _toolProperty, _leftMenuProperty);
+               setMenu();
 
                try {
                        _openStudy = getOpenStudy();
@@ -276,17 +203,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
                String res = SUCCESS;
                String[] input = _value.split(",");
 
-               setMenuProperty(Constants.STUDY_MENU);
-               setTitleProperty(Constants.STUDY_MENU);
-               if (Constants.TRUE.equals(getWriteAccess())
-                               && getUserRights().canCreateDocument()) {
-                       setToolProperty(Constants.STUDY_MENU);
-               } else {
-                       setToolProperty(Constants.STANDARD_MENU);
-               }
-               setLeftMenuProperty(Constants.STUDY_MENU);
-               initializationFullScreenContext(_menuProperty, _titleProperty,
-                               _editDisabledProperty, _toolProperty, _leftMenuProperty);
+               setMenu();
 
                try {
                        _openStudy = getOpenStudy();
@@ -322,7 +239,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
                        }
                        _openStudy.add(contex);
                        _contype = getInvolvedContexts();
-                       
+
                        setAction("setContext");
                        setIndex(String.valueOf(getContextType().getIndex()));
 
@@ -450,27 +367,6 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
                return contype;
        }
 
-       /**
-        * Get the studyService.
-        * 
-        * @return the studyService
-        */
-       @Override
-       public StudyService getStudyService() {
-               return _studyService;
-       }
-
-       /**
-        * Set the studyService.
-        * 
-        * @param studyService
-        *            the studyService to set
-        */
-       @Override
-       public void setStudyService(final StudyService studyService) {
-               _studyService = studyService;
-       }
-
        /**
         * Get the simulationContextService.
         * 
@@ -529,109 +425,4 @@ public class EditSimulationContextAction extends DisplayStudyStepAction {
        public void setStepService(final StepService stepService) {
                _stepService = stepService;
        }
-
-       /**
-        * 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