]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/src/org/splat/simer/EditScenarioPropertiesAction.java
Salome HOME
<jsp:param ... > parameters are removed from the title bar
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / EditScenarioPropertiesAction.java
1 package org.splat.simer;
2
3 import java.text.SimpleDateFormat;
4 import java.util.ResourceBundle;
5
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;
12
13 public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
14
15         private Scenario myscenario;
16         private String lasdate;
17         private String subject;
18         private ScenarioService _scenarioService;
19         private ProjectElementService _projectElementService;
20         
21         /**
22          * Value of the menu property. 
23          * It can be: none, create, open, study, knowledge, sysadmin, help.
24          */
25         private String _menuProperty;
26         
27         /**
28          * Value of the title bar property. 
29          * It can be: study, knowledge.
30          */
31         private String _titleProperty;
32         
33         /**
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.
37          */
38         private String _editDisabledProperty = "false";
39
40         /**
41          * Serial version ID.
42          */
43         private static final long serialVersionUID = 4964740932426016171L;
44
45         // ==============================================================================================================================
46         // Action methods
47         // ==============================================================================================================================
48
49         public String doInitialize() {
50                 // -----------------------------
51                 ResourceBundle label = ResourceBundle.getBundle("labels",
52                                 ApplicationSettings.getCurrentLocale());
53                 ResourceBundle custom = ResourceBundle.getBundle("som",
54                                 ApplicationSettings.getCurrentLocale());
55                 SimpleDateFormat datstring = new SimpleDateFormat(
56                                 custom.getString("date.format")); // Locale date display format
57                 Step step;
58
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();
64                 
65                 setMenuProperty("study");
66                 setTitleProperty("study");
67                 setEditDisabledProperty("true");
68         initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty);
69
70                 return SUCCESS;
71         }
72
73         public String doCheckin() {
74                 Step step;
75
76                 mystudy = getOpenStudy();
77                 selection = mystudy.getSelection();
78                 step = mystudy.getSelectedStep();
79                 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
80
81                 getScenarioService().checkin(myscenario);
82
83                 mystudy.getMenu().refreshGivenStepItem(
84                                 getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
85                 
86                 setMenuProperty("study");
87                 initializationScreenContext(_menuProperty);
88                 
89                 return SUCCESS;
90         }
91
92         // ==============================================================================================================================
93         // Getters
94         // ==============================================================================================================================
95
96         public User getAuthor() {
97                 // ------------------------
98                 if (myscenario.isCheckedout())
99                         return myscenario.getUser();
100                 else
101                         return myscenario.getAuthor();
102         }
103
104         public String getLastModificationDate() {
105                 // ----------------------------------------
106                 return lasdate;
107         }
108
109         public StepRights getSelectedStep() {
110                 // ------------------------------------
111                 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
112         }
113
114         public String getSubject() {
115                 // ---------------------------
116                 return subject;
117         }
118
119         public String getTitle() {
120                 // -------------------------
121                 return myscenario.getTitle();
122         }
123
124         public boolean isCheckedout() {
125                 // ------------------------------
126                 return myscenario.isCheckedout();
127         }
128
129         /**
130          * Get the scenarioService.
131          * 
132          * @return the scenarioService
133          */
134         public ScenarioService getScenarioService() {
135                 return _scenarioService;
136         }
137
138         /**
139          * Set the scenarioService.
140          * 
141          * @param scenarioService
142          *            the scenarioService to set
143          */
144         public void setScenarioService(ScenarioService scenarioService) {
145                 _scenarioService = scenarioService;
146         }
147
148         /**
149          * Get the projectElementService.
150          * 
151          * @return the projectElementService
152          */
153         public ProjectElementService getProjectElementService() {
154                 return _projectElementService;
155         }
156
157         /**
158          * Set the projectElementService.
159          * 
160          * @param projectElementService
161          *            the projectElementService to set
162          */
163         public void setProjectElementService(
164                         ProjectElementService projectElementService) {
165                 _projectElementService = projectElementService;
166         }
167         
168         /**
169          * Get the menuProperty.
170          * @return the menuProperty
171          */
172         public String getMenuProperty() {
173                 return _menuProperty;
174         }
175
176         /**
177          * Set the menuProperty.
178          * @param menuProperty the menuProperty to set
179          */
180         public void setMenuProperty(String menuProperty) {
181                 this._menuProperty = menuProperty;
182         }
183         
184         /**
185          * Get the _titleProperty.
186          * @return the _titleProperty
187          */
188         public String getTitleProperty() {
189                 return _titleProperty;
190         }
191
192         /**
193          * Set the _titleProperty.
194          * @param _titleProperty the titleProperty to set
195          */
196         public void setTitleProperty(String titleProperty) {
197                 _titleProperty = titleProperty;
198         }
199
200         /**
201          * Get the editDisabledProperty.
202          * @return the editDisabledProperty
203          */
204         public final String getEditDisabledProperty() {
205                 return _editDisabledProperty;
206         }
207
208         /**
209          * Set the editDisabledProperty.
210          * @param editDisabledProperty the editDisabledProperty to set
211          */
212         public final void setEditDisabledProperty(String editDisabledProperty) {
213                 _editDisabledProperty = editDisabledProperty;
214         }
215
216         
217 }