Salome HOME
Fix of "Remove this version" menu item. Also Logger is replaced by AppLogger.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / ApplicationSettings.java
index e9e6fdb583be91a8b4dbb0ff5ba093f071153fc3..6fb1c238eb52d1491f7ab0d385370184facfbb9d 100644 (file)
@@ -16,14 +16,13 @@ import javax.servlet.http.HttpServletRequest;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import org.apache.log4j.Logger;
 import org.splat.dal.bo.kernel.User;
 import org.splat.dal.bo.som.Document;
 import org.splat.dal.bo.som.DocumentType;
 import org.splat.dal.bo.som.KnowledgeElement;
-import org.splat.dal.bo.som.ProgressState;
 import org.splat.dal.bo.som.SimulationContext;
 import org.splat.dal.bo.som.Visibility;
+import org.splat.log.AppLogger;
 import org.splat.manox.XDOM;
 import org.splat.service.DocumentTypeService;
 import org.splat.service.technical.ProjectSettingsService;
@@ -49,7 +48,7 @@ public class ApplicationSettings {
        /**
         * Application settings logger.
         */
-       protected final static Logger LOG = Logger
+       protected final static AppLogger LOG = AppLogger
                        .getLogger(ApplicationSettings.class);
        /**
         * JNDI context for launching converters.
@@ -177,10 +176,10 @@ public class ApplicationSettings {
         * Version menu item name.
         */
        private static final String MNU_VERSION = "version";
-       /**
-        * Purge menu item name.
-        */
-       private static final String MNU_PURGE = "purge";
+       // /**
+       // * Purge menu item name.
+       // */
+       // private static final String MNU_PURGE = "purge";
        /**
         * Remove menu item name.
         */
@@ -214,6 +213,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.
         */
@@ -225,11 +228,11 @@ public class ApplicationSettings {
        /**
         * Purge menu item name.
         */
-       private static final String MNU_NAME_PURGE = "menu.purge";
+       // private static final String MNU_NAME_PURGE = "menu.purge";
        /**
         * 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.
         */
@@ -238,10 +241,6 @@ public class ApplicationSettings {
         * Mark as reference menu item name.
         */
        private static final String MNU_MARK_AS_REFERENCE = "markasreference";
-       /**
-        * Remove as reference menu item name.
-        */
-       private static final String MNU_REMOVE_AS_REFERENCE = "removeasreference";
        /**
         * Mark as reference menu item label key.
         */
@@ -250,10 +249,10 @@ public class ApplicationSettings {
         * Remove as reference menu item label key.
         */
        private static final String MNU_NAME_REMOVE_AS_REFERENCE = "menu.removeasreference";
-       /**
-        * Not yet implemented action name.
-        */
-       private static final String ACT_NOT_YET_IMPLEMENTED = "notyetimplemented";
+       // /**
+       // * Not yet implemented action name.
+       // */
+       // private static final String ACT_NOT_YET_IMPLEMENTED = "notyetimplemented";
        /**
         * Attach action name.
         */
@@ -337,13 +336,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"));
@@ -352,7 +357,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",
@@ -365,7 +376,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,
@@ -381,7 +398,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,
@@ -393,7 +416,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",
@@ -445,7 +474,7 @@ public class ApplicationSettings {
                 */
                edit,
                /**
-                * script
+                * script.
                 */
                script,
                /**
@@ -453,11 +482,11 @@ public class ApplicationSettings {
                 */
                version,
                /**
-                * replace
+                * replace.
                 */
                replace,
                /**
-                * export
+                * export.
                 */
                export,
                /**
@@ -465,7 +494,7 @@ public class ApplicationSettings {
                 */
                remove,
                /**
-                * purge
+                * purge.
                 */
                purge,
                /**
@@ -475,37 +504,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"));
                        }
-                       
-                       LOG.debug("MKA isPublic = " + isPublic);
+
                        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=properties"));
+                                       "icon.ed.png").action(
+                                       "../select?menu=configuration&item=prop-general"));
                        addSeparator();
                        addItem(MNU_SCRIPT, new PopupItem(MNU_NAME_SCRIPT)
                                        .action("add-scenario"));
@@ -516,8 +564,8 @@ 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(
-                                       IMG_DELETE).action(ACT_NOT_YET_IMPLEMENTED).confirmation(
+                        */addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE_VERSION).icon(
+                                       IMG_DELETE).action("remove-study").confirmation(
                                        "message.delete.study"));
                }
 
@@ -551,9 +599,9 @@ public class ApplicationSettings {
                                        case remove:
                                                res = _user.canRemove();
                                                break;
-                                       case purge:
-                                               res = _user.canPurge();
-                                               break;
+                                       /*
+                                        * case purge: res = _user.canPurge(); break;
+                                        */
                                        case markasreference:
                                                if (_user.getOperand().getMarkreference() == 0) {
                                                        res = _user.canMarkStudyAsReference();
@@ -568,6 +616,11 @@ public class ApplicationSettings {
                        return res;
                }
 
+               /**
+                * {@inheritDoc}
+                * 
+                * @see org.splat.wapp.ContextualMenu#setContext(java.lang.String, java.lang.Object)
+                */
                @Override
                public void setContext(final String name, final Object context) {
                        if (context instanceof StudyRights) {
@@ -575,7 +628,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");
                                }
@@ -585,39 +638,19 @@ public class ApplicationSettings {
 
        // Resources relative to documents
        /**
-        * Popup of In-Work documents.
+        * Popup of a document.
         */
-       private static class EditableDocumentPopup extends PopupMenu {
+       private static class DocumentPopup extends PopupMenu {
+               /**
+                * Current user rights.
+                */
                private transient DocumentRights _user = null;
 
-               private EditableDocumentPopup() {
-                       super();
-                       addItem("accept", new PopupItem("menu.accept").icon(
-                                       "image.accept.png").action("setDocument?action=accept")
-                                       .confirmation("message.accept.document"));
-                       addItem(MNU_PROMOTE, new PopupItem(MNU_NAME_PROMOTE).icon(
-                                       "image.publish.png").action("setDocument?action=promote")
-                                       .confirmation("message.promote.document"));
-                       addSeparator();
-                       addItem(MNU_RENAME, new PopupItem(MNU_NAME_RENAME)
-                                       .action("edit-document?action=renameDocument"));
-                       addItem(MNU_ATTACH, new PopupItem(MNU_NAME_ATTACH).icon(IMG_ATTACH)
-                                       .action(ACT_ATTACH));
-                       addSeparator();
-                       addItem(MNU_VERSION, new PopupItem(MNU_NAME_VERSION).icon(
-                                       IMG_VERSION).action(ACT_VERSION));
-                       addItem("replace", new PopupItem("menu.replace").icon(
-                                       "image.replace.png").action(
-                                       "select-file?nextAction=replace"));
-                       addSeparator();
-                       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"));
-               }
-
+               /**
+                * {@inheritDoc}
+                * 
+                * @see org.splat.wapp.ContextualMenu#isEnabled(java.lang.String)
+                */
                @Override
                public boolean isEnabled(final String name) {
                        boolean res = (_user != null);
@@ -636,17 +669,29 @@ public class ApplicationSettings {
                                        case attach:
                                                res = _user.canAttach();
                                                break;
+                                       case edit:
+                                               res = _user.canEdit();
+                                               break;
                                        case version:
                                                res = _user.canVersion();
                                                break;
                                        case replace:
                                                res = _user.canReplace();
                                                break;
+                                       case remove:
+                                               res = _user.canRemove();
+                                               break;
                                        case purge:
                                                res = _user.canPurge();
                                                break;
-                                       case remove:
-                                               res = _user.canRemove();
+                                       case undo:
+                                               res = _user.canInvalidate();
+                                               break;
+                                       case demote:
+                                               res = _user.canDemote();
+                                               break;
+                                       case approve:
+                                               res = _user.canApprove();
                                                break;
                                        default:
                                                res = false;
@@ -655,27 +700,71 @@ public class ApplicationSettings {
                        return res;
                }
 
+               /**
+                * {@inheritDoc}
+                * 
+                * @see org.splat.wapp.ContextualMenu#setContext(java.lang.String, java.lang.Object)
+                */
                @Override
                public void setContext(final String name, final Object context) {
                        if (context instanceof DocumentRights) {
                                _user = (DocumentRights) context; // Just for optimizing
                                Document downer = _user.getOperand();
-                               PopupItem item = this.item(MNU_REMOVE);
-                               if (downer.isVersioned()) {
-                                       item.rename(MNU_NAME_REMOVE);
-                               } else {
-                                       item.rename("menu.remove.document");
+                               if (this.hasItem(MNU_REMOVE)) {
+                                       if (downer.getPreviousVersion() == null) {
+                                               this.item(MNU_REMOVE).rename("menu.remove.document");
+                                       } else {
+                                               this.item(MNU_REMOVE).rename(MNU_NAME_REMOVE_VERSION);
+                                       }
                                }
                        }
                }
        }
 
        /**
-        * Popup of In-Draft documents.
+        * Popup of In-Work documents.
         */
-       private static class ReviewableDocumentPopup extends PopupMenu {
-               private transient DocumentRights _user = null;
+       private static class EditableDocumentPopup extends DocumentPopup {
+               /**
+                * Document popup menu constructor.
+                */
+               private EditableDocumentPopup() {
+                       super();
+                       /*
+                        * addItem("accept", new PopupItem("menu.accept").icon( "image.accept.png").action("setDocument?action=accept")
+                        * .confirmation("message.accept.document"));
+                        */
+                       addItem(MNU_PROMOTE, new PopupItem(MNU_NAME_PROMOTE).icon(
+                                       "image.publish.png").action("setDocument?action=promote")
+                                       .confirmation("message.promote.document"));
+                       addSeparator();
+                       addItem(MNU_RENAME, new PopupItem(MNU_NAME_RENAME)
+                                       .action("edit-document?action=renameDocument"));
+                       addItem(MNU_ATTACH, new PopupItem(MNU_NAME_ATTACH).icon(IMG_ATTACH)
+                                       .action(ACT_ATTACH));
+                       addSeparator();
+                       addItem(MNU_VERSION, new PopupItem(MNU_NAME_VERSION).icon(
+                                       IMG_VERSION).action(ACT_VERSION));
+                       addItem("replace", new PopupItem("menu.replace").icon(
+                                       "image.replace.png").action(
+                                       "select-file?nextAction=replace"));
+                       addSeparator();
+                       /*
+                        * 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_VERSION).icon(
+                                       IMG_DELETE).action("remove-document").confirmation(
+                                       "message.delete.document"));
+               }
+       }
 
+       /**
+        * Popup of In-Draft documents.
+        */
+       private static class ReviewableDocumentPopup extends DocumentPopup {
+               /**
+                * Document popup menu constructor.
+                */
                private ReviewableDocumentPopup() {
                        super();
                        addItem(MNU_DEMOTE, new PopupItem(MNU_NAME_DEMOTE).icon(
@@ -691,50 +780,19 @@ public class ApplicationSettings {
                        addItem(MNU_VERSION, new PopupItem(MNU_NAME_VERSION).icon(
                                        IMG_VERSION).action(ACT_VERSION));
                        addSeparator();
-                       addItem(MNU_PURGE, new PopupItem(MNU_NAME_PURGE).action(
-                                       ACT_NOT_YET_IMPLEMENTED).confirmation(
-                                       "message.purge.document"));
-               }
-
-               @Override
-               public boolean isEnabled(final String name) {
-                       boolean res = (_user != null);
-                       if (res) {
-                               Item item = Item.valueOf(name);
-                               switch (item) {
-                                       case demote:
-                                               res = _user.canDemote();
-                                               break;
-                                       case promote:
-                                               res = _user.canReview();
-                                               break;
-                                       case attach:
-                                               res = _user.canAttach();
-                                               break;
-                                       case version:
-                                               res = _user.canVersion();
-                                               break;
-                                       case purge:
-                                               res = _user.canPurge();
-                                               break;
-                                       default:
-                                               res = false;
-                               }
-                       }
-                       return res;
-               }
-
-               @Override
-               public void setContext(final String name, final Object context) {
-                       if (context instanceof DocumentRights) {
-                               _user = (DocumentRights) context; // Just for optimizing
-                       }
+                       /*
+                        * addItem(MNU_PURGE, new PopupItem(MNU_NAME_PURGE).action( ACT_NOT_YET_IMPLEMENTED).confirmation( "message.purge.document"));
+                        */
                }
        }
 
-       private static class NotResultDocumentPopup extends PopupMenu {
-               // private final DocumentRights _user = null;
-
+       /**
+        * Popup menu for documents which are not results of a step.
+        */
+       private static class NotResultDocumentPopup extends DocumentPopup {
+               /**
+                * Default constructor.
+                */
                private NotResultDocumentPopup() {
                        super();
                        addItem(MNU_DEMOTE, new PopupItem(MNU_NAME_DEMOTE).icon(
@@ -747,21 +805,22 @@ public class ApplicationSettings {
                        addItem(MNU_VERSION, new PopupItem(MNU_NAME_VERSION).icon(
                                        IMG_VERSION).action(ACT_VERSION));
                        addSeparator();
-                       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_PURGE, new PopupItem(MNU_NAME_PURGE).action( ACT_NOT_YET_IMPLEMENTED).confirmation( "message.purge.document"));
+                        */
+                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE_VERSION).icon(
+                                       IMG_DELETE).action("remove-document").confirmation(
+                                       "message.delete.document"));
                }
        }
 
        /**
         * Popup of In-Check documents.
         */
-       private static class ApprovableDocumentPopup extends PopupMenu {
-               private transient DocumentRights _user = null;
-
+       private static class ApprovableDocumentPopup extends DocumentPopup {
+               /**
+                * Default constructor.
+                */
                private ApprovableDocumentPopup() {
                        super();
                        addItem("undo", new PopupItem(MNU_NAME_DEMOTE).icon(
@@ -775,41 +834,15 @@ public class ApplicationSettings {
                                        "icon.APPROVED.png").action("setDocument?action=approve")
                                        .confirmation("message.approve.document"));
                }
-
-               @Override
-               public boolean isEnabled(final String name) {
-                       boolean res = (_user != null);
-                       if (res) {
-                               Item item = Item.valueOf(name);
-                               switch (item) {
-                                       case undo:
-                                               res = _user.canInvalidate();
-                                               break;
-                                       case demote:
-                                               res = _user.canDemote();
-                                               break;
-                                       case approve:
-                                               res = _user.canApprove();
-                                               break;
-                                       default:
-                                               res = false;
-                               }
-                       }
-                       return res;
-               }
-
-               @Override
-               public void setContext(final String name, final Object context) {
-                       if (context instanceof DocumentRights) {
-                               _user = (DocumentRights) context; // Just for optimizing
-                       }
-               }
        }
 
        /**
         * Popup of Approved documents.
         */
-       private static class ApprovedPopup extends PopupMenu {
+       private static class ApprovedPopup extends DocumentPopup {
+               /**
+                * Default constructor.
+                */
                private ApprovedPopup() {
                        super();
                        addItem(MNU_ATTACH, new PopupItem(MNU_NAME_ATTACH).icon(IMG_ATTACH)
@@ -821,11 +854,12 @@ public class ApplicationSettings {
        }
 
        /**
-        * Popup of Extern documents.
+        * Popup of external documents.
         */
-       private static class ExternPopup extends PopupMenu {
-               private transient DocumentRights _user = null;
-
+       private static class ExternPopup extends DocumentPopup {
+               /**
+                * Default constructor.
+                */
                private ExternPopup() {
                        super();
                        addItem(MNU_RENAME, new PopupItem(MNU_NAME_RENAME)
@@ -842,44 +876,20 @@ public class ApplicationSettings {
                                        IMG_DELETE).action("remove-document").confirmation(
                                        "message.delete.document"));
                }
-
-               @Override
-               public boolean isEnabled(final String name) {
-                       boolean res = (_user != null);
-                       if (res) {
-                               Item item = Item.valueOf(name);
-                               switch (item) {
-                                       case rename:
-                                               res = _user.canRename();
-                                               break;
-                                       case version:
-                                               res = _user.canVersion();
-                                               break;
-                                       case replace:
-                                               res = _user.canReplace();
-                                               break;
-                                       case remove:
-                                               res = _user.canRemove();
-                                               break;
-                                       default:
-                                               res = false;
-                               }
-                       }
-                       return res;
-               }
-
-               @Override
-               public void setContext(final String name, final Object context) {
-                       if (context instanceof DocumentRights) {
-                               _user = (DocumentRights) context; // Just for optimizing
-                       }
-               }
        }
 
-       // Resources relative to simulation contexts
+       /**
+        * Simulation context popup menu.
+        */
        private static class ScontextPopup extends PopupMenu {
+               /**
+                * Owner object.
+                */
                private SimulationContextFacade _owner = null; // RKV: NOPMD: TODO: Refine the usage of this field or remove it.
 
+               /**
+                * Default constructor.
+                */
                private ScontextPopup() {
                        super();
                        addItem(MNU_RENAME, new PopupItem(MNU_NAME_RENAME)
@@ -887,11 +897,16 @@ 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"));
                }
 
+               /**
+                * {@inheritDoc}
+                * 
+                * @see org.splat.wapp.ContextualMenu#isEnabled(java.lang.String)
+                */
                @Override
                public boolean isEnabled(final String name) {
                        Item item = Item.valueOf(name);
@@ -906,6 +921,11 @@ public class ApplicationSettings {
                        return res;
                }
 
+               /**
+                * {@inheritDoc}
+                * 
+                * @see org.splat.wapp.ContextualMenu#setContext(java.lang.String, java.lang.Object)
+                */
                @Override
                public void setContext(final String name, final Object context) {
                        if (context instanceof SimulationContextFacade) {
@@ -917,44 +937,47 @@ public class ApplicationSettings {
        }
 
        // Resources relative to knowledge
+       /**
+        * Knowledge element popup menu.
+        */
        private static class FeedbexPopup extends PopupMenu {
-               private transient KnowledgeElement _owner = null;
 
+               /**
+                * Popup menu owner object.
+                */
+               protected transient KnowledgeElement _owner = null;
+
+               /**
+                * Default constructor.
+                */
                private FeedbexPopup() {
                        super();
-                       addItem(MNU_PROMOTE, new PopupItem(MNU_NAME_PROMOTE).icon(
-                                       "image.review.png").action("promote-knowledge")
-                                       .confirmation("message.promote.knowledge"));
-                       addItem(MNU_DEMOTE, new PopupItem(MNU_NAME_DEMOTE).icon(
-                                       "image.invalidate.png").action("demote-knowledge")
-                                       .confirmation("message.demote.knowledge"));
-                       addSeparator();
                        addItem(MNU_RENAME, new PopupItem(MNU_NAME_RENAME)
                                        .action("edit-knowledge?action=renameKnowledge"));
                        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"));
                }
 
+               /**
+                * {@inheritDoc}
+                * 
+                * @see org.splat.wapp.ContextualMenu#isEnabled(java.lang.String)
+                */
                @Override
                public boolean isEnabled(final String name) {
-                       Item item = Item.valueOf(name);
                        boolean res = true;
-
-                       if (item == Item.promote) {
-                               if (_owner.getProgressState() != ProgressState.inDRAFT) {
-                                       res = false;
-                               }
-                       } else if ((item == Item.demote)
-                                       && (_owner.getProgressState() != ProgressState.inCHECK)) {
-                               res = false;
-                       }
                        return res;
                }
 
+               /**
+                * {@inheritDoc}
+                * 
+                * @see org.splat.wapp.ContextualMenu#setContext(java.lang.String, java.lang.Object)
+                */
                @Override
                public void setContext(final String name, final Object context) {
                        if (context instanceof KnowledgeElement) {
@@ -965,6 +988,64 @@ public class ApplicationSettings {
                }
        }
 
+       /**
+        * Pop-up menu for comments.
+        */
+       private static class CommentPopup extends PopupMenu {
+               /**
+                * Default constructor.
+                */
+               private CommentPopup() {
+                       super();
+                       addItem(MNU_EDIT, new PopupItem(MNU_NAME_EDIT).icon("icon.ed.png")
+                                       .action("editComment(entity_index)"));
+                       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
+                * @return true
+                */
+               @Override
+               public boolean isEnabled(final String name) {
+                       return true;
+               }
+       }
+
+       /**
+        * Pop-up menu for comments.
+        */
+       private static class DescritptionPopup extends PopupMenu {
+               /**
+                * Default constructor.
+                */
+               private DescritptionPopup() {
+                       super();
+                       addItem(MNU_EDIT, new PopupItem(MNU_NAME_EDIT).icon("icon.ed.png")
+                                       .action("showDescriptionEditor()"));
+                       addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(IMG_DELETE)
+                                       .action("removeDescription()").confirmation(
+                                                       "message.delete.description"));
+               }
+
+               /**
+                * Is enable.
+                * 
+                * @param name
+                *            the entry name
+                * @return true
+                */
+               @Override
+               public boolean isEnabled(final String name) {
+                       return true;
+               }
+       }
+
        // ==============================================================================================================================
        // Construction
        // ==============================================================================================================================
@@ -973,6 +1054,9 @@ public class ApplicationSettings {
        // Public member functions
        // ==============================================================================================================================
 
+       /**
+        * Initialize application menus.
+        */
        public void configure() {
                // Non customizable settings
                _menus.clear();
@@ -988,10 +1072,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());
@@ -1000,6 +1088,8 @@ public class ApplicationSettings {
                _popups.put("extern", new ExternPopup());
                _popups.put("scontext", new ScontextPopup());
                _popups.put("feedbex", new FeedbexPopup());
+               _popups.put("comment", new CommentPopup());
+               _popups.put("description", new DescritptionPopup());
 
                // Default customizable mandatory settings
                Map<String, Object> fprop = new HashMap<String, Object>();