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;
20 * The Scenario service.
22 private ScenarioService _scenarioService;
25 * The PojectElement service.
27 private ProjectElementService _projectElementService;
30 * Value of the menu property.
31 * It can be: none, create, open, study, knowledge, sysadmin, help.
33 private String _menuProperty;
36 * Value of the title bar property.
37 * It can be: study, knowledge.
39 private String _titleProperty;
42 * Property that indicates whether the current open study is editable or not.
43 * On the screen it looks like pen on the status icon, pop-up menu also can be called.
44 * It is necessary for correct building the title bar.
46 private String _editDisabledProperty = "false";
49 * Value of the tool bar property.
50 * It can be: none, standard, study, back.
52 private String _toolProperty;
55 * Value of the left menu property.
56 * It can be: open, study, knowledge, scenario.
58 private String _leftMenuProperty;
63 private static final long serialVersionUID = 4964740932426016171L;
65 // ==============================================================================================================================
67 // ==============================================================================================================================
69 public String doInitialize() {
70 // -----------------------------
71 ResourceBundle label = ResourceBundle.getBundle("labels",
72 getApplicationSettings().getCurrentLocale());
73 ResourceBundle custom = ResourceBundle.getBundle("som",
74 getApplicationSettings().getCurrentLocale());
75 SimpleDateFormat datstring = new SimpleDateFormat(
76 custom.getString("date.format")); // Locale date display format
79 mystudy = getOpenStudy();
80 step = mystudy.getSelectedStep();
81 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
82 lasdate = datstring.format(myscenario.getLastModificationDate());
83 subject = label.getString("label.study") + " " + mystudy.getTitle();
85 setMenuProperty("study");
86 setTitleProperty("study");
87 setEditDisabledProperty("true");
88 setToolProperty("back");
89 setLeftMenuProperty("open");
90 initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty);
95 public String doCheckin() {
98 mystudy = getOpenStudy();
99 selection = mystudy.getSelection();
100 step = mystudy.getSelectedStep();
101 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
103 getScenarioService().checkin(myscenario);
105 mystudy.getMenu().refreshGivenStepItem(
106 getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
108 setMenuProperty("study");
109 if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) {
110 setToolProperty("study");
112 setToolProperty("standard");
114 setLeftMenuProperty("study");
115 initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty);
121 // ==============================================================================================================================
123 // ==============================================================================================================================
125 public User getAuthor() {
126 // ------------------------
127 if (myscenario.isCheckedout())
128 return myscenario.getUser();
130 return myscenario.getAuthor();
133 public String getLastModificationDate() {
134 // ----------------------------------------
138 public StepRights getSelectedStep() {
139 // ------------------------------------
140 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
143 public String getSubject() {
144 // ---------------------------
148 public String getTitle() {
149 // -------------------------
150 return myscenario.getTitle();
153 public boolean isCheckedout() {
154 // ------------------------------
155 return myscenario.isCheckedout();
159 * Get the scenarioService.
161 * @return the scenarioService
163 public ScenarioService getScenarioService() {
164 return _scenarioService;
168 * Set the scenarioService.
170 * @param scenarioService
171 * the scenarioService to set
173 public void setScenarioService(ScenarioService scenarioService) {
174 _scenarioService = scenarioService;
178 * Get the projectElementService.
180 * @return the projectElementService
182 public ProjectElementService getProjectElementService() {
183 return _projectElementService;
187 * Set the projectElementService.
189 * @param projectElementService
190 * the projectElementService to set
192 public void setProjectElementService(
193 ProjectElementService projectElementService) {
194 _projectElementService = projectElementService;
198 * Get the menuProperty.
199 * @return the menuProperty
201 public String getMenuProperty() {
202 return _menuProperty;
206 * Set the menuProperty.
207 * @param menuProperty the menuProperty to set
209 public void setMenuProperty(String menuProperty) {
210 this._menuProperty = menuProperty;
214 * Get the _titleProperty.
215 * @return the _titleProperty
217 public String getTitleProperty() {
218 return _titleProperty;
222 * Set the _titleProperty.
223 * @param _titleProperty the titleProperty to set
225 public void setTitleProperty(String titleProperty) {
226 _titleProperty = titleProperty;
230 * Get the editDisabledProperty.
231 * @return the editDisabledProperty
233 public final String getEditDisabledProperty() {
234 return _editDisabledProperty;
238 * Set the editDisabledProperty.
239 * @param editDisabledProperty the editDisabledProperty to set
241 public final void setEditDisabledProperty(String editDisabledProperty) {
242 _editDisabledProperty = editDisabledProperty;
246 * Get the toolProperty.
247 * @return the toolProperty
249 public String getToolProperty() {
250 return _toolProperty;
254 * Set the toolProperty.
255 * @param toolProperty the toolProperty to set
257 public void setToolProperty(final String toolProperty) {
258 _toolProperty = toolProperty;
262 * Get the leftMenuProperty.
263 * @return the leftMenuProperty
265 public String getLeftMenuProperty() {
266 return _leftMenuProperty;
270 * Set the leftMenuProperty.
271 * @param leftMenuProperty the leftMenuProperty to set
273 public void setLeftMenuProperty(final String leftMenuProperty) {
274 _leftMenuProperty = leftMenuProperty;