[sword-svn] r109 - in trunk: app app/src/org/crosswire/flashcards micro/src/org/crosswire/flashcards micro/src/org/crosswire/flashcards/mobile
Apache
apache at www.crosswire.org
Tue Jan 30 20:16:11 MST 2007
Author:
Date: 2007-01-30 20:16:11 -0700 (Tue, 30 Jan 2007)
New Revision: 109
Modified:
trunk/app/Flash.jpx
trunk/app/src/org/crosswire/flashcards/LessonManager.java
trunk/app/src/org/crosswire/flashcards/LessonSetPane.java
trunk/app/src/org/crosswire/flashcards/QuizPane.java
trunk/micro/src/org/crosswire/flashcards/Properties.java
trunk/micro/src/org/crosswire/flashcards/mobile/FlashCards.java
Log:
Updated for more micro changes. More should be coming soon.
Modified: trunk/app/Flash.jpx
===================================================================
--- trunk/app/Flash.jpx 2006-12-27 23:57:16 UTC (rev 108)
+++ trunk/app/Flash.jpx 2007-01-31 03:16:11 UTC (rev 109)
@@ -157,7 +157,10 @@
<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="includeDeps" value="1"/>
+<property category="archiving" name="libraryStates.1" value="2:../../../Documents and Settings/scribe/Application Data/Sun/Java/Deployment/javaws/cache/http/Dwww.crosswire.org/P80/DMflashcards/DMwebstart/RMlessons.jar"/>
<property category="archiving" name="manifestConfigFile" value="0"/>
+<property category="archiving" name="obfuscator" value="RetroGuard for J2ME"/>
<property category="archiving" name="targetPath" value="Flash.jar"/>
<property category="archiving" name="usingRules" value="1"/>
</node>
Modified: trunk/app/src/org/crosswire/flashcards/LessonManager.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonManager.java 2006-12-27 23:57:16 UTC (rev 108)
+++ trunk/app/src/org/crosswire/flashcards/LessonManager.java 2007-01-31 03:16:11 UTC (rev 109)
@@ -27,7 +27,6 @@
import java.net.URLConnection;
import java.util.Arrays;
import java.util.Enumeration;
-import java.util.Iterator;
import java.util.Locale;
import java.util.Vector;
import java.util.jar.JarEntry;
@@ -44,7 +43,7 @@
public static final String LESSON_ROOT = "lessons";
private static final String DIR_PROJECT = ".flashcards";
- private static final LessonManager INSTANCE = new LessonManager();
+ private static LessonManager instance = new LessonManager();
/**
* An ordered list of <code>lessonSets</code>
@@ -54,7 +53,7 @@
private String homeProjectPath = null;
public static LessonManager instance() {
- return INSTANCE;
+ return instance;
}
@@ -62,7 +61,6 @@
homeProjectPath = System.getProperty("user.home") + File.separator + DIR_PROJECT;
homeLessonDir = new File(homeProjectPath + File.separator + LESSON_ROOT);
load();
- jbInit();
}
@@ -82,10 +80,13 @@
}
+ public Vector getLessonSets() {
+ return lessonSets;
+ }
+
public LessonSet getLessonSet(String description) {
- Iterator i = iterator();
- while (i.hasNext()) {
- LessonSet ls = (LessonSet) i.next();
+ for (int i = 0; i < lessonSets.size(); i++) {
+ LessonSet ls = (LessonSet) lessonSets.elementAt(i);
if (description.equals(ls.getDescription())) {
return ls;
}
@@ -161,15 +162,18 @@
* Load lesson sets from the jar file
*/
private void loadLessonSetsFromJarDir(String path) {
- File lessonDir = new File(path);
- if (lessonDir.isDirectory()) {
- File[] files = lessonDir.listFiles(new JarFileFilter());
- if (files != null) {
- for (int i = 0; i < files.length; i++) {
- loadJarLessonSets(files[i]);
+ try {
+ File lessonDir = new File(path);
+ if (lessonDir.isDirectory()) {
+ File[] files = lessonDir.listFiles(new JarFileFilter());
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
+ loadJarLessonSets(files[i]);
+ }
}
}
}
+ catch (Exception e) { e.printStackTrace(); }
}
@@ -229,9 +233,8 @@
* See if any LessonSet has changes that need to be saved
*/
public boolean isModified() {
- Iterator iter = lessonSets.iterator();
- while (iter.hasNext()) {
- LessonSet lessonSet = (LessonSet) iter.next();
+ for (int i = 0; i < lessonSets.size(); i++) {
+ LessonSet lessonSet = (LessonSet) lessonSets.elementAt(i);
if (lessonSet.isModified()) {
return true;
}
@@ -244,9 +247,8 @@
* Save all the modified lesson sets to persistent store named by the lesson's <code>LESSON_ROOT</code>.
*/
public void store() {
- Iterator iter = lessonSets.iterator();
- while (iter.hasNext()) {
- LessonSet lessonSet = (LessonSet) iter.next();
+ for (int i = 0; i < lessonSets.size(); i++) {
+ LessonSet lessonSet = (LessonSet) lessonSets.elementAt(i);
if (lessonSet.isModified()) {
lessonSet.store();
}
@@ -257,27 +259,18 @@
* Save all the modified lesson sets to persistent store named by the lesson's <code>LESSON_ROOT</code>.
*/
public void genImages() {
- Iterator iter = lessonSets.iterator();
- while (iter.hasNext()) {
- ComplexLessonSet lessonSet = (ComplexLessonSet) iter.next();
+ for (int i = 0; i < lessonSets.size(); i++) {
+ ComplexLessonSet lessonSet = (ComplexLessonSet) lessonSets.elementAt(i);
lessonSet.generateImages();
}
}
- public Iterator iterator() {
- return lessonSets.iterator();
- }
-
-
public String getHomeProjectPath() {
return homeProjectPath;
}
- private void jbInit() {
- }
-
static class JarFileFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
return name.toUpperCase(Locale.ENGLISH).endsWith(".JAR");
Modified: trunk/app/src/org/crosswire/flashcards/LessonSetPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonSetPane.java 2006-12-27 23:57:16 UTC (rev 108)
+++ trunk/app/src/org/crosswire/flashcards/LessonSetPane.java 2007-01-31 03:16:11 UTC (rev 109)
@@ -37,6 +37,7 @@
import javax.swing.ListSelectionModel;
import javax.swing.event.EventListenerList;
import javax.swing.event.ListSelectionListener;
+import java.util.Vector;
/**
@@ -129,10 +130,10 @@
private void loadLessonSets()
{
- Iterator lessonSetIterator = LessonManager.instance().iterator();
- while (lessonSetIterator.hasNext())
- {
- LessonSet lessonSet = (LessonSet) lessonSetIterator.next();
+ LessonManager lm = LessonManager.instance();
+ Vector ls =lm.getLessonSets();
+ for (int i = 0; i < ls.size(); i++) {
+ LessonSet lessonSet = (LessonSet) ls.elementAt(i);
DefaultListModel model = (DefaultListModel) lessonSetList.getModel();
model.addElement(lessonSet);
}
Modified: trunk/app/src/org/crosswire/flashcards/QuizPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/QuizPane.java 2006-12-27 23:57:16 UTC (rev 108)
+++ trunk/app/src/org/crosswire/flashcards/QuizPane.java 2007-01-31 03:16:11 UTC (rev 109)
@@ -423,7 +423,14 @@
void answer_itemStateChanged(ItemEvent e) {
- JCheckBox ck = (JCheckBox) e.getItem();
+ JCheckBox ck = null;
+ try {
+ ck = (JCheckBox) e.getItem();
+ }
+ catch (Exception e1) { e1.printStackTrace(); }
+
+ if (ck == null) return;
+
if (ck.isSelected()) {
totalAsked++;
if (ck.getText().compareTo(currentWord.getSide(setupPane.isFlipped())) != 0) {
Modified: trunk/micro/src/org/crosswire/flashcards/Properties.java
===================================================================
--- trunk/micro/src/org/crosswire/flashcards/Properties.java 2006-12-27 23:57:16 UTC (rev 108)
+++ trunk/micro/src/org/crosswire/flashcards/Properties.java 2007-01-31 03:16:11 UTC (rev 109)
@@ -33,7 +33,6 @@
throw new Exception("File Does Not Exist");
}
load(is);
- is.close();
}
public void loadURL(String url) throws Exception {
Modified: trunk/micro/src/org/crosswire/flashcards/mobile/FlashCards.java
===================================================================
--- trunk/micro/src/org/crosswire/flashcards/mobile/FlashCards.java 2006-12-27 23:57:16 UTC (rev 108)
+++ trunk/micro/src/org/crosswire/flashcards/mobile/FlashCards.java 2007-01-31 03:16:11 UTC (rev 109)
@@ -28,14 +28,14 @@
instance = this;
Properties l = new Properties();
try {
- l.load("lessons.properties");
+ l.load("/lessons.properties");
}
catch (Exception e) {}
if (l != null) {
for (int i = 0; true; i++) {
String ld = l.getProperty("LessonSet" + Integer.toString(i));
if (ld != null) {
- LessonSet ls = new MicroLessonSet(ld);
+ LessonSet ls = new MicroLessonSet("/"+ld);
String desc = l.getProperty("LessonDescription" + Integer.toString(i));
ls.setDescription( (desc != null) ? desc : ld);
lessonSets.addElement(ls);
More information about the sword-cvs
mailing list