From 9d5b424eba0a26fca39bbbd604863d5f7aafbbf8 Mon Sep 17 00:00:00 2001 From: rkv Date: Fri, 19 Apr 2013 14:28:09 +0000 Subject: [PATCH] Fix for display knowledge description. --- .../WebContent/jsp/knowledgeProperties.jsp | 66 ++++++------- .../WebContent/study/displayKnowledge.jsp | 25 +++-- .../splat/simer/DisplayKnowledgeAction.java | 97 +++++++++++++------ .../src/org/splat/simer/OpenKnowledge.java | 9 +- .../Siman/src/org/splat/simer/OpenStudy.java | 7 +- 5 files changed, 120 insertions(+), 84 deletions(-) diff --git a/Workspace/Siman/WebContent/jsp/knowledgeProperties.jsp b/Workspace/Siman/WebContent/jsp/knowledgeProperties.jsp index ef8f961..e21b8b2 100644 --- a/Workspace/Siman/WebContent/jsp/knowledgeProperties.jsp +++ b/Workspace/Siman/WebContent/jsp/knowledgeProperties.jsp @@ -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" -%> - -<% OpenKnowledge entity = (OpenKnowledge)session.getAttribute("knowledge.open"); -%> - -
-      -
- - - \ No newline at end of file + pageEncoding="ISO-8859-1"%> +<%@ taglib prefix="s" uri="/struts-tags"%> + + +
    
+ + + \ No newline at end of file diff --git a/Workspace/Siman/WebContent/study/displayKnowledge.jsp b/Workspace/Siman/WebContent/study/displayKnowledge.jsp index 518ddbb..22d02f7 100644 --- a/Workspace/Siman/WebContent/study/displayKnowledge.jsp +++ b/Workspace/Siman/WebContent/study/displayKnowledge.jsp @@ -1,12 +1,5 @@ <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> - - - - rel="stylesheet" type="text/css"> - - -
- - - +
+ + + + +
+
+ +
+   +
+
@@ -79,6 +81,3 @@ - - - \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java b/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java index 9503490..3de15dd 100644 --- a/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java +++ b/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java @@ -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 getDocuments() { - return _myknelm.getDisplayedDocuments(); + return _knelm.getDisplayedDocuments(); } public List getKnowledges() { - return _myknelm.getDisplayedKnowledges(); + return _knelm.getDisplayedKnowledges(); } public List 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 diff --git a/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java b/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java index b1ead94..fc28242 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java +++ b/Workspace/Siman/src/org/splat/simer/OpenKnowledge.java @@ -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; diff --git a/Workspace/Siman/src/org/splat/simer/OpenStudy.java b/Workspace/Siman/src/org/splat/simer/OpenStudy.java index 901495a..e983036 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenStudy.java +++ b/Workspace/Siman/src/org/splat/simer/OpenStudy.java @@ -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. -- 2.39.2