Salome HOME
Tool bar is improved.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / EditKnowledgeElementAction.java
index 16f48baa66dd6178c4cdb0c7edd50462167eff10..5e839d72c37943efa28907deeeedb7dec2dbd9c9 100644 (file)
@@ -43,12 +43,30 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
         * Injected knowledge element type service.
         */
        private KnowledgeElementTypeService _knowledgeElementTypeService;
-       
+
        /**
-        * Value of the menu property. 
-        * It can be: none, create, open, study, knowledge, sysadmin, help.
+        * 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;
 
        // ==============================================================================================================================
        // Action methods
@@ -61,10 +79,16 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
         */
        public String doInitialize() {
                mystudy = getOpenStudy();
-               
+
                setMenuProperty("study");
-               initializationScreenContext(_menuProperty);
-               
+               setTitleProperty("study");
+               if ("true".equals(getWriteAccess()) &&  getUserRights().canCreateDocument()) {
+                       setToolProperty("study");
+               } else {
+                       setToolProperty("standard");
+               }
+               initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+
                return SUCCESS;
        }
 
@@ -74,10 +98,16 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
         * @return SUCCESS if operation succeeded, ERROR if Runtime exception, otherwise INPUT
         */
        public String doSetKnowledge() {
-               
+
                setMenuProperty("study");
-               initializationScreenContext(_menuProperty);
-               
+               setTitleProperty("study");
+               if ("true".equals(getWriteAccess()) &&  getUserRights().canCreateDocument()) {
+                       setToolProperty("study");
+               } else {
+                       setToolProperty("standard");
+               }
+               initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+
                try {
                        User user = getConnectedUser();
                        mystudy = getOpenStudy();
@@ -131,9 +161,15 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
 
                mystudy.remove(kelm);
                getMenu("study").selects(mystudy.getSelection()); // Updates the menu icon, in case of last removed document
-               
+
                setMenuProperty("study");
-               initializationScreenContext(_menuProperty);
+               setTitleProperty("study");
+               if ("true".equals(getWriteAccess()) &&  getUserRights().canCreateDocument()) {
+                       setToolProperty("study");
+               } else {
+                       setToolProperty("standard");
+               }
+               initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
 
                return SUCCESS;
        }
@@ -236,6 +272,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
 
        /**
         * Get the knowledgeElementTypeService.
+        * 
         * @return the knowledgeElementTypeService
         */
        public KnowledgeElementTypeService getKnowledgeElementTypeService() {
@@ -244,15 +281,18 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
 
        /**
         * Set the knowledgeElementTypeService.
-        * @param knowledgeElementTypeService the knowledgeElementTypeService to set
+        * 
+        * @param knowledgeElementTypeService
+        *            the knowledgeElementTypeService to set
         */
        public void setKnowledgeElementTypeService(
                        KnowledgeElementTypeService knowledgeElementTypeService) {
                _knowledgeElementTypeService = knowledgeElementTypeService;
        }
-       
+
        /**
         * Get the menuProperty.
+        * 
         * @return the menuProperty
         */
        public String getMenuProperty() {
@@ -261,9 +301,61 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction {
 
        /**
         * Set the menuProperty.
-        * @param menuProperty the menuProperty to set
+        * 
+        * @param menuProperty
+        *            the menuProperty to set
         */
-       public void setMenuProperty(String menuProperty) {
+       public void setMenuProperty(final String menuProperty) {
                this._menuProperty = menuProperty;
        }
+       
+       /**
+        * Get the _titleProperty.
+        * @return the _titleProperty
+        */
+       public String getTitleProperty() {
+               return _titleProperty;
+       }
+
+       /**
+        * Set the titleProperty.
+        * @param titleProperty the titleProperty to set
+        */
+       public void setTitleProperty(final String titleProperty) {
+               _titleProperty = titleProperty;
+       }
+
+       /**
+        * Get the editDisabledProperty.
+        * @return the editDisabledProperty
+        */
+       public String getEditDisabledProperty() {
+               return _editDisabledProperty;
+       }
+
+       /**
+        * Set the editDisabledProperty.
+        * @param editDisabledProperty the editDisabledProperty to set
+        */
+       public void setEditDisabledProperty(final String editDisabledProperty) {
+               _editDisabledProperty = editDisabledProperty;
+       }
+
+       /**
+        * Get the toolProperty.
+        * @return the toolProperty
+        */
+       public String getToolProperty() {
+               return _toolProperty;
+       }
+
+       /**
+        * Set the toolProperty.
+        * @param toolProperty the toolProperty to set
+        */
+       public void setToolProperty(final String toolProperty) {
+               _toolProperty = toolProperty;
+       }
+
+       
 }
\ No newline at end of file