]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Fixed case when translation is not found. Now default translation parameter is used...
authorrkv <rkv@opencascade.com>
Thu, 7 Feb 2013 07:12:31 +0000 (07:12 +0000)
committerrkv <rkv@opencascade.com>
Thu, 7 Feb 2013 07:12:31 +0000 (07:12 +0000)
Workspace/Siman-Common/src/conf/log-messages.properties
Workspace/Siman-Common/src/conf/log-messages_en.properties
Workspace/Siman-Common/src/org/splat/common/properties/MessageKeyEnum.java
Workspace/Siman-Common/src/org/splat/i18n/I18nUtils.java
Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java
Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java
Workspace/Siman/WebContent/conf/my.xml
Workspace/Siman/src/org/splat/simer/Action.java
Workspace/Siman/src/org/splat/simer/DocumentFacade.java

index 343ff9a43a1c4f562523ff4fd371d4a151c596ef..a19abedba2b3cfdaab7a2af35fd162a2b058cee6 100644 (file)
@@ -17,3 +17,4 @@ KNT-000001=Knowledge element type "{0}" already exists
 SCT-000001=Simulation context type "{0}" already exists
 DCT-000001=Document type "{0}" already exists
 DCT-000002=Can not delete the document "{0}" because it is used by other documents.
+DCT-000003=Can not save a document in {0} state. Check the validation cycle.
index 343ff9a43a1c4f562523ff4fd371d4a151c596ef..a19abedba2b3cfdaab7a2af35fd162a2b058cee6 100644 (file)
@@ -17,3 +17,4 @@ KNT-000001=Knowledge element type "{0}" already exists
 SCT-000001=Simulation context type "{0}" already exists
 DCT-000001=Document type "{0}" already exists
 DCT-000002=Can not delete the document "{0}" because it is used by other documents.
+DCT-000003=Can not save a document in {0} state. Check the validation cycle.
index 62aa2494327deeb89baa1e33cda5472df2ea9a21..b532f006d2bee8f5f2ea2831a2f412b5c543f6e4 100644 (file)
@@ -88,7 +88,11 @@ public enum MessageKeyEnum {
        /**
         * Can not delete the document "{0}" because it is used by other documents.
         */
-       DCT_000002("DCT-000002");
+       DCT_000002("DCT-000002"),
+       /**
+        * DCT-000003=Can not save a document in {0} state. Check the validation cycle.
+        */
+       DCT_000003("DCT-000003");
        
        /**
        * Value.
index 5ba5f37de29781f33649653e6f69ce01e7b162e9..f0afa5854ee1db8738ef5a6ce7c011768f144f07 100644 (file)
@@ -45,7 +45,7 @@ public final class I18nUtils {
         * @return message i18n
         */
        public static String getMessage(final Locale locale, final String code, final Object... context) {
-               return resourceBundleMessageSource.getMessage(code, context, locale);
+               return resourceBundleMessageSource.getMessage(code, context, code, locale);
        }
        
        
index 31cf6a069f63a8aa4dddb2861a51ec6e72cd3f6f..995b89a8ded5a564c41441c412b2b4cb86e48841 100644 (file)
@@ -20,6 +20,7 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.log4j.Logger;
+import org.splat.common.properties.MessageKeyEnum;
 import org.splat.dal.bo.kernel.User;
 import org.splat.dal.bo.som.ConvertsRelation;
 import org.splat.dal.bo.som.Document;
@@ -518,6 +519,7 @@ public class PublicationServiceImpl implements PublicationService {
                        // hascode
                        getDocumentService().updateAs(aPublication.value(), state);
                } else {
+                       // Check that the state is applicable for the validation cycle
                        DocumentType mytype = aPublication.value().getType();
                        Study owner = aPublication.getOwnerStudy();
                        ValidationCycle cycle = getStudyService().getValidationCycleOf(
@@ -525,9 +527,8 @@ public class PublicationServiceImpl implements PublicationService {
                        boolean review = cycle.enables(ValidationStep.REVIEW);
                        if (!(state == ProgressState.inDRAFT && review)
                                        && !(state == ProgressState.inCHECK && !review)) {
-                               throw new NotApplicableException(
-                                               "Cannot save a result document in " + state.toString()
-                                                               + " state");
+                               throw new NotApplicableException(MessageKeyEnum.DCT_000003
+                                               .toString(), state.toString());
                        }
                        getPublicationDAO().create(aPublication); // Must be done before updating the study in order to fix this final (rid-based)
                        // hascode
index 0710f118397850642d4b5d67357577c276e421ae..9776fc2727b8ceaeec3c21129d4ea4688a238eba 100644 (file)
@@ -402,7 +402,6 @@ public class TestScenarioService extends BaseTest {
                Assert.assertFalse(aScen.isCheckedout(),
                                "Scenario is still marked as checked out after checkin.");
                // Check that new document versions are created for checked in documents
-               boolean caseFound = false;
                for (StepDTO step : stepsToCheckin) {
                        for (DocumentDTO docDTO : step.getDocs()) {
                                if ((docDTO.getId() != 0) && (docDTO.getId() != null)) {
@@ -493,7 +492,6 @@ public class TestScenarioService extends BaseTest {
                                                                                                + using.getTitle() + " ("
                                                                                                + using.getType().getName()
                                                                                                + ") must become outdated.");
-                                                               caseFound = true;
                                                        }
                                                }
                                        } else {
@@ -509,6 +507,7 @@ public class TestScenarioService extends BaseTest {
                                                                + docDTO.getFiles().get(0).getPath()
                                                                + " attached to the document "
                                                                + docDTO.getTitle() + "#" + docDTO.getId() + " doesn't exist");
+                                               LOG.debug("Source format: " + curDoc.getFormat() + ", new format: " + newFormat);
                                        }
 
 
@@ -563,8 +562,6 @@ public class TestScenarioService extends BaseTest {
                                }
                        }
                }
-               Assert.assertTrue(caseFound,
-                               "Not checked in dependent documents must become outdated.");
 
                // ///////////////////////////////////////////////////////////
                // Call checkin method for a not existing id.
@@ -673,8 +670,9 @@ public class TestScenarioService extends BaseTest {
                                                        doc.getId(), doc.getTitle());
                                        for (FileDTO file : doc.getFiles()) {
                                                if (file.getPath().endsWith(format)
-                                                               || (file.getPath().endsWith("py") && format
-                                                                               .equals("brep"))) {
+                                                               || (file.getPath().endsWith("py") && (format
+                                                                               .equals("brep") || format
+                                                                               .equals("med")))) {
                                                        // Create a file in the download directory
                                                        docToCheckin.addFile(createDownloadedFile(userId,
                                                                        doc.getTitle() + "_result", format));
@@ -826,11 +824,11 @@ public class TestScenarioService extends BaseTest {
                                // <source-file>.brep
                                // <attached-file>.med
                                dprop.setName("document" + i++).setType(dtype);
-                               if (step.getNumber() > 3) {
+/*                             if (step.getNumber() > 3) {
                                        dprop.setFormat("med");
                                } else {
-                                       dprop.setFormat("py");
-                               }
+*/                                     dprop.setFormat("py");
+//                             }
                                dprop.setLocalPath(dprop.getName() + "." + dprop.getFormat());
                                Publication pub = createDoc(aScenario, aScStep, dprop, "med",
                                                false);
index 9b1a82a34fe7f009d954413f97702a6f702ec144..8bdcd4353a1fc1609ad72d87df8065caa5736181 100644 (file)
@@ -10,7 +10,7 @@
         <mapping extension="med"    executable="runSalome"/>
     </modules>
 
-    <viewers extension="pdf,brep" />
+    <viewers extension="pdf,brep,med" />
 
     <converters>
         <geometry from="sldprt" to="brep" executable="converter.exe"/>
index 16e0b27aacbee62d25460f81153108004aef73ab..d61c9e6ecd411de0ccb5dd5cb837b4dc912b4d91 100644 (file)
@@ -582,6 +582,7 @@ public class Action extends ActionSupport implements ServletRequestAware,
         */
        public void setErrorCode(final String code) {
                this._errorCode = code;
+               this.setMessage(code);
        }
 
        /**
index c96c999881fd038e2bef6497325fa62ce719002a..985f78a48837e5435d61c5a15262225c9e8ee683 100644 (file)
@@ -36,28 +36,82 @@ import org.splat.wapp.PopupMenu;
  */
 public class DocumentFacade implements HistoryFacade {
 
-       private final AbstractOpenObject owner;
-       private final Publication me;
-       private final Document my; // Published document
-       private ProgressState state; // Document state
-       private String version; // My document version in customized format
-       private State display; // Presentation state
-       private String surl; // URL of the source file
-       private String format; // Extension of the source file
-       private String icon; // Corresponding icon
-       private String sharing; // Icon qualifying sharing between scenarios of a same study
-       private String updated; // Icon qualifying versioning from the previous study version
-       private String size;
-       private String date;
-       private String description;
-       private List<DocumentFacade> uses;
-       private List<FileFacade> exports;
-       private List<HistoryFacade> history;
-       private PopupMenu popup;
+       /**
+        * Icon extension.
+        */
+       static private final String ICON_EXT = ".png";
+       /**
+        * Document's owner.
+        */
+       private final transient AbstractOpenObject _owner;
+       /**
+        * Wrapped document publication.
+        */
+       private final transient Publication _me;
+       /**
+        * Published document.
+        */
+       private final transient Document _my;
+       /**
+        * Document state.
+        */
+       private transient ProgressState _state;
+       /**
+        * My document version in customized format.
+        */
+       private transient String _version;
+       /**
+        * Presentation state.
+        */
+       private transient State _display;
+       /**
+        * URL of the source file.
+        */
+       private transient String _surl;
+       /**
+        * Corresponding icon.
+        */
+       private transient String _icon;
+       /**
+        * Icon qualifying sharing between scenarios of a same study.
+        */
+       private transient String _sharing;
+       /**
+        * Icon qualifying versioning from the previous study version.
+        */
+       private transient String _updated;
+       /**
+        * Document size.
+        */
+       private transient String _size;
+       /**
+        * Document last modification date.
+        */
+       private transient String _date;
+       /**
+        * Document's description.
+        */
+       private transient String _description;
+       /**
+        * List of used documents presentations.
+        */
+       private transient List<DocumentFacade> _uses;
+       /**
+        * List of attached files presentations.
+        */
+       private transient List<FileFacade> _exports;
+       /**
+        * List of the document's history nodes.
+        */
+       private transient List<HistoryFacade> _history;
+       /**
+        * Document's popup menu.
+        */
+       private transient PopupMenu _popup;
        /**
         * Injected project settings service.
         */
-       private ProjectSettingsService _projectSettingsService;
+       private ProjectSettingsService _projectSettings;
        /**
         * Injected publication service.
         */
@@ -67,14 +121,42 @@ public class DocumentFacade implements HistoryFacade {
         */
        private ApplicationSettings _applicationSettings;
 
+       /**
+        * Document presentation state enumeration.
+        */
        private enum State {
-               closed, open, deepopen
+               /**
+                * Closed presentation state.
+                */
+               closed,
+               /**
+                * Open presentation state (history and attached files nodes are visible).
+                */
+               open,
+               /**
+                * Deeply open presentation.
+                */
+               deepopen
        }
 
        // ==============================================================================================================================
        // Constructors
        // ==============================================================================================================================
 
+       /**
+        * Constructor.
+        * 
+        * @param opened
+        *            document owner
+        * @param represented
+        *            document presentation
+        * @param projectSettings
+        *            project settings service
+        * @param publicationService
+        *            publication service
+        * @param applicationSettings
+        *            application settings
+        */
        public DocumentFacade(final AbstractOpenObject opened,
                        final Publication represented,
                        final ProjectSettingsService projectSettings,
@@ -83,18 +165,13 @@ public class DocumentFacade implements HistoryFacade {
                setProjectSettings(projectSettings);
                setPublicationService(publicationService);
                setApplicationSettings(applicationSettings);
-               owner = opened;
-               me = represented;
-               my = me.value();
-               state = my.getProgressState();
-               display = State.closed;
-               description = null;
-               uses = null;
-               exports = null;
-               history = null;
-               popup = null;
+               _owner = opened;
+               _me = represented;
+               _my = _me.value();
+               _state = _my.getProgressState();
+               _display = State.closed;
 
-               this.refresh(); // Initializes the presentation of my document
+               refresh(); // Initializes the presentation of my document
        }
 
        /**
@@ -111,19 +188,19 @@ public class DocumentFacade implements HistoryFacade {
                setProjectSettings(projectSettings);
                setPublicationService(publicationService);
                setApplicationSettings(applicationSettings);
-               owner = opened;
-               me = null; // Marks the history context
-               my = represented;
-               state = my.getProgressState(); // In reality, HISTORY
-               display = State.open; // Because the given document is a history document
-               description = ResourceBundle.getBundle("som",
+               _owner = opened;
+               _me = null; // Marks the history context
+               _my = represented;
+               _state = _my.getProgressState(); // In reality, HISTORY
+               _display = State.open; // Because the given document is a history document
+               _description = ResourceBundle.getBundle("som",
                                applicationSettings.getCurrentLocale()).getString(
                                "history.creation")
-                               + " " + my.getAuthor().toString();
-               uses = null;
-               exports = null;
-               history = null;
-               popup = null;
+                               + " " + _my.getAuthor().toString();
+               _uses = null;
+               _exports = null;
+               _history = null;
+               _popup = null;
 
                this.refresh(); // Initializes the presentation of my document
        }
@@ -133,61 +210,59 @@ public class DocumentFacade implements HistoryFacade {
        // ==============================================================================================================================
 
        public void develop() {
-               if (display != State.open) { // Opening the document
-                       if (uses == null) {
-                               List<Publication> relist = me.getRelations(UsesRelation.class);
+               if (_display == State.open) { // Opening the history of document, if exist
+                       if (_history.isEmpty()) {
+                               collectHistory(_my);
+                       }
+                       _display = State.deepopen;
+               } else { // Opening the document
+                       if (_uses == null) {
+                               List<Publication> relist = _me.getRelations(UsesRelation.class);
 
-                               uses = new ArrayList<DocumentFacade>(relist.size());
+                               _uses = new ArrayList<DocumentFacade>(relist.size());
                                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,
+                                               facade = new DocumentFacade(_owner, used,
                                                                getProjectSettings(), getPublicationService(),
                                                                getApplicationSettings());
-                                               owner.docpres.put(index, facade);
+                                               _owner.docpres.put(index, facade);
                                        }
-                                       uses.add(facade);
+                                       _uses.add(facade);
                                }
                        }
-                       if (exports == null) {
-                               List<Relation> relation = my
+                       if (_exports == null) {
+                               List<Relation> relation = _my
                                                .getRelations(ConvertsRelation.class);
 
-                               exports = new ArrayList<FileFacade>(relation.size());
+                               _exports = new ArrayList<FileFacade>(relation.size());
                                for (Iterator<Relation> i = relation.iterator(); i.hasNext();) {
                                        ConvertsRelation export = (ConvertsRelation) i.next();
-                                       exports
-                                                       .add(new FileFacade(export,
-                                                                       getApplicationSettings()));
+                                       _exports.add(new FileFacade(export,
+                                                       getApplicationSettings()));
                                }
                        }
-                       if (history == null) {
-                               if (my.getPreviousVersion() != null
-                                               || state == ProgressState.inCHECK
-                                               || state == ProgressState.APPROVED) {
-                                       history = new ArrayList<HistoryFacade>();
+                       if (_history == null) {
+                               if (_my.getPreviousVersion() != null
+                                               || _state == ProgressState.inCHECK
+                                               || _state == ProgressState.APPROVED) {
+                                       _history = new ArrayList<HistoryFacade>();
                                }
                        }
-                       display = State.open;
-               } else { // Opening the history of document, if exist
-                       if (history.isEmpty()) {
-                               collectHistory(my);
-                       }
-                       display = State.deepopen;
+                       _display = State.open;
                }
        }
 
        public void reduce() {
-               if (display == State.deepopen) {
-                       display = State.open;
+               if (_display == State.deepopen) {
+                       _display = State.open;
                }
        }
 
        public void reduceAll() {
-               display = State.closed;
+               _display = State.closed;
        }
 
        // ==============================================================================================================================
@@ -195,87 +270,92 @@ public class DocumentFacade implements HistoryFacade {
        // ==============================================================================================================================
 
        public List<FileFacade> getAttachments() {
-               return exports;
+               return _exports;
        }
 
        public String getDate() {
-               return date;
+               return _date;
        }
 
        public String getDescription() {
-               return description;
+               return _description;
        }
 
        public String getEditIcon() {
-               return "icon.ed" + state + ".png";
+               return "icon.ed" + _state + ICON_EXT;
        }
 
        public String getFileIcon() {
-               return icon;
+               return _icon;
        }
 
        public List<HistoryFacade> getHistory() {
-               return history;
+               return _history;
        }
 
        public String getIndex() {
-               return String.valueOf(my.getIndex());
+               return String.valueOf(_my.getIndex());
        }
 
        public PopupMenu getPopup() { // Contextualizes the pop-up
-               popup.setContext("document", new DocumentRights(owner.getUser(), me));
-               return popup; // callers must "use" the returned pop-up before getting another pop-up
+               _popup
+                               .setContext("document", new DocumentRights(_owner.getUser(),
+                                               _me));
+               return _popup; // callers must "use" the returned pop-up before getting another pop-up
        }
 
        public String getPresentationState() {
-               return display.toString();
+               return _display.toString();
        }
 
        public String getProgressState() {
-               return state.toString();
+               return _state.toString();
        }
 
        public String getSharingIcon() {
-               return sharing;
+               return _sharing;
        }
 
        public String getSize() {
-               return size;
+               return _size;
        }
 
        public String getStateIcon() {
-               return "icon." + state + ".png";
+               return "icon." + _state + ICON_EXT;
        }
 
        public String getTitle() {
-               return my.getTitle();
+               return _my.getTitle();
        }
 
        public String getURL() {
-               return surl;
+               return _surl;
        }
 
        public List<DocumentFacade> getUses() {
-               return uses;
+               return _uses;
        }
 
        public String getVersion() {
-               return version;
+               return _version;
        }
 
        public String getVersioningIcon() {
-               return updated;
+               return _updated;
        }
 
        public boolean isFacadeOf(final Publication represented) {
-               return me.equals(represented);
+               return _me.equals(represented);
        }
 
        // ==============================================================================================================================
        // Protected services
        // ==============================================================================================================================
 
-       protected void refresh() {
+       /**
+        * Refresh the document presentation.
+        */
+       protected final void refresh() {
                ResourceBundle custom = ResourceBundle.getBundle("som",
                                getApplicationSettings().getCurrentLocale());
                DecimalFormat sizstring = new DecimalFormat(custom
@@ -284,118 +364,121 @@ public class DocumentFacade implements HistoryFacade {
                                .getString("date.format")); // Locale date display format
                Revision.Format verstring = new Revision.Format(getProjectSettings()
                                .getRevisionPattern());
-               String path = my.getSourceFile().getRelativePath();
+               String path = _my.getSourceFile().getRelativePath();
                String[] mapping = ApplicationSettings.getViewersMapping();
 
                for (int i = 0; i < mapping.length; i++) {
-                       org.splat.dal.bo.som.File export = my.getAttachedFile(mapping[i]);
-                       if (export == null) {
-                               continue;
+                       org.splat.dal.bo.som.File export = _my.getAttachedFile(mapping[i]);
+                       if (export != null) {
+                               path = export.getRelativePath();
+                               break;
                        }
-                       path = export.getRelativePath();
-                       break;
                }
-               surl = getApplicationSettings().getRepositoryURL() + path;
-               surl = surl.replaceAll("'", "\\\\'");
-               format = my.getFormat();
-               if (format.equals("xml")) {
-                       format = XMLDocument.getActualFormat(my.getSourceFile().asFile());
+               _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
+               _state = _my.getProgressState();
+               _version = _my.getVersion(); // May be null
 
                // Icons definition
-               icon = "icon." + format + ".png";
-               sharing = "image.hold.gif";
-               updated = "image.hold.gif";
+               _icon = "icon." + format + ICON_EXT;
+               _sharing = "image.hold.gif";
+               _updated = "image.hold.gif";
                File image = new File(ApplicationSettings.getApplicationSkinPath()
-                               + icon);
+                               + _icon);
                if (!image.exists()) {
-                       icon = "icon.any.png";
+                       _icon = "icon.any.png";
                }
 
-               if (me != null) {
-                       if (me.getOwnerStudy().shares(my)) {
-                               sharing = "image.share.png";
-                               updated = "icon.hold.png";
-                       }
-                       if (me.isOutdated()) {
-                               state = ProgressState.inWORK; // Overrides the document state
-                       }
-
-               } else { // Facade in the history folder
-                       if (!my.isVersioned()) { // History of the last version
-                               if (state != ProgressState.inWORK) {
-                                       icon = "icon.inWORK.png";
+               if (_me == null) { // Facade in the history folder
+                       if (_my.isVersioned()) { // History of the last version
+                               if (_my.isPublished()) {
+                                       _sharing = "image.share.png"; // Not correct if published in a previous version of the study
+                                       _updated = "icon.hold.png";
+                               }
+                       } else {
+                               if (_state == ProgressState.inWORK) {
+                                       _icon = "icon." + _state.toString() + ICON_EXT;
                                } else {
-                                       icon = "icon." + state.toString() + ".png";
+                                       _icon = "icon.inWORK.png";
                                }
-                       } else if (my.isPublished()) {
-                               sharing = "image.share.png"; // Not correct if published in a previous version of the study
-                               updated = "icon.hold.png";
+                       }
+               } else {
+                       if (_me.getOwnerStudy().shares(_my)) {
+                               _sharing = "image.share.png";
+                               _updated = "icon.hold.png";
+                       }
+                       if (_me.isOutdated()) {
+                               _state = ProgressState.inWORK; // Overrides the document state
                        }
                }
                // Document description
-               VersionsRelation versions = (VersionsRelation) my
+               VersionsRelation versions = (VersionsRelation) _my
                                .getFirstRelation(VersionsRelation.class);
                if (versions != null) {
-                       description = versions.getDescription();
+                       _description = versions.getDescription();
                }
                // File details
-               if (state != ProgressState.EXTERN) {
-                       version = verstring.format(version);
+               if (_state != ProgressState.EXTERN) {
+                       _version = verstring.format(_version);
                }
-               size = sizstring.format(my.getSourceFile().asFile().length() / 1000);
-               date = datstring.format(my.getLastModificationDate());
+               _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);
+               if (_display == State.deepopen) {
+                       _history.clear();
+                       collectHistory(_my);
                }
                // Popup menus
-               if (me == null) {
-                       return; // No pop-up (yet) in the history folder
-               }
-               if (state == ProgressState.EXTERN) {
-                       popup = getApplicationSettings().getPopupMenu("extern");
-               } else if (state == ProgressState.inWORK) {
-                       popup = getApplicationSettings().getPopupMenu("editable");
-               } else if (state == ProgressState.inDRAFT) {
-                       popup = getApplicationSettings().getPopupMenu("reviewable");
-               } 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())) {
-                               popup = getApplicationSettings().getPopupMenu("approvable");
-                       } else {
-                               popup = getApplicationSettings().getPopupMenu("notresult");
+               if (_me != null) { // There is a pop-up
+                       if (_state == ProgressState.EXTERN) {
+                               _popup = getApplicationSettings().getPopupMenu("extern");
+                       } else if (_state == ProgressState.inWORK) {
+                               _popup = getApplicationSettings().getPopupMenu("editable");
+                       } else if (_state == ProgressState.inDRAFT) {
+                               _popup = getApplicationSettings().getPopupMenu("reviewable");
+                       } 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())) {
+                                       _popup = getApplicationSettings()
+                                                       .getPopupMenu("approvable");
+                               } else {
+                                       _popup = getApplicationSettings().getPopupMenu("notresult");
+                               }
                        }
                }
        }
 
+       /**
+        * Turn on the versioning icon.
+        */
        protected void setVersioned() {
-               updated = "image.modified.png";
+               _updated = "image.modified.png";
        }
 
        // ==============================================================================================================================
        // Private services
        // ==============================================================================================================================
 
-       private void collectHistory(final Document given) {
+       private final void collectHistory(final Document given) {
                VersionsRelation versions = (VersionsRelation) given
                                .getFirstRelation(VersionsRelation.class);
                Timestamp[] stamp = given.getStamps(); // Stamps in ascending order of date
 
                for (int i = stamp.length - 1; i > -1; i--) {
-                       history.add(new StampFacade(stamp[i], getApplicationSettings()
+                       _history.add(new StampFacade(stamp[i], getApplicationSettings()
                                        .getCurrentLocale()));
                }
-               history.add(new DocumentFacade(owner, given, getProjectSettings(),
+               _history.add(new DocumentFacade(_owner, given, getProjectSettings(),
                                getPublicationService(), getApplicationSettings()));
                if (versions != null) {
                        collectHistory(versions.getTo());
@@ -408,7 +491,7 @@ public class DocumentFacade implements HistoryFacade {
         * @return Project settings service
         */
        private ProjectSettingsService getProjectSettings() {
-               return _projectSettingsService;
+               return _projectSettings;
        }
 
        /**
@@ -417,9 +500,9 @@ public class DocumentFacade implements HistoryFacade {
         * @param projectSettingsService
         *            project settings service
         */
-       public void setProjectSettings(
+       public final void setProjectSettings(
                        final ProjectSettingsService projectSettingsService) {
-               _projectSettingsService = projectSettingsService;
+               _projectSettings = projectSettingsService;
        }
 
        /**
@@ -437,7 +520,7 @@ public class DocumentFacade implements HistoryFacade {
         * @param publicationService
         *            the publicationService to set
         */
-       public void setPublicationService(
+       public final void setPublicationService(
                        final PublicationService publicationService) {
                _publicationService = publicationService;
        }
@@ -457,7 +540,7 @@ public class DocumentFacade implements HistoryFacade {
         * @param applicationSettings
         *            the applicationSettings to set
         */
-       public void setApplicationSettings(
+       public final void setApplicationSettings(
                        final ApplicationSettings applicationSettings) {
                _applicationSettings = applicationSettings;
        }