]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman-Common/src/org/splat/service/dto/SimulationContextFacade.java
Salome HOME
Ignore temp subfolder.
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / dto / SimulationContextFacade.java
1 package org.splat.service.dto;
2
3 import java.util.Iterator;
4 import java.util.List;
5
6 import org.splat.service.technical.ProjectSettingsService;
7 import org.splat.dal.bo.som.ProgressState;
8 import org.splat.dal.bo.som.SimulationContext;
9 import org.splat.dal.bo.som.SimulationContextType;
10
11 public class SimulationContextFacade {
12
13         private SimulationContext my;
14         private String name;
15         private int at;
16         private ProgressState state;
17
18         // ==============================================================================================================================
19         // Constructor
20         // ==============================================================================================================================
21
22         public SimulationContextFacade(SimulationContext represented,
23                         List<ProjectSettingsService.Step> steps) {
24                 // --------------------------------------------------------------
25                 SimulationContextType mytype;
26
27                 my = represented;
28                 mytype = my.getType();
29                 for (Iterator<ProjectSettingsService.Step> i = steps.iterator(); i
30                                 .hasNext();) {
31                         ProjectSettingsService.Step step = i.next();
32                         if (!mytype.isAttachedTo(step))
33                                 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                         // RKV: TODO: Do translation in presentation layer by struts tools: name = ResourceBundle.getBundle("som",
41                         // ApplicationSettings.getCurrentLocale()).getString("type.context." + name);
42                 } else {
43                         state = ProgressState.inDRAFT;
44                 }
45         }
46
47         // ==============================================================================================================================
48         // Getters
49         // ==============================================================================================================================
50
51         public String getEditIcon() {
52                 // ----------------------------
53                 StringBuffer result = new StringBuffer("icon.ed").append(state).append(
54                                 ".png");
55                 return result.toString();
56         }
57
58         public String getIndex() {
59                 // -------------------------
60                 return String.valueOf(my.getIndex());
61         }
62
63         public int getStepNumber() {
64                 // ---------------------------
65                 return at;
66         }
67
68         public String getTypeName() {
69                 // ----------------------------
70                 return name;
71         }
72
73         public String getValue() {
74                 // -------------------------
75                 return my.getValue();
76         }
77 }