]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/src/org/splat/simer/EditStudyAction.java
Salome HOME
Tool bar is improved.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / EditStudyAction.java
1 package org.splat.simer;
2
3 import org.splat.dal.bo.som.Study;
4 import org.splat.service.StudyService;
5
6
7 public class EditStudyAction extends DisplayStudyStepAction {
8     
9         /**
10          * Serial version ID.
11          */
12     private static final long serialVersionUID = -4865668290514118396L;
13
14         private enum Execute { publish, promote }
15
16         private StudyService _studyService;
17         
18         /**
19          * Value of the menu property. 
20          * It can be: none, create, open, study, knowledge, sysadmin, help.
21          */
22         private String _menuProperty;
23         
24         /**
25          * Value of the title bar property. 
26          * It can be: study, knowledge.
27          */
28         private String _titleProperty;
29         
30         /**
31          * Value of the tool bar property. 
32          * It can be: none, standard, study, back.
33          */
34         private String _toolProperty;
35         
36         /**
37          * Property that indicates whether the current open study is editable or not.
38          * On the screen it looks like pen on the status icon, pop-up menu also can be called.
39          * It is necessary for correct building the title bar.
40          */
41         private String _editDisabledProperty = "false";
42
43 //  ==============================================================================================================================
44 //  Action methods
45 //  ==============================================================================================================================
46
47     public String doEdition () {
48           try {
49         mystudy = getOpenStudy();
50
51         Execute  todo   = Execute.valueOf(action);
52         Study    study  = mystudy.getStudyObject();
53         
54         if      (todo == Execute.publish) getStudyService().moveToPublic(study);
55         else if (todo == Execute.promote) getStudyService().moveToReference(study);
56         mystudy.getPopup().setContext("study", mystudy.getStudyRights());   // The context has changed
57         
58         setMenuProperty("study");
59         setTitleProperty("study");
60         if ("true".equals(getWriteAccess()) &&  getUserRights().canCreateDocument()) {
61                         setToolProperty("study");
62                 } else {
63                         setToolProperty("standard");
64                 }
65                 initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
66
67         return SUCCESS;
68           }
69       catch (RuntimeException saverror) {
70         logger.error("Reason:", saverror);
71         return ERROR;
72       }
73     }
74         /**
75          * Get the studyService.
76          * 
77          * @return the studyService
78          */
79         public StudyService getStudyService() {
80                 return _studyService;
81         }
82
83         /**
84          * Set the studyService.
85          * 
86          * @param studyService
87          *            the studyService to set
88          */
89         public void setStudyService(StudyService studyService) {
90                 _studyService = studyService;
91         }
92         
93         /**
94          * Get the menuProperty.
95          * @return the menuProperty
96          */
97         public String getMenuProperty() {
98                 return _menuProperty;
99         }
100
101         /**
102          * Set the menuProperty.
103          * @param menuProperty the menuProperty to set
104          */
105         public void setMenuProperty(String menuProperty) {
106                 this._menuProperty = menuProperty;
107         }
108         
109         /**
110          * Get the _titleProperty.
111          * @return the _titleProperty
112          */
113         public String getTitleProperty() {
114                 return _titleProperty;
115         }
116
117         /**
118          * Set the _titleProperty.
119          * @param _titleProperty the titleProperty to set
120          */
121         public void setTitleProperty(String titleProperty) {
122                 _titleProperty = titleProperty;
123         }
124         /**
125          * Get the editDisabledProperty.
126          * @return the editDisabledProperty
127          */
128         public final String getEditDisabledProperty() {
129                 return _editDisabledProperty;
130         }
131         /**
132          * Set the editDisabledProperty.
133          * @param editDisabledProperty the editDisabledProperty to set
134          */
135         public final void setEditDisabledProperty(String editDisabledProperty) {
136                 _editDisabledProperty = editDisabledProperty;
137         }
138         
139         /**
140          * Get the toolProperty.
141          * @return the toolProperty
142          */
143         public String getToolProperty() {
144                 return _toolProperty;
145         }
146
147         /**
148          * Set the toolProperty.
149          * @param toolProperty the toolProperty to set
150          */
151         public void setToolProperty(final String toolProperty) {
152                 _toolProperty = toolProperty;
153         }
154
155 }