1 package org.splat.simer;
3 import java.text.SimpleDateFormat;
4 import java.util.ResourceBundle;
6 import org.splat.dal.bo.kernel.User;
7 import org.splat.dal.bo.som.Scenario;
8 import org.splat.service.ProjectElementService;
9 import org.splat.service.ScenarioService;
10 import org.splat.som.Step;
11 import org.splat.som.StepRights;
13 public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
15 private Scenario myscenario;
16 private String lasdate;
17 private String subject;
18 private ScenarioService _scenarioService;
19 private ProjectElementService _projectElementService;
22 * Value of the menu property.
23 * It can be: none, create, open, study, knowledge, sysadmin, help.
25 private String _menuProperty;
30 private static final long serialVersionUID = 4964740932426016171L;
32 // ==============================================================================================================================
34 // ==============================================================================================================================
36 public String doInitialize() {
37 // -----------------------------
38 ResourceBundle label = ResourceBundle.getBundle("labels",
39 ApplicationSettings.getCurrentLocale());
40 ResourceBundle custom = ResourceBundle.getBundle("som",
41 ApplicationSettings.getCurrentLocale());
42 SimpleDateFormat datstring = new SimpleDateFormat(
43 custom.getString("date.format")); // Locale date display format
46 mystudy = getOpenStudy();
47 step = mystudy.getSelectedStep();
48 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
49 lasdate = datstring.format(myscenario.getLastModificationDate());
50 subject = label.getString("label.study") + " " + mystudy.getTitle();
52 setMenuProperty("study");
53 initializationScreenContext(_menuProperty);
58 public String doCheckin() {
61 mystudy = getOpenStudy();
62 selection = mystudy.getSelection();
63 step = mystudy.getSelectedStep();
64 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
66 getScenarioService().checkin(myscenario);
68 mystudy.getMenu().refreshGivenStepItem(
69 getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
71 setMenuProperty("study");
72 initializationScreenContext(_menuProperty);
77 // ==============================================================================================================================
79 // ==============================================================================================================================
81 public User getAuthor() {
82 // ------------------------
83 if (myscenario.isCheckedout())
84 return myscenario.getUser();
86 return myscenario.getAuthor();
89 public String getLastModificationDate() {
90 // ----------------------------------------
94 public StepRights getSelectedStep() {
95 // ------------------------------------
96 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
99 public String getSubject() {
100 // ---------------------------
104 public String getTitle() {
105 // -------------------------
106 return myscenario.getTitle();
109 public boolean isCheckedout() {
110 // ------------------------------
111 return myscenario.isCheckedout();
115 * Get the scenarioService.
117 * @return the scenarioService
119 public ScenarioService getScenarioService() {
120 return _scenarioService;
124 * Set the scenarioService.
126 * @param scenarioService
127 * the scenarioService to set
129 public void setScenarioService(ScenarioService scenarioService) {
130 _scenarioService = scenarioService;
134 * Get the projectElementService.
136 * @return the projectElementService
138 public ProjectElementService getProjectElementService() {
139 return _projectElementService;
143 * Set the projectElementService.
145 * @param projectElementService
146 * the projectElementService to set
148 public void setProjectElementService(
149 ProjectElementService projectElementService) {
150 _projectElementService = projectElementService;
154 * Get the menuProperty.
155 * @return the menuProperty
157 public String getMenuProperty() {
158 return _menuProperty;
162 * Set the menuProperty.
163 * @param menuProperty the menuProperty to set
165 public void setMenuProperty(String menuProperty) {
166 this._menuProperty = menuProperty;