/**
* 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,
// Public member functions
// ==============================================================================================================================
+ /**
+ * Open the presentation subtree.
+ */
public void develop() {
if (_display == State.open) { // Opening the history of document, if exist
if (_history.isEmpty()) {
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();
}
_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";
_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) {
} 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 {
_history.add(new DocumentFacade(_owner, given, getProjectSettings(),
getPublicationService(), getApplicationSettings()));
if (versions != null) {
- collectHistory(versions.getTo());
+ this.collectHistory(versions.getTo());
}
}