Salome HOME
Some PMD rules are satisfied.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / OpenKnowledge.java
index 7795dbe0508dac8a174723d15ee04eaa3dcf9195..b1ead94c35978abddb619d0706170c1b2e5ab967 100644 (file)
@@ -11,12 +11,13 @@ import org.splat.dal.bo.som.ProgressState;
 import org.splat.dal.bo.som.SimulationContext;
 import org.splat.service.dto.KnowledgeElementDTO;
 import org.splat.som.Step;
+import org.splat.wapp.Constants;
 import org.splat.wapp.SimpleMenu;
 
 /**
  * Open knowledge details for presentation.
  */
-public class OpenKnowledge extends OpenObject {
+public class OpenKnowledge extends AbstractOpenObject {
 
        /**
         * The open knowledge element DTO.
@@ -49,9 +50,9 @@ public class OpenKnowledge extends OpenObject {
                                        j = i + 1; // Steps are numbered from 1 to N
                                }
                                if (step.isStarted()) {
-                                       icon = "icon.done.png";
+                                       icon = Constants.IMG_DONE;
                                } else {
-                                       icon = "icon.empty.png";
+                                       icon = Constants.IMG_EMPTY;
                                }
                                addItem(String.valueOf(number), "folder.step." + number, icon,
                                                "step-knowledge?selection=" + number);
@@ -77,7 +78,8 @@ public class OpenKnowledge extends OpenObject {
                ResourceBundle custom = ResourceBundle.getBundle("som",
                                getApplicationSettings().getCurrentLocale());
                SimpleDateFormat convert = new SimpleDateFormat(custom
-                               .getString("date.format"));
+                               .getString("date.format"), getApplicationSettings()
+                               .getCurrentLocale());
                StringBuffer value = new StringBuffer(knelm.getValue());
                String sceneTitle = knelm.getScenarioTitle();
                String studyTitle = knelm.getStudyTitle();
@@ -87,20 +89,21 @@ public class OpenKnowledge extends OpenObject {
                // Preparation of the display
                _credate = convert.format(_myknelm.getDate());
                // involving = getAllSteps(knelm.getOwnerScenario());
-               involving = knelm.getInvolving();
-               context = new ArrayList<SimulationContextFacade>();
-               menu = new Menu(getInvolvedSteps());
-               selection = menu.getSelection(); // The default selection is set in the menu definition
-               int index = Integer.valueOf(selection);
-               for (Iterator<Step> i = involving.iterator(); i.hasNext();) {
+               _involving = knelm.getInvolving();
+               _context = new ArrayList<SimulationContextFacade>();
+               _menu = new Menu(getInvolvedSteps());
+               _selection = _menu.getSelection(); // The default selection is set in the menu definition
+               int index = Integer.valueOf(_selection);
+               for (Iterator<Step> i = _involving.iterator(); i.hasNext();) {
                        Step next = i.next();
                        if (next.getNumber() == index) {
-                               ustep = next;
+                               _ustep = next;
                        }
                        for (Iterator<SimulationContext> j = next
                                        .getAllSimulationContexts().iterator(); j.hasNext();) {
-                               context.add(new SimulationContextFacade(j.next(),
-                                               getProjectSettings().getAllSteps()));
+                               _context.add(new SimulationContextFacade(j.next(),
+                                               getProjectSettings().getAllSteps(),
+                                               getApplicationSettings()));
                        }
                }
                value.append("<p>").append("<b>").append(
@@ -110,7 +113,7 @@ public class OpenKnowledge extends OpenObject {
                                .append("\",").append("<br>")
                                .append(sceneTitle/* scene.getTitle() */).append(".").append(
                                                "</p>");
-               description = value.toString();
+               _description = value.toString();
                setupContents(); // Initializes documents and knowledge at ustep
                return this;
        }
@@ -133,7 +136,7 @@ public class OpenKnowledge extends OpenObject {
 
        @Override
        public Menu getMenu() {
-               return (Menu) menu;
+               return (Menu) _menu;
        }
 
        public ProgressState getProgressState() {
@@ -153,21 +156,23 @@ public class OpenKnowledge extends OpenObject {
        }
 
        public String getType() {
-               return ResourceBundle.getBundle("som",
-                               getApplicationSettings().getCurrentLocale()).getString(
-                               "type.knowledge." + _myknelm.getType().getName());
+               /*
+                * RKV: return ResourceBundle.getBundle("som", getApplicationSettings().getCurrentLocale()).getString( "type.knowledge." +
+                * _myknelm.getType().getName());
+                */
+               return "knowledge";
        }
 
        public void setSelection(final String step) {
-               selection = step;
-               int index = Integer.valueOf(selection);
-               for (Iterator<Step> i = involving.iterator(); i.hasNext();) {
-                       ustep = i.next();
-                       if (ustep.getNumber() == index) {
+               _selection = step;
+               int index = Integer.valueOf(_selection);
+               for (Iterator<Step> i = _involving.iterator(); i.hasNext();) {
+                       _ustep = i.next();
+                       if (_ustep.getNumber() == index) {
                                break;
                        }
                }
-               menu.selects(selection);
+               _menu.selects(_selection);
                setupContents(); // The contents may have changed even if the selection is the same
        }
 }
\ No newline at end of file