]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java
Salome HOME
Tool bar is improved.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / ImportDocumentAction.java
index 995ea703d995b983e5dbace5300888b99ca276c5..d6af46bcf4a4608bd413a62f5ad6a2ec153559f3 100644 (file)
@@ -77,6 +77,12 @@ public class ImportDocumentAction extends UploadBaseNextAction {
         */
        private String _titleProperty;
        
+       /**
+        * 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.
@@ -97,7 +103,12 @@ public class ImportDocumentAction 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);
@@ -130,10 +141,18 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                                                new Revision().toString());
                                if (slot == null) {
                                        setErrorCode("reference.undefined");
+                                       
+                                       setToolProperty("none");
+                                       initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+                                       
                                        return ERROR;
                                } else {
                                        if (!slot.isUndefined()) {
                                                setErrorCode("reference.duplicate");
+                                               
+                                               setToolProperty("none");
+                                               initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+                                               
                                                return ERROR;
                                        }
                                        docref = fileref; // Disables document name and state fields
@@ -153,6 +172,10 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                                        docver = version.toString();
                                } catch (ParseException e) {
                                        setErrorCode("format.version");
+                                       
+                                       setToolProperty("none");
+                                       initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+                                       
                                        return ERROR;
                                }
                        docname = tool.extractProperty("title"); // Property kept even if the file is not referenced
@@ -166,6 +189,10 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                                        check.parse(date);
                                } catch (ParseException e) {
                                        setErrorCode("format.date");
+                                       
+                                       setToolProperty("none");
+                                       initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+                                       
                                        return ERROR;
                                }
                        } else
@@ -205,6 +232,10 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                        return "cancel";
                if (doctype == 0) {
                        setErrorCode("import.type");
+                       
+                       setToolProperty("none");
+                       initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+                       
                        return ERROR;
                }
                try {
@@ -296,6 +327,10 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                        logger.error("Reason:", error);
                        setErrorCode("internal");
                }
+               
+               setToolProperty("none");
+               initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
+               
                return ERROR;
        }
 
@@ -521,5 +556,19 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                _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