]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Applet is working now and calls runSalome with appropriate parameters. New ant target...
authorrkv <rkv@opencascade.com>
Mon, 26 Nov 2012 08:48:05 +0000 (08:48 +0000)
committerrkv <rkv@opencascade.com>
Mon, 26 Nov 2012 08:48:05 +0000 (08:48 +0000)
13 files changed:
Workspace/Siman/WebContent/conf/my.xml
Workspace/Siman/WebContent/jap/psw.txt [new file with mode: 0644]
Workspace/Siman/WebContent/jap/signlauncher.bat [new file with mode: 0644]
Workspace/Siman/WebContent/jap/splat-launcher.jar
Workspace/Siman/WebContent/jap/splat-signedlauncher.jar
Workspace/Siman/WebContent/jsp/toolbar.jsp
Workspace/Siman/applet_howto.txt [new file with mode: 0644]
Workspace/Siman/build.xml
Workspace/Siman/src/hibernate.properties
Workspace/Siman/src/jdbc.properties
Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java
Workspace/Siman/src/org/splat/simer/AbstractOpenObject.java
Workspace/Siman/src/org/splat/simer/ApplicationSettings.java

index 38f8d2cf1e37c999e30f265102ecf810977a7db6..8becf051ffb329a555bf9d8168a1adeef9b15d20 100644 (file)
@@ -6,8 +6,8 @@
         <mapping extension="doc"    executable="winword.exe"/>
         <mapping extension="docx"   executable="winword.exe"/>
         <mapping extension="xml"    executable="winword.exe"/>
-        <mapping extension="part"   executable="../sgeom/index.jsp"/>
-        <mapping extension="med"    executable="../smesh/index.jsp"/>
+        <mapping extension="part"   executable="runSalome"/>
+        <mapping extension="med"    executable="runSalome"/>
     </modules>
 
     <viewers extension="pdf,brep" />
diff --git a/Workspace/Siman/WebContent/jap/psw.txt b/Workspace/Siman/WebContent/jap/psw.txt
new file mode 100644 (file)
index 0000000..89f76d0
--- /dev/null
@@ -0,0 +1 @@
+launcher
\ No newline at end of file
diff --git a/Workspace/Siman/WebContent/jap/signlauncher.bat b/Workspace/Siman/WebContent/jap/signlauncher.bat
new file mode 100644 (file)
index 0000000..bdb1f75
--- /dev/null
@@ -0,0 +1,5 @@
+set path=%path%;"C:\Program Files\Java\jdk1.6.0_20\bin"
+
+delete splat-signedlauncher.jar
+
+jarsigner -verbose -keystore launcherkeystore -signedjar splat-signedlauncher.jar splat-launcher.jar launcheralias <psw.txt
index 84a57b49c8884a0e07b3ac2df1923958347e2876..cf88bdd6c612cddc9e62f01155678c1207007d6d 100644 (file)
Binary files a/Workspace/Siman/WebContent/jap/splat-launcher.jar and b/Workspace/Siman/WebContent/jap/splat-launcher.jar differ
index 13bf335861e43d53906a216b5b8b193635df8ac2..34958b2382b72648cd9fbcbac15e7b46dc217c30 100644 (file)
Binary files a/Workspace/Siman/WebContent/jap/splat-signedlauncher.jar and b/Workspace/Siman/WebContent/jap/splat-signedlauncher.jar differ
index 00c9795d2057fec4e4d540eb8ee9deec1cf312d5..aa9972ed827f7e7e56abbab44e17b4d03f8b5cb1 100644 (file)
@@ -3,9 +3,11 @@
 %>
 <%@ page import="org.splat.som.StepRights"%>
 <%@ page import="org.splat.simer.OpenStudy"%>
+<%@ page import="org.splat.simer.Action"%>
 <%@ page import="org.splat.wapp.ToolBar"%>
 <%@ page import="org.splat.wapp.ToolButton"%>
 <%@ page import="java.util.Iterator"%>
+<%@page import="com.opensymphony.xwork2.ActionContext"%>
 <%@
     taglib prefix="s" uri="/struts-tags"
 %>
       <img src="<s:url value="/skin/image.vseparator.png"/>" border="none" />
 <%    OpenStudy    study = (OpenStudy)session.getAttribute("study.open");
          ToolBar  mbar = study.getModuleBar();
+      Action anAction = (Action)ActionContext.getContext().getActionInvocation().getAction();
+
       if (study.getSelectedStepRights().canCreateDocument() && mbar != null) {
 %>
-      <applet name="perform" id="perform" code="org.splat.launcher.ToolbarApplet.class" archive="../jap/splat-signedlauncher.jar" width=<%=mbar.getWidth()%> height=<%=mbar.getHeight()%>>
+      <applet name="perform" id="perform" code="org.splat.launcher.ToolbarApplet.class" archive="../jap/splat-signedlauncher.jar"
+            width=<%=mbar.getWidth()%> height=<%=mbar.getHeight()%>>
 <%      Iterator<ToolButton> item = mbar.asList().iterator();
         for (int i=0; item.hasNext(); i++) {
-               ToolButton tool = item.next();
+            ToolButton tool = item.next();
           String     arg  = tool.getArgument();
 %>        <param name="icon<%=i%>" value="<%=tool.getIcon()%>" />
           <param name="tool<%=i%>" value="<%=tool.getAction()%>" />
-<%        if (arg != null) {
+<%
+                       if ("runSalome".equals(tool.getAction())) {
+                           // --siman --siman-study=s --siman-scenario=sc --siman-user=u -k
+                           arg = "--siman --siman-study=" + study.getIndex() 
+                                    + " --siman-scenario=" + study.getSelectedScenarioId()
+                                    + " --siman-user=" + anAction.getConnectedUser().getUsername()
+                                    + " -k";
+                       }
+                       if (arg != null) {
 %>        <param name="file<%=i%>" value="<%=arg%>" />
-<%        }
+<%          }
         }
 %>    </applet>
 <%    }
-%>  </td>
+%>
+
+
+
+  </td>
     <td width=30 align=right>
       <s:a href="%{#idea}"><img src="<s:url value="/skin/icon.idea.png"/>" border="none" title="<s:text name="tooltip.search"/>" /></s:a>
     </td>
diff --git a/Workspace/Siman/applet_howto.txt b/Workspace/Siman/applet_howto.txt
new file mode 100644 (file)
index 0000000..0c0a694
--- /dev/null
@@ -0,0 +1,90 @@
+set path=%path%;C:\Program Files\Java\jdk1.6.0_03\bin
+
+
+D:\users\rkv\SIMAN\SIMAN_SRC\Workspace\Siman\build\classes>
+set path=%path%;"C:\Program Files\Java\jdk1.6.0_20\bin"
+
+C:\work\Siman\SIMAN_SRC\Workspace\Siman\build\classes>
+jar cvf splat-launcher.jar org\splat\launcher\*.class
+
+
+cd ..\..\WebContent\jap
+
+jarsigner -verbose -keystore launcherkeystore -signedjar splat-signedlauncher.jar splat-launcher.jar launcheralias
+
+
+
+For creation the applet please use the following java methods :
+
+ //To get the SALOME_HOME environment variable
+     String SALOME_HOME = System.getenv("SALOME_ROOT_DIR");
+
+ If SALOME_ROOT_DIR does not exist the SALOME_HOME equals to _null_.
+
+ //To execute the RunSalome script
+     Runtime runtime = Runtime.getRuntime();
+     String pathToScript = SALOME_HOME+"\\runSalome" or pathToScript = SALOME_HOME+"runSalome"
+
+     if (new File(pathToScript).exists()) {
+         Process process = runtime.exec(pathToScript);
+     }
+     
+     
+     
+    <applet name="perform" id="perform" code="org.splat.launcher.ToolbarApplet.class" archive="../jap/splat-signedlauncher.jar" width=54 height=24>
+        <param name="icon0" value="tool.winword.png" />
+          <param name="tool0" value="winword.exe" />
+        <param name="icon1" value="tool.sgeom.png" />
+          <param name="tool1" value="../sgeom/index.jsp" />
+    </applet>
+
+
+Dear Colleagues,
+
+  
+
+ Some more details about current procedure of SALOME running
+
+ It probably will be updated in accordance with changes of SALOME directories
+ organizarion
+
+  
+
+ To check availability of SALOME environment, the applet should :
+
+ - check existence of environment variable $SALOME_ROOT_DIR
+
+ - check existence of environment file $SALOME_ROOT_DIR/env_build.sh
+
+ - existence of run bash script $SALOME_ROOT_DIR/KERNEL/bin/salome/runSalome
+
+  
+
+ To run SALOME-SIMAN :
+
+ - open bash shell 
+
+ bash
+
+ - export SALOME environment variables  
+
+ . $SALOME_ROOT_DIR/env_build.sh
+
+ - run bash shell script 
+
+ runSalome --siman --siman-study=s --siman-scenario=sc --siman-user=u -k
+  
+
+ where :
+
+ the SIMAN parameters are displayed as Title of the SALOME GUI Window 
+
+ "-k" is to kill previously run runSalome and all SALOME processes
+
+  
+
+ --
+
+ Best Regards,
+
+ Alexander
\ No newline at end of file
index 1c355957f2b3959f10784b3329979412ee88a380..0cb3a8c7415e6012b3b1cf7e60997091164b7922 100644 (file)
                <format property="time" pattern="${time.pattern}" />
        </tstamp>
 
-       <!-- ================================================= -->
-       <!--    siman-common: Build Siman-Common project           -->
-       <!-- ================================================= -->
-       <target name="siman-common" description="Builds Siman-Common project">
-               <ant dir="../${siman-common.project.name}" />
-       </target>
+    <!-- ================================================= -->
+    <!--    launcher: Build launcher jar                   -->
+    <!-- ================================================= -->
+    <target name="launcher" description="Builds launcher jar">
+       <delete file="${siman.content.dir}/jap/splat-launcher.jar"/>
+        <jar destfile="${siman.content.dir}/jap/splat-launcher.jar">
+            <zipfileset dir="${siman.bin.dir}/classes">
+                <include name="org/splat/launcher/**" />
+            </zipfileset>
+            <manifest>
+                <attribute name="Built-By" value="${app.author}" />
+                <attribute name="Version" value="${app.version}" />
+                <attribute name="Built-Date" value="${timesimple}" />
+            </manifest>
+        </jar>
+    </target>
+
+    <!-- ================================================= -->
+    <!--    siman-common: Build Siman-Common project       -->
+    <!-- ================================================= -->
+    <target name="siman-common" description="Builds Siman-Common project">
+        <ant dir="../${siman-common.project.name}" />
+    </target>
 
        <!-- ================================================= -->
        <!--    copy-config: Copy parametrized config files        -->
index 6c0cad67e0a072118c2870c21a1fc041c1efd055..326140a023d883a1c1e6f9340e7c2389b7feb754 100644 (file)
@@ -1,4 +1,4 @@
-# Generated at 02/11/2012 05:50:20
+# Generated at 26/11/2012 09:23:45
 # Don't edit manually. See the source in D:\users\rkv\SIMAN\SIMAN_SRC\Workspace\Siman\conf\templates.
 # Connection properties
 connection.driver_class=com.mysql.jdbc.Driver
index 8404e7d1e93b237f3b7a87ca01126d42a83304bb..62a0c8bc4300f710d39f3c5eb7521a5e16fb904b 100644 (file)
@@ -1,4 +1,4 @@
-# Generated at 02/11/2012 05:50:20
+# Generated at 26/11/2012 09:23:45
 # Don't edit manually. See the source in D:\users\rkv\SIMAN\SIMAN_SRC\Workspace\Siman\conf\templates.
 # Connection properties
 connection.url=jdbc:mysql://localhost/simer
index c5bc1768e13511403cb1d65fe9ecb5901cc64561..183b0fe5f672e31209197b885ebdce9b1f98c382 100644 (file)
@@ -4,18 +4,37 @@ import java.awt.ComponentOrientation;
 import java.awt.GridLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.ObjectInputStream;
 import java.net.URL;
 import java.net.URLConnection;
 
+/**
+ * Applet providing a set of buttons. Each button is defined by three parameters:<BR>
+ * <ul>
+ * <li><i>icon&lt;i&gt;</i></li>
+ * <li><i>tool&lt;i&gt;</i></li>
+ * <li><i>file&lt;i&gt;</i></li> - may be null
+ * </ul>
+ * where i is an index beginning from zero.
+ */
 public class ToolbarApplet extends java.applet.Applet implements ActionListener {
 
+       /**
+        * Serialization version id.
+        */
        private static final long serialVersionUID = 3243053622061086715L;
 
        // ==============================================================================================================================
        // Overridden functions
        // ==============================================================================================================================
 
+       /**
+        * {@inheritDoc}
+        * 
+        * @see java.applet.Applet#init()
+        */
        @Override
        public void init() {
                URL appurl = getCodeBase();
@@ -39,8 +58,12 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener
                applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        }
 
+       /**
+        * {@inheritDoc}
+        * 
+        * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+        */
        public void actionPerformed(final ActionEvent event) {
-               // -----------------------------------------------
                if (event.getSource() instanceof ToolButton) {
                        ToolButton clicked = (ToolButton) event.getSource();
                        String module = clicked.getTool();
@@ -53,8 +76,15 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener
        // Public member functions
        // ==============================================================================================================================
 
+       /**
+        * Launch an appropriate application for the given file.
+        * 
+        * @param name
+        *            module name
+        * @param filename
+        *            file name
+        */
        public void launch(final String name, final String filename) {
-               // -------------------------------------------------
                String module = name;
                try {
 
@@ -73,6 +103,53 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener
                        } else
 
                        // Opening an application on the local machine
+
+                       if (module.equals("runSalome")) {
+                               // Run SALOME
+                               // To get the SALOME_HOME environment variable
+                               String SALOME_HOME = System.getenv("SALOME_ROOT_DIR");
+                               // If SALOME_ROOT_DIR does not exist the SALOME_HOME equals to null.
+                               if (SALOME_HOME == null) {
+                                       // TODO: Use logger to be more user friendly
+                                       getAppletContext()
+                                                       .showDocument(
+                                                                       new URL(
+                                                                                       getCodeBase().toString()
+                                                                                                       + "error.jsp?message=launch&value="
+                                                                                                       + "SALOME_ROOT_DIR environment variable is not defined."),
+                                                                       "_blank");
+                                       throw new Exception(
+                                                       "SALOME_ROOT_DIR nevironment variable is not defined.");
+                               } else if (!SALOME_HOME.endsWith(File.separator)) {
+                                       SALOME_HOME += File.separator;
+                               }
+                               String pathToScript = SALOME_HOME + "runSalome";
+
+                               File script = new File(pathToScript);
+                               if (!script.exists()) {
+                                       script = new File(pathToScript + ".bat");
+                                       if (!script.exists()) {
+                                               script = new File(pathToScript + ".cmd");
+                                       }
+                               }
+                               
+                               if (script.exists()) {
+                                       // Execute the runSalome script.
+                                       // filename here indeed a string containing parameters for runSalome.
+                                       Runtime.getRuntime().exec(
+                                                       new String[] { script.getAbsolutePath(), filename });
+                               } else {
+                                       // TODO: Use logger to be more user friendly
+                                       getAppletContext().showDocument(
+                                                       new URL(getCodeBase().toString()
+                                                                       + "error.jsp?message=launch&value="
+                                                                       + "SALOME module is not found: "
+                                                                       + script.getAbsolutePath()), "_blank");
+                                       throw new FileNotFoundException(
+                                                       "SALOME module is not found: " + script.getAbsolutePath());
+                               }
+                       } else
+
                        if (module.endsWith(".exe") || module.endsWith(".EXE")) {
                                String applikey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Applications\\"
                                                + module;
index a83ba4c25ba67085fad8c7cc6344895b69dfe37e..43a0391a415867d8af2be20d4a3d10df25b7fe31 100644 (file)
@@ -216,6 +216,16 @@ public abstract class AbstractOpenObject implements Proxy {
                return _selection;
        }
 
+       public String getSelectedScenarioId() {
+               String res;
+               if (_selection == null) {
+                       res = "0";
+               } else {
+                       res = _selection.substring(0, _selection.indexOf('.'));
+               }
+               return res;
+       }
+
        public User getUser() {
                return _cuser;
        }
index 9309647d848b3ac104acdb74b7b0b426056c1a48..0c30875b87885e8fe5be5ecc75d03679a054666c 100644 (file)
@@ -257,12 +257,12 @@ public class ApplicationSettings implements ServletContextAware {
                        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-instance", new MenuItem("menu.new.instance")
-                                       .icon(IMG_HOLD));
-                       addItem("new-import", new MenuItem("menu.new.import")
-                                       .icon("icon.upload.png"));
+                       addItem("new-copy",
+                                       new MenuItem("menu.new.copy").icon("image.copy.png"));
+                       addItem("new-instance",
+                                       new MenuItem("menu.new.instance").icon(IMG_HOLD));
+                       addItem("new-import",
+                                       new MenuItem("menu.new.import").icon("icon.upload.png"));
                        this.selects("new-empty");
                }
        }
@@ -274,8 +274,8 @@ public class ApplicationSettings implements ServletContextAware {
                                        "select?menu=search&item=search-study");
                        addItem("search-knowledge", "menu.search.idea", "image.idea.png",
                                        "select?menu=search&item=search-knowledge");
-                       addItem("search-document", new MenuItem("menu.search.document")
-                                       .icon("icon.any.png"));
+                       addItem("search-document",
+                                       new MenuItem("menu.search.document").icon("icon.any.png"));
                        this.selects("search-study");
                }
        }
@@ -303,8 +303,8 @@ public class ApplicationSettings implements ServletContextAware {
                                        "select?menu=datadmin&item=admin-scontext");
                        addItem("admin-knowelm", "menu.admin.knowledge", "image.idea.png",
                                        "select?menu=datadmin&item=admin-knowelm");
-                       addItem("admin-study", new MenuItem("menu.admin.study")
-                                       .icon("image.study.png"));
+                       addItem("admin-study",
+                                       new MenuItem("menu.admin.study").icon("image.study.png"));
                }
        }
 
@@ -329,26 +329,31 @@ public class ApplicationSettings implements ServletContextAware {
 
                private EditableStudyPopup() {
                        super();
-                       addItem(MNU_PUBLISH, new PopupItem(MNU_NAME_PUBLISH).icon(
-                                       "image.publish.png").action("edit-study?action=publish")
-                                       .confirmation("message.publish.study"));
+                       addItem(MNU_PUBLISH,
+                                       new PopupItem(MNU_NAME_PUBLISH).icon("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"));
+                       addItem(MNU_EDIT,
+                                       new PopupItem("menu.properties").icon("icon.ed.png")
+                                                       .action("../select?menu=properties"));
                        addSeparator();
-                       addItem(MNU_SCRIPT, new PopupItem(MNU_NAME_SCRIPT)
-                                       .action("add-scenario"));
-                       addItem(MNU_VERSION, new PopupItem(MNU_NAME_VERSION).icon(
-                                       IMG_VERSION).action(ACT_NOT_YET_IMPLEMENTED));
+                       addItem(MNU_SCRIPT,
+                                       new PopupItem(MNU_NAME_SCRIPT).action("add-scenario"));
+                       addItem(MNU_VERSION,
+                                       new PopupItem(MNU_NAME_VERSION).icon(IMG_VERSION).action(
+                                                       ACT_NOT_YET_IMPLEMENTED));
                        addSeparator();
-                       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(
-                                                       "message.delete.study"));
+                       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("message.delete.study"));
                }
 
                @Override
@@ -406,30 +411,36 @@ public class ApplicationSettings implements ServletContextAware {
 
                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"));
+                       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_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"));
+                       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"));
+                       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"));
                }
 
                @Override
@@ -492,22 +503,26 @@ public class ApplicationSettings implements ServletContextAware {
 
                private ReviewableDocumentPopup() {
                        super();
-                       addItem(MNU_DEMOTE, new PopupItem(MNU_NAME_DEMOTE).icon(
-                                       "image.demote.png").action("setDocument?action=demote")
-                                       .confirmation("message.demote.document"));
-                       addItem(MNU_PROMOTE, new PopupItem("menu.review").icon(
-                                       "image.review.png").action("setDocument?action=review")
-                                       .confirmation("message.review.document"));
+                       addItem(MNU_DEMOTE,
+                                       new PopupItem(MNU_NAME_DEMOTE).icon("image.demote.png")
+                                                       .action("setDocument?action=demote")
+                                                       .confirmation("message.demote.document"));
+                       addItem(MNU_PROMOTE,
+                                       new PopupItem("menu.review").icon("image.review.png")
+                                                       .action("setDocument?action=review")
+                                                       .confirmation("message.review.document"));
                        addSeparator();
                        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(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_PURGE,
+                                       new PopupItem(MNU_NAME_PURGE).action(
+                                                       ACT_NOT_YET_IMPLEMENTED).confirmation(
+                                                       "message.purge.document"));
                }
 
                @Override
@@ -551,22 +566,26 @@ public class ApplicationSettings implements ServletContextAware {
 
                private NotResultDocumentPopup() {
                        super();
-                       addItem(MNU_DEMOTE, new PopupItem(MNU_NAME_DEMOTE).icon(
-                                       "image.demote.png").action("setDocument?action=demote")
-                                       .confirmation("message.demote.document"));
+                       addItem(MNU_DEMOTE,
+                                       new PopupItem(MNU_NAME_DEMOTE).icon("image.demote.png")
+                                                       .action("setDocument?action=demote")
+                                                       .confirmation("message.demote.document"));
                        addSeparator();
                        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(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).icon(IMG_DELETE)
+                                                       .action("remove-document")
+                                                       .confirmation("message.delete.document"));
                }
        }
 
@@ -578,16 +597,18 @@ public class ApplicationSettings implements ServletContextAware {
 
                private ApprovableDocumentPopup() {
                        super();
-                       addItem("undo", new PopupItem(MNU_NAME_DEMOTE).icon(
-                                       "image.invalidate.png").action(
-                                       "setDocument?action=invalidate").confirmation(
-                                       "message.demote.document"));
-                       addItem(MNU_DEMOTE, new PopupItem("menu.disapprove").icon(
-                                       "image.demote.png").action("setDocument?action=disapprove")
-                                       .confirmation("message.disapprove.document"));
-                       addItem("approve", new PopupItem("menu.approve").icon(
-                                       "icon.APPROVED.png").action("setDocument?action=approve")
-                                       .confirmation("message.approve.document"));
+                       addItem("undo",
+                                       new PopupItem(MNU_NAME_DEMOTE).icon("image.invalidate.png")
+                                                       .action("setDocument?action=invalidate")
+                                                       .confirmation("message.demote.document"));
+                       addItem(MNU_DEMOTE,
+                                       new PopupItem("menu.disapprove").icon("image.demote.png")
+                                                       .action("setDocument?action=disapprove")
+                                                       .confirmation("message.disapprove.document"));
+                       addItem("approve",
+                                       new PopupItem("menu.approve").icon("icon.APPROVED.png")
+                                                       .action("setDocument?action=approve")
+                                                       .confirmation("message.approve.document"));
                }
 
                @Override
@@ -629,8 +650,9 @@ public class ApplicationSettings implements ServletContextAware {
                        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(MNU_VERSION,
+                                       new PopupItem(MNU_NAME_VERSION).icon(IMG_VERSION).action(
+                                                       ACT_VERSION));
                }
        }
 
@@ -642,15 +664,17 @@ public class ApplicationSettings implements ServletContextAware {
 
                private ExternPopup() {
                        super();
-                       addItem(MNU_RENAME, new PopupItem(MNU_NAME_RENAME)
-                                       .action("edit-document?action=renameDocument"));
-                       addItem("replace", new PopupItem("menu.replace").icon(
-                                       "image.replace.png").action(
-                                       "select-file?nextAction=replace"));
+                       addItem(MNU_RENAME,
+                                       new PopupItem(MNU_NAME_RENAME)
+                                                       .action("edit-document?action=renameDocument"));
+                       addItem("replace",
+                                       new PopupItem("menu.replace").icon("image.replace.png")
+                                                       .action("select-file?nextAction=replace"));
                        addSeparator();
-                       addItem(MNU_REMOVE, new PopupItem("menu.remove.document").icon(
-                                       IMG_DELETE).action("remove-document").confirmation(
-                                       "message.delete.document"));
+                       addItem(MNU_REMOVE,
+                                       new PopupItem("menu.remove.document").icon(IMG_DELETE)
+                                                       .action("remove-document")
+                                                       .confirmation("message.delete.document"));
                }
 
                @Override
@@ -689,14 +713,17 @@ public class ApplicationSettings implements ServletContextAware {
 
                private ScontextPopup() {
                        super();
-                       addItem(MNU_RENAME, new PopupItem(MNU_NAME_RENAME)
-                                       .action("edit-context?action=renameContext"));
-                       addItem(MNU_EDIT, new PopupItem(MNU_NAME_EDIT)
-                                       .action("edit-context?action=editContext"));
+                       addItem(MNU_RENAME,
+                                       new PopupItem(MNU_NAME_RENAME)
+                                                       .action("edit-context?action=renameContext"));
+                       addItem(MNU_EDIT,
+                                       new PopupItem(MNU_NAME_EDIT)
+                                                       .action("edit-context?action=editContext"));
                        addSeparator();
-                       addItem(MNU_REMOVE, new PopupItem("menu.remove").icon(IMG_DELETE)
-                                       .action("remove-context").confirmation(
-                                                       "message.delete.context"));
+                       addItem(MNU_REMOVE,
+                                       new PopupItem("menu.remove").icon(IMG_DELETE)
+                                                       .action("remove-context")
+                                                       .confirmation("message.delete.context"));
                }
 
                @Override
@@ -729,21 +756,26 @@ public class ApplicationSettings implements ServletContextAware {
 
                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"));
+                       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"));
+                       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)
-                                       .action("remove-knowledge").confirmation(
-                                                       "message.delete.knowledge"));
+                       addItem(MNU_REMOVE,
+                                       new PopupItem("menu.remove").icon(IMG_DELETE)
+                                                       .action("remove-knowledge")
+                                                       .confirmation("message.delete.knowledge"));
                }
 
                @Override
@@ -895,8 +927,7 @@ public class ApplicationSettings implements ServletContextAware {
 
                        ToolBar bar = new ToolBar(24); // Height of the module-bar
                        Set<String> module = new HashSet<String>(); // For not duplicating modules
-                       for (Iterator<String> j = formats.iterator(); j.hasNext();) {
-                               String format = j.next();
+                       for (String format : formats) {
                                String command = getApplicationProperty("executable." + format);
                                if (command == null) {
                                        continue; // Module not installed
@@ -922,9 +953,8 @@ public class ApplicationSettings implements ServletContextAware {
                                        } else {
                                                icon = "tool." + icon.toLowerCase() + ".png";
                                        }
-                                       File image = new File(ApplicationSettings
-                                                       .getApplicationSkinPath()
-                                                       + icon);
+                                       File image = new File(
+                                                       ApplicationSettings.getApplicationSkinPath() + icon);
                                        if (!image.exists()) {
                                                icon = "tool.any.png";
                                        }
@@ -932,9 +962,8 @@ public class ApplicationSettings implements ServletContextAware {
                                } else {
                                        docname = "/jsp/newDocument.jsp?type=" + docname;
                                        String icon = "tool." + name[0].toLowerCase() + ".png";
-                                       File image = new File(ApplicationSettings
-                                                       .getApplicationSkinPath()
-                                                       + icon);
+                                       File image = new File(
+                                                       ApplicationSettings.getApplicationSkinPath() + icon);
                                        if (!image.exists()) {
                                                icon = "tool.any.png";
                                        }
@@ -957,8 +986,8 @@ public class ApplicationSettings implements ServletContextAware {
        }
 
        public String getApplicationURL() {
-               StringBuffer url = new StringBuffer("http://").append(
-                               MY_APP._wappserver).append("/").append(_wappname);
+               StringBuffer url = new StringBuffer("http://")
+                               .append(MY_APP._wappserver).append("/").append(_wappname);
                return url.toString();
        }
 
@@ -1002,9 +1031,9 @@ public class ApplicationSettings implements ServletContextAware {
        }
 
        public static String getDownloadURL(final User user) {
-               StringBuffer url = new StringBuffer("http://").append(
-                               MY_APP._wappserver).append("/download/").append(
-                               user.getUsername()).append("/");
+               StringBuffer url = new StringBuffer("http://")
+                               .append(MY_APP._wappserver).append("/download/")
+                               .append(user.getUsername()).append("/");
                return url.toString(); // The download Tomcat context is supposed being defined
        }