<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
+
+<s:url id="rename_scenario" value="valid-rename.action" includeParams="none" escapeAmp="false" />
+
<script language="JavaScript">
function checkin (message) {
<div id=article-box>
<div id=section>
<s:text name="title.prop.scenario">
- <s:param><s:property value="%{title}"/></s:param>
+ <s:param><s:property value="%{selectedScenarioTitle}"/></s:param>
</s:text>
</div>
<div id=article-body class=text>
<!-- Scenario ckecked-in (editable)
--> <s:else>
- <form name="property" action="valid-rename" method="post">
+ <s:form name="property" action="%{rename_scenario}" method="post">
<table class="text">
<tr>
<td><s:text name="field.scenariotitle"/>*: </td>
<td>
- <input type=text size="25" name=title value="<s:property value="title"/>">
+ <input type=text" size="25" name="selectedScenarioTitle" value="<s:property value="selectedScenarioTitle"/>">
</td>
<td>
<input type="submit" name="save" value="<s:text name="button.save"/>"/>
</td>
</tr>
</table>
- </form>
+ </s:form>
</s:else>
</div>
package org.splat.simer;
import java.text.SimpleDateFormat;
+import java.util.Iterator;
+import java.util.List;
import java.util.ResourceBundle;
import org.splat.dal.bo.kernel.User;
import org.splat.dal.bo.som.Scenario;
+import org.splat.dal.bo.som.Study;
import org.splat.kernel.InvalidPropertyException;
import org.splat.service.ProjectElementService;
import org.splat.service.ScenarioService;
private transient Scenario _myscenario;
private transient String _lasdate;
private transient String _subject;
+
+ /**
+ * Title of the selected scenario.
+ */
+ private String _selectedScenarioTitle;
/**
* The Scenario service.
_myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
_lasdate = datstring.format(_myscenario.getLastModificationDate());
_subject = label.getString("label.study") + " " + _openStudy.getTitle();
+ _selectedScenarioTitle = _myscenario.getTitle();
initializationFullScreenContext(Constants.STUDY_MENU,
Constants.STUDY_MENU, "true", "back", "open");
return SUCCESS;
}
+ /**
+ * Rename the scenario functionality.
+ * @return SUCCESS
+ */
+ public String doEditScenarioTitle() {
+ OpenStudy openStudy = getOpenStudy();
+ Study study = openStudy.getStudyObject();
+ List<Scenario> scenarios = study.getScenariiList();
+ Iterator<Scenario> iter = scenarios.iterator();
+ for (; iter.hasNext();) {
+ Scenario scenario = iter.next();
+ if (openStudy.getSelectedScenarioId().equals(String.valueOf(scenario.getIndex()))) {
+ scenario.setTitle(getSelectedScenarioTitle());
+ _scenarioService.renameScenario(scenario);
+ }
+ }
+ return SUCCESS;
+ }
+
// ==============================================================================================================================
// Getters
// ==============================================================================================================================
return _subject;
}
- public String getTitle() {
- return _myscenario.getTitle();
- }
public boolean isCheckedout() {
return _myscenario.isCheckedout();
}
+
+
+
+ /**
+ * Get the selectedScenarioTitle.
+ * @return the selectedScenarioTitle
+ */
+ public String getSelectedScenarioTitle() {
+ return _selectedScenarioTitle;
+ }
+
+ /**
+ * Set the selectedScenarioTitle.
+ * @param selectedScenarioTitle the selectedScenarioTitle to set
+ */
+ public void setSelectedScenarioTitle(final String selectedScenarioTitle) {
+ _selectedScenarioTitle = selectedScenarioTitle;
+ }
/**
* Get the scenarioService.
</action>
<action name="markasref-study" class="editStudyAction"
method="markAsReference">
+ <interceptor-ref name="simanBasicStack" />
<result name="success" type="tiles">
page.displaystudy
</result>
</action>
<action name="removeasref-study" class="editStudyAction"
method="removeAsReference">
+ <interceptor-ref name="simanBasicStack" />
<result name="success" type="tiles">
page.displaystudy
</result>
</action>
+ <action name="valid-rename" class="editScenarioPropertiesAction"
+ method="editScenarioTitle">
+ <interceptor-ref name="simanBasicStack" />
+ <result name="success" type="redirectAction">
+ open-study
+ </result>
+ </action>
+
<action name="add-scenario" class="newScenarioAction"
method="initialize">
<result name="success" type="tiles">