]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman/src/org/splat/simer/SimulationContextFacade.java
Salome HOME
Modifications to respect PMD rules.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / SimulationContextFacade.java
index 3cd145fe02185072094c5762a13375cc485dc662..1124d3df397f8b3626339643a7d954ae9e0ae980 100644 (file)
@@ -5,89 +5,93 @@ import java.util.List;
 import java.util.ResourceBundle;
 
 import org.splat.dal.bo.som.ProgressState;
-import org.splat.service.technical.ProjectSettingsService;
 import org.splat.dal.bo.som.SimulationContext;
 import org.splat.dal.bo.som.SimulationContextType;
+import org.splat.service.technical.ProjectSettingsService;
 import org.splat.wapp.PopupMenu;
 
-
 public class SimulationContextFacade {
 
-    private SimulationContext  my;
-    private String             name;
-    private int                step;
-    private ProgressState      state;
-    private PopupMenu          popup;
-
-//  ==============================================================================================================================
-//  Constructor
-//  ==============================================================================================================================
-
-    public SimulationContextFacade (SimulationContext represented, List<ProjectSettingsService.Step> allSteps) {
-//  --------------------------------------------------------------
-      my    = represented;
-      popup = ApplicationSettings.getPopupMenu("scontext");
-
-      SimulationContextType type = my.getType();
-      for (Iterator<ProjectSettingsService.Step> i=allSteps.iterator(); i.hasNext(); ) {
-        ProjectSettingsService.Step   next = i.next();
-       if (!type.isAttachedTo(next)) continue;
-        step = next.getNumber();
-       break;
-      }
-      state = my.getProgressState();                     // inCHECK or APPROVED
-      name  = type.getName();
-      if (type.isApproved()) {
-        name = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale()).getString("type.context." + name);
-      } else {
-        state  = ProgressState.inDRAFT;
-      }
-    }
-
-//  ==============================================================================================================================
-//  Getters
-//  ==============================================================================================================================
-
-    public String getEditIcon () {
-//  ----------------------------
-      return "icon.ed" + state + ".png";
-    }
-    public String getIndex () {
-//  -------------------------
-      return String.valueOf(my.getIndex());
-    }
-    public PopupMenu getPopup () {
-//  ----------------------------
-      popup.setContext("scontext", this);     // Cannot be done at construction because pop-ups are shared
-      return popup;
-    }
-    public String getStateIcon () {
-//  -----------------------------
-      return "icon." + state + ".png";
-    }
-    public String getStepNumber () {
-//  ------------------------------
-      return String.valueOf(step);
-    }
-    public String getTypeName () {
-//  ----------------------------
-      return  name;
-    }
-    public String getValue () {
-//  -------------------------
-      return  my.getValue();
-    }
-
-    public boolean isApproved () {
-//  ----------------------------
-      return (state == ProgressState.APPROVED);
-    }
-    public boolean isEditable () {
-//  ----------------------------
-      return !my.isShared();
-    }
-    public boolean isFacadeOf (SimulationContext represented) {
-//  ---------------------------------------------------------
-      return  my.equals(represented);
-    }
+       private final SimulationContext _my;
+       private String _name;
+       private int _step;
+       private ProgressState _state;
+       private final PopupMenu _popup;
+
+       // ==============================================================================================================================
+       // Constructor
+       // ==============================================================================================================================
+
+       public SimulationContextFacade(final SimulationContext represented,
+                       final List<ProjectSettingsService.Step> allSteps) {
+               _my = represented;
+               _popup = ApplicationSettings.getPopupMenu("scontext");
+
+               SimulationContextType type = _my.getType();
+               for (Iterator<ProjectSettingsService.Step> i = allSteps.iterator(); i
+                               .hasNext();) {
+                       ProjectSettingsService.Step next = i.next();
+                       if (!type.isAttachedTo(next)) {
+                               continue;
+                       }
+                       _step = next.getNumber();
+                       break;
+               }
+               _state = _my.getProgressState(); // inCHECK or APPROVED
+               _name = type.getName();
+               if (type.isApproved()) {
+                       _name = ResourceBundle.getBundle("som",
+                                       ApplicationSettings.getCurrentLocale()).getString(
+                                       "type.context." + _name);
+               } else {
+                       _state = ProgressState.inDRAFT;
+               }
+       }
+
+       // ==============================================================================================================================
+       // Getters
+       // ==============================================================================================================================
+
+       public String getEditIcon() {
+
+               return "icon.ed" + _state + ".png";
+       }
+
+       public String getIndex() {
+               return String.valueOf(_my.getIndex());
+       }
+
+       public PopupMenu getPopup() {
+
+               _popup.setContext("scontext", this); // Cannot be done at construction because pop-ups are shared
+               return _popup;
+       }
+
+       public String getStateIcon() {
+               return "icon." + _state + ".png";
+       }
+
+       public String getStepNumber() {
+               return String.valueOf(_step);
+       }
+
+       public String getTypeName() {
+               return _name;
+       }
+
+       public String getValue() {
+               return _my.getValue();
+       }
+
+       public boolean isApproved() {
+               return (_state == ProgressState.APPROVED);
+       }
+
+       public boolean isEditable() {
+               return !_my.isShared();
+       }
+
+       public boolean isFacadeOf(final SimulationContext represented) {
+               return _my.equals(represented);
+       }
 }
\ No newline at end of file