1 package org.splat.simer.admin;
3 import java.util.Iterator;
5 import java.util.ResourceBundle;
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;
14 public class SimulationContextFacade {
16 private SimulationContext my;
19 private ProgressState state;
20 private ProjectSettingsService _projectSettingsService;
22 // ==============================================================================================================================
24 // ==============================================================================================================================
26 public SimulationContextFacade (SimulationContext represented) {
27 // --------------------------------------------------------------
28 List<ProjectSettingsService.Step> steps = getProjectSettings().getAllSteps();
29 SimulationContextType mytype;
32 mytype = my.getType();
33 for (Iterator<ProjectSettingsService.Step> i=steps.iterator(); i.hasNext(); ) {
34 ProjectSettingsService.Step step = i.next();
35 if (!mytype.isAttachedTo(step)) continue;
36 at = step.getNumber(); // There is no direct service for getting the step number
39 name = my.getType().getName();
40 if (mytype.isApproved()) {
41 state = ProgressState.inCHECK;
42 name = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale()).getString("type.context." + name);
44 state = ProgressState.inDRAFT;
48 // ==============================================================================================================================
50 // ==============================================================================================================================
52 public String getEditIcon () {
53 // ----------------------------
54 StringBuffer result = new StringBuffer("icon.ed").append(state).append(".png");
55 return result.toString();
57 public String getIndex () {
58 // -------------------------
59 return String.valueOf(my.getIndex());
61 public int getStepNumber () {
62 // ---------------------------
65 public String getTypeName () {
66 // ----------------------------
69 public String getValue () {
70 // -------------------------
74 * Get project settings.
75 * @return Project settings service
77 private ProjectSettingsService getProjectSettings() {
78 return _projectSettingsService;
82 * Set project settings service.
83 * @param projectSettingsService project settings service
85 public void setProjectSettings(
86 ProjectSettingsService projectSettingsService) {
87 _projectSettingsService = projectSettingsService;