]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman/src/org/splat/simer/ApplicationSettings.java
Salome HOME
The draft of the "Copy from existing study" action is added. The YACS step is introdu...
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / ApplicationSettings.java
index 99fdb59a957150f1e90fd2b5ada4162ad75993d9..a30dd31f205cb74a73566486b633d84d1eee7cbd 100644 (file)
@@ -214,6 +214,10 @@ public class ApplicationSettings {
         * Edit menu item name.
         */
        private static final String MNU_NAME_EDIT = "menu.edit";
+       /**
+        * Edit menu item name.
+        */
+       private static final String MNU_NAME_REMOVE = "menu.remove";
        /**
         * Script menu item name.
         */
@@ -229,7 +233,7 @@ public class ApplicationSettings {
        /**
         * Remove menu item name.
         */
-       private static final String MNU_NAME_REMOVE = "menu.remove.version";
+       private static final String MNU_NAME_REMOVE_VERSION = "menu.remove.version";
        /**
         * Rename menu item name.
         */
@@ -333,13 +337,19 @@ public class ApplicationSettings {
                _projectSettings = projectSettingsService;
        }
 
+       /**
+        * New study menu.
+        */
        private static class NewMenu extends SimpleMenu {
+               /**
+                * New study menu constructor.
+                */
                private NewMenu() {
                        super("create");
                        addItem("new-empty", "menu.new.empty", "image.empty.png",
                                        "select?menu=create&item=new-empty");
-                       addItem("new-copy", new MenuItem("menu.new.copy")
-                                       .icon("image.copy.png"));
+                       addItem("new-copy", "menu.new.copy", "image.copy.png",
+                                       "select?menu=create&item=new-copy");
                        /*
                         * addItem("new-instance", new MenuItem("menu.new.instance") .icon(IMG_HOLD)); addItem("new-import", new
                         * MenuItem("menu.new.import") .icon("icon.upload.png"));
@@ -348,7 +358,13 @@ public class ApplicationSettings {
                }
        }
 
+       /**
+        * Search menu.
+        */
        private static class SearchMenu extends SimpleMenu {
+               /**
+                * Search menu constructor.
+                */
                private SearchMenu() {
                        super("search");
                        addItem("search-study", "menu.search.study", "image.study.png",
@@ -361,7 +377,13 @@ public class ApplicationSettings {
                }
        }
 
+       /**
+        * Configuration menu.
+        */
        private static class PropertiesMenu extends SimpleMenu {
+               /**
+                * Configuration menu constructor.
+                */
                private PropertiesMenu() {
                        super("configuration");
                        addItem("prop-general", "menu.prop.general", IMG_HOLD,
@@ -377,7 +399,13 @@ public class ApplicationSettings {
                }
        }
 
+       /**
+        * Data administrator menu.
+        */
        private static class DatadminMenu extends SimpleMenu {
+               /**
+                * Data administrator menu constructor.
+                */
                private DatadminMenu() {
                        super("datadmin");
                        addItem("admin-scontext", "menu.admin.context", IMG_HOLD,
@@ -389,7 +417,13 @@ public class ApplicationSettings {
                }
        }
 
+       /**
+        * System administrator menu.
+        */
        private static class SysadminMenu extends SimpleMenu {
+               /**
+                * System administrator menu constructor.
+                */
                private SysadminMenu() {
                        super("sysadmin");
                        addItem("admin-indexing", "menu.admin.indexing", "image.index.png",
@@ -471,36 +505,56 @@ public class ApplicationSettings {
        };
 
        // Resources relative to studies
+       /**
+        * Study popup menu.
+        */
        private static class EditableMarkedStudyPopup extends PopupMenu {
+               /**
+                * User rights for the selected study.
+                */
                private transient StudyRights _user = null;
 
-               private EditableMarkedStudyPopup(final boolean isPublic, final boolean isMarked) {
+               /**
+                * Study popup menu constructor.
+                * 
+                * @param isPublic
+                *            public study flag
+                * @param isMarked
+                *            "marked as reference" study flag
+                */
+               private EditableMarkedStudyPopup(final boolean isPublic,
+                               final boolean isMarked) {
                        super();
-                       
+
                        if (isMarked) {
                                addItem(MNU_MARK_AS_REFERENCE, new PopupItem(
-                                               MNU_NAME_REMOVE_AS_REFERENCE).action(ACT_REMOVE_AS_REFERENCE)
-                                               .confirmation("message.removeasreference.study"));
+                                               MNU_NAME_REMOVE_AS_REFERENCE).action(
+                                               ACT_REMOVE_AS_REFERENCE).confirmation(
+                                               "message.removeasreference.study"));
                        } else {
-                               addItem(MNU_MARK_AS_REFERENCE, new PopupItem(MNU_NAME_MARK_AS_REFERENCE)
-                                               .action(ACT_MARK_AS_REFERENCE).confirmation(
+                               addItem(MNU_MARK_AS_REFERENCE, new PopupItem(
+                                               MNU_NAME_MARK_AS_REFERENCE).action(
+                                               ACT_MARK_AS_REFERENCE).confirmation(
                                                "message.markasreference.study"));
                        }
-                       
+
                        if (isPublic) {
                                addItem(MNU_PUBLISH, new PopupItem(MNU_NAME_PROTECT).icon(
-                                               "image.publish.png").action("edit-study?action=protect")
-                                               .confirmation("message.protect.study"));
+                                               "image.publish.png")
+                                               .action("edit-study?action=protect").confirmation(
+                                                               "message.protect.study"));
                        } else {
                                addItem(MNU_PUBLISH, new PopupItem(MNU_NAME_PUBLISH).icon(
-                                               "image.publish.png").action("edit-study?action=publish")
-                                               .confirmation("message.publish.study"));
+                                               "image.publish.png")
+                                               .action("edit-study?action=publish").confirmation(
+                                                               "message.publish.study"));
                        }
 
                        /* addItem(MNU_PROMOTE, new PopupItem("menu.archive")); */
                        addSeparator();
                        addItem(MNU_EDIT, new PopupItem("menu.properties").icon(
-                                       "icon.ed.png").action("../select?menu=configuration&item=prop-general"));
+                                       "icon.ed.png").action(
+                                       "../select?menu=configuration&item=prop-general"));
                        addSeparator();
                        addItem(MNU_SCRIPT, new PopupItem(MNU_NAME_SCRIPT)
                                        .action("add-scenario"));
@@ -511,7 +565,7 @@ public class ApplicationSettings {
                        /*
                         * addItem(MNU_PURGE, new PopupItem(MNU_NAME_PURGE) .confirmation("message.purge.study")); addItem("export", new
                         * PopupItem("menu.export") .icon("image.export.png")); // For future needs
-                        */addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(
+                        */addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE_VERSION).icon(
                                        IMG_DELETE).action("remove-study").confirmation(
                                        "message.delete.study"));
                }
@@ -570,7 +624,7 @@ public class ApplicationSettings {
                                boolean history = _user.getOperand().isVersioned();
                                PopupItem item = this.item(MNU_REMOVE);
                                if (history) {
-                                       item.rename(MNU_NAME_REMOVE);
+                                       item.rename(MNU_NAME_REMOVE_VERSION);
                                } else {
                                        item.rename("menu.remove.study");
                                }
@@ -583,8 +637,14 @@ public class ApplicationSettings {
         * Popup of In-Work documents.
         */
        private static class EditableDocumentPopup extends PopupMenu {
+               /**
+                * User rights for the selected document.
+                */
                private transient DocumentRights _user = null;
 
+               /**
+                * Document popup menu constructor.
+                */
                private EditableDocumentPopup() {
                        super();
                        addItem("accept", new PopupItem("menu.accept").icon(
@@ -608,9 +668,9 @@ public class ApplicationSettings {
                        addItem(MNU_PURGE, new PopupItem(MNU_NAME_PURGE).action(
                                        ACT_NOT_YET_IMPLEMENTED).confirmation(
                                        "message.purge.document"));
-                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(IMG_DELETE)
-                                       .action("remove-document").confirmation(
-                                                       "message.delete.document"));
+                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE_VERSION).icon(
+                                       IMG_DELETE).action("remove-document").confirmation(
+                                       "message.delete.document"));
                }
 
                @Override
@@ -657,7 +717,7 @@ public class ApplicationSettings {
                                Document downer = _user.getOperand();
                                PopupItem item = this.item(MNU_REMOVE);
                                if (downer.isVersioned()) {
-                                       item.rename(MNU_NAME_REMOVE);
+                                       item.rename(MNU_NAME_REMOVE_VERSION);
                                } else {
                                        item.rename("menu.remove.document");
                                }
@@ -669,8 +729,14 @@ public class ApplicationSettings {
         * Popup of In-Draft documents.
         */
        private static class ReviewableDocumentPopup extends PopupMenu {
+               /**
+                * User rights for the selected document.
+                */
                private transient DocumentRights _user = null;
 
+               /**
+                * Document popup menu constructor.
+                */
                private ReviewableDocumentPopup() {
                        super();
                        addItem(MNU_DEMOTE, new PopupItem(MNU_NAME_DEMOTE).icon(
@@ -745,9 +811,9 @@ public class ApplicationSettings {
                        addItem(MNU_PURGE, new PopupItem(MNU_NAME_PURGE).action(
                                        ACT_NOT_YET_IMPLEMENTED).confirmation(
                                        "message.purge.document"));
-                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(IMG_DELETE)
-                                       .action("remove-document").confirmation(
-                                                       "message.delete.document"));
+                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE_VERSION).icon(
+                                       IMG_DELETE).action("remove-document").confirmation(
+                                       "message.delete.document"));
                }
        }
 
@@ -882,7 +948,7 @@ public class ApplicationSettings {
                        addItem(MNU_EDIT, new PopupItem(MNU_NAME_EDIT)
                                        .action("edit-context?action=editContext"));
                        addSeparator();
-                       addItem(MNU_REMOVE, new PopupItem("menu.remove").icon(IMG_DELETE)
+                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(IMG_DELETE)
                                        .action("remove-context").confirmation(
                                                        "message.delete.context"));
                }
@@ -929,7 +995,7 @@ public class ApplicationSettings {
                        addItem(MNU_EDIT, new PopupItem(MNU_NAME_EDIT)
                                        .action("edit-knowledge?action=editKnowledge"));
                        addSeparator();
-                       addItem(MNU_REMOVE, new PopupItem("menu.remove").icon(IMG_DELETE)
+                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(IMG_DELETE)
                                        .action("remove-knowledge").confirmation(
                                                        "message.delete.knowledge"));
                }
@@ -959,7 +1025,7 @@ public class ApplicationSettings {
                        }
                }
        }
-       
+
        /**
         * Pop-up menu for comments.
         */
@@ -971,13 +1037,16 @@ public class ApplicationSettings {
                        super();
                        addItem(MNU_EDIT, new PopupItem(MNU_NAME_EDIT).icon("icon.ed.png")
                                        .action("editComment(entity_index)"));
-                       addItem(MNU_REMOVE, new PopupItem("menu.remove").icon(IMG_DELETE)
-                                       .action("removeComment(entity_index)").confirmation("message.delete.comment"));
+                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(IMG_DELETE)
+                                       .action("removeComment(entity_index)").confirmation(
+                                                       "message.delete.comment"));
                }
 
                /**
                 * Is enabled.
-                * @param name the entry name
+                * 
+                * @param name
+                *            the entry name
                 * @return true
                 */
                @Override
@@ -985,7 +1054,7 @@ public class ApplicationSettings {
                        return true;
                }
        }
-       
+
        /**
         * Pop-up menu for comments.
         */
@@ -997,14 +1066,16 @@ public class ApplicationSettings {
                        super();
                        addItem(MNU_EDIT, new PopupItem(MNU_NAME_EDIT).icon("icon.ed.png")
                                        .action("showDescriptionEditor()"));
-                       addItem(MNU_REMOVE, new PopupItem("menu.remove").icon(IMG_DELETE)
-                                       .action("removeDescription()")
-                                       .confirmation("message.delete.description"));
+                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(IMG_DELETE)
+                                       .action("removeDescription()").confirmation(
+                                                       "message.delete.description"));
                }
 
                /**
                 * Is enable.
-                * @param name the entry name
+                * 
+                * @param name
+                *            the entry name
                 * @return true
                 */
                @Override
@@ -1036,10 +1107,14 @@ public class ApplicationSettings {
                _menus.put(menu.getName(), menu);
 
                _popups = new HashMap<String, PopupMenu>();
-               _popups.put("steditablemarkpublic", new EditableMarkedStudyPopup(false, false));
-               _popups.put("steditableunmarkpublic", new EditableMarkedStudyPopup(false, true));
-               _popups.put("steditablemarkprivate", new EditableMarkedStudyPopup(true, false));
-               _popups.put("steditableunmarkprivate", new EditableMarkedStudyPopup(true, true));
+               _popups.put("steditablemarkpublic", new EditableMarkedStudyPopup(false,
+                               false));
+               _popups.put("steditableunmarkpublic", new EditableMarkedStudyPopup(
+                               false, true));
+               _popups.put("steditablemarkprivate", new EditableMarkedStudyPopup(true,
+                               false));
+               _popups.put("steditableunmarkprivate", new EditableMarkedStudyPopup(
+                               true, true));
                _popups.put("editable", new EditableDocumentPopup());
                _popups.put("notresult", new NotResultDocumentPopup());
                _popups.put("reviewable", new ReviewableDocumentPopup());