X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=Workspace%2FSiman%2Fsrc%2Forg%2Fsplat%2Fsimer%2FOpenStudy.java;h=50e3c30dd09733f79980fa71b37f5f182c9004ad;hb=0dcc3472827825d3d7f22916bfd9490e2395c610;hp=46d1085395bc5639bc5711ea4e8bcf2a947ba506;hpb=2588c47a9aa7a8ed827b0c2a43791f68573e1a41;p=tools%2Fsiman.git diff --git a/Workspace/Siman/src/org/splat/simer/OpenStudy.java b/Workspace/Siman/src/org/splat/simer/OpenStudy.java index 46d1085..50e3c30 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenStudy.java +++ b/Workspace/Siman/src/org/splat/simer/OpenStudy.java @@ -3,7 +3,7 @@ package org.splat.simer; /** * * @author Daniel Brunier-Coulin - * @copyright OPEN CASCADE 2012 + * @copyright OPEN CASCADE 2012-2014 */ import java.io.File; @@ -124,8 +124,10 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { .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 @@ -133,11 +135,17 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { _credate = datstring.format(_mystudy.getDate()); _lasdate = datstring.format(_mystudy.getLastModificationDate()); _description = _mystudy.getDescription(); - _involving = new ArrayList(1); + //_involving = new ArrayList(1); _context = new ArrayList(); - _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 i = _ustep.getAllSimulationContexts() .iterator(); i.hasNext();) { _context.add(new SimulationContextFacade(i.next(), @@ -165,19 +173,25 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { _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); } } @@ -646,7 +660,12 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { 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); } } @@ -828,4 +847,13 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { 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