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";
41 * Value of the tool bar property.
42 * It can be: none, standard, study, back.
44 private String _toolProperty;
49 private static final long serialVersionUID = 4964740932426016171L;
51 // ==============================================================================================================================
53 // ==============================================================================================================================
55 public String doInitialize() {
56 // -----------------------------
57 ResourceBundle label = ResourceBundle.getBundle("labels",
58 getApplicationSettings().getCurrentLocale());
59 ResourceBundle custom = ResourceBundle.getBundle("som",
60 getApplicationSettings().getCurrentLocale());
61 SimpleDateFormat datstring = new SimpleDateFormat(
62 custom.getString("date.format")); // Locale date display format
65 mystudy = getOpenStudy();
66 step = mystudy.getSelectedStep();
67 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
68 lasdate = datstring.format(myscenario.getLastModificationDate());
69 subject = label.getString("label.study") + " " + mystudy.getTitle();
71 setMenuProperty("study");
72 setTitleProperty("study");
73 setEditDisabledProperty("true");
74 setToolProperty("back");
75 initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
80 public String doCheckin() {
83 mystudy = getOpenStudy();
84 selection = mystudy.getSelection();
85 step = mystudy.getSelectedStep();
86 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
88 getScenarioService().checkin(myscenario);
90 mystudy.getMenu().refreshGivenStepItem(
91 getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
93 setMenuProperty("study");
94 if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) {
95 setToolProperty("study");
97 setToolProperty("standard");
99 initializationScreenContext(_menuProperty, _toolProperty);
105 // ==============================================================================================================================
107 // ==============================================================================================================================
109 public User getAuthor() {
110 // ------------------------
111 if (myscenario.isCheckedout())
112 return myscenario.getUser();
114 return myscenario.getAuthor();
117 public String getLastModificationDate() {
118 // ----------------------------------------
122 public StepRights getSelectedStep() {
123 // ------------------------------------
124 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
127 public String getSubject() {
128 // ---------------------------
132 public String getTitle() {
133 // -------------------------
134 return myscenario.getTitle();
137 public boolean isCheckedout() {
138 // ------------------------------
139 return myscenario.isCheckedout();
143 * Get the scenarioService.
145 * @return the scenarioService
147 public ScenarioService getScenarioService() {
148 return _scenarioService;
152 * Set the scenarioService.
154 * @param scenarioService
155 * the scenarioService to set
157 public void setScenarioService(ScenarioService scenarioService) {
158 _scenarioService = scenarioService;
162 * Get the projectElementService.
164 * @return the projectElementService
166 public ProjectElementService getProjectElementService() {
167 return _projectElementService;
171 * Set the projectElementService.
173 * @param projectElementService
174 * the projectElementService to set
176 public void setProjectElementService(
177 ProjectElementService projectElementService) {
178 _projectElementService = projectElementService;
182 * Get the menuProperty.
183 * @return the menuProperty
185 public String getMenuProperty() {
186 return _menuProperty;
190 * Set the menuProperty.
191 * @param menuProperty the menuProperty to set
193 public void setMenuProperty(String menuProperty) {
194 this._menuProperty = menuProperty;
198 * Get the _titleProperty.
199 * @return the _titleProperty
201 public String getTitleProperty() {
202 return _titleProperty;
206 * Set the _titleProperty.
207 * @param _titleProperty the titleProperty to set
209 public void setTitleProperty(String titleProperty) {
210 _titleProperty = titleProperty;
214 * Get the editDisabledProperty.
215 * @return the editDisabledProperty
217 public final String getEditDisabledProperty() {
218 return _editDisabledProperty;
222 * Set the editDisabledProperty.
223 * @param editDisabledProperty the editDisabledProperty to set
225 public final void setEditDisabledProperty(String editDisabledProperty) {
226 _editDisabledProperty = editDisabledProperty;
230 * Get the toolProperty.
231 * @return the toolProperty
233 public String getToolProperty() {
234 return _toolProperty;
238 * Set the toolProperty.
239 * @param toolProperty the toolProperty to set
241 public void setToolProperty(final String toolProperty) {
242 _toolProperty = toolProperty;