Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Main : minor improvement open next doc when close currently openDoc

  • Loading branch information...
commit bb744ef8e4304d300fe3a415a1beffbf6179ae28 1 parent f51ba28
@cbonnissent authored
Showing with 46 additions and 6 deletions.
  1. +46 −6 chrome/dcpOffline/content/main.js
View
52 chrome/dcpOffline/content/main.js
@@ -76,11 +76,11 @@ function initListeners() {
updateOpenDocumentList);
applicationEvent.subscribe("postChangeSelectedDomain", updateDocManager);
applicationEvent.subscribe("changeSelectedDomain", updateFamilyList);
- applicationEvent.subscribe("changeSelectedDomain",updateAbstractList);
- applicationEvent.subscribe("postChangeSelectedDomain", tryToUpdateOpenFamily);
+ applicationEvent.subscribe("changeSelectedDomain", updateAbstractList);
+ applicationEvent.subscribe("postChangeSelectedDomain",
+ tryToUpdateOpenFamily);
applicationEvent.subscribe("postChangeSelectedDomain",
tryToUpdateCurrentDocument);
-
applicationEvent.subscribe("postChangeSelectedFamily", updateAbstractList);
applicationEvent.subscribe("postChangeSelectedFamily",
@@ -108,6 +108,8 @@ function initListeners() {
applicationEvent.subscribe("askForOpenDocument", tryToOpenDocument);
+ applicationEvent.subscribe("preCloseDocument", prepareClose);
+
applicationEvent.subscribe("closeDocument", removeDocumentFromOpenList);
applicationEvent.subscribe("postCloseDocument", closeDocument);
@@ -291,6 +293,11 @@ function tryToCloseDocument(param) {
} else {
applicationEvent.publish("closeDocument", param);
applicationEvent.publish("postCloseDocument", param);
+ if (param.openAfterClose) {
+ tryToOpenDocument({
+ documentId : param.openAfterClose
+ });
+ }
}
return true;
}
@@ -323,7 +330,6 @@ function tryToUpdateOpenFamily() {
setPrefCurrentSelectedFamily(true);
}
-
// IHM methods
/**
@@ -454,7 +460,7 @@ function updateFamilyList(config) {
document.getElementById("famDomainIdParam").textContent = config.domainId;
}
document.getElementById("familyList").builder.rebuild();
- //applicationEvent.publish("postUpdateFamilyList");
+ // applicationEvent.publish("postUpdateFamilyList");
}
/**
* update abstract list Private method : you should never use it
@@ -477,7 +483,7 @@ function updateAbstractList(config) {
}
document.getElementById("abstractList").builder.rebuild();
document.getElementById("abstractList").selectedIndex = -1;
- //applicationEvent.publish("postUpdateAbstractList");
+ // applicationEvent.publish("postUpdateAbstractList");
}
/**
* Update documentList IHM Private method : you should never use it
@@ -727,6 +733,40 @@ function setPrefCurrentOpenDocument(propagEvent) {
}
}
+function prepareClose(param) {
+ logIHM("prepareClose", param);
+
+ var currentDoc;
+ var currentDocs;
+ var stop = false;
+
+ if (param && param.documentId) {
+ currentDoc = getCurrentDocument();
+ if (param.documentId == currentDoc.documentId) {
+ currentDocs = getListOfOpenDocuments();
+ for (currentDocId in currentDocs) {
+ if (stop) {
+ param.openAfterClose = currentDocId;
+ return true;
+ }
+ if (currentDocId == param.documentId) {
+ stop = true;
+ }
+ }
+ if (!param.onAfterClose) {
+ for (currentDocId in currentDocs) {
+ break;
+ }
+ if (currentDocId != currentDoc.documentId) {
+ param.openAfterClose = currentDocId;
+ return true;
+ }
+ }
+ }
+ return true;
+ }
+}
+
/**
* Try to prepare the doc to be displayed Private method : you should never use
* it Can cancel the display if the document is not ready to be display (in
Please sign in to comment.
Something went wrong with that request. Please try again.