From 4269fb3d9b84cb6e004d45c87cc1e102d599654c Mon Sep 17 00:00:00 2001 From: rkv Date: Wed, 27 Feb 2013 11:29:43 +0000 Subject: [PATCH] Some PMD rules are satisfied. --- .../org/splat/simer/AbstractOpenObject.java | 24 +-- .../splat/simer/AbstractSearchBaseAction.java | 30 ++- .../org/splat/simer/ApplicationSettings.java | 4 - .../src/org/splat/simer/DocumentFacade.java | 8 +- .../Siman/src/org/splat/simer/FileFacade.java | 42 ++-- .../splat/simer/KnowledgeElementFacade.java | 2 +- .../src/org/splat/simer/NewScenarioMenu.java | 185 +++++++++++------- .../src/org/splat/simer/OpenKnowledge.java | 15 +- .../Siman/src/org/splat/simer/OpenStudy.java | 38 ++-- .../src/org/splat/simer/StampFacade.java | 2 +- .../Siman/src/org/splat/simer/StudyMenu.java | 32 +-- .../Siman/src/org/splat/wapp/Constants.java | 16 ++ 12 files changed, 237 insertions(+), 161 deletions(-) diff --git a/Workspace/Siman/src/org/splat/simer/AbstractOpenObject.java b/Workspace/Siman/src/org/splat/simer/AbstractOpenObject.java index 5b67ecd..c8a01c4 100644 --- a/Workspace/Siman/src/org/splat/simer/AbstractOpenObject.java +++ b/Workspace/Siman/src/org/splat/simer/AbstractOpenObject.java @@ -33,11 +33,11 @@ public abstract class AbstractOpenObject implements Proxy { /** * Current open study step cache for presented documents. */ - protected Map docpres = null; + protected transient Map _docpres = null; /** * Current open study step cache for presented knowledges. */ - protected Map knowpres = null; + protected transient Map _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(); + if (_docpres == null) { + _docpres = new HashMap(); } - if (knowpres == null) { - knowpres = new HashMap(); + if (_knowpres == null) { + _knowpres = new HashMap(); } } @@ -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 collectInvolvedDocuments(final DocumentType type) { @@ -305,13 +305,13 @@ public abstract class AbstractOpenObject implements Proxy { List display = new ArrayList( 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 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); } diff --git a/Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java b/Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java index 477a447..0e76bba 100644 --- a/Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java +++ b/Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java @@ -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 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; } diff --git a/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java b/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java index 8a437cf..06b640c 100644 --- a/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java +++ b/Workspace/Siman/src/org/splat/simer/ApplicationSettings.java @@ -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. */ diff --git a/Workspace/Siman/src/org/splat/simer/DocumentFacade.java b/Workspace/Siman/src/org/splat/simer/DocumentFacade.java index e7637d0..e112a48 100644 --- a/Workspace/Siman/src/org/splat/simer/DocumentFacade.java +++ b/Workspace/Siman/src/org/splat/simer/DocumentFacade.java @@ -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 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); diff --git a/Workspace/Siman/src/org/splat/simer/FileFacade.java b/Workspace/Siman/src/org/splat/simer/FileFacade.java index 0fd141d..0b5b484 100644 --- a/Workspace/Siman/src/org/splat/simer/FileFacade.java +++ b/Workspace/Siman/src/org/splat/simer/FileFacade.java @@ -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 diff --git a/Workspace/Siman/src/org/splat/simer/KnowledgeElementFacade.java b/Workspace/Siman/src/org/splat/simer/KnowledgeElementFacade.java index 03265a4..9c1787c 100644 --- a/Workspace/Siman/src/org/splat/simer/KnowledgeElementFacade.java +++ b/Workspace/Siman/src/org/splat/simer/KnowledgeElementFacade.java @@ -233,7 +233,7 @@ public class KnowledgeElementFacade { * @param applicationSettings * the applicationSettings to set */ - public void setApplicationSettings( + private void setApplicationSettings( final ApplicationSettings applicationSettings) { _applicationSettings = applicationSettings; } diff --git a/Workspace/Siman/src/org/splat/simer/NewScenarioMenu.java b/Workspace/Siman/src/org/splat/simer/NewScenarioMenu.java index 41eb3b4..5723350 100644 --- a/Workspace/Siman/src/org/splat/simer/NewScenarioMenu.java +++ b/Workspace/Siman/src/org/splat/simer/NewScenarioMenu.java @@ -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 steps = new Vector(); + List steps = new ArrayList(); 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 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 steps = new Vector(); + List steps = new ArrayList(); 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 diff --git a/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java b/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java index 85ca119..b1ead94 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java +++ b/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java @@ -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"; } diff --git a/Workspace/Siman/src/org/splat/simer/OpenStudy.java b/Workspace/Siman/src/org/splat/simer/OpenStudy.java index d024155..6b467ae 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenStudy.java +++ b/Workspace/Siman/src/org/splat/simer/OpenStudy.java @@ -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 slist = getInvolvedSteps(); for (Iterator 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 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); } diff --git a/Workspace/Siman/src/org/splat/simer/StampFacade.java b/Workspace/Siman/src/org/splat/simer/StampFacade.java index 5c43387..c0991de 100644 --- a/Workspace/Siman/src/org/splat/simer/StampFacade.java +++ b/Workspace/Siman/src/org/splat/simer/StampFacade.java @@ -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"; diff --git a/Workspace/Siman/src/org/splat/simer/StudyMenu.java b/Workspace/Siman/src/org/splat/simer/StudyMenu.java index 3117d1c..d2238d2 100644 --- a/Workspace/Siman/src/org/splat/simer/StudyMenu.java +++ b/Workspace/Siman/src/org/splat/simer/StudyMenu.java @@ -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; } diff --git a/Workspace/Siman/src/org/splat/wapp/Constants.java b/Workspace/Siman/src/org/splat/wapp/Constants.java index 308426b..e7f4e41 100644 --- a/Workspace/Siman/src/org/splat/wapp/Constants.java +++ b/Workspace/Siman/src/org/splat/wapp/Constants.java @@ -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"; } -- 2.39.2