Salome HOME
Tool bar is improved.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / VersionDocumentAction.java
index 98550dc2488e751476a50474ea7e1a51f46cd3b5..6b879e6c2407d66a661839cb076758af1ba6bb95 100644 (file)
@@ -78,18 +78,27 @@ public class VersionDocumentAction extends UploadBaseNextAction {
         */
        private RepositoryService _repositoryService;
        /**
-        * 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.
+        * 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.
+        * Value of the tool bar property. 
+        * It can be: none, standard, study, back.
+        */
+       private String _toolProperty;
+
+       /**
+        * 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";
 
@@ -107,9 +116,13 @@ public class VersionDocumentAction extends UploadBaseNextAction {
                setMenuProperty("study");
                setTitleProperty("study");
                setEditDisabledProperty("true");
-               initializationScreenContext(_menuProperty, _titleProperty,
-                               _editDisabledProperty);
-
+               if ("true".equals(getWriteAccess())) {
+                       setToolProperty("study");
+               } else {
+                       setToolProperty("none");
+               }
+        initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+           
                User user = getConnectedUser();
                File updir = getRepositoryService().getDownloadDirectory(user);
                File upfile = new File(updir.getPath() + "/" + filename);
@@ -125,6 +138,10 @@ public class VersionDocumentAction extends UploadBaseNextAction {
                usedby = new Vector<Publication>();
 
                if (!extractProperties(upfile, doc)) {
+                       if (!("none".equals(_toolProperty))) {
+                               setToolProperty("none");
+                               initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+                       }
                        return ERROR;
                }
                setupDefaultUses(deftype);
@@ -214,9 +231,8 @@ public class VersionDocumentAction extends UploadBaseNextAction {
                setMenuProperty("study");
                setTitleProperty("study");
                setEditDisabledProperty("true");
-               initializationScreenContext(_menuProperty, _titleProperty,
-                               _editDisabledProperty);
-
+        initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty);
+           
                if (action == ToDo.cancel)
                        return "cancel";
 
@@ -254,6 +270,10 @@ public class VersionDocumentAction extends UploadBaseNextAction {
                        logger.error("Reason:", error);
                        setErrorCode("internal");
                }
+               
+               setToolProperty("none");
+               initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+               
                return ERROR;
        }
 
@@ -438,4 +458,20 @@ public class VersionDocumentAction extends UploadBaseNextAction {
        public void setEditDisabledProperty(String _editDisabledProperty) {
                this._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