From: rkv Date: Thu, 7 Feb 2013 07:43:00 +0000 (+0000) Subject: Modified to respect some PMD rules. X-Git-Tag: Root_Delivery2_2013_04_22~143 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6dede3c9f3c30cb0aff1eeb2660fe8a6d9d3bcbe;p=tools%2Fsiman.git Modified to respect some PMD rules. --- diff --git a/Workspace/Siman/src/org/splat/simer/DocumentFacade.java b/Workspace/Siman/src/org/splat/simer/DocumentFacade.java index 985f78a..e7637d0 100644 --- a/Workspace/Siman/src/org/splat/simer/DocumentFacade.java +++ b/Workspace/Siman/src/org/splat/simer/DocumentFacade.java @@ -177,8 +177,16 @@ public class DocumentFacade implements HistoryFacade { /** * Constructs the facade of a document presented in the history folder. * + * @param opened + * document owner * @param represented - * the represented history document + * document presentation + * @param projectSettings + * project settings service + * @param publicationService + * publication service + * @param applicationSettings + * application settings */ private DocumentFacade(final AbstractOpenObject opened, final Document represented, @@ -209,6 +217,9 @@ public class DocumentFacade implements HistoryFacade { // Public member functions // ============================================================================================================================== + /** + * Open the presentation subtree. + */ public void develop() { if (_display == State.open) { // Opening the history of document, if exist if (_history.isEmpty()) { @@ -361,7 +372,8 @@ public class DocumentFacade implements HistoryFacade { DecimalFormat sizstring = new DecimalFormat(custom .getString("size.format")); // Locale size display format SimpleDateFormat datstring = new SimpleDateFormat(custom - .getString("date.format")); // Locale date display format + .getString("date.format"), getApplicationSettings() + .getCurrentLocale()); // Locale date display format Revision.Format verstring = new Revision.Format(getProjectSettings() .getRevisionPattern()); String path = _my.getSourceFile().getRelativePath(); @@ -376,16 +388,44 @@ public class DocumentFacade implements HistoryFacade { } _surl = getApplicationSettings().getRepositoryURL() + path; _surl = _surl.replaceAll("'", "\\\\'"); - String format = _my.getFormat(); - if ("xml".equals(format)) { - format = XMLDocument.getActualFormat(_my.getSourceFile().asFile()); - } // Document state (overridable by the publication - see below) _state = _my.getProgressState(); _version = _my.getVersion(); // May be null + initIcons(); + + // Document description + VersionsRelation versions = (VersionsRelation) _my + .getFirstRelation(VersionsRelation.class); + if (versions != null) { + _description = versions.getDescription(); + } + // File details + if (_state != ProgressState.EXTERN) { + _version = verstring.format(_version); + } + _size = sizstring.format(_my.getSourceFile().asFile().length() / 1000); + _date = datstring.format(_my.getLastModificationDate()); + + // Refresh of the history in case of promotion + if (_display == State.deepopen) { + _history.clear(); + this.collectHistory(_my); + } + initPopupMenu(); + } + + /** + * Initialize document presentation icons. + */ + private final void initIcons() { // Icons definition + String format = _my.getFormat(); + if ("xml".equals(format)) { + format = XMLDocument.getActualFormat(_my.getSourceFile().asFile()); + } + _icon = "icon." + format + ICON_EXT; _sharing = "image.hold.gif"; _updated = "image.hold.gif"; @@ -417,24 +457,12 @@ public class DocumentFacade implements HistoryFacade { _state = ProgressState.inWORK; // Overrides the document state } } - // Document description - VersionsRelation versions = (VersionsRelation) _my - .getFirstRelation(VersionsRelation.class); - if (versions != null) { - _description = versions.getDescription(); - } - // File details - if (_state != ProgressState.EXTERN) { - _version = verstring.format(_version); - } - _size = sizstring.format(_my.getSourceFile().asFile().length() / 1000); - _date = datstring.format(_my.getLastModificationDate()); + } - // Refresh of the history in case of promotion - if (_display == State.deepopen) { - _history.clear(); - collectHistory(_my); - } + /** + * Initialize document's popup menu. + */ + private final void initPopupMenu() { // Popup menus if (_me != null) { // There is a pop-up if (_state == ProgressState.EXTERN) { @@ -446,9 +474,9 @@ public class DocumentFacade implements HistoryFacade { } else if (_state == ProgressState.APPROVED) { _popup = getApplicationSettings().getPopupMenu("approved"); } else { // (state == ProgressState.inCHECK) - DocumentType mytype = _me.value().getType(); // Only result documents need to be approved - Step mystep = getPublicationService().getInvolvedStep(_me); - if (mytype.isResultOf(mystep.getStep())) { + DocumentType aType = _me.value().getType(); // Only result documents need to be approved + Step aStep = getPublicationService().getInvolvedStep(_me); + if (aType.isResultOf(aStep.getStep())) { _popup = getApplicationSettings() .getPopupMenu("approvable"); } else { @@ -481,7 +509,7 @@ public class DocumentFacade implements HistoryFacade { _history.add(new DocumentFacade(_owner, given, getProjectSettings(), getPublicationService(), getApplicationSettings())); if (versions != null) { - collectHistory(versions.getTo()); + this.collectHistory(versions.getTo()); } }