]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Scenario view is refreshed now after check in. Labels of activities are fixed.
authorrkv <rkv@opencascade.com>
Mon, 3 Dec 2012 11:44:26 +0000 (11:44 +0000)
committerrkv <rkv@opencascade.com>
Mon, 3 Dec 2012 11:44:26 +0000 (11:44 +0000)
Workspace/Siman-Common/src/org/splat/service/ScenarioService.java
Workspace/Siman-Common/src/org/splat/service/ScenarioServiceImpl.java
Workspace/Siman/.externalToolBuilders/Ant_Siman_War_Builder.launch
Workspace/Siman/WebContent/jap/splat-launcher.jar
Workspace/Siman/WebContent/jap/splat-signedlauncher.jar
Workspace/Siman/WebContent/jsp/toolbar.jsp
Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java
Workspace/Siman/src/org/splat/simer/EditScenarioPropertiesAction.java
Workspace/Siman/src/org/splat/wapp/ContextualMenu.java
Workspace/Siman/src/som.properties
Workspace/Siman/src/som_en.properties

index 9087b190ebbc57ce4489185f81ed603023f3dada..eb15f8632454a42e67fade04b2d08ebfd199a679 100644 (file)
@@ -138,10 +138,12 @@ public interface ScenarioService {
        /**
         * Check in the scenario.
         * 
-        * @param aScenario
-        *            the scenario to check in
+        * @param scenarioId
+        *            the id of the scenario to check in
+        * @throws InvalidPropertyException
+        *             if the scenario is not found in the database
         */
-       void checkin(Scenario aScenario);
+       public void checkin(final long scenarioId) throws InvalidPropertyException;
 
        /**
         * Check out the scenario.
@@ -168,7 +170,7 @@ public interface ScenarioService {
         */
        public void checkout(final long scenarioId, final String username)
                        throws InvalidPropertyException, NotApplicableException;
-       
+
        /**
         * Copy contents from other scenario up to its given step into the given scenario.
         * 
index 98949f13770e2d751b7ec81c53ef0a2023fa0752..f66ef9a17e1f938899a95afffd4e59e43172f26c 100644 (file)
@@ -357,9 +357,8 @@ public class ScenarioServiceImpl implements ScenarioService {
                                                + " is added to the scenario #" + aScenario.getIndex());
                        }
                } catch (IOException error) {
-                       LOG.error(
-                                       "Unable to index the knowedge element '" + kelm.getIndex()
-                                                       + "', reason:", error);
+                       LOG.error("Unable to index the knowedge element '"
+                                       + kelm.getIndex() + "', reason:", error);
                        kelm = null;
                }
 
@@ -380,9 +379,8 @@ public class ScenarioServiceImpl implements ScenarioService {
                        getScenarioDAO().update(aScenario); // Update of relational base
                        isOk = true;
                } catch (Exception error) {
-                       LOG.error(
-                                       "Unable to re-index the knowledge element '"
-                                                       + aScenario.getIndex() + "', reason:", error);
+                       LOG.error("Unable to re-index the knowledge element '"
+                                       + aScenario.getIndex() + "', reason:", error);
                }
                return isOk;
        }
@@ -584,8 +582,8 @@ public class ScenarioServiceImpl implements ScenarioService {
                                                        MessageKeyEnum.SCN_000002.toString(), doc.getId());
                                }
                                if (pub.value() == null) {
-                                       throw new MismatchException(
-                                                       MessageKeyEnum.SCN_000002.toString(), doc.getId());
+                                       throw new MismatchException(MessageKeyEnum.SCN_000002
+                                                       .toString(), doc.getId());
                                }
                                newPub = getStepService().versionDocument(step, pub, dprop);
                                // Remeber the link from the old document to the new document version
@@ -612,8 +610,8 @@ public class ScenarioServiceImpl implements ScenarioService {
                                }
                                docname += "_" + i; // The generated new document title
 
-                               dprop.setDescription("Checked in").setName(docname)
-                                               .setFormat(fileFormat);
+                               dprop.setDescription("Checked in").setName(docname).setFormat(
+                                               fileFormat);
                                newPub = getStepService().createDocument(step, dprop);
 
                                // Remeber the new document
@@ -628,8 +626,8 @@ public class ScenarioServiceImpl implements ScenarioService {
                        }
                        if (updir.exists()) {
                                if (updir.delete()) {
-                                       LOG.info(MessageKeyEnum.SCN_000003.toString(),
-                                                       updir.getAbsoluteFile(), step.getOwner().getIndex());
+                                       LOG.info(MessageKeyEnum.SCN_000003.toString(), updir
+                                                       .getAbsoluteFile(), step.getOwner().getIndex());
                                } else {
                                        throw new IOException(
                                                        "Can't delete the existing destination file to move file from "
@@ -671,8 +669,8 @@ public class ScenarioServiceImpl implements ScenarioService {
                } while ((step == null) && (i < steps.length));
 
                if (step == null) {
-                       throw new InvalidPropertyException(
-                                       MessageKeyEnum.SCN_000001.toString(), stepDTO.getNumber());
+                       throw new InvalidPropertyException(MessageKeyEnum.SCN_000001
+                                       .toString(), stepDTO.getNumber());
                }
                return step;
        }
@@ -680,12 +678,29 @@ public class ScenarioServiceImpl implements ScenarioService {
        /**
         * {@inheritDoc}
         * 
-        * @see org.splat.service.ScenarioService#checkin(org.splat.dal.bo.som.Scenario)
+        * @see org.splat.service.ScenarioService#checkin(long)
+        */
+       @Transactional
+       public void checkin(final long scenarioId) throws InvalidPropertyException {
+               Scenario aScenario = getScenarioDAO().get(scenarioId);
+               if (aScenario == null) {
+                       // Scenario not found
+                       throw new InvalidPropertyException(MessageKeyEnum.SCN_000006
+                                       .toString(), scenarioId);
+               }
+               checkin(aScenario);
+       }
+
+       /**
+        * Mark the scenario as checked in.
+        * 
+        * @param aScenario
+        *            the scenario to check in.
         */
-       public void checkin(final Scenario aScenario) {
+       private void checkin(final Scenario aScenario) {
                aScenario.setUser(null);
                aScenario.setLastModificationDate(Calendar.getInstance().getTime());
-               getScenarioDAO().update(aScenario);
+               // getScenarioDAO().update(aScenario);
        }
 
        /**
@@ -722,30 +737,30 @@ public class ScenarioServiceImpl implements ScenarioService {
                User aUser = getUserService().selectUser(username);
                if (aUser == null) {
                        // User not found
-                       throw new InvalidPropertyException(
-                                       MessageKeyEnum.USR_000001.toString(), username);
+                       throw new InvalidPropertyException(MessageKeyEnum.USR_000001
+                                       .toString(), username);
                }
                Scenario aScenario = getScenarioDAO().get(scenarioId);
                if (aScenario == null) {
                        // Scenario not found
-                       throw new InvalidPropertyException(
-                                       MessageKeyEnum.SCN_000006.toString(), scenarioId);
+                       throw new InvalidPropertyException(MessageKeyEnum.SCN_000006
+                                       .toString(), scenarioId);
                }
                boolean res = getStudyService().isStaffedBy(aScenario.getOwnerStudy(),
                                aUser);
                if (res) {
                        if (aScenario.isCheckedout()
                                        && (!aScenario.getUser().getUsername().equals(username))) {
-                               throw new NotApplicableException(
-                                               MessageKeyEnum.SCN_000008.toString(), scenarioId,
-                                               aScenario.getUser().getUsername());
+                               throw new NotApplicableException(MessageKeyEnum.SCN_000008
+                                               .toString(), scenarioId, aScenario.getUser()
+                                               .getUsername());
                        }
                        aScenario.setUser(aUser);
                        aScenario.setLastModificationDate(Calendar.getInstance().getTime());
                } else {
                        // User doesn't participate in the scenario
-                       throw new NotApplicableException(
-                                       MessageKeyEnum.SCN_000007.toString(), username, scenarioId);
+                       throw new NotApplicableException(MessageKeyEnum.SCN_000007
+                                       .toString(), username, scenarioId);
                }
        }
 
@@ -855,8 +870,8 @@ public class ScenarioServiceImpl implements ScenarioService {
                User admin = getUserDAO().getFilteredList(
                                Restrictions.eq("role", adminRole), Order.asc("rid")).get(0); // First sysadmin in the database
 
-               kprop.setType(ucase).setTitle(aStudy.getTitle())
-                               .setValue(scenario.getTitle()).setAuthor(admin); // Internal Knowledge Element required by the validation process of
+               kprop.setType(ucase).setTitle(aStudy.getTitle()).setValue(
+                               scenario.getTitle()).setAuthor(admin); // Internal Knowledge Element required by the validation process of
                // knowledges
                addKnowledgeElement(scenario, kprop);
                return scenario;
index 00f4d15fda6ab01be06cae7365cf4d44dc884a46..2bf33ed4756d78401b806e6b111cae895f4d8b9f 100644 (file)
 <booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
 <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
 <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_20"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Siman"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_INSTALL_NAME" value="jdk1.6.0_20"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_INSTALL_TYPE_ID" value="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType"/>
 <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Siman/build.xml}"/>
 <stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,clean"/>
 <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
index afb3cbf4013dbc4e5f1dea8ff6d86a1f9110d05d..a2ece4ea18727c9ead0ffdb6d2b5a34bf7cd3c4c 100644 (file)
Binary files a/Workspace/Siman/WebContent/jap/splat-launcher.jar and b/Workspace/Siman/WebContent/jap/splat-launcher.jar differ
index bfb539491a9dd52b8d646f820bde9fdb9b418d65..cd45d583e517c0cd40b7f95ebacc0a5c1f84399f 100644 (file)
Binary files a/Workspace/Siman/WebContent/jap/splat-signedlauncher.jar and b/Workspace/Siman/WebContent/jap/splat-signedlauncher.jar differ
index 477281a62e7155d0302b5c71ca88e35ffd54244e..369aa47c9d44547a5c4fa0fe3eaa8228e0ea3d78 100644 (file)
@@ -1,95 +1,95 @@
 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
-    pageEncoding="ISO-8859-1"
-%>
-<%@ 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"
-%>
+       pageEncoding="ISO-8859-1"%>
+<%@ taglib prefix="s" uri="/struts-tags"%>
 
 <s:url id="properties" namespace="/" action="select">
-  <s:param name="menu">configuration</s:param>
+       <s:param name="menu">configuration</s:param>
 </s:url>
-<s:url id="scenario"   namespace="/study" action="add-scenario"></s:url>
-<s:url id="idea"       namespace="/study" action="notyetimplemented"></s:url>
-<s:url id="back"       namespace="/study" action="step-study"></s:url>
+<s:url id="scenario" namespace="/study" action="add-scenario"></s:url>
+<s:url id="idea" namespace="/study" action="notyetimplemented"></s:url>
+<s:url id="back" namespace="/study" action="step-study"></s:url>
 
 <table width=100% border=0 cellspacing=0 cellpadding=0>
-  <tr height=30 valign=middle>
-  
-       <s:if test="toolBarSettings.isToolStudy">
-    <td width=30 align=left>
-               <s:if test="toolBarSettings.canUserEdit">
-               <s:a href="%{#properties}"><img src="<s:url value="/skin/tool.property.png"/>" border="none" title="<s:text name="tooltip.property"/>" /></s:a>
-       </s:if>
-               <s:else>
-                   <s:a href="%{#properties}"><img src="<s:url value="/skin/tool.property.png"/>" border="none" title="<s:text name="tooltip.details"/>" /></s:a>
-               </s:else>
-    </td>  
-    <td width=30 align=left>
-               <s:if test="toolBarSettings.isEnabledScript">
-               <s:a href="%{#scenario}"><img src="<s:url value="/skin/tool.scenario.png"/>" border="none" title="<s:text name="tooltip.scenario"/>"/></s:a>
-       </s:if> 
-               <s:else>
-                   <img src="<s:url value="/skin/disabled.scenario.png"/>" border="none" title="" />
-               </s:else>
+       <tr height=30 valign=middle>
 
-    </td>
-    <td align=right>
-      <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();
+               <s:if test="toolBarSettings.isToolStudy">
+                       <td width=30 align=left><s:if test="toolBarSettings.canUserEdit">
+                               <s:a href="%{#properties}">
+                                       <img src="<s:url value="/skin/tool.property.png"/>" border="none"
+                                               title="<s:text name="tooltip.property"/>" />
+                               </s:a>
+                       </s:if> <s:else>
+                               <s:a href="%{#properties}">
+                                       <img src="<s:url value="/skin/tool.property.png"/>" border="none"
+                                               title="<s:text name="tooltip.details"/>" />
+                               </s:a>
+                       </s:else></td>
+                       <td width=30 align=left><s:if
+                               test="toolBarSettings.isEnabledScript">
+                               <s:a href="%{#scenario}">
+                                       <img src="<s:url value="/skin/tool.scenario.png"/>" border="none"
+                                               title="<s:text name="tooltip.scenario"/>" />
+                               </s:a>
+                       </s:if> <s:else>
+                               <img src="<s:url value="/skin/disabled.scenario.png"/>"
+                                       border="none" title="" />
+                       </s:else></td>
+                       <%-- URL for refreshing scenario view after checkin --%>
+                       <s:url id="refresh" forceAddSchemeHostAndPort="true"
+                               namespace="/study" action="open-%{#entitype}">
+                               <s:param name="selection" value="titleBarSettings.selectionState" />
+                       </s:url>
+                       <td align=right><img
+                               src="<s:url value="/skin/image.vseparator.png"/>" border="none" />
+                       <s:if
+                               test="openStudy.selectedStepRights.canCreateDocument() && (openStudy.moduleBar != null)">
+                               <applet name="perform" id="perform"
+                                       code="org.splat.launcher.ToolbarApplet"
+                                       archive="../jap/splat-signedlauncher.jar"
+                                       width=<s:property value="openStudy.moduleBar.width"/>
+                                       height=<s:property value="openStudy.moduleBar.height"/>> <%-- Generate applet parameters for each tool button --%>
+                                       <s:iterator var="tool" value="openStudy.moduleBar.items"
+                                               status="stat">
+                                               <s:set var="arg" value="#tool.argument" />
+                                               <param name="icon<s:property value="#stat.index" />"
+                                                       value="<s:property value="#tool.icon" />" />
+                                               <param name="tool<s:property value="#stat.index" />"
+                                                       value="<s:property value="#tool.action" />" />
+                                               <s:if test="#tool.action == 'runSalome'">
+                                                       <%-- 
+                       --siman --siman-study=s --siman-scenario=sc --siman-user=u -k
+                       --%>
+                                                       <s:set var="arg">--siman --siman-study=<s:property
+                                                                       value="openStudy.index" /> --siman-scenario=<s:property
+                                                                       value="openStudy.selectedScenarioId" /> --siman-user=<s:property
+                                                                       value="connectedUser.username" /> -k</s:set>
+                                               </s:if>
+                                               <s:if test="#arg != null">
+                                                       <param name="file<s:property value="#stat.index" />"
+                                                               value="<s:property value="#arg" />" />
+                                               </s:if>
+                                       </s:iterator>
+                                       <param name="refresh" value="<s:property value="%{refresh}"/>">
+                               </applet>
+                       </s:if></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>
+               </s:if>
 
-      if (study.getSelectedStepRights().canCreateDocument() && mbar != null) {
-%>
-      <applet name="perform" id="perform" code="org.splat.launcher.ToolbarApplet" 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();
-          String     arg  = tool.getArgument();
-%>        <param name="icon<%=i%>" value="<%=tool.getIcon()%>" />
-          <param name="tool<%=i%>" value="<%=tool.getAction()%>" />
-<%
-                       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>
-<%    }
-%>
+               <s:elseif test="toolBarSettings.isToolStandard">
+                       <td width=30 align=left><s:a href="%{#properties}">
+                               <img src="<s:url value="/skin/tool.property.png"/>" border="none"
+                                       title="<s:text name="tooltip.details"/>" />
+                       </s:a></td>
+               </s:elseif>
 
-
-
-  </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>
-       </s:if>
-       
-       <s:elseif test="toolBarSettings.isToolStandard">
-           <td width=30 align=left>
-             <s:a href="%{#properties}"><img src="<s:url value="/skin/tool.property.png"/>" border="none" title="<s:text name="tooltip.details"/>" /></s:a>
-           </td>
-       </s:elseif>
-       
-       <s:elseif test="toolBarSettings.isToolBack">
-           <td width=30 align=left>
-             <s:a href="%{#back}"><img src="<s:url value="/skin/icon.back.png"/>" border="none" title="<s:text name="tooltip.back"/>" /></s:a>
-           </td>
-       </s:elseif>
-</tr>
+               <s:elseif test="toolBarSettings.isToolBack">
+                       <td width=30 align=left><s:a href="%{#back}">
+                               <img src="<s:url value="/skin/icon.back.png"/>" border="none"
+                                       title="<s:text name="tooltip.back"/>" />
+                       </s:a></td>
+               </s:elseif>
+       </tr>
 </table>
\ No newline at end of file
index 0de07566c800377e69b2364856fa72c74ed9e75c..6c02458569af3d808f89459d13f6f0422863cbbd 100644 (file)
@@ -200,6 +200,7 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener
                }
                String pathToScript = SALOME_HOME + "runSalome";
 
+               // Look for the launching script in the file system
                File script = new File(pathToScript);
                if (!script.exists()) {
                        script = new File(pathToScript + ".bat");
@@ -210,7 +211,7 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener
 
                if (script.exists()) {
 
-                       // Checkout the scenario
+                       // Call to the Siman server to checkout the scenario
                        URL checkoutUrl = new URL(getCodeBase().toString()
                                        + "checkout.action?"
                                        + params.replaceAll("siman-", "").replaceAll("--", "-")
@@ -218,6 +219,8 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener
 
                        BufferedReader buffer = new BufferedReader(new InputStreamReader(
                                        checkoutUrl.openStream()));
+
+                       // Read the response of the Siman server
                        boolean isOk = false;
                        String response = buffer.readLine();
                        while ((response != null)) {
@@ -234,19 +237,19 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener
                                // filename here indeed a string containing parameters for runSalome.
                                Runtime.getRuntime().exec(
                                                new String[] { script.getAbsolutePath(), params });
+                               // Refresh the current scenario view
+                               getAppletContext().showDocument(new URL(this.getParameter("refresh")));
                        } else {
                                // Checkout of the scenario is failed at the beginning.
                                if (response != null) {
-                                       response = response
-                                                       .substring(
-                                                                       response.indexOf(CHECKOUT_RES)
-                                                                                       + CHECKOUT_RES.length())
-                                                       .replace('}', ' ').replace('"', ' ');
+                                       response = response.substring(
+                                                       response.indexOf(CHECKOUT_RES)
+                                                                       + CHECKOUT_RES.length()).replace('}', ' ')
+                                                       .replace('"', ' ');
                                }
                                showError(response);
                        }
                } else {
-                       // TODO: Use logger to be more user friendly
                        showError("SALOME module is not found: " + script.getAbsolutePath());
                        throw new ConfigurationException("SALOME module is not found: "
                                        + script.getAbsolutePath());
index 501a3c539ff44269757dee336d129bd5a3721e25..e2094b9b6ea8e8c9650f46612e2024bf21a4f9ff 100644 (file)
@@ -5,55 +5,52 @@ import java.util.ResourceBundle;
 
 import org.splat.dal.bo.kernel.User;
 import org.splat.dal.bo.som.Scenario;
+import org.splat.kernel.InvalidPropertyException;
 import org.splat.service.ProjectElementService;
 import org.splat.service.ScenarioService;
 import org.splat.som.Step;
 import org.splat.som.StepRights;
+import org.splat.wapp.Constants;
 
 public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
 
        private Scenario myscenario;
        private String lasdate;
        private String subject;
-       
+
        /**
         * The Scenario service.
         */
        private ScenarioService _scenarioService;
-       
+
        /**
         * The PojectElement service.
         */
        private ProjectElementService _projectElementService;
-       
+
        /**
-        * Value of the menu property. 
-        * It can be: none, create, open, study, knowledge, sysadmin, help.
+        * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help.
         */
        private String _menuProperty;
-       
+
        /**
-        * Value of the title bar property. 
-        * It can be: study, knowledge.
+        * Value of the title bar property. It can be: study, knowledge.
         */
        private String _titleProperty;
-       
+
        /**
-        * Property that indicates whether the current open study is editable or not.
-        * On the screen it looks like pen on the status icon, pop-up menu also can be called.
-        * It is necessary for correct building the title bar.
+        * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up
+        * menu also can be called. It is necessary for correct building the title bar.
         */
        private String _editDisabledProperty = "false";
-       
+
        /**
-        * Value of the tool bar property. 
-        * It can be: none, standard, study, back.
+        * Value of the tool bar property. It can be: none, standard, study, back.
         */
        private String _toolProperty;
-       
+
        /**
-        * Value of the left menu property. 
-        * It can be: open, study, knowledge, scenario.
+        * Value of the left menu property. It can be: open, study, knowledge, scenario.
         */
        private String _leftMenuProperty;
 
@@ -72,8 +69,8 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
                                getApplicationSettings().getCurrentLocale());
                ResourceBundle custom = ResourceBundle.getBundle("som",
                                getApplicationSettings().getCurrentLocale());
-               SimpleDateFormat datstring = new SimpleDateFormat(
-                               custom.getString("date.format")); // Locale date display format
+               SimpleDateFormat datstring = new SimpleDateFormat(custom
+                               .getString("date.format")); // Locale date display format
                Step step;
 
                _openStudy = getOpenStudy();
@@ -81,18 +78,26 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
                myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
                lasdate = datstring.format(myscenario.getLastModificationDate());
                subject = label.getString("label.study") + " " + _openStudy.getTitle();
-               
-               setMenuProperty("study");
-               setTitleProperty("study");
+
+               setMenuProperty(Constants.STUDY_MENU);
+               setTitleProperty(Constants.STUDY_MENU);
                setEditDisabledProperty("true");
                setToolProperty("back");
                setLeftMenuProperty("open");
-        initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty);
+               initializationFullScreenContext(_menuProperty, _titleProperty,
+                               _editDisabledProperty, _toolProperty, _leftMenuProperty);
 
                return SUCCESS;
        }
 
-       public String doCheckin() {
+       /**
+        * Mark the scenario as checked in.
+        * 
+        * @return SUCCESS
+        * @throws InvalidPropertyException
+        *             if scenario is not found in the database
+        */
+       public String doCheckin() throws InvalidPropertyException {
                Step step;
 
                _openStudy = getOpenStudy();
@@ -100,21 +105,25 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
                step = _openStudy.getSelectedStep();
                myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
 
-               getScenarioService().checkin(myscenario);
+               getScenarioService().checkin(myscenario.getIndex());
+               // TODO: Do it in the business service after moving to DTO instead of id parameter
+               // or reread the scenario.
+               myscenario.setUser(null);
 
                _openStudy.getMenu().refreshGivenStepItem(
                                getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
-               
-               setMenuProperty("study");
-               if ("true".equals(getWriteAccess()) &&  getUserRights().canCreateDocument()) {
-                       setToolProperty("study");
+
+               setMenuProperty(Constants.STUDY_MENU);
+               if ("true".equals(getWriteAccess())
+                               && getUserRights().canCreateDocument()) {
+                       setToolProperty(Constants.STUDY_MENU);
                } else {
                        setToolProperty("standard");
                }
-               setLeftMenuProperty("study");
-               initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty);
+               setLeftMenuProperty(Constants.STUDY_MENU);
+               initializationFullScreenContext(_menuProperty, _toolProperty,
+                               _leftMenuProperty);
 
-               
                return SUCCESS;
        }
 
@@ -122,36 +131,38 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
        // Getters
        // ==============================================================================================================================
 
+       /**
+        * Get current scenario editor or author if the scenario is not checked out.
+        * 
+        * @return the scenario editor or author
+        */
        public User getAuthor() {
-               // ------------------------
-               if (myscenario.isCheckedout())
-                       return myscenario.getUser();
-               else
-                       return myscenario.getAuthor();
+               User author;
+               if (myscenario.isCheckedout()) {
+                       author = myscenario.getUser();
+               } else {
+                       author = myscenario.getAuthor();
+               }
+               return author;
        }
 
        public String getLastModificationDate() {
-               // ----------------------------------------
                return lasdate;
        }
 
        public StepRights getSelectedStep() {
-               // ------------------------------------
                return _openStudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
        }
 
        public String getSubject() {
-               // ---------------------------
                return subject;
        }
 
        public String getTitle() {
-               // -------------------------
                return myscenario.getTitle();
        }
 
        public boolean isCheckedout() {
-               // ------------------------------
                return myscenario.isCheckedout();
        }
 
@@ -170,7 +181,7 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
         * @param scenarioService
         *            the scenarioService to set
         */
-       public void setScenarioService(ScenarioService scenarioService) {
+       public void setScenarioService(final ScenarioService scenarioService) {
                _scenarioService = scenarioService;
        }
 
@@ -190,86 +201,111 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
         *            the projectElementService to set
         */
        public void setProjectElementService(
-                       ProjectElementService projectElementService) {
+                       final ProjectElementService projectElementService) {
                _projectElementService = projectElementService;
        }
-       
+
        /**
         * Get the menuProperty.
+        * 
         * @return the menuProperty
         */
+       @Override
        public String getMenuProperty() {
                return _menuProperty;
        }
 
        /**
         * Set the menuProperty.
-        * @param menuProperty the menuProperty to set
+        * 
+        * @param menuProperty
+        *            the menuProperty to set
         */
-       public void setMenuProperty(String menuProperty) {
+       @Override
+       public void setMenuProperty(final String menuProperty) {
                this._menuProperty = menuProperty;
        }
-       
+
        /**
         * Get the _titleProperty.
+        * 
         * @return the _titleProperty
         */
+       @Override
        public String getTitleProperty() {
                return _titleProperty;
        }
 
        /**
         * Set the _titleProperty.
-        * @param _titleProperty the titleProperty to set
+        * 
+        * @param _titleProperty
+        *            the titleProperty to set
         */
-       public void setTitleProperty(String titleProperty) {
+       @Override
+       public void setTitleProperty(final String titleProperty) {
                _titleProperty = titleProperty;
        }
 
        /**
         * Get the editDisabledProperty.
+        * 
         * @return the editDisabledProperty
         */
+       @Override
        public final String getEditDisabledProperty() {
                return _editDisabledProperty;
        }
 
        /**
         * Set the editDisabledProperty.
-        * @param editDisabledProperty the editDisabledProperty to set
+        * 
+        * @param editDisabledProperty
+        *            the editDisabledProperty to set
         */
-       public final void setEditDisabledProperty(String editDisabledProperty) {
+       @Override
+       public final void setEditDisabledProperty(final String editDisabledProperty) {
                _editDisabledProperty = editDisabledProperty;
        }
 
        /**
         * Get the toolProperty.
+        * 
         * @return the toolProperty
         */
+       @Override
        public String getToolProperty() {
                return _toolProperty;
        }
 
        /**
         * Set the toolProperty.
-        * @param toolProperty the toolProperty to set
+        * 
+        * @param toolProperty
+        *            the toolProperty to set
         */
+       @Override
        public void setToolProperty(final String toolProperty) {
                _toolProperty = toolProperty;
        }
-       
+
        /**
         * Get the leftMenuProperty.
+        * 
         * @return the leftMenuProperty
         */
+       @Override
        public String getLeftMenuProperty() {
                return _leftMenuProperty;
        }
 
        /**
         * Set the leftMenuProperty.
-        * @param leftMenuProperty the leftMenuProperty to set
+        * 
+        * @param leftMenuProperty
+        *            the leftMenuProperty to set
         */
+       @Override
        public void setLeftMenuProperty(final String leftMenuProperty) {
                _leftMenuProperty = leftMenuProperty;
        }
index a32b858f8625b8419cb38c2b17e1d41231cb49c1..e6e766c287c69a2c3cc5048f1c2aecc1a7af7223 100644 (file)
@@ -17,7 +17,7 @@ public class ContextualMenu {
        protected transient int _width;
        protected transient int _height;
        protected transient Map<String, Object> _context;
-       protected transient List<ContextualItem> _items; // Instead of HashMap for being able to see ContextualMenu objects as Lists
+       protected List<ContextualItem> _items; // Instead of HashMap for being able to see ContextualMenu objects as Lists
        protected transient Map<String, Integer> _indices; // Indices of ContextualItem objects into items
 
        private enum Side {
@@ -121,4 +121,20 @@ public class ContextualMenu {
        public void setContext(final String name, final Object context) {
                this._context.put(name, context);
        }
+
+       /**
+        * Get the items.
+        * @return the items
+        */
+       public List<ContextualItem> getItems() {
+               return _items;
+       }
+
+       /**
+        * Set the items.
+        * @param items the items to set
+        */
+       public void setItems(final List<ContextualItem> items) {
+               _items = items;
+       }
 }
\ No newline at end of file
index 11e83af12a2945bee178b67810ecb926328bc393..61b0dce1ede4435ecd002b58fb6fb4a44cbdef43 100644 (file)
@@ -8,21 +8,21 @@ menu.step.1   = Sp
 menu.step.2   = Concevoir le scénario
 menu.step.3   = Créer la géométrie
 menu.step.4   = Générer le modèle d''analyse
-menu.step.5   = Entrer les conditions de calcul
-menu.step.6   = Effectuer le calcul
-menu.step.7   = Analyser les résultats
-menu.step.8   = Capitaliser ce cas d''étude
-menu.step.9   = Finaliser l''étude
+#menu.step.5   = Entrer les conditions de calcul
+menu.step.5   = Effectuer le calcul
+menu.step.6   = Analyser les résultats
+menu.step.7   = Capitaliser ce cas d''étude
+menu.step.8   = Finaliser l''étude
 
 folder.step.1 = Spécification de l''étude
 folder.step.2 = Description du scénario
 folder.step.3 = Géométrie
 folder.step.4 = Modèle d''analyse
-folder.step.5 = Conditions de calcul
-folder.step.6 = Schéma de calcul
-folder.step.7 = Résultats
-folder.step.8 = Élements de connaissances
-folder.step.9 = Rapport final
+#folder.step.5 = Conditions de calcul
+folder.step.5 = Schéma de calcul
+folder.step.6 = Résultats
+folder.step.7 = Élements de connaissances
+folder.step.8 = Rapport final
 
 type.document.requirements   = Cahier des charges
 type.document.specification  = Document de spécification
index 8a16f839ab6477019b3cd678f8f10e2feebe29f4..13cf269b817ce6bddf731057602aace73199ce7b 100644 (file)
@@ -8,21 +8,21 @@ menu.step.1   = Specify the study
 menu.step.2   = Design the scenario
 menu.step.3   = Create the geometry
 menu.step.4   = Generate the analysis model
-menu.step.5   = Enter the boundary conditions
-menu.step.6   = Execute the calculation
-menu.step.7   = Analyze the results
-menu.step.8   = Capitalize this use-case
-menu.step.9   = Finalize the study
+#menu.step.5   = Enter the boundary conditions
+menu.step.5   = Execute the calculation
+menu.step.6   = Analyze the results
+menu.step.7   = Capitalize this use-case
+menu.step.8   = Finalize the study
 
 folder.step.1 = Specification of the study
 folder.step.2 = Description of the scenario
 folder.step.3 = Geometry
 folder.step.4 = Analysis model
-folder.step.5 = Boundary conditions
-folder.step.6 = Calculation scheme
-folder.step.7 = Calculation results
-folder.step.8 = Knowledge elements
-folder.step.9 = Final report
+#folder.step.5 = Boundary conditions
+folder.step.5 = Calculation scheme
+folder.step.6 = Calculation results
+folder.step.7 = Knowledge elements
+folder.step.8 = Final report
 
 type.document.requirements   = Customer requirements
 type.document.specification  = Specification document