From: <se...@us...> - 2008-05-20 20:25:42
|
Revision: 152 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=152&view=rev Author: sem62 Date: 2008-05-20 13:25:50 -0700 (Tue, 20 May 2008) Log Message: ----------- Integrated rte.jar Modified Paths: -------------- WebEditor/resources/index.html WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java Modified: WebEditor/resources/index.html =================================================================== --- WebEditor/resources/index.html 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/resources/index.html 2008-05-20 20:25:50 UTC (rev 152) @@ -85,7 +85,7 @@ </tr> <tr height='*'> <td class='side-body'> - <applet mayscript="" name="webeditor" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar, dom4j.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> + <applet mayscript="" name="webeditor" archive="webeditor.jar,RTEValidators.jar,FFManifest.jar,dom4j.jar,rte.jar" code=edu.lnu.FireFly.WebEditor.WebEditor.class width="100%" height="100%"> <PARAM NAME="courseLocation" VALUE="http://127.0.0.1/sem/course/"> <PARAM NAME="serviceLocation" VALUE="http://127.0.0.1/sem/WebEditor/service/"> <PARAM NAME="templateLocation" VALUE="http://127.0.0.1/sem/WebEditor/template/"> Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/AppletWithApiHandle.java 2008-05-20 20:25:50 UTC (rev 152) @@ -2,6 +2,11 @@ import javax.swing.JApplet; +import edu.lnu.FireFly.Rte.Activity; +import edu.lnu.FireFly.Rte.Cmi; +import edu.lnu.FireFly.Rte.CmiManager; +import edu.lnu.FireFly.Rte.GlobalStateInformation; + /** * It is an Applet, but it contain API handlers. * @@ -14,43 +19,64 @@ private static final long serialVersionUID = 5396705469025038804L; public static boolean initialized = false; public static boolean terminated = false; - - static public String Initialize(String parameter) { + + public String Initialize(String parameter) { System.out.print("Initialize(" + parameter + ");\n"); + return "true"; } - static public String Terminate(String parameter) { + public String Terminate(String parameter) { System.out.print("Terminate(" + parameter + ");\n"); + return "true"; } - static public String GetValue(String parameter) { + public String GetValue(String parameter) { System.out.print("GetValue(" + parameter + ");\n"); - if (parameter.endsWith("completionStatus")) { - return "incomplete"; + Cmi cmi = getCmiModel(); + + if (parameter.toLowerCase().startsWith("cmi.")){ + return cmi.getValue(parameter.substring(4)); + } else { + return ""; } + } - return "6"; + private Cmi getCmiModel() { + + Activity activity = GlobalStateInformation.getCurrentActivity(); + + Cmi cmi = CmiManager.getInstance().getModelForActivity(activity); + return cmi; } - static public boolean SetValue(String parameter, String value) { + public boolean SetValue(String parameter, String value) { System.out.print("SetValue(" + parameter + ", " + value + ");\n"); - return true; + + Cmi cmi = getCmiModel(); + + if (parameter.toLowerCase().startsWith("cmi.")){ + cmi.setValue(parameter.substring(4), value); + return true; + } else { + return false; + } + } - static public String Commit(String parameter) { + public String Commit(String parameter) { System.out.print("Commit(" + parameter + ");\n"); return "true"; } - static public int GetLastError() { + public int GetLastError() { System.out.print("GetLastError();\n"); return 0; } - static public String GetErrorString(String parameter) { + public String GetErrorString(String parameter) { int code = Integer.parseInt(parameter); String result = ""; @@ -60,7 +86,7 @@ return result; } - static public String GetDiagnostic(String parameter) { + public String GetDiagnostic(String parameter) { System.out.print("GetDiagnostic(" + parameter + ");\n"); return ""; } Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/CourseTree.java 2008-05-20 20:25:50 UTC (rev 152) @@ -9,6 +9,8 @@ import edu.lnu.FireFly.FFManifest.item.Item; import edu.lnu.FireFly.FFManifest.resource.Resource; +import edu.lnu.FireFly.Rte.Activity; +import edu.lnu.FireFly.Rte.GlobalStateInformation; import edu.lnu.FireFly.WebEditor.GUI.TreeDataModel; public class CourseTree extends JTree implements TreeSelectionListener { @@ -38,6 +40,7 @@ public void valueChanged(TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() == null) { try { + GlobalStateInformation.setCurrentActivity(null); getAppletContext().showDocument( new URL(Settings.getInstance().getResourceLocation() + "/empty.htm"), "ContentFrame"); @@ -53,6 +56,9 @@ if (e.getNewLeadSelectionPath().getLastPathComponent().getClass() == Item.class) { Item item = (Item) e.getNewLeadSelectionPath() .getLastPathComponent(); + + GlobalStateInformation.setCurrentActivity(Activity.findActivityByIdentifier(item.identifier)); + try { Resource resource = WebEditor.instance.getManifest().resources .findResourceByIdentifier(item.identifierref); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/GUI/CourseTreePopupMenu.java 2008-05-20 20:25:50 UTC (rev 152) @@ -181,9 +181,9 @@ private void displayMenu(MouseEvent e) { if (e.isPopupTrigger()) { Point pt = e.getPoint(); - TreePath path = WebEditor.tree + TreePath path = WebEditor.getCourseTree() .getClosestPathForLocation(pt.x, pt.y); - WebEditor.tree.setSelectionPath(path); + WebEditor.getCourseTree().setSelectionPath(path); manifestItem = (TreeItem) path.getLastPathComponent(); ItemModel model = ItemModels.getModelFromItem(manifestItem); Modified: WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java =================================================================== --- WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-20 20:25:02 UTC (rev 151) +++ WebEditor/src/edu/lnu/FireFly/WebEditor/WebEditor.java 2008-05-20 20:25:50 UTC (rev 152) @@ -7,12 +7,12 @@ import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JScrollPane; -import javax.swing.JTree; import edu.lnu.FireFly.FFManifest.Manifest; import edu.lnu.FireFly.FFManifest.TreeItem; import edu.lnu.FireFly.FFManifest.parser.Parser; import edu.lnu.FireFly.FFManifest.parser.TestDocException; +import edu.lnu.FireFly.Rte.Activity; import edu.lnu.FireFly.WebEditor.Data.AutoSaveThread; import edu.lnu.FireFly.WebEditor.Data.ManifestFactory; import edu.lnu.FireFly.WebEditor.Data.SummaryPageManager; @@ -30,7 +30,7 @@ */ private static final long serialVersionUID = 1144429894709918030L; - public static JTree tree; + protected static CourseTree courseTree; public static WebEditor instance = null; @@ -85,6 +85,8 @@ ItemModels.synchronizeAllItemDatas(manifest.getRoot()); SummaryPageManager.getInstance().setManifest(manifest); + + Activity.fullUpdate(manifest); } public Manifest getManifest() { @@ -110,10 +112,10 @@ CreateNewCourse(); } - tree = new CourseTree(TreeDataModel.getInstance(), getAppletContext()); - this.add(new JScrollPane(tree)); + courseTree = new CourseTree(TreeDataModel.getInstance(), getAppletContext()); + this.add(new JScrollPane(courseTree)); - tree.addMouseListener(new CourseTreePopupMenu()); + courseTree.addMouseListener(new CourseTreePopupMenu()); } private void parseParameter() { @@ -149,6 +151,8 @@ model.synchronizeItemWithResource(root, "template"); SummaryPageManager.getInstance().updateSummaryPages(); + + Activity.fullUpdate(manifest); } catch (Exception e) { e.printStackTrace(); } @@ -179,4 +183,8 @@ // Install the menu bar in the frame this.setJMenuBar(menuBar); } + + public static CourseTree getCourseTree() { + return courseTree; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |