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;
28 * Value of the title bar property.
29 * It can be: study, knowledge.
31 private String _titleProperty;
34 * Property that indicates whether the current open study is editable or not.
35 * On the screen it looks like pen on the status icon, pop-up menu also can be called.
36 * It is necessary for correct building the title bar.
38 private String _editDisabledProperty = "false";
43 private static final long serialVersionUID = 4964740932426016171L;
45 // ==============================================================================================================================
47 // ==============================================================================================================================
49 public String doInitialize() {
50 // -----------------------------
51 ResourceBundle label = ResourceBundle.getBundle("labels",
52 getApplicationSettings().getCurrentLocale());
53 ResourceBundle custom = ResourceBundle.getBundle("som",
54 getApplicationSettings().getCurrentLocale());
55 SimpleDateFormat datstring = new SimpleDateFormat(
56 custom.getString("date.format")); // Locale date display format
59 mystudy = getOpenStudy();
60 step = mystudy.getSelectedStep();
61 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
62 lasdate = datstring.format(myscenario.getLastModificationDate());
63 subject = label.getString("label.study") + " " + mystudy.getTitle();
65 setMenuProperty("study");
66 setTitleProperty("study");
67 setEditDisabledProperty("true");
68 initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty);
73 public String doCheckin() {
76 mystudy = getOpenStudy();
77 selection = mystudy.getSelection();
78 step = mystudy.getSelectedStep();
79 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
81 getScenarioService().checkin(myscenario);
83 mystudy.getMenu().refreshGivenStepItem(
84 getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
86 setMenuProperty("study");
87 initializationScreenContext(_menuProperty);
92 // ==============================================================================================================================
94 // ==============================================================================================================================
96 public User getAuthor() {
97 // ------------------------
98 if (myscenario.isCheckedout())
99 return myscenario.getUser();
101 return myscenario.getAuthor();
104 public String getLastModificationDate() {
105 // ----------------------------------------
109 public StepRights getSelectedStep() {
110 // ------------------------------------
111 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
114 public String getSubject() {
115 // ---------------------------
119 public String getTitle() {
120 // -------------------------
121 return myscenario.getTitle();
124 public boolean isCheckedout() {
125 // ------------------------------
126 return myscenario.isCheckedout();
130 * Get the scenarioService.
132 * @return the scenarioService
134 public ScenarioService getScenarioService() {
135 return _scenarioService;
139 * Set the scenarioService.
141 * @param scenarioService
142 * the scenarioService to set
144 public void setScenarioService(ScenarioService scenarioService) {
145 _scenarioService = scenarioService;
149 * Get the projectElementService.
151 * @return the projectElementService
153 public ProjectElementService getProjectElementService() {
154 return _projectElementService;
158 * Set the projectElementService.
160 * @param projectElementService
161 * the projectElementService to set
163 public void setProjectElementService(
164 ProjectElementService projectElementService) {
165 _projectElementService = projectElementService;
169 * Get the menuProperty.
170 * @return the menuProperty
172 public String getMenuProperty() {
173 return _menuProperty;
177 * Set the menuProperty.
178 * @param menuProperty the menuProperty to set
180 public void setMenuProperty(String menuProperty) {
181 this._menuProperty = menuProperty;
185 * Get the _titleProperty.
186 * @return the _titleProperty
188 public String getTitleProperty() {
189 return _titleProperty;
193 * Set the _titleProperty.
194 * @param _titleProperty the titleProperty to set
196 public void setTitleProperty(String titleProperty) {
197 _titleProperty = titleProperty;
201 * Get the editDisabledProperty.
202 * @return the editDisabledProperty
204 public final String getEditDisabledProperty() {
205 return _editDisabledProperty;
209 * Set the editDisabledProperty.
210 * @param editDisabledProperty the editDisabledProperty to set
212 public final void setEditDisabledProperty(String editDisabledProperty) {
213 _editDisabledProperty = editDisabledProperty;