import org.splat.dal.bo.som.ProjectElement;
import org.splat.dal.bo.som.Scenario;
-import org.splat.dal.bo.som.Study;
import org.splat.service.StudyService;
import org.splat.som.StepRights;
import org.splat.wapp.Constants;
*/
private StudyService _studyService;
- /**
- * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help.
- */
- private String _menuProperty;
-
- /**
- * Value of the title bar property. It can be: study, knowledge.
- */
- private String _titleProperty;
-
- /**
- * Value of the tool bar property. It can be: none, standard, study, back.
- */
- private String _toolProperty;
-
- /**
- * Value of the left menu property. It can be: open, study, knowledge, scenario.
- */
- private String _leftMenuProperty;
-
- /**
- * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up
- * menu also can be called. It is necessary for correct building the title bar.
- */
- private String _editDisabledProperty = "false";
-
// ==============================================================================================================================
// Action methods
// ==============================================================================================================================
+ /**
+ * Open the selected study.
+ *
+ * @return SUCCESS if succeeded or ERROR if can't open
+ */
public String doOpen() {
- Study study;
String res = SUCCESS;
_openStudy = getOpenStudy();
if (_myindex == null) {
if (_selection == null) { // Opening a study just newed
_selection = _openStudy.getSelection(); // Default selection
- study = _openStudy.getStudyObject();
} else { // Re-opening (refreshing) the currently open study
- study = getStudyService().selectStudy(_openStudy.getIndex());
- _openStudy = open(study); // Closes the previously open study
+ _openStudy = open(getStudyService().selectStudy(
+ _openStudy.getIndex())); // Closes the previously open study
_openStudy.setSelection(_selection);
}
} else {
if (_openStudy != null && _openStudy.getStudyObject() != null
&& _openStudy.getIndex() == index) { // - The selected study is currently open
_selection = _openStudy.getSelection(); // Current selection
- study = _openStudy.getStudyObject(); // Current Study object
// RKV:BEGIN: put in session if necessary
if (!getSession().containsKey("study.open")) {
- open(study);
+ open(_openStudy.getStudyObject());
}
// RKV:END
} else { // - The selected study is new
- study = getStudyService().selectStudy(index);
- _openStudy = open(study);
+ _openStudy = open(getStudyService().selectStudy(index));
_selection = _openStudy.getSelection(); // Default selection
}
} catch (Exception error) {
}
getSession().put("menu.study", _openStudy.getMenu());
- setMenuProperty(Constants.STUDY_MENU);
- setTitleProperty(Constants.STUDY_MENU);
- if (Constants.TRUE.equals(getWriteAccess())
- && getUserRights().canCreateDocument()) {
- setToolProperty(Constants.STUDY_MENU);
- } else {
- setToolProperty(Constants.STANDARD_MENU);
- }
-
- setLeftMenuProperty(Constants.STUDY_MENU);
-
- initializationFullScreenContext(_menuProperty, _titleProperty,
- _editDisabledProperty, _toolProperty, _leftMenuProperty);
+ setMenu();
}
return res;
}
+ /**
+ * Set context menu.
+ */
+ protected void setMenu() {
+ if (Constants.TRUE.equals(getWriteAccess())
+ && getUserRights().canCreateDocument()) {
+ setToolProperty(Constants.STUDY_MENU);
+ } else {
+ setToolProperty(Constants.STANDARD_MENU);
+ }
+
+ initializationFullScreenContext(Constants.STUDY_MENU,
+ Constants.STUDY_MENU, "false", getToolProperty(),
+ Constants.STUDY_MENU);
+ }
+
public String doSelectStep() {
_openStudy = getOpenStudy();
menu.selects("prop-general");
}
- setMenuProperty(Constants.STUDY_MENU);
- setTitleProperty(Constants.STUDY_MENU);
- if (Constants.TRUE.equals(getWriteAccess())
- && getUserRights().canCreateDocument()) {
- setToolProperty(Constants.STUDY_MENU);
- } else {
- setToolProperty(Constants.STANDARD_MENU);
- }
-
- setLeftMenuProperty(Constants.STUDY_MENU);
- initializationFullScreenContext(_menuProperty, _titleProperty,
- _editDisabledProperty, _toolProperty, _leftMenuProperty);
+ setMenu();
return SUCCESS;
}
_openStudy.reduceDocument(_myindex);
}
- setMenuProperty(Constants.STUDY_MENU);
- setTitleProperty(Constants.STUDY_MENU);
- if (Constants.TRUE.equals(getWriteAccess())
- && getUserRights().canCreateDocument()) {
- setToolProperty(Constants.STUDY_MENU);
- } else {
- setToolProperty(Constants.STANDARD_MENU);
- }
- setLeftMenuProperty(Constants.STUDY_MENU);
- initializationFullScreenContext(_menuProperty, _titleProperty,
- _editDisabledProperty, _toolProperty, _leftMenuProperty);
+ setMenu();
return SUCCESS;
}
_openStudy.reduceKnowledge(_myindex);
}
- setMenuProperty(Constants.STUDY_MENU);
- setTitleProperty(Constants.STUDY_MENU);
- if (Constants.TRUE.equals(getWriteAccess())
- && getUserRights().canCreateDocument()) {
- setToolProperty(Constants.STUDY_MENU);
- } else {
- setToolProperty(Constants.STANDARD_MENU);
- }
- setLeftMenuProperty(Constants.STUDY_MENU);
- initializationFullScreenContext(_menuProperty, _titleProperty,
- _editDisabledProperty, _toolProperty, _leftMenuProperty);
+ setMenu();
return SUCCESS;
}
+ /**
+ * Close the currently open study.
+ *
+ * @return SUCCESS
+ */
public String doClose() {
closeStudy();
-
- setMenuProperty("none");
- initializationScreenContext(_menuProperty);
-
+ initializationScreenContext("none");
return SUCCESS;
}
super.setOpenStudy(study);
_openStudy = study;
}
-
- /**
- * Get the menuProperty.
- *
- * @return the menuProperty
- */
- public String getMenuProperty() {
- return _menuProperty;
- }
-
- /**
- * Set the menuProperty.
- *
- * @param menuProperty
- * the menuProperty to set
- */
- public void setMenuProperty(final String menuProperty) {
- this._menuProperty = menuProperty;
- }
-
- /**
- * Get the _titleProperty.
- *
- * @return the _titleProperty
- */
- public String getTitleProperty() {
- return _titleProperty;
- }
-
- /**
- * Set the _titleProperty.
- *
- * @param _titleProperty
- * the titleProperty to set
- */
- public void setTitleProperty(final String titleProperty) {
- _titleProperty = titleProperty;
- }
-
- /**
- * Get the editDisabledProperty.
- *
- * @return the editDisabledProperty
- */
- public String getEditDisabledProperty() {
- return _editDisabledProperty;
- }
-
- /**
- * Set the editDisabledProperty.
- *
- * @param editDisabledProperty
- * the editDisabledProperty to set
- */
- public void setEditDisabledProperty(final String editDisabledProperty) {
- _editDisabledProperty = editDisabledProperty;
- }
-
- /**
- * Get the toolProperty.
- *
- * @return the toolProperty
- */
- public String getToolProperty() {
- return _toolProperty;
- }
-
- /**
- * Set the toolProperty.
- *
- * @param toolProperty
- * the toolProperty to set
- */
- public void setToolProperty(final String toolProperty) {
- _toolProperty = toolProperty;
- }
-
- /**
- * Get the leftMenuProperty.
- *
- * @return the leftMenuProperty
- */
- public String getLeftMenuProperty() {
- return _leftMenuProperty;
- }
-
- /**
- * Set the leftMenuProperty.
- *
- * @param leftMenuProperty
- * the leftMenuProperty to set
- */
- public void setLeftMenuProperty(final String leftMenuProperty) {
- _leftMenuProperty = leftMenuProperty;
- }
}
\ No newline at end of file