.getRevisionPattern());
_cuser = user; // May be null if nobody connected
+ if(!study.equals(_mystudy)) {
+ _selection = "0.1"; // Default selection
+ }
_mystudy = study;
- _selection = "0.1"; // Default selection
_selecdoc = null;
// Preparation of the display
_version = verstring.format(_mystudy.getVersion());
_credate = datstring.format(_mystudy.getDate());
- _lasdate = ""; // Not yet supported
+ _lasdate = datstring.format(_mystudy.getLastModificationDate());
_description = _mystudy.getDescription();
- _involving = new ArrayList<Step>(1);
+ //_involving = new ArrayList<Step>(1);
_context = new ArrayList<SimulationContextFacade>();
- _ustep = getProjectElementService().getFirstStep(_mystudy);
- _ustep.setActor(_cuser);
- _involving.add(_ustep);
+ if (_selection.equals("0.1")) {
+ _ustep = getProjectElementService().getFirstStep(_mystudy);
+ }
+ _ustep.setActor(_cuser);
+ if ((_involving.isEmpty()) || (_involving.get(0).getOwnerStudy().getIndex()
+ != _ustep.getOwnerStudy().getIndex())) {
+ _involving.clear();
+ _involving.add(_ustep);
+ }
for (Iterator<SimulationContext> i = _ustep.getAllSimulationContexts()
.iterator(); i.hasNext();) {
_context.add(new SimulationContextFacade(i.next(),
_popup = getApplicationSettings().getPopupMenu(
"steditablemarkprivate");
} else {
- if (_mystudy.getProgressState() == ProgressState.inWORK) {
- _popup = getApplicationSettings().getPopupMenu(
- "steditable");
- } else if (_mystudy.getProgressState() == ProgressState.inDRAFT) {
- _popup = getApplicationSettings().getPopupMenu(
- "streviewable");
- } else if (_mystudy.getProgressState() == ProgressState.inCHECK) {
- _popup = getApplicationSettings().getPopupMenu(
- "stapprovable");
- } else { // APPROVED
- _popup = getApplicationSettings().getPopupMenu(
- "steditablemarkpublic");
+ String key = null;
+ switch(_mystudy.getProgressState()) {
+ case inWORK:
+ key = "steditable";
+ break;
+ case inDRAFT:
+ key = "streviewable";
+ break;
+ case inCHECK:
+ key = "stapprovable";
+ break;
+ default: // APPROVED
+ key = "steditablemarkpublic";
+ break;
+ }
+ if(Long.valueOf(getSelectedScenarioId()) != 0) {
+ key += "ScenarioSelected";
}
+ _popup = getApplicationSettings().getPopupMenu(key);
}
}
*/
@Override
public String getType() {
- /*
- * RKV: return ResourceBundle.getBundle("labels", getApplicationSettings().getCurrentLocale()).getString( "label.study");
- */
return Constants.STUDY_MENU;
}
+
+ /**
+ * {@inheritDoc}
+ * @see org.splat.simer.AbstractOpenObject#getTypeName()
+ */
+ @Override
+ public String getTypeName() {
+ return ResourceBundle.getBundle("labels", getApplicationSettings().getCurrentLocale()).getString( "label.study");
+ }
/**
* Get the study version.
protected void update(final Publication doc) {
DocumentFacade facade = _docpres.get(doc.getIndex());
if (facade != null) {
- facade.refresh();
+ _contents.remove(facade);
+ facade = new DocumentFacade(this, doc,
+ getProjectSettings(), getPublicationService(),
+ getApplicationSettings());
+ _docpres.put(doc.getIndex(), facade);
+ _contents.add(facade);
}
}
public void setMystudy(final Study mystudy) {
this._mystudy = mystudy;
}
+
+ /**
+ * Update the current step.
+ *
+ */
+ public final void updateCurrentStep() {
+ setupPreviousToSelectedSteps();
+ _ustep = _involving.get(_involving.size() - 1);
+ }
}
\ No newline at end of file