[sword-svn] r102 - in trunk: . app app/src/org/crosswire/flashcards src src/org src/org/crosswire src/org/crosswire/flashcards
Apache
apache at www.crosswire.org
Fri Dec 8 17:53:33 MST 2006
Author:
Date: 2006-12-08 17:53:32 -0700 (Fri, 08 Dec 2006)
New Revision: 102
Added:
trunk/app/src/org/crosswire/flashcards/ComplexLesson.java
trunk/app/src/org/crosswire/flashcards/ComplexLessonSet.java
trunk/src/
trunk/src/org/
trunk/src/org/crosswire/
trunk/src/org/crosswire/flashcards/
trunk/src/org/crosswire/flashcards/FlashCard.java
trunk/src/org/crosswire/flashcards/Lesson.java
trunk/src/org/crosswire/flashcards/LessonSet.java
Removed:
trunk/app/Flash.jpx.local
trunk/app/src/org/crosswire/flashcards/FlashCard.java
trunk/app/src/org/crosswire/flashcards/FlashCardRep.java
trunk/app/src/org/crosswire/flashcards/Lesson.java
trunk/app/src/org/crosswire/flashcards/LessonSet.java
Modified:
trunk/app/Flash.jpx
trunk/app/src/org/crosswire/flashcards/EditPane.java
trunk/app/src/org/crosswire/flashcards/EditorFrame.java
trunk/app/src/org/crosswire/flashcards/FlashCardEditor.java
trunk/app/src/org/crosswire/flashcards/FlashCardPane.java
trunk/app/src/org/crosswire/flashcards/LessonManager.java
trunk/app/src/org/crosswire/flashcards/LessonPane.java
trunk/app/src/org/crosswire/flashcards/LessonSetPane.java
trunk/app/src/org/crosswire/flashcards/QuizPane.java
trunk/app/src/org/crosswire/flashcards/SetupPane.java
Log:
Start of separation of fundamental functionality from more complex impl for desktops
Modified: trunk/app/Flash.jpx
===================================================================
--- trunk/app/Flash.jpx 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/Flash.jpx 2006-12-09 00:53:32 UTC (rev 102)
@@ -1,176 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--JBuilder XML Project-->
<project>
- <property category="debug.0" name="SmartStepRedefineClasses" value="0"/>
- <property category="debug.0" name="SmartStepSkipStaticInitializers" value="0"/>
- <property category="debug.0" name="SmartStepSkipSynthetics" value="0"/>
- <property category="generalFormatting" name="blockIndent" value="5"/>
- <property category="generalFormatting" name="continuationIndent" value="10"/>
- <property category="generalFormatting" name="tabSize" value="5"/>
- <property category="generalFormatting2" name="blockIndent" value="5"/>
- <property category="generalFormatting2" name="continuationIndent" value="10"/>
- <property category="generalFormatting2" name="tabSize" value="5"/>
- <property category="java.sapient" name="ACE" value="false"/>
- <property category="java.sapient" name="AFLV" value="true"/>
- <property category="java.sapient" name="AFP" value="false"/>
- <property category="java.sapient" name="ASMDCN" value="true"/>
- <property category="java.sapient" name="ASMO" value="true"/>
- <property category="java.sapient" name="BSMC" value="true"/>
- <property category="java.sapient" name="BTJC" value="false"/>
- <property category="java.sapient" name="CA" value="false"/>
- <property category="java.sapient" name="CEV" value="false"/>
- <property category="java.sapient" name="CFPV" value="false"/>
- <property category="java.sapient" name="CIUCFL" value="true"/>
- <property category="java.sapient" name="CQS" value="false"/>
- <property category="java.sapient" name="CSR" value="true"/>
- <property category="java.sapient" name="CVSBF" value="true"/>
- <property category="java.sapient" name="EIAV" value="false"/>
- <property category="java.sapient" name="EJB_CL" value="false"/>
- <property category="java.sapient" name="EJB_CONSOLE" value="false"/>
- <property category="java.sapient" name="EJB_ENTITY" value="false"/>
- <property category="java.sapient" name="EJB_FDESCR" value="false"/>
- <property category="java.sapient" name="EJB_FILES" value="false"/>
- <property category="java.sapient" name="EJB_HOME" value="false"/>
- <property category="java.sapient" name="EJB_IO" value="false"/>
- <property category="java.sapient" name="EJB_JDBC" value="false"/>
- <property category="java.sapient" name="EJB_MESSAGE" value="false"/>
- <property category="java.sapient" name="EJB_NAMES" value="false"/>
- <property category="java.sapient" name="EJB_NATIVE" value="false"/>
- <property category="java.sapient" name="EJB_OBJECT" value="false"/>
- <property category="java.sapient" name="EJB_REFL" value="false"/>
- <property category="java.sapient" name="EJB_SEC" value="false"/>
- <property category="java.sapient" name="EJB_SECOBJ" value="false"/>
- <property category="java.sapient" name="EJB_SESSION" value="false"/>
- <property category="java.sapient" name="EJB_SFACT" value="false"/>
- <property category="java.sapient" name="EJB_SOCKET" value="false"/>
- <property category="java.sapient" name="EJB_SUBST" value="false"/>
- <property category="java.sapient" name="EJB_THREADS" value="false"/>
- <property category="java.sapient" name="EOBA" value="true"/>
- <property category="java.sapient" name="EVC" value="true"/>
- <property category="java.sapient" name="HIF" value="true"/>
- <property category="java.sapient" name="HISM" value="true"/>
- <property category="java.sapient" name="HN" value="true"/>
- <property category="java.sapient" name="ICSBF" value="false"/>
- <property category="java.sapient" name="IFM" value="true"/>
- <property category="java.sapient" name="ILC" value="false"/>
- <property category="java.sapient" name="IMCM" value="true"/>
- <property category="java.sapient" name="IMMD" value="true"/>
- <property category="java.sapient" name="LF" value="false"/>
- <property category="java.sapient" name="LMC" value="false"/>
- <property category="java.sapient" name="LNU" value="true"/>
- <property category="java.sapient" name="MCP" value="true"/>
- <property category="java.sapient" name="MCS" value="true"/>
- <property category="java.sapient" name="MLOWP" value="false"/>
- <property category="java.sapient" name="MNU" value="true"/>
- <property category="java.sapient" name="MSOL" value="true"/>
- <property category="java.sapient" name="MVDSN" value="false"/>
- <property category="java.sapient" name="NC" value="true"/>
- <property category="java.sapient" name="NCLS" value="true"/>
- <property category="java.sapient" name="NFSF" value="false"/>
- <property category="java.sapient" name="NLC" value="false"/>
- <property category="java.sapient" name="NOIS" value="false"/>
- <property category="java.sapient" name="ODCM" value="false"/>
- <property category="java.sapient" name="OHCE" value="true"/>
- <property category="java.sapient" name="OIM" value="true"/>
- <property category="java.sapient" name="ONAMAM" value="true"/>
- <property category="java.sapient" name="ONE" value="true"/>
- <property category="java.sapient" name="OPM" value="true"/>
- <property category="java.sapient" name="OSNBU" value="false"/>
- <property category="java.sapient" name="OWS" value="false"/>
- <property category="java.sapient" name="PCO" value="true"/>
- <property category="java.sapient" name="PDBB" value="false"/>
- <property category="java.sapient" name="PFC" value="false"/>
- <property category="java.sapient" name="PIFS" value="false"/>
- <property category="java.sapient" name="PJDC" value="false"/>
- <property category="java.sapient" name="PMSNT" value="false"/>
- <property category="java.sapient" name="PN" value="false"/>
- <property category="java.sapient" name="PPA" value="false"/>
- <property category="java.sapient" name="PPCF" value="true"/>
- <property category="java.sapient" name="PSIB" value="true"/>
- <property category="java.sapient" name="RIP" value="false"/>
- <property category="java.sapient" name="SBC" value="true"/>
- <property category="java.sapient" name="SEB" value="false"/>
- <property category="java.sapient" name="SL" value="false"/>
- <property category="java.sapient" name="SSSIDC" value="false"/>
- <property category="java.sapient" name="SU" value="true"/>
- <property category="java.sapient" name="TMSSC" value="false"/>
- <property category="java.sapient" name="UAAO" value="true"/>
- <property category="java.sapient" name="UC" value="true"/>
- <property category="java.sapient" name="UCVN" value="false"/>
- <property category="java.sapient" name="UE" value="true"/>
- <property category="java.sapient" name="UL" value="true"/>
- <property category="java.sapient" name="ULVFP" value="true"/>
- <property category="java.sapient" name="UMM" value="true"/>
- <property category="java.sapient" name="URSP" value="true"/>
- <property category="java.sapient" name="enable" value="1"/>
- <property category="javaFormatting" name="alwaysClasses" value="1"/>
- <property category="javaFormatting" name="blankLinesAfterClass" value="2"/>
- <property category="javaFormatting" name="blankLinesAfterImports" value="2"/>
- <property category="javaFormatting" name="blankLinesAfterMethod" value="2"/>
- <property category="javaFormatting" name="packagePrefixGroups" value="java;javax;BLANK_LINE;java.awt;javax.swing;BLANK_LINE;org;(*)"/>
- <property category="javaFormatting" name="preserveLineBreaks" value="0"/>
- <property category="javaFormatting" name="wrapAtColumn" value="120"/>
- <property category="module" name="ProjectConvertedToEnsureModulesHaveSupportedFeatures" value="1"/>
- <property category="module" name="ProjectConvertedToUseFilesAndDependenciesAsDefaultContent" value="1"/>
- <property category="module" name="ProjectConvertedToUseProperModuleDefaults" value="1"/>
- <property category="module" name="projectConvertedFromModuleExtensionsToModuleFileTypes" value="1"/>
- <property category="personality" name="personality" value=""/>
- <property category="runtime" name="DefaultConfiguration" value="-1"/>
- <property category="runtime.0" name="BuildTargetOnRun" value="com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make"/>
- <property category="runtime.0" name="ConfigurationName" value="Quiz"/>
- <property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner"/>
- <property category="runtime.0" name="application.class" value="org.crosswire.flashcards.Quiz"/>
- <property category="serverservices" name="disabled.services" value="jdatastore"/>
- <property category="serverservices" name="single.server.name" value="Tomcat 4.1"/>
- <property category="sys" name="AuthorLabel" value="@author"/>
- <property category="sys" name="Autorefresh" value="1"/>
- <property category="sys" name="BackupPath" value="bak"/>
- <property category="sys" name="CheckStable" value="1"/>
- <property category="sys" name="Company" value=""/>
- <property category="sys" name="CompanyLabel" value="Company:"/>
- <property category="sys" name="Copyright" value="Copyright (c) 2003"/>
- <property category="sys" name="CopyrightLabel" value="Copyright:"/>
- <property category="sys" name="DefaultPath" value="src"/>
- <property category="sys" name="Description" value=""/>
- <property category="sys" name="DescriptionLabel" value="Description:"/>
- <property category="sys" name="DocPath" value="doc"/>
- <property category="sys" name="ExcludeClassEnabled" value="0"/>
- <property category="sys" name="IncludeTestPath" value="1"/>
- <property category="sys" name="InstanceVisibility" value="2"/>
- <property category="sys" name="JDK" value="java version 1.4.2_04-b05"/>
- <property category="sys" name="JbxEventListener0" value="org.crosswire.flashcards.FlashCardEventListener"/>
- <property category="sys" name="JbxEventListener1" value="org.crosswire.flashcards.FlashCardEventListener"/>
- <property category="sys" name="JvmVersion" value="1.4"/>
- <property category="sys" name="LastTag" value="0"/>
- <property category="sys" name="Libraries" value="../../../Documents and Settings/scribe/Application Data/Sun/Java/Deployment/javaws/cache/http/Dwww.crosswire.org/P80/DMflashcards/DMwebstart/RMlessons.jar"/>
- <property category="sys" name="MakeStable" value="0"/>
- <property category="sys" name="OutPath" value="classes"/>
- <property category="sys" name="SourcePath" value="src;test;../jsword-old/apps/ModEdit/src"/>
- <property category="sys" name="SourceVersion" value="1.4"/>
- <property category="sys" name="TestPath" value="test"/>
- <property category="sys" name="Title" value=""/>
- <property category="sys" name="TitleLabel" value="Title:"/>
- <property category="sys" name="Version" value="1.0"/>
- <property category="sys" name="VersionLabel" value="@version"/>
- <property category="sys" name="WorkingDirectory" value="."/>
- <property category="sys" name="palette.bean.chooser.beans" value="org.crosswire.modedit.UniTextEdit;"/>
- <node name="Flash" type="Archive">
- <property category="archiving" name="archiverClass" value="com.borland.jbuilder.wizard.archive.ApplicationArchiver"/>
- <property category="archiving" name="contentRules.1" value="I:**/*.*"/>
- <property category="archiving" name="manifestConfigFile" value="0"/>
- <property category="archiving" name="targetPath" value="Flash.jar"/>
- <property category="archiving" name="usingRules" value="1"/>
- </node>
- <node name="FlashEditor" type="Archive">
- <property category="archiving" name="archiverClass" value="com.borland.jbuilder.wizard.archive.ApplicationArchiver"/>
- <property category="archiving" name="contentRules.1" value="I:**/*.*"/>
- <property category="archiving" name="manifestMainClass" value="org.crosswire.flashcards.Editor"/>
- <property category="archiving" name="targetPath" value="FlashEditor.jar"/>
- <property category="archiving" name="usingRules" value="1"/>
- </node>
- <file path="../build.xml">
- <property category="ant" name="displayrelativepath" value="0"/>
- <property category="ant" name="loglevel" value="-debug"/>
- <property category="ant" name="usebmj" value="0"/>
- </file>
+<property category="debug.0" name="SmartStepRedefineClasses" value="0"/>
+<property category="debug.0" name="SmartStepSkipStaticInitializers" value="0"/>
+<property category="debug.0" name="SmartStepSkipSynthetics" value="0"/>
+<property category="generalFormatting" name="blockIndent" value="5"/>
+<property category="generalFormatting" name="continuationIndent" value="10"/>
+<property category="generalFormatting" name="tabSize" value="5"/>
+<property category="generalFormatting2" name="blockIndent" value="5"/>
+<property category="generalFormatting2" name="continuationIndent" value="10"/>
+<property category="generalFormatting2" name="tabSize" value="5"/>
+<property category="java.sapient" name="ACE" value="false"/>
+<property category="java.sapient" name="AFLV" value="true"/>
+<property category="java.sapient" name="AFP" value="false"/>
+<property category="java.sapient" name="ASMDCN" value="true"/>
+<property category="java.sapient" name="ASMO" value="true"/>
+<property category="java.sapient" name="BSMC" value="true"/>
+<property category="java.sapient" name="BTJC" value="false"/>
+<property category="java.sapient" name="CA" value="false"/>
+<property category="java.sapient" name="CEV" value="false"/>
+<property category="java.sapient" name="CFPV" value="false"/>
+<property category="java.sapient" name="CIUCFL" value="true"/>
+<property category="java.sapient" name="CQS" value="false"/>
+<property category="java.sapient" name="CSR" value="true"/>
+<property category="java.sapient" name="CVSBF" value="true"/>
+<property category="java.sapient" name="EIAV" value="false"/>
+<property category="java.sapient" name="EJB_CL" value="false"/>
+<property category="java.sapient" name="EJB_CONSOLE" value="false"/>
+<property category="java.sapient" name="EJB_ENTITY" value="false"/>
+<property category="java.sapient" name="EJB_FDESCR" value="false"/>
+<property category="java.sapient" name="EJB_FILES" value="false"/>
+<property category="java.sapient" name="EJB_HOME" value="false"/>
+<property category="java.sapient" name="EJB_IO" value="false"/>
+<property category="java.sapient" name="EJB_JDBC" value="false"/>
+<property category="java.sapient" name="EJB_MESSAGE" value="false"/>
+<property category="java.sapient" name="EJB_NAMES" value="false"/>
+<property category="java.sapient" name="EJB_NATIVE" value="false"/>
+<property category="java.sapient" name="EJB_OBJECT" value="false"/>
+<property category="java.sapient" name="EJB_REFL" value="false"/>
+<property category="java.sapient" name="EJB_SEC" value="false"/>
+<property category="java.sapient" name="EJB_SECOBJ" value="false"/>
+<property category="java.sapient" name="EJB_SESSION" value="false"/>
+<property category="java.sapient" name="EJB_SFACT" value="false"/>
+<property category="java.sapient" name="EJB_SOCKET" value="false"/>
+<property category="java.sapient" name="EJB_SUBST" value="false"/>
+<property category="java.sapient" name="EJB_THREADS" value="false"/>
+<property category="java.sapient" name="EOBA" value="true"/>
+<property category="java.sapient" name="EVC" value="true"/>
+<property category="java.sapient" name="HIF" value="true"/>
+<property category="java.sapient" name="HISM" value="true"/>
+<property category="java.sapient" name="HN" value="true"/>
+<property category="java.sapient" name="ICSBF" value="false"/>
+<property category="java.sapient" name="IFM" value="true"/>
+<property category="java.sapient" name="ILC" value="false"/>
+<property category="java.sapient" name="IMCM" value="true"/>
+<property category="java.sapient" name="IMMD" value="true"/>
+<property category="java.sapient" name="LF" value="false"/>
+<property category="java.sapient" name="LMC" value="false"/>
+<property category="java.sapient" name="LNU" value="true"/>
+<property category="java.sapient" name="MCP" value="true"/>
+<property category="java.sapient" name="MCS" value="true"/>
+<property category="java.sapient" name="MLOWP" value="false"/>
+<property category="java.sapient" name="MNU" value="true"/>
+<property category="java.sapient" name="MSOL" value="true"/>
+<property category="java.sapient" name="MVDSN" value="false"/>
+<property category="java.sapient" name="NC" value="true"/>
+<property category="java.sapient" name="NCLS" value="true"/>
+<property category="java.sapient" name="NFSF" value="false"/>
+<property category="java.sapient" name="NLC" value="false"/>
+<property category="java.sapient" name="NOIS" value="false"/>
+<property category="java.sapient" name="ODCM" value="false"/>
+<property category="java.sapient" name="OHCE" value="true"/>
+<property category="java.sapient" name="OIM" value="true"/>
+<property category="java.sapient" name="ONAMAM" value="true"/>
+<property category="java.sapient" name="ONE" value="true"/>
+<property category="java.sapient" name="OPM" value="true"/>
+<property category="java.sapient" name="OSNBU" value="false"/>
+<property category="java.sapient" name="OWS" value="false"/>
+<property category="java.sapient" name="PCO" value="true"/>
+<property category="java.sapient" name="PDBB" value="false"/>
+<property category="java.sapient" name="PFC" value="false"/>
+<property category="java.sapient" name="PIFS" value="false"/>
+<property category="java.sapient" name="PJDC" value="false"/>
+<property category="java.sapient" name="PMSNT" value="false"/>
+<property category="java.sapient" name="PN" value="false"/>
+<property category="java.sapient" name="PPA" value="false"/>
+<property category="java.sapient" name="PPCF" value="true"/>
+<property category="java.sapient" name="PSIB" value="true"/>
+<property category="java.sapient" name="RIP" value="false"/>
+<property category="java.sapient" name="SBC" value="true"/>
+<property category="java.sapient" name="SEB" value="false"/>
+<property category="java.sapient" name="SL" value="false"/>
+<property category="java.sapient" name="SSSIDC" value="false"/>
+<property category="java.sapient" name="SU" value="true"/>
+<property category="java.sapient" name="TMSSC" value="false"/>
+<property category="java.sapient" name="UAAO" value="true"/>
+<property category="java.sapient" name="UC" value="true"/>
+<property category="java.sapient" name="UCVN" value="false"/>
+<property category="java.sapient" name="UE" value="true"/>
+<property category="java.sapient" name="UL" value="true"/>
+<property category="java.sapient" name="ULVFP" value="true"/>
+<property category="java.sapient" name="UMM" value="true"/>
+<property category="java.sapient" name="URSP" value="true"/>
+<property category="java.sapient" name="enable" value="1"/>
+<property category="javaFormatting" name="alwaysClasses" value="1"/>
+<property category="javaFormatting" name="blankLinesAfterClass" value="2"/>
+<property category="javaFormatting" name="blankLinesAfterImports" value="2"/>
+<property category="javaFormatting" name="blankLinesAfterMethod" value="2"/>
+<property category="javaFormatting" name="packagePrefixGroups" value="java;javax;BLANK_LINE;java.awt;javax.swing;BLANK_LINE;org;(*)"/>
+<property category="javaFormatting" name="preserveLineBreaks" value="0"/>
+<property category="javaFormatting" name="wrapAtColumn" value="120"/>
+<property category="module" name="ProjectConvertedToEnsureModulesHaveSupportedFeatures" value="1"/>
+<property category="module" name="ProjectConvertedToUseFilesAndDependenciesAsDefaultContent" value="1"/>
+<property category="module" name="ProjectConvertedToUseProperModuleDefaults" value="1"/>
+<property category="module" name="projectConvertedFromModuleExtensionsToModuleFileTypes" value="1"/>
+<property category="personality" name="personality" value=""/>
+<property category="runtime" name="DefaultConfiguration" value="-1"/>
+<property category="runtime.0" name="BuildTargetOnRun" value="com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make"/>
+<property category="runtime.0" name="ConfigurationName" value="Quiz"/>
+<property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner"/>
+<property category="runtime.0" name="application.class" value="org.crosswire.flashcards.Quiz"/>
+<property category="serverservices" name="disabled.services" value="jdatastore"/>
+<property category="serverservices" name="single.server.name" value="Tomcat 4.1"/>
+<property category="sys" name="AuthorLabel" value="@author"/>
+<property category="sys" name="Autorefresh" value="1"/>
+<property category="sys" name="BackupPath" value="bak"/>
+<property category="sys" name="CheckStable" value="1"/>
+<property category="sys" name="Company" value=""/>
+<property category="sys" name="CompanyLabel" value="Company:"/>
+<property category="sys" name="Copyright" value="Copyright (c) 2003"/>
+<property category="sys" name="CopyrightLabel" value="Copyright:"/>
+<property category="sys" name="DefaultPath" value="src"/>
+<property category="sys" name="Description" value=""/>
+<property category="sys" name="DescriptionLabel" value="Description:"/>
+<property category="sys" name="DocPath" value="doc"/>
+<property category="sys" name="ExcludeClassEnabled" value="0"/>
+<property category="sys" name="IncludeTestPath" value="1"/>
+<property category="sys" name="InstanceVisibility" value="2"/>
+<property category="sys" name="JDK" value="java version 1.5.0_03-b07"/>
+<property category="sys" name="JbxEventListener0" value="org.crosswire.flashcards.FlashCardEventListener"/>
+<property category="sys" name="JbxEventListener1" value="org.crosswire.flashcards.FlashCardEventListener"/>
+<property category="sys" name="JvmVersion" value="1.4"/>
+<property category="sys" name="LastTag" value="0"/>
+<property category="sys" name="Libraries" value="../../../Documents and Settings/scribe/Application Data/Sun/Java/Deployment/javaws/cache/http/Dwww.crosswire.org/P80/DMflashcards/DMwebstart/RMlessons.jar"/>
+<property category="sys" name="MakeStable" value="0"/>
+<property category="sys" name="OutPath" value="classes"/>
+<property category="sys" name="SourcePath" value="src;test;../src"/>
+<property category="sys" name="SourceVersion" value="1.4"/>
+<property category="sys" name="TestPath" value="test"/>
+<property category="sys" name="Title" value=""/>
+<property category="sys" name="TitleLabel" value="Title:"/>
+<property category="sys" name="Version" value="1.0"/>
+<property category="sys" name="VersionLabel" value="@version"/>
+<property category="sys" name="WorkingDirectory" value="."/>
+<property category="sys" name="palette.bean.chooser.beans" value="org.crosswire.modedit.UniTextEdit;"/>
+<node name="Flash" type="Archive">
+<property category="archiving" name="archiverClass" value="com.borland.jbuilder.wizard.archive.ApplicationArchiver"/>
+<property category="archiving" name="contentRules.1" value="I:**/*.*"/>
+<property category="archiving" name="manifestConfigFile" value="0"/>
+<property category="archiving" name="targetPath" value="Flash.jar"/>
+<property category="archiving" name="usingRules" value="1"/>
+</node>
+<node name="FlashEditor" type="Archive">
+<property category="archiving" name="archiverClass" value="com.borland.jbuilder.wizard.archive.ApplicationArchiver"/>
+<property category="archiving" name="contentRules.1" value="I:**/*.*"/>
+<property category="archiving" name="manifestMainClass" value="org.crosswire.flashcards.Editor"/>
+<property category="archiving" name="targetPath" value="FlashEditor.jar"/>
+<property category="archiving" name="usingRules" value="1"/>
+</node>
+<file path="../build.xml">
+<property category="ant" name="displayrelativepath" value="0"/>
+<property category="ant" name="loglevel" value="-debug"/>
+<property category="ant" name="usebmj" value="0"/>
+</file>
</project>
Deleted: trunk/app/Flash.jpx.local
===================================================================
--- trunk/app/Flash.jpx.local 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/Flash.jpx.local 2006-12-09 00:53:32 UTC (rev 102)
@@ -1,126 +0,0 @@
-build.menu.1[0]=com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make
-build.menu.2[0]=com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;rebuild
-classFilter.unittest.1[0]=junit.framework.*
-classFilter.unittest.2[0]=java.lang.reflect.Method
-classFilter.unittest.3[0]=com.borland.jbuilder.unittest.JBTestRunner
-classFilter.unittest.4[0]=sun.reflect.NativeMethodAccessorImpl
-classFilter.unittest.5[0]=sun.reflect.DelegatingMethodAccessorImpl
-content.layout.xml.[0]=<project-layout><tab_container selected_index="3"><tab node_name="src/org/crosswire/flashcards/FlashCard.java"/><tab node_name="src/org/crosswire/flashcards/FlashCardRep.java"/><tab node_name="src/org/crosswire/flashcards/Lesson.java"/><tab node_name="src/org/crosswire/flashcards/LessonManager.java"/><tab node_name="src/org/crosswire/flashcards/LessonPane.java"/><tab node_name="src/org/crosswire/flashcards/LessonSet.java"/><tab node_name="src/org/crosswire/flashcards/QuizPane.java"/></tab_container></project-layout>
-debug.Breakpoints.1[0]=1 038 org.crosswire.flashcards.LessonSetPane47 src/org/crosswire/flashcards/LessonSetPane.java3 1271 10 1 10 1 10 1 0 -1
-debug.Breakpoints.2[0]=1 038 org.crosswire.flashcards.LessonManager47 src/org/crosswire/flashcards/LessonManager.java3 1341 10 1 10 1 10 1 0 -1
-debug.Breakpoints.3[0]=1 038 org.crosswire.flashcards.LessonManager47 src/org/crosswire/flashcards/LessonManager.java3 1931 10 1 10 1 10 1 0 -1
-debug.Breakpoints.4[0]=1 038 org.crosswire.flashcards.LessonManager47 src/org/crosswire/flashcards/LessonManager.java3 2191 10 1 10 1 10 1 0 -1
-debug.EvaluateExpressions.1[0]=uri
-debug.NoTracingClasses.1[0]=16 java.lang.Object1 1 -1
-debug.NoTracingClasses.2[0]=21 java.lang.ClassLoader1 1 -1
-debug.NoTracingClasses.3[0]=16 java.lang.String1 1 -1
-debug.SplitThreadsAndDataView[0]=0
-debug.Watches.1[0]=1 110 lessonPath10 expression1 02 501 01 01 01 1 -1
-debug.Watches.2[0]=1 111 description10 expression1 02 501 01 01 01 1 -1
-debug.Watches.3[0]=1 19 entryName10 expression1 02 501 01 01 01 1 -1
-editor.search.file_filter_history.1[0]=*.*
-editor.search.path_history.1[0]=/space/home/scribe/src/flashcards/app/src
-history.files.active[0]=src/org/crosswire/flashcards/LessonManager.java,F;177,7533,d240``0``open
-history.files.open.1[0]=src/org/crosswire/flashcards/FlashCard.java,F;45,1394,d240``0``open
-history.files.open.2[0]=src/org/crosswire/flashcards/FlashCardRep.java,F;131,4051,d240``0``open
-history.files.open.3[0]=src/org/crosswire/flashcards/Lesson.java,F;94,2508,d216``1``save
-history.files.open.4[0]=src/org/crosswire/flashcards/LessonManager.java,F;177,7533,d240``0``open
-history.files.open.5[0]=src/org/crosswire/flashcards/LessonPane.java,F;112,3623,d240``0``open
-history.files.open.6[0]=src/org/crosswire/flashcards/LessonSet.java,F;37,1828,d240``0``open
-history.files.open.7[0]=src/org/crosswire/flashcards/QuizPane.java,F;334,12025,d216``1``save
-import.optimize.legacyPropertiesRead[0]=1
-java.classdefaults.1[0]=java.util.Enumeration
-java.classdefaults.2[0]=javax.swing.filechooser.FileFilter
-java.classdefaults.3[0]=java.util.Properties
-java.classdefaults.4[0]=java.util.Hashtable
-java.classdefaults.5[0]=java.util.Set
-java.classdefaults.6[0]=org.crosswire.flashcards.Debug
-java.classdefaults.7[0]=java.net.URLConnection
-java.classdefaults.8[0]=java.net.JarURLConnection
-packagebrowser.lastClassName[0]=org.crosswire.flashcards.Editor
-svn.showconsole[0]=1
-sys.Author[0]=
-sys.DefaultPackage[0]=flash
-sys.ReopenHistory.1[0]=[D%|/Borland/JBuilder2006/jdk1.5/src.zip]/java/awt/Component.java
-sys.ReopenHistory.10[0]=src/org/crosswire/flashcards/LessonSet.java
-sys.ReopenHistory.11[0]=[C%|/Borland/JBuilder2005/jdk1.4/jre/lib/rt.jar]/sun/misc/Launcher.class
-sys.ReopenHistory.12[0]=[C%|/Borland/JBuilder2005/jdk1.4/src.zip]/java/net/JarURLConnection.java
-sys.ReopenHistory.13[0]=src/org/crosswire/flashcards/FlashCardPane.java
-sys.ReopenHistory.14[0]=src/org/crosswire/flashcards/LessonSetPane.java
-sys.ReopenHistory.15[0]=src/org/crosswire/flashcards/EditPane.java
-sys.ReopenHistory.16[0]=[C%|/Borland/JBuilder2005/jdk1.4/src.zip]/java/io/File.java
-sys.ReopenHistory.17[0]=src/org/crosswire/flashcards/Lesson.java
-sys.ReopenHistory.18[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/Iterator.java
-sys.ReopenHistory.19[0]=src/org/crosswire/flashcards/FlashCardColumns.java
-sys.ReopenHistory.2[0]=src/org/crosswire/flashcards/EditorFrame.java
-sys.ReopenHistory.20[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/Set.java
-sys.ReopenHistory.21[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/io/File.java
-sys.ReopenHistory.22[0]=[/space/opt/JBuilder2005/jdk1.4/jre/lib/rt.jar]/sun/misc/Launcher.class
-sys.ReopenHistory.23[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/net/URL.java
-sys.ReopenHistory.24[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/TreeSet.java
-sys.ReopenHistory.25[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/lang/StringBuffer.java
-sys.ReopenHistory.26[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/lang/System.java
-sys.ReopenHistory.27[0]=src/org/crosswire/common/util/CWClassLoader.java
-sys.ReopenHistory.28[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/lang/Class.java
-sys.ReopenHistory.29[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/net/JarURLConnection.java
-sys.ReopenHistory.3[0]=src/org/crosswire/flashcards/MainFrame.java
-sys.ReopenHistory.30[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/net/URLConnection.java
-sys.ReopenHistory.31[0]=src/org/crosswire/flashcards/migrate/ImportLesson.java
-sys.ReopenHistory.32[0]=src/org/crosswire/modedit/SWInputMethod.java
-sys.ReopenHistory.33[0]=src/org/crosswire/modedit/NullIM.java
-sys.ReopenHistory.34[0]=src/org/crosswire/modedit/Ibycus4IM.java
-sys.ReopenHistory.35[0]=src/org/crosswire/modedit/HebrewMCIM.java
-sys.ReopenHistory.36[0]=src/org/crosswire/modedit/HebrewDurusauIM.java
-sys.ReopenHistory.37[0]=src/org/crosswire/modedit/Gtk2ClassicalGreekIM.java
-sys.ReopenHistory.38[0]=src/org/crosswire/modedit/GreekKeymanIM.java
-sys.ReopenHistory.39[0]=src/org/crosswire/modedit/CGreekIM.java
-sys.ReopenHistory.4[0]=src/org/crosswire/flashcards/LessonManager.java
-sys.ReopenHistory.40[0]=E%|/Eclipse/JSword/flashcards/target/jar/flashcards.jar
-sys.ReopenHistory.41[0]=E%|/Eclipse/JSword/flashcards/lessons/black/eimi_pi.flash
-sys.ReopenHistory.42[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter21vocab.flash
-sys.ReopenHistory.43[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter19vocab.flash
-sys.ReopenHistory.44[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter18vocab.flash
-sys.ReopenHistory.45[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter17vocab.flash
-sys.ReopenHistory.46[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter15vocab.flash
-sys.ReopenHistory.47[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter14vocab.flash
-sys.ReopenHistory.48[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter13vocab.flash
-sys.ReopenHistory.49[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter12vocab.flash
-sys.ReopenHistory.5[0]=[C%|/Borland/JBuilder2005/jdk1.4/src.zip]/java/net/URL.java
-sys.ReopenHistory.50[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter11vocab.flash
-sys.ReopenHistory.51[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter03vocab.flash
-sys.ReopenHistory.52[0]=Flash.jar
-sys.ReopenHistory.53[0]=src/org/crosswire/flashcards/MainFrame_AboutBox.java
-sys.ReopenHistory.54[0]=src/org/crosswire/flashcards/EditorFrame_AboutBox.java
-sys.ReopenHistory.55[0]=src/flash/Quiz.java
-sys.ReopenHistory.56[0]=src/flash/openFile.png
-sys.ReopenHistory.57[0]=src/flash/OpenFile.java
-sys.ReopenHistory.58[0]=src/flash/MainFrame_AboutBox.java
-sys.ReopenHistory.59[0]=src/flash/MainFrame.java
-sys.ReopenHistory.6[0]=[C%|/Borland/JBuilder2005/jdk1.4/src.zip]/java/net/URI.java
-sys.ReopenHistory.60[0]=src/flash/help.png
-sys.ReopenHistory.61[0]=Flash.html
-sys.ReopenHistory.62[0]=src/flash/EditorFrame_AboutBox.java
-sys.ReopenHistory.63[0]=src/flash/EditorFrame.java
-sys.ReopenHistory.64[0]=src/flash/Editor.java
-sys.ReopenHistory.65[0]=src/flash/closeFile.png
-sys.ReopenHistory.66[0]=src/flash/about.png
-sys.ReopenHistory.67[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/awt/Font.java
-sys.ReopenHistory.68[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/JFileChooser.java
-sys.ReopenHistory.69[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/text/JTextComponent.java
-sys.ReopenHistory.7[0]=[C%|/Borland/JBuilder2005/jdk1.4/src.zip]/java/lang/System.java
-sys.ReopenHistory.70[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/util/Properties.java
-sys.ReopenHistory.8[0]=src/org/crosswire/flashcards/SetupPane.java
-sys.ReopenHistory.9[0]=src/org/crosswire/common/swing/RowTable.java
-team.ActiveVCS[0]=Subversion
-team.lastScanned[0]=1165191489359
-wizard.package.package_history.1[0]=flash
-wizards.classes.class_type_history.1[0]=boolean
-wizards.classes.class_type_history.10[0]=java.lang.String
-wizards.classes.class_type_history.2[0]=byte
-wizards.classes.class_type_history.3[0]=char
-wizards.classes.class_type_history.4[0]=short
-wizards.classes.class_type_history.5[0]=int
-wizards.classes.class_type_history.6[0]=long
-wizards.classes.class_type_history.7[0]=float
-wizards.classes.class_type_history.8[0]=double
-wizards.classes.class_type_history.9[0]=java.lang.Object
Added: trunk/app/src/org/crosswire/flashcards/ComplexLesson.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/ComplexLesson.java (rev 0)
+++ trunk/app/src/org/crosswire/flashcards/ComplexLesson.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -0,0 +1,144 @@
+/*
+ * Distribution Licence:
+ * FlashCard is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public License,
+ * version 2 as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details.
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/gpl.html,
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ *
+ * Copyright: 2004 CrossWire Bible Society
+ */
+
+package org.crosswire.flashcards;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Vector;
+
+
+/**
+ * A Lesson is an ordered list of FlashCards.
+ * The lesson also has a description which is useful for showing to a user.
+ *
+ * @author Troy A. Griffitts [scribe at crosswire dot org]
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class ComplexLesson extends Lesson {
+
+ public ComplexLesson(String url) {
+ super(url);
+ }
+
+ public ComplexLesson(String url, String description) {
+ super(url, description);
+ }
+
+ /**
+ * Load this lesson from persistent store named by the lesson's <code>filename</code>.
+ */
+ public void load() {
+ try {
+ URL lessonURL = new URL(getURL());
+ Properties lesson = new Properties();
+ lesson.load(lessonURL.openConnection().getInputStream());
+ int wordCount = Integer.parseInt(lesson.getProperty("wordCount"));
+ setDescription(lesson.getProperty("lessonTitle", getURL().substring(getURL().lastIndexOf('/') + 1)));
+
+ int baseOffset = getURL().lastIndexOf("/");
+ if (baseOffset < 0) {
+ baseOffset = getURL().lastIndexOf( ("\\"));
+ }
+ String lname = getURL().substring(baseOffset+1);
+ lname = lname.substring(0, lname.indexOf(".flash"));
+ String audioPath = getURL().substring(0, baseOffset) + "/audio";
+
+ for (int i = 0; i < wordCount; i++) {
+ FlashCard f = new FlashCard(lesson.getProperty("word" + i), lesson.getProperty("answers" + i));
+ String audioURLString = audioPath + "/" + lname + "_" + Integer.toString(i) + ".wav";
+ URL audioURL = new URL(audioURLString);
+ try {
+ audioURL.openConnection().getInputStream();
+ f.setAudioURL(audioURLString);
+ }
+ catch (Exception e) {}
+ add(f);
+ }
+ setModified(false);
+ }
+ catch (IOException e1) {
+ /* ignore it */
+ }
+ }
+
+
+ /**
+ * Save this lesson to persistent store named by the lesson's <code>filename</code>.
+ */
+ public void store() {
+ Properties lesson = new Properties();
+ OutputStream outStream = null;
+ try {
+ lesson.setProperty("lessonTitle", getDescription());
+ int i = 0;
+ for (;i < getFlashcards().size(); i++) {
+ FlashCard flashCard = (FlashCard) getFlashcards().get(i);
+ lesson.setProperty("word" + i, flashCard.getFront());
+ lesson.setProperty("answers" + i, flashCard.getBack());
+ i++;
+ }
+ lesson.setProperty("wordCount", Integer.toString(i));
+
+ // Save it as a "home" resource.
+ URL filePath = new URL(getURL());
+ File file = null;
+ URLConnection connection = filePath.openConnection();
+ if (connection instanceof JarURLConnection) {
+ file = new File(LessonManager.instance().getHomeProjectPath() + File.separator + ((JarURLConnection)connection).getEntryName());
+ }
+ else {
+ file = new File(filePath.getFile());
+ }
+ File dir = file.getParentFile();
+ // Is it already a directory ?
+ if (!dir.isDirectory()) {
+ dir.mkdirs();
+ }
+ outStream = new FileOutputStream(file);
+ lesson.store(outStream, "Flash Lesson");
+ setModified(false);
+ }
+ catch (IOException ex) {
+ Debug.error(this.getClass().getName(), ex.getMessage());
+ } finally {
+ if (outStream != null) {
+ try
+ {
+ outStream.close();
+ }
+ catch (IOException e)
+ {
+ Debug.error(this.getClass().getName(), e.getMessage());
+ }
+ }
+ }
+ }
+}
Copied: trunk/app/src/org/crosswire/flashcards/ComplexLessonSet.java (from rev 101, trunk/app/src/org/crosswire/flashcards/LessonSet.java)
===================================================================
--- trunk/app/src/org/crosswire/flashcards/ComplexLessonSet.java (rev 0)
+++ trunk/app/src/org/crosswire/flashcards/ComplexLessonSet.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -0,0 +1,144 @@
+/*
+ * Distribution Licence:
+ * FlashCard is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public License,
+ * version 2 as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details.
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/gpl.html,
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2004 CrossWire Bible Society
+ */
+package org.crosswire.flashcards;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+
+/**
+ * A <code>LessonSet</code> is an ordered list of <code>Lesson</code>s.
+ * The lessons are sorted by filename.
+ * The lesson set also has a description which is useful for showing to a user
+ * and a directory name where its Lessons are stored. This directory name is expected to be a relative
+ * path and will be stored either in a jar or in the user's FlashCard directory.
+ *
+ * @author Troy A. Griffitts [scribe at crosswire dot org]
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class ComplexLessonSet extends LessonSet {
+
+ public ComplexLessonSet(String url) {
+ super(url);
+ }
+
+
+ /**
+ * Load this lesson set from persistent store named by the lesson set's <code>dirname</code>.
+ * This is the union of lessons in the Jar and in the user's flashcard home directory.
+ */
+ protected void load() {
+ if (getURL() == null) { // assert we have an URL
+ return;
+ }
+
+ URL lessonsURL = null;
+ URLConnection connection = null;
+ try {
+ lessonsURL = new URL(getURL());
+ connection = lessonsURL.openConnection();
+ }
+ catch (Exception e1) {
+ Debug.error(this.getClass().getName(), e1.getMessage());
+ }
+ if (connection instanceof JarURLConnection) {
+ JarURLConnection jarConnection = (JarURLConnection) connection;
+ loadJarLessonSet(jarConnection);
+ }
+ else if (lessonsURL != null) {
+ loadDirectoryLessonSet(new File(lessonsURL.getFile()));
+ }
+ }
+
+
+ private void loadJarLessonSet(JarURLConnection jarConnection) {
+ String dirName = jarConnection.getEntryName();
+ JarFile jarFile = null;
+ try {
+ jarFile = jarConnection.getJarFile();
+ }
+ catch (Exception e2) {
+ Debug.error(this.getClass().getName(), e2.getMessage());
+ }
+ if (jarFile == null) {
+ return;
+ }
+ Enumeration entries = jarFile.entries();
+ while (entries.hasMoreElements()) {
+ JarEntry jarEntry = (JarEntry) entries.nextElement();
+ String lessonPath = jarEntry.getName();
+ if (lessonPath.startsWith(dirName) && !jarEntry.isDirectory() &&
+ lessonPath.toUpperCase(Locale.ENGLISH).endsWith(".FLASH")) {
+ add(new ComplexLesson("jar:" + jarConnection.getJarFileURL() + "!/" + lessonPath));
+ }
+ }
+ }
+
+
+ /**
+ * Get the relative path names of the lessons in this lesson set from
+ * the user's program home.
+ * @param lessonSet
+ */
+ private void loadDirectoryLessonSet(File directory) {
+ try {
+ File[] files = directory.listFiles(new FlashFileFilter());
+ if (files == null) {
+ return;
+ }
+ Arrays.sort(files);
+ for (int i = 0; i < files.length; i++) {
+ add(new ComplexLesson(files[i].getCanonicalFile().toURL().toString()));
+ }
+ }
+ catch (IOException e) {
+ // that's fine. We just failed to load local files.
+ }
+ }
+
+
+ public String getNextLessonFilename() {
+ // This needs work: It should check for collisions
+ String result = null;
+ int next = getLessons().size();
+ Object[] params = {
+ getURL(), new Integer(next)};
+ MessageFormat format = new MessageFormat("{0}/lesson{1,number,00}.flash");
+ result = format.format(params);
+ return result;
+ }
+
+
+ static class FlashFileFilter implements FilenameFilter {
+ public boolean accept(File dir, String name) {
+ return name.toUpperCase(Locale.ENGLISH).endsWith(".FLASH");
+ }
+ }
+}
Modified: trunk/app/src/org/crosswire/flashcards/EditPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/EditPane.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/EditPane.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -109,7 +109,7 @@
return;
}
JList list = (JList) e.getSource();
- lessonPanel.loadLessons((LessonSet) list.getSelectedValue());
+ lessonPanel.loadLessons((ComplexLessonSet) list.getSelectedValue());
}
});
Modified: trunk/app/src/org/crosswire/flashcards/EditorFrame.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/EditorFrame.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/EditorFrame.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -6,7 +6,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
+ *
* See the GNU General Public License for more details.
* The License is available on the internet at:
* http://www.gnu.org/copyleft/gpl.html,
@@ -14,7 +14,7 @@
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307, USA
- *
+ *
* The copyright to this program is held by it's authors
* Copyright: 2004
*/
@@ -368,7 +368,7 @@
(frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.pack();
- dlg.show();
+ dlg.setVisible(true);
}
// Overridden so we can exit when window is closed
Deleted: trunk/app/src/org/crosswire/flashcards/FlashCard.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/FlashCard.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/FlashCard.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -1,209 +0,0 @@
-/*
- * Distribution Licence:
- * FlashCard is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License,
- * version 2 as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU General Public License for more details.
- * The License is available on the internet at:
- * http://www.gnu.org/copyleft/gpl.html,
- * or by writing to:
- * Free Software Foundation, Inc.
- * 59 Temple Place - Suite 330
- * Boston, MA 02111-1307, USA
- *
- * The copyright to this program is held by it's authors
- * Copyright: 2004
- */
-package org.crosswire.flashcards;
-
-import java.io.Serializable;
-
-
-/**
- * A FlashCard has a front and a back. The front has the test
- * and the back has the answer.
- *
- * @author Troy A. Griffitts [scribe at crosswire dot org]
- * @author DM Smith [ dmsmith555 at yahoo dot com]
- */
-public class FlashCard implements Cloneable, Comparable, Serializable
-{
- /**
- * Create a partial FlashCard.
- * @param front
- */
- public FlashCard()
- {
- this("", "");
- }
-
- /**
- * Create a complete FlashCard
- * @param front
- * @param back
- */
- public FlashCard(String front, String back)
- {
- original = new FlashCardRep(front, back);
-
- try
- {
- copy = (FlashCardRep) original.clone();
- }
- catch (CloneNotSupportedException e)
- {
- assert false;
- }
- }
-
- public void setAudioURL(String url) {
- copy.setAudioURL(url);
- }
-
- public String getAudioURL() {
- return copy.getAudioURL();
- }
-
-
- /**
- * Get a particular side of this FlashCard.
- * This is useful to flip the cards.
- * @param front
- * @return the requested side
- */
- public String getSide(boolean frontside)
- {
- if (frontside)
- {
- return getFront();
- }
- return getBack();
- }
-
- /**
- * @return Returns the back.
- */
- public String getBack()
- {
- return copy.getBack();
- }
-
- /**
- * @param newBack The back to set.
- */
- public void setBack(String newBack)
- {
- copy.setBack(newBack);
- }
-
- /**
- * @return Returns the front.
- */
- public String getFront()
- {
- return copy.getFront();
- }
-
- /**
- * @param newFront The front to set.
- */
- public void setFront(String newFront)
- {
- copy.setFront(newFront);
- }
-
- /**
- * Method reset
- */
- public void reset()
- {
- copy.assign(original);
- }
-
- /**
- * Method isIncomplete
- * @return boolean
- */
- public boolean isIncomplete()
- {
- return copy.isIncomplete();
- }
-
- /**
- * Method setOriginal
- */
- public void setOriginal()
- {
- original.assign(copy);
- }
-
- /**
- * @return Returns whether this FlashCard has been modified.
- */
- protected boolean isModified()
- {
- return !original.equals(copy);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#clone()
- */
- public Object clone() throws CloneNotSupportedException
- {
- return super.clone();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (!(obj instanceof FlashCard))
- {
- return false;
- }
- FlashCard otherCard = (FlashCard) obj;
- return copy.equals(otherCard.copy);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode()
- {
- return copy.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- return copy.toString();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object obj)
- {
- FlashCard otherCard = (FlashCard) obj;
- return copy.compareTo(otherCard.copy);
- }
-
- private FlashCardRep original;
- private FlashCardRep copy;
-
- /**
- * Serialization ID
- */
- private static final long serialVersionUID = -4429061155097506281L;
-}
Modified: trunk/app/src/org/crosswire/flashcards/FlashCardEditor.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/FlashCardEditor.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/FlashCardEditor.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -137,14 +137,7 @@
if (newFlashCard != null)
{
selected = true;
- try
- {
- flashCard = (FlashCard) newFlashCard.clone();
- }
- catch (CloneNotSupportedException e)
- {
- assert false;
- }
+ flashCard = (FlashCard) newFlashCard.clone();
wordText.setText(flashCard.getFront());
answers.setText(flashCard.getBack());
}
@@ -175,7 +168,7 @@
protected void modifyFlashCard()
{
- assert flashCard != null;
+ if (flashCard == null) return;
flashCard.setFront(wordText.getText());
flashCard.setBack(answers.getText());
Modified: trunk/app/src/org/crosswire/flashcards/FlashCardPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/FlashCardPane.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/FlashCardPane.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -6,7 +6,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
+ *
* See the GNU General Public License for more details.
* The License is available on the internet at:
* http://www.gnu.org/copyleft/gpl.html,
@@ -14,7 +14,7 @@
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307, USA
- *
+ *
* The copyright to this program is held by it's authors
* Copyright: 2004
*/
@@ -22,7 +22,7 @@
import java.awt.BorderLayout;
import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Vector;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@@ -34,7 +34,7 @@
/**
* A panel listing the Flash Cards in a Lesson.
- *
+ *
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
public class FlashCardPane extends JPanel implements FlashCardEventListener
@@ -127,10 +127,9 @@
lesson = aLesson;
if (lesson != null)
{
- Iterator flashCardIterator = lesson.iterator();
- while (flashCardIterator.hasNext())
- {
- FlashCard flashCard = (FlashCard) flashCardIterator.next();
+ Vector flashcards = lesson.getFlashcards();
+ for (int i = 0; i < flashcards.size(); i++) {
+ FlashCard flashCard = (FlashCard) flashcards.get(i);
model.addRow(flashCard);
}
}
@@ -198,4 +197,4 @@
}
}
}
-}
\ No newline at end of file
+}
Deleted: trunk/app/src/org/crosswire/flashcards/FlashCardRep.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/FlashCardRep.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/FlashCardRep.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -1,186 +0,0 @@
-/*
- * Distribution Licence:
- * FlashCard is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License,
- * version 2 as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU General Public License for more details.
- * The License is available on the internet at:
- * http://www.gnu.org/copyleft/gpl.html,
- * or by writing to:
- * Free Software Foundation, Inc.
- * 59 Temple Place - Suite 330
- * Boston, MA 02111-1307, USA
- *
- * The copyright to this program is held by it's authors
- * Copyright: 2004
- */
-package org.crosswire.flashcards;
-
-import java.io.Serializable;
-
-/**
- * A FlashCard has a front and a back. The front has the test
- * and the back has the answer.
- *
- * @author Troy A. Griffitts [scribe at crosswire dot org]
- * @author DM Smith [ dmsmith555 at yahoo dot com]
- */
-public class FlashCardRep implements Cloneable, Comparable, Serializable
-{
- /**
- * Create a partial FlashCard.
- * @param front
- */
- public FlashCardRep(String front)
- {
- this(front, "");
- }
-
- /**
- * Create a complete FlashCard
- * @param front
- * @param back
- */
- public FlashCardRep(String front, String back)
- {
- this.front = front;
- this.back = back;
- }
-
- public void setAudioURL(String url) {
- audioURL = url;
- }
-
- public String getAudioURL() {
- return audioURL;
- }
-
- /**
- * Get a particular side of this FlashCard.
- * This is useful to flip the cards.
- * @param front
- * @return the requested side
- */
- public String getSide(boolean frontside)
- {
- if (frontside)
- {
- return getFront();
- }
- return getBack();
- }
-
- /**
- * @return Returns the back.
- */
- public String getBack()
- {
- return back;
- }
-
- /**
- * @param newBack The back to set.
- */
- public void setBack(String newBack)
- {
- back = newBack;
- }
-
- /**
- * @return Returns the front.
- */
- public String getFront()
- {
- return front;
- }
-
- /**
- * @param newFront The front to set.
- */
- public void setFront(String newFront)
- {
- front = newFront;
- }
-
- public void assign(FlashCardRep rep)
- {
- front = rep.front;
- back = rep.back;
- }
-
- public boolean isIncomplete()
- {
- return (back.length() == 0 || front.length() == 0);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#clone()
- */
- public Object clone() throws CloneNotSupportedException
- {
- return super.clone();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (!(obj instanceof FlashCardRep))
- {
- return false;
- }
- FlashCardRep otherCard = (FlashCardRep) obj;
- return front.equals(otherCard.front)
- && back.equals(otherCard.back);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode()
- {
- int hashCode = 31 + front.hashCode();
- hashCode = 31 * hashCode + back.hashCode();
- return hashCode;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- return front + " " + back;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object obj)
- {
- FlashCardRep otherCard = (FlashCardRep) obj;
- int result = front.compareTo(otherCard.front);
- if (result == 0)
- {
- result = back.compareTo(otherCard.back);
- }
- return result;
- }
-
- private String front;
- private String back;
- private String audioURL = null;
-
- /**
- * Serialization ID
- */
- private static final long serialVersionUID = 3503218506665464549L;
-}
Deleted: trunk/app/src/org/crosswire/flashcards/Lesson.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/Lesson.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/Lesson.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -1,324 +0,0 @@
-/*
- * Distribution Licence:
- * FlashCard is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License,
- * version 2 as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU General Public License for more details.
- * The License is available on the internet at:
- * http://www.gnu.org/copyleft/gpl.html,
- * or by writing to:
- * Free Software Foundation, Inc.
- * 59 Temple Place - Suite 330
- * Boston, MA 02111-1307, USA
- *
- *
- * Copyright: 2004 CrossWire Bible Society
- */
-
-package org.crosswire.flashcards;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.net.JarURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
-
-
-/**
- * A Lesson is an ordered list of FlashCards.
- * The lesson also has a description which is useful for showing to a user.
- *
- * @author Troy A. Griffitts [scribe at crosswire dot org]
- * @author DM Smith [dmsmith555 at yahoo dot com]
- */
-public class Lesson implements Comparable, Serializable {
-
- /**
- * The <code>filename</code> gives the relative location of the lesson.
- * Typically this is something like lesson/setname/lessonname.flash.
- */
- private String url;
-
- /**
- * A <code>description</code> of the lesson to be displayed to the user.
- */
- private String description;
-
- /**
- * A path to the <code>font</code> to be used by the lesson.
- */
- private String font;
-
- /**
- * An ordered list of <code>flashCards</code>
- */
- private Set flashCards = new TreeSet();
-
- private boolean modified = false;
-
- /**
- * Serialization ID
- */
- private static final long serialVersionUID = -4031174832238749375L;
-
- /**
- * Construct a new, empty lesson.
- */
- public Lesson() {
- this("NewLesson.flash", "New Lesson");
- }
-
-
- /**
- * Construct a lesson from URL.
- * @param url
- */
- public Lesson(String url) {
- this(url, null);
- }
-
-
- /**
- * Construct a lesson and assign a description
- * @param url
- * @param description
- */
- public Lesson(String url, String description) {
- this.url = url;
- load();
-
- if (description != null) {
- this.description = description;
- }
- }
-
-
- /**
- * Load this lesson from persistent store named by the lesson's <code>filename</code>.
- */
- public void load() {
- try {
- URL lessonURL = new URL(url);
- Properties lesson = new Properties();
- lesson.load(lessonURL.openConnection().getInputStream());
- int wordCount = Integer.parseInt(lesson.getProperty("wordCount"));
- description = lesson.getProperty("lessonTitle", url.substring(url.lastIndexOf('/') + 1));
-
- int baseOffset = url.lastIndexOf("/");
- if (baseOffset < 0) {
- baseOffset = url.lastIndexOf( ("\\"));
- }
- String lname = url.substring(baseOffset+1);
- lname = lname.substring(0, lname.indexOf(".flash"));
- String audioPath = url.substring(0, baseOffset) + "/audio";
-
- for (int i = 0; i < wordCount; i++) {
- FlashCard f = new FlashCard(lesson.getProperty("word" + i), lesson.getProperty("answers" + i));
- String audioURLString = audioPath + "/" + lname + "_" + Integer.toString(i) + ".wav";
- URL audioURL = new URL(audioURLString);
- try {
- audioURL.openConnection().getInputStream();
- f.setAudioURL(audioURLString);
- }
- catch (Exception e) {}
- add(f);
- }
- modified = false;
- }
- catch (IOException e1) {
- /* ignore it */
- }
- }
-
-
- /**
- * Save this lesson to persistent store named by the lesson's <code>filename</code>.
- */
- public void store() {
- Properties lesson = new Properties();
- OutputStream outStream = null;
- try {
- lesson.setProperty("lessonTitle", description);
- Iterator iter = flashCards.iterator();
- int i = 0;
- while (iter.hasNext()) {
- FlashCard flashCard = (FlashCard) iter.next();
- lesson.setProperty("word" + i, flashCard.getFront());
- lesson.setProperty("answers" + i, flashCard.getBack());
- i++;
- }
- lesson.setProperty("wordCount", Integer.toString(i));
-
- // Save it as a "home" resource.
- URL filePath = new URL(url);
- File file = null;
- URLConnection connection = filePath.openConnection();
- if (connection instanceof JarURLConnection) {
- file = new File(LessonManager.instance().getHomeProjectPath() + File.separator + ((JarURLConnection)connection).getEntryName());
- }
- else {
- file = new File(filePath.getFile());
- }
- File dir = file.getParentFile();
- // Is it already a directory ?
- if (!dir.isDirectory()) {
- dir.mkdirs();
- }
- outStream = new FileOutputStream(file);
- lesson.store(outStream, "Flash Lesson");
- modified = false;
- }
- catch (IOException ex) {
- Debug.error(this.getClass().getName(), ex.getMessage());
- } finally {
- if (outStream != null) {
- try
- {
- outStream.close();
- }
- catch (IOException e)
- {
- Debug.error(this.getClass().getName(), e.getMessage());
- }
- }
- }
- }
-
-
- /**
- * Adds the specified <code>FlashCard</code> to this Lesson.
- *
- * @param flashCard to be added.
- */
- public void add(FlashCard flashCard) {
- flashCards.add(flashCard);
- modified = true;
- }
-
-
- /**
- * Removes the specified <code>FlashCard</code> from the lesson.
- *
- * @param flashCard to be removed.
- */
- public void remove(FlashCard flashCard) {
- flashCards.remove(flashCard);
- modified = true;
- }
-
-
- /**
- * @param flashCard
- * @return
- */
- public boolean contains(FlashCard flashCard) {
- return flashCards.contains(flashCard);
- }
-
-
- /**
- * @return Returns the filename.
- */
- public String getURL() {
- return url;
- }
-
-
- /**
- * @param filename The filename to set.
- */
- public void setURL(String url) {
- this.url = url;
- modified = true;
- }
-
-
- /**
- * @return Returns the description.
- */
- public String getDescription() {
- return description;
- }
-
-
- /**
- * @param newDescription The description to set.
- */
- public void setDescription(String newDescription) {
- description = newDescription;
- modified = true;
- }
-
-
- /**
- * @return Returns the font.
- */
- public String getFont() {
- return font;
- }
-
-
- /**
- * @param newFont The font to set.
- */
- public void setFont(String newFont) {
- font = newFont;
- modified = true;
- }
-
-
- /**
- * @return Returns the flashCards.
- */
- public Iterator iterator() {
- return flashCards.iterator();
- }
-
-
- /**
- * @return whether this lesson has been modified
- */
- public boolean isModified() {
- if (modified) {
- return true;
- }
-
- Iterator iter = iterator();
- while (iter.hasNext()) {
- FlashCard flashCard = (FlashCard) iter.next();
- if (flashCard.isModified()) {
- return true;
- }
- }
- return false;
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object obj) {
- Lesson lesson = (Lesson) obj;
- return url.compareTo(lesson.url);
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return description;
- }
-
-}
Modified: trunk/app/src/org/crosswire/flashcards/LessonManager.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonManager.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/LessonManager.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -192,8 +192,7 @@
entryName = entryName.substring(0, entryName.length() - 1);
if (entryName.startsWith(LESSON_ROOT) && !entryName.equals(LESSON_ROOT) && !entryName.endsWith("/audio")) {
// let the description be just the directory name and not the path
- add(new LessonSet("jar:" + jarFile.getCanonicalFile().toURL().toString() + "!/" +
- entryName));
+ add(new ComplexLessonSet("jar:" + jarFile.getCanonicalFile().toURL().toString() + "!/" + entryName));
}
}
}
@@ -217,7 +216,7 @@
for (int i = 0; i < files.length; i++) {
File file = files[i];
if (file.isDirectory() && !file.getName().equals("audio")) {
- add(new LessonSet(files[i].toURL().toString()));
+ add(new ComplexLessonSet(files[i].toURL().toString()));
}
}
}
Modified: trunk/app/src/org/crosswire/flashcards/LessonPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonPane.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/LessonPane.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -23,6 +23,7 @@
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.util.Vector;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -39,7 +40,7 @@
/**
* A panel listing the lessons in a lesson set.
- *
+ *
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
public class LessonPane extends JPanel
@@ -49,7 +50,7 @@
*/
private static final long serialVersionUID = -4950398737983745837L;
private JList lessonList = new JList(new DefaultListModel());
- private LessonSet lessonSet;
+ private ComplexLessonSet lessonSet;
private JMenuItem newItem;
private boolean editable;
@@ -121,13 +122,13 @@
// JMenuItem renameLesson = new JMenuItem("Rename Lesson");
// lessonEditMenu.add(editLesson);
// lessonEditMenu.add(renameLesson);
-
+
enableControls();
}
public void createLesson(String description)
{
- Lesson lesson = new Lesson(lessonSet.getNextLessonFilename(), description);
+ Lesson lesson = new ComplexLesson(lessonSet.getNextLessonFilename(), description);
DefaultListModel model = (DefaultListModel) lessonList.getModel();
if (!model.contains(lesson))
{
@@ -136,24 +137,23 @@
fireLessonChanged(new LessonChangeEvent(this));
}
lessonList.setSelectedValue(lesson, true);
-
+
}
- public void loadLessons(LessonSet aLessonSet)
+ public void loadLessons(ComplexLessonSet aLessonSet)
{
lessonSet = aLessonSet;
DefaultListModel model = (DefaultListModel) lessonList.getModel();
model.clear();
if (lessonSet != null)
{
- Iterator lessonIterator = lessonSet.iterator();
- while (lessonIterator.hasNext())
- {
- Lesson lesson = (Lesson) lessonIterator.next();
+ Vector lessons = lessonSet.getLessons();
+ for (int i = 0; i < lessons.size(); i++) {
+ Lesson lesson = (Lesson) lessons.elementAt(i);
model.addElement(lesson);
}
}
- enableControls();
+ enableControls();
}
private void enableControls()
Deleted: trunk/app/src/org/crosswire/flashcards/LessonSet.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonSet.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/LessonSet.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -1,302 +0,0 @@
-/*
- * Distribution Licence:
- * FlashCard is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License,
- * version 2 as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU General Public License for more details.
- * The License is available on the internet at:
- * http://www.gnu.org/copyleft/gpl.html,
- * or by writing to:
- * Free Software Foundation, Inc.
- * 59 Temple Place - Suite 330
- * Boston, MA 02111-1307, USA
- *
- * Copyright: 2004 CrossWire Bible Society
- */
-package org.crosswire.flashcards;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.JarURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-
-/**
- * A <code>LessonSet</code> is an ordered list of <code>Lesson</code>s.
- * The lessons are sorted by filename.
- * The lesson set also has a description which is useful for showing to a user
- * and a directory name where its Lessons are stored. This directory name is expected to be a relative
- * path and will be stored either in a jar or in the user's FlashCard directory.
- *
- * @author Troy A. Griffitts [scribe at crosswire dot org]
- * @author DM Smith [dmsmith555 at yahoo dot com]
- */
-public class LessonSet implements Comparable, Serializable {
-
- /**
- * The <code>url</code> of the lesson
- */
- private String url = null;
-
- /**
- * A <code>description</code> of the lesson to be displayed to the user.
- */
- private String description;
-
- /**
- * An ordered list of <code>lessons</code>
- */
- private Set lessons = new TreeSet();
-
- /**
- * Flag indicating whether this lesson set has been <code>modified</code>
- */
- private boolean modified;
-
- /**
- * Serialization ID
- */
- private static final long serialVersionUID = -798022075988174038L;
-
- public LessonSet(String url) {
- this.url = url; // .toLowerCase();
- description = url.substring(url.lastIndexOf('/', url.length() - 2) + 1);
- if (description.endsWith("/")) {
- description = description.substring(0, description.length() - 1);
- }
- load();
- }
-
-
- /**
- * Get the relative path names of the lessons in this lesson set from
- * the jar file.
- * @param lessonSet
- */
-
-
- /**
- * Load this lesson set from persistent store named by the lesson set's <code>dirname</code>.
- * This is the union of lessons in the Jar and in the user's flashcard home directory.
- */
- private void load() {
- if (url == null) { // assert we have an URL
- return;
- }
-
- URL lessonsURL = null;
- URLConnection connection = null;
- try {
- lessonsURL = new URL(url);
- connection = lessonsURL.openConnection();
- }
- catch (Exception e1) {
- Debug.error(this.getClass().getName(), e1.getMessage());
- }
- if (connection instanceof JarURLConnection) {
- JarURLConnection jarConnection = (JarURLConnection) connection;
- loadJarLessonSet(jarConnection);
- }
- else if (lessonsURL != null) {
- loadDirectoryLessonSet(new File(lessonsURL.getFile()));
- }
- }
-
-
- private void loadJarLessonSet(JarURLConnection jarConnection) {
- String dirName = jarConnection.getEntryName();
- JarFile jarFile = null;
- try {
- jarFile = jarConnection.getJarFile();
- }
- catch (Exception e2) {
- Debug.error(this.getClass().getName(), e2.getMessage());
- }
- if (jarFile == null) {
- return;
- }
- Enumeration entries = jarFile.entries();
- while (entries.hasMoreElements()) {
- JarEntry jarEntry = (JarEntry) entries.nextElement();
- String lessonPath = jarEntry.getName();
- if (lessonPath.startsWith(dirName) && !jarEntry.isDirectory() &&
- lessonPath.toUpperCase(Locale.ENGLISH).endsWith(".FLASH")) {
- lessons.add(new Lesson("jar:" + jarConnection.getJarFileURL() + "!/" + lessonPath));
- }
- }
- }
-
-
- /**
- * Get the relative path names of the lessons in this lesson set from
- * the user's program home.
- * @param lessonSet
- */
- private void loadDirectoryLessonSet(File directory) {
- try {
- File[] files = directory.listFiles(new FlashFileFilter());
- if (files == null) {
- return;
- }
- Arrays.sort(files);
- for (int i = 0; i < files.length; i++) {
- lessons.add(new Lesson(files[i].getCanonicalFile().toURL().toString()));
- }
- }
- catch (IOException e) {
- // that's fine. We just failed to load local files.
- }
- }
-
-
- /**
- * Save this lesson to persistent store named by the lesson's <code>dirname</code>.
- */
- public void store() {
- Iterator iter = lessons.iterator();
- while (iter.hasNext()) {
- Lesson lesson = (Lesson) iter.next();
- if (lesson.isModified()) {
- lesson.store();
- }
- }
- }
-
-
- /**
- * @return whether the lesson set has been modified
- */
- public boolean isModified() {
- if (modified) {
- return true;
- }
-
- Iterator iter = lessons.iterator();
- while (iter.hasNext()) {
- Lesson lesson = (Lesson) iter.next();
- if (lesson.isModified()) {
- return true;
- }
- }
- return false;
- }
-
-
- public Iterator iterator() {
- return lessons.iterator();
- }
-
-
- /**
- * Adds the specified <code>Lesson</code> to this lesson set.
- *
- * @param flashCard to be added.
- */
- public void add(Lesson lesson) {
- modified = true;
- lessons.add(lesson);
- }
-
-
- /**
- * @return Returns the description.
- */
- public String getDescription() {
- return description;
- }
-
-
- /**
- * @param description The description to set.
- */
- public void setDescription(String newDescription) {
- if (newDescription != null && !newDescription.equals(description)) {
- modified = true;
- description = newDescription;
- }
- }
-
-
- /**
- * @return Returns the dirname.
- */
- public String getURL() {
- return url;
- }
-
-
- public String getNextLessonFilename() {
- // This needs work: It should check for collisions
- String result = null;
- int next = lessons.size();
- Object[] params = {
- url, new Integer(next)};
- MessageFormat format = new MessageFormat("{0}/lesson{1,number,00}.flash");
- result = format.format(params);
- return result;
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object obj) {
- LessonSet lesson = (LessonSet) obj;
- return description.compareTo(lesson.description);
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return description;
- }
-
-
- public void augment(LessonSet other) {
- Iterator i = other.iterator();
- while (i.hasNext()) {
- Lesson l = (Lesson) i.next();
- Lesson exists = getLesson(l.getDescription());
- if (exists != null) {
- lessons.remove(exists);
- }
- lessons.add(l);
- }
- }
-
-
- public Lesson getLesson(String desc) {
- Iterator i = iterator();
- while (i.hasNext()) {
- Lesson ls = (Lesson) i.next();
- if (desc.equals(ls.getDescription())) {
- return ls;
- }
- }
- return null;
- }
-
- static class FlashFileFilter implements FilenameFilter {
- public boolean accept(File dir, String name) {
- return name.toUpperCase(Locale.ENGLISH).endsWith(".FLASH");
- }
- }
-}
Modified: trunk/app/src/org/crosswire/flashcards/LessonSetPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonSetPane.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/LessonSetPane.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -115,7 +115,7 @@
public void createLessonSet(String name)
{
- LessonSet lessonSet = new LessonSet("file:"+LessonManager.instance().getHomeProjectPath() + "/" + LessonManager.LESSON_ROOT + '/' + name);
+ LessonSet lessonSet = new ComplexLessonSet("file:"+LessonManager.instance().getHomeProjectPath() + "/" + LessonManager.LESSON_ROOT + '/' + name);
DefaultListModel model = (DefaultListModel) lessonSetList.getModel();
if (!model.contains(lessonSet))
{
Modified: trunk/app/src/org/crosswire/flashcards/QuizPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/QuizPane.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/QuizPane.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -35,6 +35,7 @@
import java.awt.event.ItemListener;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Vector;
import java.util.Iterator;
import java.util.List;
@@ -107,6 +108,7 @@
JPanel jPanel4 = new JPanel();
JPanel jPanel5 = new JPanel();
JPanel jPanel6 = new JPanel();
+ BorderLayout borderLayout4 = new BorderLayout();
static class WordEntry implements Serializable {
@@ -189,6 +191,7 @@
statusBar.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
jPanel1.setLayout(borderLayout3);
jPanel2.setLayout(borderLayout1);
+ jPanel6.setLayout(borderLayout4);
statusPanel.add(statusBar, BorderLayout.CENTER);
statusPanel.add(wCount, BorderLayout.EAST);
setLayout(borderLayout2);
@@ -196,7 +199,6 @@
jPanel3.add(playSoundButton);
jPanel4.add(startLessonButton);
jPanel5.add(showAnswerButton);
- jPanel6.add(choicesPanel);
this.add(statusPanel, java.awt.BorderLayout.SOUTH);
this.add(jPanel2, java.awt.BorderLayout.CENTER);
this.add(jPanel1, java.awt.BorderLayout.NORTH);
@@ -205,6 +207,7 @@
jPanel1.add(jPanel5, java.awt.BorderLayout.EAST);
jPanel2.add(jPanel6, java.awt.BorderLayout.SOUTH);
jPanel2.add(wordText, java.awt.BorderLayout.CENTER);
+ jPanel6.add(choicesPanel, java.awt.BorderLayout.CENTER);
}
@@ -221,9 +224,9 @@
Iterator lessonIter = setupPane.iterator();
while (lessonIter.hasNext()) {
Lesson lesson = (Lesson) lessonIter.next();
- Iterator cardIter = lesson.iterator();
- while (cardIter.hasNext()) {
- words.add(new WordEntry( (FlashCard) cardIter.next()));
+ Vector cards = lesson.getFlashcards();
+ for (int i = 0; i < cards.size(); i++) {
+ words.add(new WordEntry( (FlashCard) cards.get(i)));
}
// if (!loadedFont)
// {
Modified: trunk/app/src/org/crosswire/flashcards/SetupPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/SetupPane.java 2006-12-04 18:37:19 UTC (rev 101)
+++ trunk/app/src/org/crosswire/flashcards/SetupPane.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -105,7 +105,7 @@
panel.add(noMultipleChoice);
add(panel, BorderLayout.SOUTH);
}
-
+
static class LessonSetSelectionListener implements ListSelectionListener
{
private LessonPane lessonPanel;
@@ -125,7 +125,7 @@
return;
}
JList list = (JList) e.getSource();
- lessonPanel.loadLessons((LessonSet) list.getSelectedValue());
+ lessonPanel.loadLessons((ComplexLessonSet) list.getSelectedValue());
}
}
Copied: trunk/src/org/crosswire/flashcards/FlashCard.java (from rev 96, trunk/app/src/org/crosswire/flashcards/FlashCard.java)
===================================================================
--- trunk/src/org/crosswire/flashcards/FlashCard.java (rev 0)
+++ trunk/src/org/crosswire/flashcards/FlashCard.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -0,0 +1,169 @@
+/*
+ * Distribution Licence:
+ * FlashCard is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public License,
+ * version 2 as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details.
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/gpl.html,
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * The copyright to this program is held by it's authors
+ * Copyright: 2004
+ */
+package org.crosswire.flashcards;
+
+import java.util.Hashtable;
+import java.util.Enumeration;
+
+/**
+ * A FlashCard has a front and a back. The front has the test
+ * and the back has the answer.
+ *
+ * @author Troy A. Griffitts [scribe at crosswire dot org]
+ * @author DM Smith [ dmsmith555 at yahoo dot com]
+ */
+public class FlashCard {
+ private Hashtable original = new Hashtable();
+ private Hashtable values = new Hashtable();
+ private final String front = "front";
+ private final String back = "back";
+ private final String audioURL = "audioURL";
+
+ /**
+ * Create a partial FlashCard.
+ * @param front
+ */
+ public FlashCard() {
+ this("", "");
+ }
+
+ /**
+ * Create a complete FlashCard
+ * @param front
+ * @param back
+ */
+ public FlashCard(String frontValue, String backValue) {
+ original.put(front, frontValue);
+ original.put(back, backValue);
+ reset();
+ }
+
+ /**
+ * Get a particular side of this FlashCard.
+ * This is useful to flip the cards.
+ * @param front
+ * @return the requested side
+ */
+ public String getSide(boolean frontside) {
+ if (frontside) {
+ return getFront();
+ }
+ return getBack();
+ }
+
+ /**
+ * @return Returns the back.
+ */
+ public String getBack() {
+ return (String)values.get(back);
+ }
+
+ /**
+ * @param newBack The back to set.
+ */
+ public void setBack(String newBack) {
+ values.put(back, newBack);
+ }
+
+ /**
+ * @return Returns the front.
+ */
+ public String getFront() {
+ return (String)values.get(front);
+ }
+
+ /**
+ * @param newFront The front to set.
+ */
+ public void setFront(String newFront) {
+ values.put(front, newFront);
+ }
+
+ public String getAudioURL() {
+ return (String) values.get(audioURL);
+ }
+
+ public void setAudioURL(String newAudioURL) {
+ values.put(audioURL, newAudioURL);
+ }
+
+ /**
+ * Method reset
+ */
+ public void reset() {
+ hashCopy(values, original);
+ }
+
+ private static void hashCopy(Hashtable dest, Hashtable src) {
+ dest.clear();
+ for (Enumeration k = src.keys(); k.hasMoreElements();) {
+ String key = (String)k.nextElement();
+ dest.put(key, src.get(key));
+ }
+ }
+
+ /**
+ * Method isIncomplete
+ * @return boolean
+ */
+ public boolean isIncomplete() {
+ return (values.get(front) != null) && (values.get(back) != null);
+ }
+
+ /**
+ * Method setOriginal
+ */
+ public void setOriginal() {
+ hashCopy(original, values);
+ }
+
+ /**
+ * @return Returns whether this FlashCard has been modified.
+ */
+ protected boolean isModified() {
+ return !values.equals(original);
+ }
+
+ public Object clone() {
+ FlashCard n = new FlashCard();
+ hashCopy(n.original, original);
+ hashCopy(n.values, values);
+ return n;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (! (obj instanceof FlashCard)) {
+ return false;
+ }
+ FlashCard otherCard = (FlashCard) obj;
+ return values.equals(otherCard.values);
+ }
+
+ public int compareTo(Object other) {
+ return getFront().compareTo(((FlashCard)other).getFront());
+ }
+}
Copied: trunk/src/org/crosswire/flashcards/Lesson.java (from rev 101, trunk/app/src/org/crosswire/flashcards/Lesson.java)
===================================================================
--- trunk/src/org/crosswire/flashcards/Lesson.java (rev 0)
+++ trunk/src/org/crosswire/flashcards/Lesson.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -0,0 +1,237 @@
+/*
+ * Distribution Licence:
+ * FlashCard is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public License,
+ * version 2 as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details.
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/gpl.html,
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ *
+ * Copyright: 2004 CrossWire Bible Society
+ */
+
+package org.crosswire.flashcards;
+
+import java.util.Vector;
+
+/**
+ * A Lesson is an ordered list of FlashCards.
+ * The lesson also has a description which is useful for showing to a user.
+ *
+ * @author Troy A. Griffitts [scribe at crosswire dot org]
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class Lesson {
+
+ /**
+ * The <code>filename</code> gives the relative location of the lesson.
+ * Typically this is something like lesson/setname/lessonname.flash.
+ */
+ private String url;
+
+ /**
+ * A <code>description</code> of the lesson to be displayed to the user.
+ */
+ private String description;
+
+ /**
+ * A path to the <code>font</code> to be used by the lesson.
+ */
+ private String font;
+
+ /**
+ * An ordered list of <code>flashCards</code>
+ */
+ private Vector flashCards = new Vector();
+
+ private boolean modified = false;
+
+ /**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = -4031174832238749375L;
+
+ /**
+ * Construct a new, empty lesson.
+ */
+ public Lesson() {
+ this("NewLesson.flash", "New Lesson");
+ }
+
+
+ /**
+ * Construct a lesson from URL.
+ * @param url
+ */
+ public Lesson(String url) {
+ this(url, null);
+ }
+
+
+ /**
+ * Construct a lesson and assign a description
+ * @param url
+ * @param description
+ */
+ public Lesson(String url, String description) {
+ this.url = url;
+ load();
+
+ if (description != null) {
+ this.description = description;
+ }
+ }
+
+
+ /**
+ * Load this lesson from persistent store named by the lesson's <code>filename</code>.
+ */
+ protected void load() {
+ }
+
+
+ /**
+ * Save this lesson to persistent store named by the lesson's <code>filename</code>.
+ */
+ protected void store() {
+ }
+
+
+ /**
+ * Adds the specified <code>FlashCard</code> to this Lesson.
+ *
+ * @param flashCard to be added.
+ */
+ public void add(FlashCard flashCard) {
+ flashCards.addElement(flashCard);
+ modified = true;
+ }
+
+
+ /**
+ * Removes the specified <code>FlashCard</code> from the lesson.
+ *
+ * @param flashCard to be removed.
+ */
+ public void remove(FlashCard flashCard) {
+ flashCards.removeElement(flashCard);
+ modified = true;
+ }
+
+
+ /**
+ * @param flashCard
+ * @return
+ */
+ public boolean contains(FlashCard flashCard) {
+ return flashCards.contains(flashCard);
+ }
+
+
+ /**
+ * @return Returns the filename.
+ */
+ public String getURL() {
+ return url;
+ }
+
+
+ /**
+ * @param filename The filename to set.
+ */
+ public void setURL(String url) {
+ this.url = url;
+ modified = true;
+ }
+
+
+ /**
+ * @return Returns the description.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+
+ /**
+ * @param newDescription The description to set.
+ */
+ public void setDescription(String newDescription) {
+ description = newDescription;
+ modified = true;
+ }
+
+
+ /**
+ * @return Returns the font.
+ */
+ public String getFont() {
+ return font;
+ }
+
+
+ /**
+ * @param newFont The font to set.
+ */
+ public void setFont(String newFont) {
+ font = newFont;
+ modified = true;
+ }
+
+
+ /**
+ * @return Returns the flashCards.
+ */
+ public Vector getFlashcards() {
+ return flashCards;
+ }
+
+
+ public void setModified(boolean mod) {
+ modified = mod;
+ }
+
+ /**
+ * @return whether this lesson has been modified
+ */
+ public boolean isModified() {
+ if (modified) {
+ return true;
+ }
+
+ for (int i = 0; i < flashCards.size(); i++) {
+ FlashCard flashCard = (FlashCard) flashCards.elementAt(i);
+ if (flashCard.isModified()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object obj) {
+ Lesson lesson = (Lesson) obj;
+ return url.compareTo(lesson.url);
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return description;
+ }
+
+}
Copied: trunk/src/org/crosswire/flashcards/LessonSet.java (from rev 101, trunk/app/src/org/crosswire/flashcards/LessonSet.java)
===================================================================
--- trunk/src/org/crosswire/flashcards/LessonSet.java (rev 0)
+++ trunk/src/org/crosswire/flashcards/LessonSet.java 2006-12-09 00:53:32 UTC (rev 102)
@@ -0,0 +1,199 @@
+/*
+ * Distribution Licence:
+ * FlashCard is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public License,
+ * version 2 as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details.
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/gpl.html,
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2004 CrossWire Bible Society
+ */
+package org.crosswire.flashcards;
+
+import java.util.Vector;
+
+
+/**
+ * A <code>LessonSet</code> is an ordered list of <code>Lesson</code>s.
+ * The lessons are sorted by filename.
+ * The lesson set also has a description which is useful for showing to a user
+ * and a directory name where its Lessons are stored. This directory name is expected to be a relative
+ * path and will be stored either in a jar or in the user's FlashCard directory.
+ *
+ * @author Troy A. Griffitts [scribe at crosswire dot org]
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class LessonSet {
+
+ /**
+ * The <code>url</code> of the lesson
+ */
+ private String url = null;
+
+ /**
+ * A <code>description</code> of the lesson to be displayed to the user.
+ */
+ private String description;
+
+ /**
+ * An ordered list of <code>lessons</code>
+ */
+ private Vector lessons = new Vector();
+
+ /**
+ * Flag indicating whether this lesson set has been <code>modified</code>
+ */
+ private boolean modified;
+
+ /**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = -798022075988174038L;
+
+ public LessonSet(String url) {
+ this.url = url; // .toLowerCase();
+ description = url.substring(url.lastIndexOf('/', url.length() - 2) + 1);
+ if (description.endsWith("/")) {
+ description = description.substring(0, description.length() - 1);
+ }
+ load();
+ }
+
+
+ /**
+ * Get the relative path names of the lessons in this lesson set from
+ * the jar file.
+ * @param lessonSet
+ */
+
+
+ /**
+ * Load this lesson set from persistent store named by the lesson set's <code>dirname</code>.
+ * This is the union of lessons in the Jar and in the user's flashcard home directory.
+ */
+ protected void load() {
+ }
+
+
+ /**
+ * Save this lesson to persistent store named by the lesson's <code>dirname</code>.
+ */
+ public void store() {
+ for (int i = 0; i < lessons.size(); i++) {
+ Lesson lesson = (Lesson) lessons.elementAt(i);
+ if (lesson.isModified()) {
+ lesson.store();
+ }
+ }
+ }
+
+
+ /**
+ * @return whether the lesson set has been modified
+ */
+ public boolean isModified() {
+ if (modified) {
+ return true;
+ }
+
+ for (int i = 0; i < lessons.size(); i++) {
+ Lesson lesson = (Lesson) lessons.elementAt(i);
+ if (lesson.isModified()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public Vector getLessons() {
+ return lessons;
+ }
+
+
+ /**
+ * Adds the specified <code>Lesson</code> to this lesson set.
+ *
+ * @param flashCard to be added.
+ */
+ public void add(Lesson lesson) {
+ modified = true;
+ lessons.addElement(lesson);
+ }
+
+
+ /**
+ * @return Returns the description.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+
+ /**
+ * @param description The description to set.
+ */
+ public void setDescription(String newDescription) {
+ if (newDescription != null && !newDescription.equals(description)) {
+ modified = true;
+ description = newDescription;
+ }
+ }
+
+
+ /**
+ * @return Returns the dirname.
+ */
+ public String getURL() {
+ return url;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object obj) {
+ LessonSet lesson = (LessonSet) obj;
+ return description.compareTo(lesson.description);
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return description;
+ }
+
+
+ public void augment(LessonSet other) {
+ for (int i = 0; i < other.getLessons().size(); i++) {
+ Lesson l = (Lesson) other.getLessons().elementAt(i);
+ Lesson exists = getLesson(l.getDescription());
+ if (exists != null) {
+ lessons.removeElement(exists);
+ }
+ lessons.addElement(l);
+ }
+ }
+
+
+ public Lesson getLesson(String desc) {
+ for (int i = 0; i < lessons.size(); i++) {
+ Lesson ls = (Lesson) lessons.elementAt(i);
+ if (desc.equals(ls.getDescription())) {
+ return ls;
+ }
+ }
+ return null;
+ }
+}
More information about the sword-cvs
mailing list