]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/src/org/splat/simer/admin/SimulationContextFacade.java
Salome HOME
Beans initialization is fixed. Document can be added to study now.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / admin / SimulationContextFacade.java
1 package org.splat.simer.admin;
2
3 import java.util.Iterator;
4 import java.util.List;
5 import java.util.ResourceBundle;
6
7 import org.splat.service.technical.ProjectSettingsService;
8 import org.splat.simer.ApplicationSettings;
9 import org.splat.dal.bo.som.ProgressState;
10 import org.splat.dal.bo.som.SimulationContext;
11 import org.splat.dal.bo.som.SimulationContextType;
12
13
14 public class SimulationContextFacade {
15
16     private SimulationContext  my;
17     private String             name;
18     private int                at;
19     private ProgressState      state;
20
21 //  ==============================================================================================================================
22 //  Constructor
23 //  ==============================================================================================================================
24
25     public SimulationContextFacade (SimulationContext represented, List<ProjectSettingsService.Step> steps) {
26 //  --------------------------------------------------------------
27       SimulationContextType      mytype;
28
29       my     = represented;
30       mytype = my.getType();
31       for (Iterator<ProjectSettingsService.Step> i=steps.iterator(); i.hasNext(); ) {
32         ProjectSettingsService.Step          step = i.next();
33         if (!mytype.isAttachedTo(step)) continue;
34         at = step.getNumber();   // There is no direct service for getting the step number
35         break;
36       }
37           name  = my.getType().getName();
38       if (mytype.isApproved()) {
39         state = ProgressState.inCHECK;
40         name  = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale()).getString("type.context." + name);
41       } else {
42         state = ProgressState.inDRAFT;
43       }
44     }
45
46 //  ==============================================================================================================================
47 //  Getters
48 //  ==============================================================================================================================
49
50     public String getEditIcon () {
51 //  ----------------------------
52       StringBuffer result = new StringBuffer("icon.ed").append(state).append(".png");
53       return       result.toString();
54     }
55     public String getIndex () {
56 //  -------------------------
57       return String.valueOf(my.getIndex());
58     }
59     public int getStepNumber () {
60 //  ---------------------------
61       return  at;
62     }
63     public String getTypeName () {
64 //  ----------------------------
65       return name;
66     }
67     public String getValue () {
68 //  -------------------------
69       return  my.getValue();
70     }
71 }