Salome HOME
Some PMD rules are satisfied.
authorrkv <rkv@opencascade.com>
Wed, 27 Feb 2013 11:29:43 +0000 (11:29 +0000)
committerrkv <rkv@opencascade.com>
Wed, 27 Feb 2013 11:29:43 +0000 (11:29 +0000)
12 files changed:
Workspace/Siman/src/org/splat/simer/AbstractOpenObject.java
Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java
Workspace/Siman/src/org/splat/simer/ApplicationSettings.java
Workspace/Siman/src/org/splat/simer/DocumentFacade.java
Workspace/Siman/src/org/splat/simer/FileFacade.java
Workspace/Siman/src/org/splat/simer/KnowledgeElementFacade.java
Workspace/Siman/src/org/splat/simer/NewScenarioMenu.java
Workspace/Siman/src/org/splat/simer/OpenKnowledge.java
Workspace/Siman/src/org/splat/simer/OpenStudy.java
Workspace/Siman/src/org/splat/simer/StampFacade.java
Workspace/Siman/src/org/splat/simer/StudyMenu.java
Workspace/Siman/src/org/splat/wapp/Constants.java

index 5b67ecdfb8fe42fff5539c231c3002c518ebdc0d..c8a01c4bb2bc2b6e96740ff8e4ed1dc3ea9675d7 100644 (file)
@@ -33,11 +33,11 @@ public abstract class AbstractOpenObject implements Proxy {
        /**
         * Current open study step cache for presented documents.
         */
-       protected Map<Long, DocumentFacade> docpres = null;
+       protected transient Map<Long, DocumentFacade> _docpres = null;
        /**
         * Current open study step cache for presented knowledges.
         */
-       protected Map<Long, KnowledgeElementFacade> knowpres = null;
+       protected transient Map<Long, KnowledgeElementFacade> _knowpres = null;
 
        /**
         * Connected user.
@@ -127,11 +127,11 @@ public abstract class AbstractOpenObject implements Proxy {
 
        protected AbstractOpenObject() {
                // All member fields are supposed initialized by subclasses
-               if (docpres == null) {
-                       docpres = new HashMap<Long, DocumentFacade>();
+               if (_docpres == null) {
+                       _docpres = new HashMap<Long, DocumentFacade>();
                }
-               if (knowpres == null) {
-                       knowpres = new HashMap<Long, KnowledgeElementFacade>();
+               if (_knowpres == null) {
+                       _knowpres = new HashMap<Long, KnowledgeElementFacade>();
                }
        }
 
@@ -167,8 +167,8 @@ public abstract class AbstractOpenObject implements Proxy {
        }
 
        public void clearFacades() {
-               docpres.clear(); // For eventually reopening the knowledge from a fresh context
-               knowpres.clear(); // For eventually reopening the knowledge from a fresh context
+               _docpres.clear(); // For eventually reopening the knowledge from a fresh context
+               _knowpres.clear(); // For eventually reopening the knowledge from a fresh context
        }
 
        public List<Document> collectInvolvedDocuments(final DocumentType type) {
@@ -305,13 +305,13 @@ public abstract class AbstractOpenObject implements Proxy {
                                List<KnowledgeElementFacade> display = new ArrayList<KnowledgeElementFacade>(
                                                kelms.size());
                                while (current != null && current.getType().equals(type)) {
-                                       KnowledgeElementFacade facade = knowpres.get(current
+                                       KnowledgeElementFacade facade = _knowpres.get(current
                                                        .getIndex());
                                        if (facade == null) {
                                                facade = new KnowledgeElementFacade(BeanHelper
                                                                .copyBean(current, KnowledgeElementDTO.class),
                                                                getApplicationSettings());
-                                               knowpres.put(current.getIndex(), facade);
+                                               _knowpres.put(current.getIndex(), facade);
                                        }
                                        display.add(facade);
                                        if (more.hasNext()) {
@@ -333,12 +333,12 @@ public abstract class AbstractOpenObject implements Proxy {
                        for (Iterator<Publication> i = list.iterator(); i.hasNext();) {
                                Publication present = i.next();
                                Long index = present.getIndex();
-                               DocumentFacade facade = docpres.get(index);
+                               DocumentFacade facade = _docpres.get(index);
                                if (facade == null) {
                                        facade = new DocumentFacade(this, present,
                                                        getProjectSettings(), getPublicationService(),
                                                        getApplicationSettings());
-                                       docpres.put(index, facade);
+                                       _docpres.put(index, facade);
                                }
                                _contents.add(facade);
                        }
index 477a447674f4f49b87c30fe37ef50956528bf46f..0e76bbaa42d49e9a3a7a39146382826d7dd284f4 100644 (file)
@@ -102,7 +102,7 @@ public abstract class AbstractSearchBaseAction extends Action {
                } else if (_cvalue != null && Integer.valueOf(_cvalue) > 0) {
                        action = UserAction.selectContextValue;
                } else if (_cindex.length() > 0) {
-                       int index = Integer.valueOf(_cindex);
+                       long index = Long.valueOf(_cindex);
                        if (index > 0) {
                                action = UserAction.removeContext;
                        } else if (index < 0) {
@@ -148,7 +148,7 @@ public abstract class AbstractSearchBaseAction extends Action {
                                Integer.valueOf(_ctype));
                _newvalue = getSimulationContextService()
                                .selectSimulationContextsWhere(sprop.setType(_newtype));
-               if (_cindex.length() > 0 && Integer.valueOf(_cindex) == 0) {
+               if (_cindex.length() > 0 && Long.valueOf(_cindex) == 0) {
                        getSession().remove(RESULT_KEY);
                } else {
                        // We keep the previous result search, if valid
@@ -179,7 +179,7 @@ public abstract class AbstractSearchBaseAction extends Action {
         * @return "refresh"
         */
        protected String doRemoveContext() {
-               int index = Integer.valueOf(_cindex);
+               long index = Long.valueOf(_cindex);
                for (Iterator<SimulationContext> selected = _context.iterator(); selected
                                .hasNext();) {
                        if (selected.next().getIndex() == index) {
@@ -279,18 +279,42 @@ public abstract class AbstractSearchBaseAction extends Action {
        // Setters
        // ==============================================================================================================================
 
+       /**
+        * Set author id to search.
+        * 
+        * @param index
+        *            persistent user id
+        */
        public void setAuthor(final String index) {
                this._author = index;
        }
 
+       /**
+        * Set applied simulation context type id to search.
+        * 
+        * @param type
+        *            persistent simulation context type id
+        */
        public void setContextType(final String type) {
                this._ctype = type;
        }
 
+       /**
+        * Set value of simulation context to search.
+        * 
+        * @param value
+        *            the simulation context value
+        */
        public void setContextValue(final String value) {
                this._cvalue = value;
        }
 
+       /**
+        * Set simulation context value id.
+        * 
+        * @param value
+        *            the persistent id as string
+        */
        public void setContextIndex(final String value) {
                this._cindex = value;
        }
index 8a437cf28fc99cf3ccb1e0481106015a1f72d611..06b640ce694e4871ba985d65e79d5c43b924bbdc 100644 (file)
@@ -238,10 +238,6 @@ public class ApplicationSettings {
         * Mark as reference menu item name.
         */
        private static final String MNU_MARK_AS_REFERENCE = "markasreference";
-       /**
-        * Remove as reference menu item name.
-        */
-       private static final String MNU_REMOVE_AS_REFERENCE = "removeasreference";
        /**
         * Mark as reference menu item label key.
         */
index e7637d0d1ebd1831fd4fd8315d0c10acafc6266d..e112a482b52b2b045c09928905b93bb8d9c9aea3 100644 (file)
@@ -171,7 +171,7 @@ public class DocumentFacade implements HistoryFacade {
                _state = _my.getProgressState();
                _display = State.closed;
 
-               refresh(); // Initializes the presentation of my document
+               refresh(); // Initializes the presentation of my document //NOPMD:RKV: to be reviewed
        }
 
        /**
@@ -234,12 +234,12 @@ public class DocumentFacade implements HistoryFacade {
                                for (Iterator<Publication> i = relist.iterator(); i.hasNext();) {
                                        Publication used = i.next();
                                        long index = used.getIndex();
-                                       DocumentFacade facade = _owner.docpres.get(index);
+                                       DocumentFacade facade = _owner._docpres.get(index);
                                        if (facade == null) {
                                                facade = new DocumentFacade(_owner, used,
                                                                getProjectSettings(), getPublicationService(),
                                                                getApplicationSettings());
-                                               _owner.docpres.put(index, facade);
+                                               _owner._docpres.put(index, facade);
                                        }
                                        _uses.add(facade);
                                }
@@ -394,7 +394,7 @@ public class DocumentFacade implements HistoryFacade {
                _version = _my.getVersion(); // May be null
 
                initIcons();
-               
+
                // Document description
                VersionsRelation versions = (VersionsRelation) _my
                                .getFirstRelation(VersionsRelation.class);
index 0fd141d2bdd4f0ae20543ed261ae943b4468630f..0b5b484b11e899c22a741559be02987816b37f2e 100644 (file)
@@ -7,13 +7,16 @@ import java.util.ResourceBundle;
 
 import org.splat.dal.bo.som.ConvertsRelation;
 
+/**
+ * File representation class.
+ */
 public class FileFacade {
 
-       private String surl; // URL of the file
-       private final String format; // Extension of the file
-       private String comment; // Short description
-       private final String size;
-       private final String date;
+       private transient String _surl; // URL of the file
+       private transient final String _format; // Extension of the file
+       private transient String _comment; // Short description
+       private transient final String _size;
+       private transient final String _date;
 
        // ==============================================================================================================================
        // Constructor
@@ -29,16 +32,17 @@ public class FileFacade {
                DecimalFormat tostring = new DecimalFormat(custom
                                .getString("size.format")); // Locale size display format
                SimpleDateFormat convert = new SimpleDateFormat(custom
-                               .getString("date.format")); // Date display format
+                               .getString("date.format"), applicationSettings
+                               .getCurrentLocale()); // Date display format
 
-               surl = applicationSettings.getRepositoryURL() + path;
-               surl = surl.replaceAll("'", "\\\\'");
-               format = table[table.length - 1].toUpperCase();
-               size = tostring.format(export.length() / 1000);
-               date = convert.format(represented.getTo().getDate());
-               comment = represented.getDescription();
-               if (comment == null) {
-                       comment = "";
+               _surl = applicationSettings.getRepositoryURL() + path;
+               _surl = _surl.replaceAll("'", "\\\\'");
+               _format = table[table.length - 1].toUpperCase();
+               _size = tostring.format(export.length() / 1000);
+               _date = convert.format(represented.getTo().getDate());
+               _comment = represented.getDescription();
+               if (_comment == null) {
+                       _comment = "";
                }
        }
 
@@ -47,22 +51,22 @@ public class FileFacade {
        // ==============================================================================================================================
 
        public String getDate() {
-               return date;
+               return _date;
        }
 
        public String getDescription() {
-               return comment;
+               return _comment;
        }
 
        public String getFormat() {
-               return format;
+               return _format;
        }
 
        public String getSize() {
-               return size;
+               return _size;
        }
 
        public String getURL() {
-               return surl;
+               return _surl;
        }
 }
\ No newline at end of file
index 03265a43508588f7fb544e78a59668fda75e67ad..9c1787c7c4f081d031023be70189659985814991 100644 (file)
@@ -233,7 +233,7 @@ public class KnowledgeElementFacade {
         * @param applicationSettings
         *            the applicationSettings to set
         */
-       public void setApplicationSettings(
+       private void setApplicationSettings(
                        final ApplicationSettings applicationSettings) {
                _applicationSettings = applicationSettings;
        }
index 41eb3b4df4efb1e9d87273b14a12ee469751e820..572335063b5a3fe491cdaac07a2cdc458af85e01 100644 (file)
@@ -1,22 +1,39 @@
 package org.splat.simer;
 
+import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
 
 import org.splat.dal.bo.som.Scenario;
+import org.splat.dal.bo.som.Study;
 import org.splat.service.ProjectElementService;
 import org.splat.service.ScenarioService;
 import org.splat.som.Step;
-import org.splat.dal.bo.som.Study;
+import org.splat.wapp.Constants;
 import org.splat.wapp.MenuItem;
 import org.splat.wapp.SlidMenu;
 
 public class NewScenarioMenu extends SlidMenu {
 
-       private Study study;
-       private Scenario scopen; // Currently "open" scenario
-       private Step stopen; // Currently selected step
+       /**
+        * Currently "open" study.
+        */
+       private transient Study _study;
+       /**
+        * Currently "open" scenario.
+        */
+       private transient Scenario _scopen;
+       /**
+        * Currently selected step.
+        */
+       private transient Step _stopen;
+       /**
+        * Injected project element service.
+        */
        private ProjectElementService _projectElementService;
+       /**
+        * Injected scenario service.
+        */
        private ScenarioService _scenarioService;
 
        // ==============================================================================================================================
@@ -25,43 +42,44 @@ public class NewScenarioMenu extends SlidMenu {
 
        public NewScenarioMenu() {
                super("scenarii", "study");
-               scopen = null;
+               _scopen = null;
        }
 
-       public NewScenarioMenu init(Study context) {
-               study = context;
-               scopen = null;
+       public NewScenarioMenu init(final Study context) {
+               _study = context;
+               _scopen = null;
                init();
                return this;
        }
 
-       public NewScenarioMenu(Study context) {
-               // -----------------------------------
+       public NewScenarioMenu(final Study context) {
                super("scenarii", "study");
-               study = context;
-               scopen = null;
+               _study = context;
+               _scopen = null;
        }
 
        // ==============================================================================================================================
        // Member functions
        // ==============================================================================================================================
 
-       public void selects(String name) {
-               // ---------------------------------
+       @Override
+       public void selects(final String name) {
                String[] parse = name.split("\\x2E");
-               Scenario[] scenes = study.getScenarii();
-               Scenario scenew = scopen;
+               Scenario[] scenes = _study.getScenarii();
+               Scenario scenew = _scopen;
                int askid = 0;
 
                // Initialization
-               if (scenew == null && scenes.length == 1)
+               if (scenew == null && scenes.length == 1) {
                        scenew = scenes[0];
+               }
                try {
                        int askdex = Integer.valueOf(parse[0]);
                        if (askdex > 0) {
                                while (askid < scenes.length) {
-                                       if (scenes[askid].getIndex() == askdex)
+                                       if (scenes[askid].getIndex() == askdex) {
                                                break;
+                                       }
                                        askid += 1;
                                }
                                scenew = scenes[askid]; // Throws an exception if the scenario does not exist (that is, if name is not correct)
@@ -74,13 +92,14 @@ public class NewScenarioMenu extends SlidMenu {
                        // Study with several scenarii, non of them open
 
                        // Collection of steps to be displayed
-                       Vector<Step> steps = new Vector<Step>();
+                       List<Step> steps = new ArrayList<Step>();
                        Step[] newstep = getProjectElementService().getSteps(scenes[0]); // All scenarii have the same steps
 
-                       for (int i = 0; i < scenes.length; i++)
+                       for (int i = 0; i < scenes.length; i++) {
                                steps.add(getProjectElementService().getFirstStep(scenes[i]));
-                       newstep = getProjectElementService().getSteps(study);
-                       stopen = newstep[0]; // Default selected step
+                       }
+                       newstep = getProjectElementService().getSteps(_study);
+                       _stopen = newstep[0]; // Default selected step
 
                        // Creation of the menu
                        for (Iterator<Step> i = steps.iterator(); i.hasNext();) {
@@ -90,30 +109,34 @@ public class NewScenarioMenu extends SlidMenu {
                                long index = group.getIndex();
                                String value = index + "." + number;
                                String icon;
-                               if (getScenarioService().isEmpty(group))
-                                       icon = "icon.empty.png";
-                               // else if (group.isFinished()) icon = "icon.checked.png";
-                               else
-                                       icon = "icon.done.png";
-                               addGroup(value, group.getTitle(), icon,
-                                               "select-step?selection=" + value + "&title=%{title}");
+                               if (getScenarioService().isEmpty(group)) {
+                                       icon = Constants.IMG_EMPTY;
+                                       // else if (group.isFinished()) icon = Constants.IMG_CHECKED;
+                               } else {
+                                       icon = Constants.IMG_DONE;
+                               }
+                               addGroup(value, group.getTitle(), icon, getSelectStepUrl(value));
                        }
-               } else if (scopen == null || !scenew.equals(scopen)) {
+               } else if (_scopen == null || !scenew.equals(_scopen)) {
 
                        // Opening a scenario
                        this.clear();
                        // Collection of steps to be displayed
-                       Vector<Step> steps = new Vector<Step>();
+                       List<Step> steps = new ArrayList<Step>();
                        Step[] newstep = getProjectElementService().getSteps(scenew);
 
                        for (int i = 0; i < newstep.length; i++) {
                                steps.add(newstep[i]);
                        }
-                       for (int i = askid - 1; i > -1; i--)
-                               steps.add(0, getProjectElementService().getFirstStep(scenes[i]));
-                       newstep = getProjectElementService().getSteps(study);
-                       for (int i = askid + 1; i < scenes.length; i++)
+                       for (int i = askid - 1; i > -1; i--) {
+                               steps
+                                               .add(0, getProjectElementService().getFirstStep(
+                                                               scenes[i]));
+                       }
+                       newstep = getProjectElementService().getSteps(_study);
+                       for (int i = askid + 1; i < scenes.length; i++) {
                                steps.add(getProjectElementService().getFirstStep(scenes[i]));
+                       }
 
                        // Creation of the menu
                        boolean first = true; // For differentiating the first scenario step
@@ -122,52 +145,72 @@ public class NewScenarioMenu extends SlidMenu {
                                Step step = i.next();
                                int number = step.getNumber();
                                String icon;
-                               if (!step.isStarted())
-                                       icon = "icon.empty.png";
-                               else if (step.isFinished())
-                                       icon = "icon.checked.png";
-                               else
-                                       icon = "icon.done.png";
-                               if (number == askdex)
-                                       stopen = step;
+                               if (step.isStarted()) {
+                                       if (step.isFinished()) {
+                                               icon = Constants.IMG_CHECKED;
+                                       } else {
+                                               icon = Constants.IMG_DONE;
+                                       }
+                               } else {
+                                       icon = Constants.IMG_EMPTY;
+                               }
+                               if (number == askdex) {
+                                       _stopen = step;
+                               }
                                Scenario group = (Scenario) step.getOwner();
                                long index = group.getIndex();
                                String value = index + "." + number;
-                               if (index != scenew.getIndex()) {
-                                       if (getScenarioService().isEmpty(group))
-                                               icon = "icon.empty.png";
-                                       // else if (group.isFinished()) icon = "icon.checked.png";
-                                       else
-                                               icon = "icon.done.png";
-                                       addGroup(value, group.getTitle(), icon,
-                                                       "select-step?selection=" + value
-                                                                       + "&title=%{title}");
-                               } else if (first) {
-                                       addGroup(value, scenew.getTitle(), icon,
-                                                       "select-step?selection=" + value
-                                                                       + "&title=%{title}");
-                                       first = false;
+                               if (index == scenew.getIndex()) {
+                                       if (first) {
+                                               addGroup(value, scenew.getTitle(), icon,
+                                                               getSelectStepUrl(value));
+                                               first = false;
+                                       } else {
+                                               addSubItem(value, "menu.step." + number, icon,
+                                                               getSelectStepUrl(value));
+                                       }
                                } else {
-                                       addSubItem(value, "menu.step." + number, icon,
-                                                       "select-step?selection=" + value
-                                                                       + "&title=%{title}");
+                                       if (getScenarioService().isEmpty(group)) {
+                                               icon = Constants.IMG_EMPTY;
+                                               // else if (group.isFinished()) icon = Constants.IMG_CHECKED;
+                                       } else {
+                                               icon = Constants.IMG_DONE;
+                                       }
+                                       addGroup(value, group.getTitle(), icon,
+                                                       getSelectStepUrl(value));
                                }
                        }
-                       scopen = scenew;
+                       _scopen = scenew;
                }
                super.selects(name);
        }
 
+       /**
+        * Build URL for selecting a study step.
+        * 
+        * @param value
+        *            selection
+        * @return URL relative to the web application context, i.e. the part after http://host/siman/
+        */
+       private String getSelectStepUrl(final String value) {
+               return "select-step?selection=" + value + "&title=%{title}";
+       }
+
+       /**
+        * Refresh the icon of the selected menu item.
+        */
        public void refreshSelectedItem() {
-               // ----------------------------------
                MenuItem item = this.getSelectedItem();
                String icon;
-               if (!stopen.isStarted())
-                       icon = "icon.empty.png";
-               else if (stopen.isFinished())
-                       icon = "icon.checked.png";
-               else
-                       icon = "icon.done.png";
+               if (_stopen.isStarted()) {
+                       if (_stopen.isFinished()) {
+                               icon = Constants.IMG_CHECKED;
+                       } else {
+                               icon = Constants.IMG_DONE;
+                       }
+               } else {
+                       icon = Constants.IMG_EMPTY;
+               }
                item.icon(icon);
        }
 
@@ -186,7 +229,7 @@ public class NewScenarioMenu extends SlidMenu {
         * @param scenarioService
         *            the scenarioService to set
         */
-       public void setScenarioService(ScenarioService scenarioService) {
+       public void setScenarioService(final ScenarioService scenarioService) {
                _scenarioService = scenarioService;
        }
 
@@ -206,7 +249,7 @@ public class NewScenarioMenu extends SlidMenu {
         *            the projectElementService to set
         */
        public void setProjectElementService(
-                       ProjectElementService projectElementService) {
+                       final ProjectElementService projectElementService) {
                _projectElementService = projectElementService;
        }
 }
\ No newline at end of file
index 85ca1193849f7d7fc1361269a660de43d1f611cf..b1ead94c35978abddb619d0706170c1b2e5ab967 100644 (file)
@@ -11,6 +11,7 @@ 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;
 
 /**
@@ -49,9 +50,9 @@ public class OpenKnowledge extends AbstractOpenObject {
                                        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 AbstractOpenObject {
                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();
@@ -154,9 +156,10 @@ public class OpenKnowledge extends AbstractOpenObject {
        }
 
        public String getType() {
-               /*RKV: 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";
        }
 
index d0241558c138fba61c1601a58b9f90b21a7c63ee..6b467ae4dca0ac3b9a471dd56abd4685fc7741c4 100644 (file)
@@ -38,6 +38,7 @@ import org.splat.som.Step;
 import org.splat.som.StepRights;
 import org.splat.som.StudyRights;
 import org.splat.util.BeanHelper;
+import org.splat.wapp.Constants;
 import org.splat.wapp.ToolBar;
 
 /**
@@ -104,7 +105,8 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                ResourceBundle custom = ResourceBundle.getBundle("som",
                                getApplicationSettings().getCurrentLocale());
                SimpleDateFormat datstring = new SimpleDateFormat(custom
-                               .getString("date.format"));
+                               .getString("date.format"), getApplicationSettings()
+                               .getCurrentLocale());
                Revision.Format verstring = new Revision.Format(getProjectSettings()
                                .getRevisionPattern());
 
@@ -135,27 +137,28 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                        // if (state == ProgressState.inCHECK) popup = getApplicationSettings().getPopupMenu("stapprovable");
                        // else if (state == ProgressState.APPROVED) popup = getApplicationSettings().getPopupMenu("stapproved");
                        /* else */
-                       
+
                        if (_mystudy.getProgressState() == ProgressState.TEMPLATE) {
                                if (_mystudy.isPublic()) {
                                        _popup = getApplicationSettings().getPopupMenu(
-                                               "steditableunmarkprivate");
+                                                       "steditableunmarkprivate");
                                } else {
                                        _popup = getApplicationSettings().getPopupMenu(
                                                        "steditableunmarkpublic");
                                }
                        } else {
-                               
+
                                if (_mystudy.isPublic()) {
                                        _popup = getApplicationSettings().getPopupMenu(
-                                               "steditablemarkprivate");
+                                                       "steditablemarkprivate");
                                } else {
                                        _popup = getApplicationSettings().getPopupMenu(
                                                        "steditablemarkpublic");
                                }
 
                        }
-                       _popup.setContext("study", new StudyRights(_cuser, _mystudy));
+                       _popup.setContext(Constants.STUDY_MENU, new StudyRights(_cuser,
+                                       _mystudy));
                }
                _urightstudy = new StudyRights(_cuser, _mystudy);
                _urightstep = new StepRights(_cuser, _ustep);
@@ -239,7 +242,7 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                /*
                 * RKV: return ResourceBundle.getBundle("labels", getApplicationSettings().getCurrentLocale()).getString( "label.study");
                 */
-               return "study";
+               return Constants.STUDY_MENU;
        }
 
        public String getVersion() {
@@ -291,7 +294,8 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                        ResourceBundle locale = ResourceBundle.getBundle("som",
                                        getApplicationSettings().getCurrentLocale());
                        SimpleDateFormat get = new SimpleDateFormat(locale
-                                       .getString("date.format"));
+                                       .getString("date.format"), getApplicationSettings()
+                                       .getCurrentLocale());
                        Writer tool = Toolbox.getWriter(credoc);
                        List<Step> slist = getInvolvedSteps();
                        for (Iterator<Step> i = slist.iterator(); i.hasNext();) {
@@ -305,7 +309,7 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                                }
                        }
                        tool.updateProperty("reference", medoc.getReference());
-                       tool.updateProperty("study", _mystudy.getTitle());
+                       tool.updateProperty(Constants.STUDY_MENU, _mystudy.getTitle());
                        tool.updateProperty("step", locale.getString(
                                        "folder.step." + step.getNumber()).replaceAll("''", "'"));
                        tool.updateProperty("author", author.getUsername().toUpperCase());
@@ -361,7 +365,7 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                                getApplicationSettings());
                boolean first = (_contents.size() == 0);
 
-               docpres.put(doc.getIndex(), facade);
+               _docpres.put(doc.getIndex(), facade);
                _contents.add(0, facade); // Prepend the new publication
                if (first) {
                        this.getMenu().refreshSelectedItem();
@@ -392,7 +396,7 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                        }
                }
                if (known != null) { // RKV:End
-                       knowpres.put(kelm.getIndex(), facade);
+                       _knowpres.put(kelm.getIndex(), facade);
                        known._list.add(facade); // Insert the new knowledge at the end of the corresponding knowledge type
                }
        }
@@ -414,8 +418,10 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                _cuser = user;
                _popup = null;
                if (getStudyService().isStaffedBy(_mystudy, _cuser)) {
-                       _popup = getApplicationSettings().getPopupMenu("steditablemarkpublic");
-                       _popup.setContext("study", new StudyRights(_cuser, _mystudy));
+                       _popup = getApplicationSettings().getPopupMenu(
+                                       "steditablemarkpublic");
+                       _popup.setContext(Constants.STUDY_MENU, new StudyRights(_cuser,
+                                       _mystudy));
                }
                // ustep = getProjectElementService().getFirstStep(mystudy);
                if (_ustep != null) {
@@ -451,7 +457,7 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                        }
                }
                if (known != null) { // RKV:End
-                       knowpres.remove(kelm.getIndex());
+                       _knowpres.remove(kelm.getIndex());
                        for (Iterator<KnowledgeElementFacade> i = known._list.iterator(); i
                                        .hasNext();) {
                                KnowledgeElementFacade facade = i.next();
@@ -466,14 +472,14 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
        }
 
        protected void update(final Publication doc) {
-               DocumentFacade facade = docpres.get(doc.getIndex());
+               DocumentFacade facade = _docpres.get(doc.getIndex());
                if (facade != null) {
                        facade.refresh();
                }
        }
 
        protected void update(final KnowledgeElementDTO kelm) {
-               KnowledgeElementFacade facade = knowpres.get(kelm.getIndex());
+               KnowledgeElementFacade facade = _knowpres.get(kelm.getIndex());
                if (facade != null) {
                        facade.refresh(kelm);
                }
index 5c43387f6c0b337cada20c2fb5da9b76aad3da3b..c0991dec924318c5d6c93c5e8b86738195e84a18 100644 (file)
@@ -29,7 +29,7 @@ public class StampFacade implements HistoryFacade {
                ResourceBundle labels = ResourceBundle.getBundle("labels", locale);
                ResourceBundle custom = ResourceBundle.getBundle("som", locale);
                SimpleDateFormat convert = new SimpleDateFormat(custom
-                               .getString("date.format")); // Date display format
+                               .getString("date.format"), locale); // Date display format
                ValidationStep type = stamp.getType();
 
                _nonicon = "image.hold.gif";
index 3117d1c072cf7dc19775f3e382ea86f2429d06f4..d2238d2c1a6746939f2feb7d573e77312f76a903 100644 (file)
@@ -20,22 +20,6 @@ import org.splat.wapp.SlidMenu;
  */
 public class StudyMenu extends SlidMenu {
 
-       /**
-        * Empty element icon.
-        */
-       private static final String IMG_EMPTY = "icon.empty.png";
-       /**
-        * Checked element icon.
-        */
-       private static final String IMG_CHECKED = "icon.checked.png";
-       /**
-        * Finished element icon.
-        */
-       private static final String IMG_DONE = "icon.done.png";
-       /**
-        * Checked out element icon.
-        */
-       private static final String IMG_CHECKEDOUT = "icon.checkedout.png";
        /**
         * Selection URL.
         */
@@ -184,7 +168,7 @@ public class StudyMenu extends SlidMenu {
                                if (index == scenew.getIndex()) {
                                        if (first) {
                                                if (group.isCheckedout()) {
-                                                       icon = IMG_CHECKEDOUT;
+                                                       icon = Constants.IMG_CHECKEDOUT;
                                                }
                                                addGroup(value, scenew.getTitle(), icon, SELECTION_URL
                                                                + value);
@@ -251,12 +235,12 @@ public class StudyMenu extends SlidMenu {
        private void addItemsGroup(final Scenario group, final String value) {
                String icon;
                if (group.isCheckedout()) {
-                       icon = IMG_CHECKEDOUT;
+                       icon = Constants.IMG_CHECKEDOUT;
                } else if (getScenarioService().isEmpty(group)) {
-                       icon = IMG_EMPTY;
+                       icon = Constants.IMG_EMPTY;
                        // else if (group.isFinished()) icon = IMG_CHECKED;
                } else {
-                       icon = IMG_DONE;
+                       icon = Constants.IMG_DONE;
                }
                addGroup(value, group.getTitle(), icon, SELECTION_URL + value);
        }
@@ -320,12 +304,12 @@ public class StudyMenu extends SlidMenu {
                String icon;
                if (step.isStarted()) {
                        if (step.isFinished()) {
-                               icon = IMG_CHECKED;
+                               icon = Constants.IMG_CHECKED;
                        } else {
-                               icon = IMG_DONE;
+                               icon = Constants.IMG_DONE;
                        }
                } else {
-                       icon = IMG_EMPTY;
+                       icon = Constants.IMG_EMPTY;
                }
                return icon;
        }
@@ -349,7 +333,7 @@ public class StudyMenu extends SlidMenu {
                        String icon;
                        if (owner instanceof Scenario) {
                                if (range == 0 && ((Scenario) owner).isCheckedout()) {
-                                       icon = IMG_CHECKEDOUT;
+                                       icon = Constants.IMG_CHECKEDOUT;
                                }
                                range += 1;
                        }
index 308426bb7bccd2397ee993b5932b21a23e854ffa..e7f4e414de09ab87643416dcef557caf47170715 100644 (file)
@@ -62,4 +62,20 @@ public class Constants {
         * Left menu property "open".
         */
        public final static String OPEN = "open";
+       /**
+        * Empty element icon.
+        */
+       public static final String IMG_EMPTY = "icon.empty.png";
+       /**
+        * Checked element icon.
+        */
+       public static final String IMG_CHECKED = "icon.checked.png";
+       /**
+        * Finished element icon.
+        */
+       public static final String IMG_DONE = "icon.done.png";
+       /**
+        * Checked out element icon.
+        */
+       public static final String IMG_CHECKEDOUT = "icon.checkedout.png";
 }