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;
47 * Value of the left menu property.
48 * It can be: open, study, knowledge, scenario.
50 private String _leftMenuProperty;
55 private static final long serialVersionUID = 4964740932426016171L;
57 // ==============================================================================================================================
59 // ==============================================================================================================================
61 public String doInitialize() {
62 // -----------------------------
63 ResourceBundle label = ResourceBundle.getBundle("labels",
64 getApplicationSettings().getCurrentLocale());
65 ResourceBundle custom = ResourceBundle.getBundle("som",
66 getApplicationSettings().getCurrentLocale());
67 SimpleDateFormat datstring = new SimpleDateFormat(
68 custom.getString("date.format")); // Locale date display format
71 mystudy = getOpenStudy();
72 step = mystudy.getSelectedStep();
73 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
74 lasdate = datstring.format(myscenario.getLastModificationDate());
75 subject = label.getString("label.study") + " " + mystudy.getTitle();
77 setMenuProperty("study");
78 setTitleProperty("study");
79 setEditDisabledProperty("true");
80 setToolProperty("back");
81 setLeftMenuProperty("study");
82 initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty);
87 public String doCheckin() {
90 mystudy = getOpenStudy();
91 selection = mystudy.getSelection();
92 step = mystudy.getSelectedStep();
93 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
95 getScenarioService().checkin(myscenario);
97 mystudy.getMenu().refreshGivenStepItem(
98 getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
100 setMenuProperty("study");
101 if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) {
102 setToolProperty("study");
104 setToolProperty("standard");
106 setLeftMenuProperty("study");
107 initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty);
113 // ==============================================================================================================================
115 // ==============================================================================================================================
117 public User getAuthor() {
118 // ------------------------
119 if (myscenario.isCheckedout())
120 return myscenario.getUser();
122 return myscenario.getAuthor();
125 public String getLastModificationDate() {
126 // ----------------------------------------
130 public StepRights getSelectedStep() {
131 // ------------------------------------
132 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
135 public String getSubject() {
136 // ---------------------------
140 public String getTitle() {
141 // -------------------------
142 return myscenario.getTitle();
145 public boolean isCheckedout() {
146 // ------------------------------
147 return myscenario.isCheckedout();
151 * Get the scenarioService.
153 * @return the scenarioService
155 public ScenarioService getScenarioService() {
156 return _scenarioService;
160 * Set the scenarioService.
162 * @param scenarioService
163 * the scenarioService to set
165 public void setScenarioService(ScenarioService scenarioService) {
166 _scenarioService = scenarioService;
170 * Get the projectElementService.
172 * @return the projectElementService
174 public ProjectElementService getProjectElementService() {
175 return _projectElementService;
179 * Set the projectElementService.
181 * @param projectElementService
182 * the projectElementService to set
184 public void setProjectElementService(
185 ProjectElementService projectElementService) {
186 _projectElementService = projectElementService;
190 * Get the menuProperty.
191 * @return the menuProperty
193 public String getMenuProperty() {
194 return _menuProperty;
198 * Set the menuProperty.
199 * @param menuProperty the menuProperty to set
201 public void setMenuProperty(String menuProperty) {
202 this._menuProperty = menuProperty;
206 * Get the _titleProperty.
207 * @return the _titleProperty
209 public String getTitleProperty() {
210 return _titleProperty;
214 * Set the _titleProperty.
215 * @param _titleProperty the titleProperty to set
217 public void setTitleProperty(String titleProperty) {
218 _titleProperty = titleProperty;
222 * Get the editDisabledProperty.
223 * @return the editDisabledProperty
225 public final String getEditDisabledProperty() {
226 return _editDisabledProperty;
230 * Set the editDisabledProperty.
231 * @param editDisabledProperty the editDisabledProperty to set
233 public final void setEditDisabledProperty(String editDisabledProperty) {
234 _editDisabledProperty = editDisabledProperty;
238 * Get the toolProperty.
239 * @return the toolProperty
241 public String getToolProperty() {
242 return _toolProperty;
246 * Set the toolProperty.
247 * @param toolProperty the toolProperty to set
249 public void setToolProperty(final String toolProperty) {
250 _toolProperty = toolProperty;
254 * Get the leftMenuProperty.
255 * @return the leftMenuProperty
257 public String getLeftMenuProperty() {
258 return _leftMenuProperty;
262 * Set the leftMenuProperty.
263 * @param leftMenuProperty the leftMenuProperty to set
265 public void setLeftMenuProperty(final String leftMenuProperty) {
266 _leftMenuProperty = leftMenuProperty;