]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Fix for display knowledge description.
authorrkv <rkv@opencascade.com>
Fri, 19 Apr 2013 14:28:09 +0000 (14:28 +0000)
committerrkv <rkv@opencascade.com>
Fri, 19 Apr 2013 14:28:09 +0000 (14:28 +0000)
Workspace/Siman/WebContent/jsp/knowledgeProperties.jsp
Workspace/Siman/WebContent/study/displayKnowledge.jsp
Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java
Workspace/Siman/src/org/splat/simer/OpenKnowledge.java
Workspace/Siman/src/org/splat/simer/OpenStudy.java

index ef8f961a339c7deb74f6caff4b78fddbbd71c161..e21b8b277a8282920115f56532837e84194940f1 100644 (file)
@@ -1,37 +1,31 @@
 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
-    pageEncoding="ISO-8859-1"
-%>
-<%@ page import="org.splat.simer.OpenKnowledge"%>
-<%@
-    taglib prefix="s" uri="/struts-tags"
-%>
-<!-- Initialization of the context
-  -->
-<%  OpenKnowledge  entity = (OpenKnowledge)session.getAttribute("knowledge.open");
-%>
-<!-- Display of the properties tab
-  -->
-  <div id="tab-bar">
-    <span id="tab-front">&nbsp;&nbsp;<s:text name="title.properties"/>&nbsp;&nbsp;</span>
-  </div>
-  
-<!-- Display of properties
-  -->
-  <div id=menuitem-box>
-    <table border=0 cellspacing=0 cellpadding=0 class=text>
-      <tr height=2><td></td></tr>
-      <tr>
-        <td>&nbsp;<s:text name="label.reference"/>:&nbsp;</td>
-        <td><%=entity.getReference()%></td>
-      </tr>
-      <tr>
-        <td>&nbsp;<s:text name="label.author"/>:&nbsp;</td>
-        <td><%=entity.getAuthorName()%></td>
-      </tr>
-      <tr>
-        <td>&nbsp;<s:text name="label.created"/>:&nbsp;</td>
-        <td><%=entity.getDate()%></td>
-      </tr>
-      <tr height=2><td></td></tr>
-    </table>
-  </div>
\ No newline at end of file
+       pageEncoding="ISO-8859-1"%>
+<%@ taglib prefix="s" uri="/struts-tags"%>
+
+<!-- Display properties tab -->
+<div id="tab-bar"><span id="tab-front">&nbsp;&nbsp;<s:text
+       name="title.properties" />&nbsp;&nbsp;</span></div>
+
+<!-- Display properties -->
+<div id="menuitem-box">
+<table border="0" cellspacing="0" cellpadding="0" class="text">
+       <tr height="2">
+               <td></td>
+       </tr>
+       <tr>
+               <td>&nbsp;<s:text name="label.reference" />:&nbsp;</td>
+               <td><s:property value="knelm.reference" /></td>
+       </tr>
+       <tr>
+               <td>&nbsp;<s:text name="label.author" />:&nbsp;</td>
+               <td><s:property value="knelm.authorName" /></td>
+       </tr>
+       <tr>
+               <td>&nbsp;<s:text name="label.created" />:&nbsp;</td>
+               <td><s:property value="knelm.date" /></td>
+       </tr>
+       <tr height="2">
+               <td></td>
+       </tr>
+</table>
+</div>
\ No newline at end of file
index 518ddbb025ec3410f4bf49fe06d632af04cedde0..22d02f7411100e066ba7207ca020ee4005de415e 100644 (file)
@@ -1,12 +1,5 @@
 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
 <%@ taglib prefix="s" uri="/struts-tags"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-
-  <link href=<s:url value="/skin/default.css"/> rel="stylesheet" type="text/css">
-
-  <body>
-
 <!-- Description and simulation context sections
      =============================================================================================================================
 
           <td width=38%>     <!-- Must conform to the width of above tab-description -->
             <div id="top-spacer"></div>
             <div id=article-body class=text>
-              <jsp:include page="/jsp/readDescription.jsp">
-                <jsp:param name="entity" value="knowledge" />
-              </jsp:include>
+                         <div id="description_div">
+                           <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
+                             <tr valign="top">
+                             <td>
+                               <div id="description_value_div">
+                                 <s:property value="knelm.displayedDescription" escapeHtml="false"/>
+                               </div>
+                               &nbsp;
+                             </td>
+                           </tr> 
+                         </table>  
+                         </div>
             </div>
           </td>
 
@@ -79,6 +81,3 @@
         </div>
       </div>
       </s:if>
-
-  </body>
-</html>
\ No newline at end of file
index 95034900a3d5f99229915a17956c5821414057a8..3de15dd6dca09dd49caf07db1457dfe72ba03083 100644 (file)
@@ -7,6 +7,9 @@ import org.splat.service.dto.KnowledgeElementDTO;
 import org.splat.som.Step;
 import org.splat.wapp.Constants;
 
+/**
+ * Display the found knowledge action.
+ */
 public class DisplayKnowledgeAction extends AbstractDisplayAction {
 
        /**
@@ -17,43 +20,52 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction {
        /**
         * Current knowledge element details.
         */
-       protected transient OpenKnowledge _myknelm = null;
+       protected transient OpenKnowledge _knelm = null;
 
        /**
         * Injected knowledge element service.
         */
        private KnowledgeElementService _knowledgeElementService;
 
-       // ==============================================================================================================================
+       // =========================================================================
        // Action methods
-       // ==============================================================================================================================
+       // =========================================================================
 
+       /**
+        * Open the found knowledge element.
+        * 
+        * @return SUCCESS if succeeded otherwise return ERROR
+        */
        public String doOpen() {
-               _myknelm = getOpenKnowledge();
+               _knelm = getOpenKnowledge();
                if (_myindex == null) {
                        if (_selection != null) { // Re-opening (refreshing) the currently open knowledge
                                KnowledgeElementDTO kelm = getKnowledgeElementService()
-                                               .getKnowledgeElement(_myknelm.getIndex());
-                               _myknelm = open(kelm); // Closes the previously open knowledge
-                               _myknelm.setSelection(_selection);
+                                               .getKnowledgeElement(_knelm.getIndex());
+                               _knelm = open(kelm); // Closes the previously open knowledge
+                               _knelm.setSelection(_selection);
                        }
                } else {
                        try { // Opening a knowledge from the search result
                                int index = Integer.valueOf(_myindex);
-                               if (_myknelm != null && _myknelm.getIndex() == index) { // - The selected knowledge is currently open
-                                       _selection = _myknelm.getSelection(); // Current selection
+                               if (_knelm != null && _knelm.getIndex() == index) { // - The selected knowledge is currently open
+                                       if ((!getSession().containsKey(KNOWLEDGE_OPEN))
+                                                       || getSession().get(KNOWLEDGE_OPEN) == null) {
+                                               getSession().put(KNOWLEDGE_OPEN, getOpenKnowledge()); // for the case of reopening the
+                                       }
+                                       _selection = _knelm.getSelection(); // Current selection
                                } else { // - The selected knowledge is new
                                        KnowledgeElementDTO kelm = getKnowledgeElementService()
                                                        .getKnowledgeElement(index);
-                                       _myknelm = open(kelm);
-                                       _selection = _myknelm.getSelection(); // Default selection
+                                       _knelm = open(kelm);
+                                       _selection = _knelm.getSelection(); // Default selection
                                }
                        } catch (Exception error) {
                                LOG.error("Reason:", error);
                                return ERROR;
                        }
                }
-               getSession().put("menu.knowledge", _myknelm.getMenu());
+               getSession().put("menu.knowledge", _knelm.getMenu());
 
                initializationFullScreenContext(Constants.KNOWLEDGE_MENU,
                                Constants.KNOWLEDGE_MENU, Constants.FALSE, Constants.NONE,
@@ -62,13 +74,18 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction {
                return SUCCESS;
        }
 
+       /**
+        * Show the selected folder.
+        * 
+        * @return SUCCESS
+        */
        public String doSelectStep() {
-               _myknelm = getOpenKnowledge();
+               _knelm = getOpenKnowledge();
 
                if (_selection == null) { // Switch back to the current study
-                       _selection = _myknelm.getSelection();
+                       _selection = _knelm.getSelection();
                } else { // Selection of a step of current study
-                       _myknelm.setSelection(_selection);
+                       _knelm.setSelection(_selection);
                }
 
                initializationFullScreenContext(Constants.KNOWLEDGE_MENU,
@@ -78,15 +95,20 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction {
                return SUCCESS;
        }
 
+       /**
+        * Perform an operation on a selected document in the presentation area.
+        * 
+        * @return SUCCESS
+        */
        public String doSelectDocument() {
                Execute todo = Execute.valueOf(_action);
-               _myknelm = getOpenKnowledge();
+               _knelm = getOpenKnowledge();
                if (todo == Execute.develop) {
-                       _myknelm.developDocument(_myindex);
+                       _knelm.developDocument(_myindex);
                } else if (todo == Execute.reduce) {
-                       _myknelm.reduceHistory(_myindex);
+                       _knelm.reduceHistory(_myindex);
                } else if (todo == Execute.reduceall) {
-                       _myknelm.reduceDocument(_myindex);
+                       _knelm.reduceDocument(_myindex);
                }
 
                initializationFullScreenContext(Constants.KNOWLEDGE_MENU,
@@ -96,13 +118,18 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction {
                return SUCCESS;
        }
 
+       /**
+        * Perform an operation on a knowledge in the presentation area.
+        * 
+        * @return SUCCESS
+        */
        public String doSelectKnowledge() {
                Execute todo = Execute.valueOf(_action);
-               _myknelm = getOpenKnowledge();
+               _knelm = getOpenKnowledge();
                if (todo == Execute.develop) {
-                       _myknelm.developKnowledge(_myindex);
+                       _knelm.developKnowledge(_myindex);
                } else if (todo == Execute.reduce) {
-                       _myknelm.reduceKnowledge(_myindex);
+                       _knelm.reduceKnowledge(_myindex);
                }
 
                initializationFullScreenContext(Constants.KNOWLEDGE_MENU,
@@ -112,6 +139,11 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction {
                return SUCCESS;
        }
 
+       /**
+        * Close the knowledge.
+        * 
+        * @return SUCCESS
+        */
        public String doClose() {
                closeKnowledge();
 
@@ -120,24 +152,24 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction {
                return SUCCESS;
        }
 
-       // ==============================================================================================================================
+       // =========================================================================
        // Getters
-       // ==============================================================================================================================
+       // =========================================================================
 
        public List<DocumentFacade> getDocuments() {
-               return _myknelm.getDisplayedDocuments();
+               return _knelm.getDisplayedDocuments();
        }
 
        public List<AbstractOpenObject.KnowledgeIterator> getKnowledges() {
-               return _myknelm.getDisplayedKnowledges();
+               return _knelm.getDisplayedKnowledges();
        }
 
        public List<SimulationContextFacade> getSimulationContexts() {
-               return _myknelm.getDisplayedSimulationContexts();
+               return _knelm.getDisplayedSimulationContexts();
        }
 
        public Step getSelectedStep() {
-               return _myknelm.getSelectedStep();
+               return _knelm.getSelectedStep();
        }
 
        @Override
@@ -164,4 +196,13 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction {
                        final KnowledgeElementService knowledgeElementService) {
                _knowledgeElementService = knowledgeElementService;
        }
+
+       /**
+        * Get the knowledge element.
+        * 
+        * @return the knowledge element
+        */
+       public OpenKnowledge getKnelm() {
+               return _knelm;
+       }
 }
\ No newline at end of file
index b1ead94c35978abddb619d0706170c1b2e5ab967..fc28242ea08c11f2b809efab93bf63dbf417ed04 100644 (file)
@@ -156,12 +156,13 @@ public class OpenKnowledge extends AbstractOpenObject {
        }
 
        public String getType() {
-               /*
-                * RKV: return ResourceBundle.getBundle("som", getApplicationSettings().getCurrentLocale()).getString( "type.knowledge." +
-                * _myknelm.getType().getName());
-                */
                return "knowledge";
        }
+       
+       public String getTypeName() {
+               return ResourceBundle.getBundle("som", getApplicationSettings()
+                               .getCurrentLocale()).getString( "type.knowledge." + _myknelm.getType().getName());
+       }
 
        public void setSelection(final String step) {
                _selection = step;
index 901495af93ba1f777ce25c6fee101e8cef0175ae..e98303607e944d95593521a4d6c0ae1ffa6ccabf 100644 (file)
@@ -339,11 +339,12 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
         */
        @Override
        public String getType() {
-               /*
-                * RKV: return ResourceBundle.getBundle("labels", getApplicationSettings().getCurrentLocale()).getString( "label.study");
-                */
                return Constants.STUDY_MENU;
        }
+       
+       public String getTypeName() {
+               return ResourceBundle.getBundle("labels", getApplicationSettings().getCurrentLocale()).getString( "label.study");
+       }
 
        /**
         * Get the study version.