diff options
author | Troy A. Griffitts <scribe@crosswire.org> | 2007-07-29 02:23:49 +0000 |
---|---|---|
committer | Troy A. Griffitts <scribe@crosswire.org> | 2007-07-29 02:23:49 +0000 |
commit | 771b8e8e21983a7e4b1a0f6bc1fcd0e16bc97179 (patch) | |
tree | 8647c54cd9df9f7b0c0df4e22482f83d3344f670 | |
parent | 3c858f2c808742bd1e16f261c6818a1589c1ab94 (diff) | |
download | sword-tools-771b8e8e21983a7e4b1a0f6bc1fcd0e16bc97179.tar.gz |
Added parallel tagging tool which was used for the KJV2003 project
It's been genericized and updated to work with newest sword codebase
Makefile has been updated and ant script has been added
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@91 07627401-56e2-0310-80f4-f8cd0041bdcd
54 files changed, 3923 insertions, 0 deletions
diff --git a/paralleltag/.aptana-settings b/paralleltag/.aptana-settings new file mode 100644 index 0000000..72a625b --- /dev/null +++ b/paralleltag/.aptana-settings @@ -0,0 +1,2 @@ +ide-has-run:true +ide-id:412495 diff --git a/paralleltag/.classpath b/paralleltag/.classpath new file mode 100644 index 0000000..73ad5f7 --- /dev/null +++ b/paralleltag/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry path="src" kind="src"/> + <classpathentry path="ModEdit.jar" kind="lib"/> + <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/> + <classpathentry path="classes" kind="output"/> +</classpath> diff --git a/paralleltag/.project b/paralleltag/.project new file mode 100644 index 0000000..f68c56f --- /dev/null +++ b/paralleltag/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>modedit</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/paralleltag/Makefile b/paralleltag/Makefile new file mode 100644 index 0000000..877965c --- /dev/null +++ b/paralleltag/Makefile @@ -0,0 +1,4 @@ +modedit: modedit.cpp + g++ -g -I/usr/include/sword modedit.cpp -o modedit `pkg-config --libs sword` +clean: + rm -f modedit diff --git a/paralleltag/ModEdit.properties b/paralleltag/ModEdit.properties new file mode 100644 index 0000000..2e5e706 --- /dev/null +++ b/paralleltag/ModEdit.properties @@ -0,0 +1,12 @@ +#ModEdit Properties +#Sat Jul 28 19:25:06 MST 2007 +localTarget=true +localImages=true +localTR=true +currentRange= +useProxy=false +lastVerse=Romans 5\:8 +proxyHost=[none] +localThayer=true +userID=tag +proxyPort=8080 diff --git a/paralleltag/README b/paralleltag/README new file mode 100644 index 0000000..689edbc --- /dev/null +++ b/paralleltag/README @@ -0,0 +1,25 @@ +Parallel tagging utility used for the KJV2003 project. + +It have been 'genericized'. + +Included is the exact TR (with NU updates) module used so the word numbering can be used to +patch update the KJV2003 project to other greek texts. It is also might +be useful to use the same word number for other tagging projects for +consistency. + +PREREQUISITES + +sword built and installed +java jdk +ant + + +BUILDING + +type: +make +ant + +RUNNING + +java -jar ParallelTag.jar diff --git a/paralleltag/build.xml b/paralleltag/build.xml new file mode 100644 index 0000000..ba7e190 --- /dev/null +++ b/paralleltag/build.xml @@ -0,0 +1,21 @@ +<project name="flashcards" default="jar"> + <target name="compile"> + <mkdir dir="classes"/> + <javac srcdir="src" + destdir="classes" + debug="on" + /> + </target> + <target name="jar" depends="compile"> + <delete file="ParallelTag.jar"/> + <jar destfile="ParallelTag.jar" basedir="classes"> + <manifest> + <attribute name="Main-Class" value="org.crosswire.modedit.ModEdit"/> + </manifest> + </jar> + </target> + <target name="clean"> + <delete dir="classes"/> + <delete file="ParallelTag.jar"/> + </target> +</project> diff --git a/paralleltag/images/endtag.gif b/paralleltag/images/endtag.gif Binary files differnew file mode 100644 index 0000000..1e078a7 --- /dev/null +++ b/paralleltag/images/endtag.gif diff --git a/paralleltag/images/endtagg.gif b/paralleltag/images/endtagg.gif Binary files differnew file mode 100644 index 0000000..f6de8cd --- /dev/null +++ b/paralleltag/images/endtagg.gif diff --git a/paralleltag/images/endtaggart.gif b/paralleltag/images/endtaggart.gif Binary files differnew file mode 100644 index 0000000..afbe5c1 --- /dev/null +++ b/paralleltag/images/endtaggart.gif diff --git a/paralleltag/images/endtaggsplit.gif b/paralleltag/images/endtaggsplit.gif Binary files differnew file mode 100644 index 0000000..95b5a0f --- /dev/null +++ b/paralleltag/images/endtaggsplit.gif diff --git a/paralleltag/images/endtaggverb.gif b/paralleltag/images/endtaggverb.gif Binary files differnew file mode 100644 index 0000000..8bc7d27 --- /dev/null +++ b/paralleltag/images/endtaggverb.gif diff --git a/paralleltag/images/endtagr.gif b/paralleltag/images/endtagr.gif Binary files differnew file mode 100644 index 0000000..bfa29a1 --- /dev/null +++ b/paralleltag/images/endtagr.gif diff --git a/paralleltag/images/endtagrart.gif b/paralleltag/images/endtagrart.gif Binary files differnew file mode 100644 index 0000000..8766002 --- /dev/null +++ b/paralleltag/images/endtagrart.gif diff --git a/paralleltag/images/endtagrsplit.gif b/paralleltag/images/endtagrsplit.gif Binary files differnew file mode 100644 index 0000000..570666f --- /dev/null +++ b/paralleltag/images/endtagrsplit.gif diff --git a/paralleltag/images/endtagrverb.gif b/paralleltag/images/endtagrverb.gif Binary files differnew file mode 100644 index 0000000..73e0cb3 --- /dev/null +++ b/paralleltag/images/endtagrverb.gif diff --git a/paralleltag/images/endtagy.gif b/paralleltag/images/endtagy.gif Binary files differnew file mode 100644 index 0000000..1e078a7 --- /dev/null +++ b/paralleltag/images/endtagy.gif diff --git a/paralleltag/images/endtagyart.gif b/paralleltag/images/endtagyart.gif Binary files differnew file mode 100644 index 0000000..6216628 --- /dev/null +++ b/paralleltag/images/endtagyart.gif diff --git a/paralleltag/images/endtagysplit.gif b/paralleltag/images/endtagysplit.gif Binary files differnew file mode 100644 index 0000000..1098f09 --- /dev/null +++ b/paralleltag/images/endtagysplit.gif diff --git a/paralleltag/images/endtagyverb.gif b/paralleltag/images/endtagyverb.gif Binary files differnew file mode 100644 index 0000000..2fc3e42 --- /dev/null +++ b/paralleltag/images/endtagyverb.gif diff --git a/paralleltag/images/starttagg.gif b/paralleltag/images/starttagg.gif Binary files differnew file mode 100644 index 0000000..f4f5515 --- /dev/null +++ b/paralleltag/images/starttagg.gif diff --git a/paralleltag/images/starttaggart.gif b/paralleltag/images/starttaggart.gif Binary files differnew file mode 100644 index 0000000..a7ce2c7 --- /dev/null +++ b/paralleltag/images/starttaggart.gif diff --git a/paralleltag/images/starttaggsplit.gif b/paralleltag/images/starttaggsplit.gif Binary files differnew file mode 100644 index 0000000..e60e012 --- /dev/null +++ b/paralleltag/images/starttaggsplit.gif diff --git a/paralleltag/images/starttaggverb.gif b/paralleltag/images/starttaggverb.gif Binary files differnew file mode 100644 index 0000000..5f47ffb --- /dev/null +++ b/paralleltag/images/starttaggverb.gif diff --git a/paralleltag/images/starttagr.gif b/paralleltag/images/starttagr.gif Binary files differnew file mode 100644 index 0000000..e6c2ed3 --- /dev/null +++ b/paralleltag/images/starttagr.gif diff --git a/paralleltag/images/starttagrart.gif b/paralleltag/images/starttagrart.gif Binary files differnew file mode 100644 index 0000000..14e197d --- /dev/null +++ b/paralleltag/images/starttagrart.gif diff --git a/paralleltag/images/starttagrsplit.gif b/paralleltag/images/starttagrsplit.gif Binary files differnew file mode 100644 index 0000000..f056a2d --- /dev/null +++ b/paralleltag/images/starttagrsplit.gif diff --git a/paralleltag/images/starttagrverb.gif b/paralleltag/images/starttagrverb.gif Binary files differnew file mode 100644 index 0000000..791e38a --- /dev/null +++ b/paralleltag/images/starttagrverb.gif diff --git a/paralleltag/images/starttagy.gif b/paralleltag/images/starttagy.gif Binary files differnew file mode 100644 index 0000000..a327bee --- /dev/null +++ b/paralleltag/images/starttagy.gif diff --git a/paralleltag/images/starttagyart.gif b/paralleltag/images/starttagyart.gif Binary files differnew file mode 100644 index 0000000..05579a2 --- /dev/null +++ b/paralleltag/images/starttagyart.gif diff --git a/paralleltag/images/starttagysplit.gif b/paralleltag/images/starttagysplit.gif Binary files differnew file mode 100644 index 0000000..96eb44d --- /dev/null +++ b/paralleltag/images/starttagysplit.gif diff --git a/paralleltag/images/starttagyverb.gif b/paralleltag/images/starttagyverb.gif Binary files differnew file mode 100644 index 0000000..f57bb97 --- /dev/null +++ b/paralleltag/images/starttagyverb.gif diff --git a/paralleltag/modedit.cpp b/paralleltag/modedit.cpp new file mode 100644 index 0000000..4f56d8b --- /dev/null +++ b/paralleltag/modedit.cpp @@ -0,0 +1,165 @@ +#include <swmgr.h> +#include <markupfiltmgr.h> +#include <versekey.h> +#include <rawtext.h> +#include <iostream> + +#ifndef __GNUC__ +#include <io.h> +#else +#include <unistd.h> +#endif +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + + + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +using namespace std; +using namespace sword; + +SWMgr *mgr = 0; + + +void getModText(const char *modName, const char *key) { + SWModule *mod = mgr->getModule(modName); + //cout << "KEY:"<<key<<"<br>"; + if (mod) { + mod->setKey(key); + cout << mod->KeyText() << "|"; + cout << mod->getRawEntry(); + } +} + + +void exportRange(const char *modName, const char *key) { + SWModule *mod = mgr->getModule(modName); + //cout << "KEY:"<<key<<"<br>"; + if (mod) { + VerseKey parser; + ListKey scope = parser.ParseVerseList(key, parser, true); + scope.Persist(1); + mod->setKey(scope); + RawText::createModule("./"); + RawText *outmod = new RawText("./"); + for (mod->setPosition(TOP); !mod->Error(); mod->increment()) { + outmod->setKey(mod->KeyText()); + outmod->setEntry(mod->getRawEntry()); + } + + } +} + + +void writeModEntry(const char *modName, const char *key, const char *text) { + SWModule *mod = mgr->getModule(modName); + //cout << "KEY:"<<key<<"<br>"; + if (mod) { + mod->setKey(key); + mod->getRawEntry(); + mod->setEntry(text); + (*mod)++; + cout << mod->KeyText(); + } +} + + +void writeModEntryFromFile(const char *modName, const char *key, const char *fname) { + SWModule *mod = mgr->getModule(modName); + //cout << "KEY:"<<key<<"<br>"; + if (mod) { + int fd = open(fname, O_RDONLY|O_BINARY); + if (fd > -1) { + long size = lseek(fd, 0, SEEK_END); + lseek(fd, 0, SEEK_SET); + char *buf = new char [ size + 1 ]; + read(fd, buf, size); + buf[size] = 0; + mod->setKey(key); + mod->getRawEntry(); + mod->setEntry(buf); + (*mod)++; + cout << mod->KeyText(); + return; + } + } + cout << key; + return; +} + + +void getAttributes(const char *modName, const char *key) { + SWModule *mod = mgr->getModule(modName); + if (mod) { + //cout << key << "<br>"; + mod->setKey(key); + mod->RenderText(); + AttributeTypeList::iterator i1; + AttributeList::iterator i2; + AttributeValue::iterator i3; + for (i1 = mod->getEntryAttributes().begin(); i1 != mod->getEntryAttributes().end(); i1++) { + for (i2 = i1->second.begin(); i2 != i1->second.end(); i2++) { + for (i3 = i2->second.begin(); i3 != i2->second.end(); i3++) { + std::cout << i1->first << "|" << i2->first << "|" << i3->first << "|" << i3->second; + std::cout.put(10); + } + } + } + } +} + + +void getModHTML(const char *modName, const char *key) { + SWModule *mod = mgr->getModule(modName); + if (mod) { + mod->setKey(key); +// cout << "<html>\n"; +// cout << "<head>\n"; +// cout << "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"; +// cout << "</head>\n"; +// cout << "<body>\n"; + cout << mod->KeyText() << "|"; + cout << mod->RenderText(); +// cout << "</body>\n"; +// cout << "</html>\n"; + } +} + + +int main(int argc, char **argv) { + if (argc < 2) { + fprintf(stderr, "usage: %s <read|html|write|fileWrite|attributes|export> <modname> <key> [text]\n\n", *argv); + exit(1); + } + + mgr = new SWMgr(new MarkupFilterMgr(FMT_HTML, ENC_UTF8)); + mgr->setGlobalOption("Textual Variants", "Secondary Reading"); + +// mgr = new SWMgr("/home/sword/html/kjv2003", true, new MarkupFilterMgr(FMT_HTML, ENC_UTF8)); +//SWMgr mgr("/home/sword/html/kjv2003"); + + switch (argv[1][0]) { + case 'r': getModText(argv[2], argv[3]); + break; + case 'h': getModHTML(argv[2], argv[3]); + break; + case 'a': getAttributes(argv[2], argv[3]); + break; + case 'e': exportRange(argv[2], argv[3]); + break; + case 'w': writeModEntry(argv[2], argv[3], argv[4]); + break; + case 'f': writeModEntryFromFile(argv[2], argv[3], argv[4]); + break; + } + char buf[20]; +// cin >> buf; + + delete mgr; + + return 0; +} diff --git a/paralleltag/modedit.html b/paralleltag/modedit.html new file mode 100644 index 0000000..c8cba22 --- /dev/null +++ b/paralleltag/modedit.html @@ -0,0 +1,24 @@ +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-15"> +<TITLE>JBuilder Project untitled4.jpx</TITLE> +</HEAD> +<BODY> +<H1>Project Notes</H1> +<HR> +<FONT SIZE=+1> +<STRONG>Project: </STRONG><BR> +<STRONG>Author: </STRONG><BR> +<STRONG>Company: </STRONG><BR> +<STRONG>Description: </STRONG><BR> + +<HR> +<STRONG>Things to do... </STRONG><BR> +</FONT> +<UL> +<!-- Edit this section to keep track of your to do items --> +<LI>Item 1 +<LI>Item 2 +</UL> +</BODY> +</HTML> diff --git a/paralleltag/mods.d/target.conf b/paralleltag/mods.d/target.conf new file mode 100644 index 0000000..7e29f9a --- /dev/null +++ b/paralleltag/mods.d/target.conf @@ -0,0 +1,11 @@ +[Target] +DataPath=./target/ +ModDrv=RawText +SourceType=GBF +Lang=en +Encoding=UTF-8 +Feature=StrongsNumbers +Version=0.1 +Description=Target Parallel Module +About=This is the target module in progress for the Parallel Module toolset +LCSH=Bible. diff --git a/paralleltag/mods.d/thayer.conf b/paralleltag/mods.d/thayer.conf new file mode 100644 index 0000000..4bc7bdf --- /dev/null +++ b/paralleltag/mods.d/thayer.conf @@ -0,0 +1,17 @@ +[Thayer] +DataPath=./modules/lexdict/zld/thayer/thayer +ModDrv=zLD +CompressType=ZIP +Lang=en +Feature=GreekDef +Feature=GreekParse +Description=Thayer's Greek Lexicon +LocalOptionFilter=GreekLexAttribs +Encoding=UTF-8 +SourceType=ThML +Version=2.1 +History_2.1=Fixed problem that caused index to fail to display +History_2.0=added Greek & Hebrew text in UTF-8 and reformatted in ThML +About=Thayer's Greek Lexicon\par\par This is a lexicon of Greek words keyed off of Strong's numbers. +LCSH=Greek language--Dictionaries--English. +DistributionLicense=Public Domain diff --git a/paralleltag/mods.d/tr.conf b/paralleltag/mods.d/tr.conf new file mode 100644 index 0000000..afb8ca3 --- /dev/null +++ b/paralleltag/mods.d/tr.conf @@ -0,0 +1,23 @@ +[TR] +DataPath=./modules/texts/ztext/tr/ +ModDrv=zText +BlockType=CHAPTER +CompressType=ZIP +Lang=grc +Encoding=UTF-8 +SourceType=ThML +MinimumVersion=1.5.3 +GlobalOptionFilter=ThMLVariants +GlobalOptionFilter=ThMLStrongs +GlobalOptionFilter=ThMLMorph +Feature=StrongsNumbers +Version=1.1 +History_1.1=corrected Strong's numbers & variants +Description=1550/1894 Textus Receptus +About=The Textus Receptus with complete parsing information for all Greek words; base text is Stephens 1550, with variants of Scrivener 1894. +SwordVersionDate=2002-02-07 +LCSH=Bible. N.T. Greek. +DistributionLicense=Public Domain +TextSource=http://www.byztxt.com +Obsoletes=Scrivner +Obsoletes=Stephanus diff --git a/paralleltag/modules/lexdict/zld/thayer/thayer.dat b/paralleltag/modules/lexdict/zld/thayer/thayer.dat Binary files differnew file mode 100644 index 0000000..c2b3c5e --- /dev/null +++ b/paralleltag/modules/lexdict/zld/thayer/thayer.dat diff --git a/paralleltag/modules/lexdict/zld/thayer/thayer.idx b/paralleltag/modules/lexdict/zld/thayer/thayer.idx Binary files differnew file mode 100644 index 0000000..404b098 --- /dev/null +++ b/paralleltag/modules/lexdict/zld/thayer/thayer.idx diff --git a/paralleltag/modules/lexdict/zld/thayer/thayer.zdt b/paralleltag/modules/lexdict/zld/thayer/thayer.zdt Binary files differnew file mode 100644 index 0000000..2165381 --- /dev/null +++ b/paralleltag/modules/lexdict/zld/thayer/thayer.zdt diff --git a/paralleltag/modules/lexdict/zld/thayer/thayer.zdx b/paralleltag/modules/lexdict/zld/thayer/thayer.zdx Binary files differnew file mode 100644 index 0000000..03cc963 --- /dev/null +++ b/paralleltag/modules/lexdict/zld/thayer/thayer.zdx diff --git a/paralleltag/modules/texts/ztext/tr/nt.czs b/paralleltag/modules/texts/ztext/tr/nt.czs Binary files differnew file mode 100644 index 0000000..3f0e832 --- /dev/null +++ b/paralleltag/modules/texts/ztext/tr/nt.czs diff --git a/paralleltag/modules/texts/ztext/tr/nt.czv b/paralleltag/modules/texts/ztext/tr/nt.czv Binary files differnew file mode 100644 index 0000000..518c0a2 --- /dev/null +++ b/paralleltag/modules/texts/ztext/tr/nt.czv diff --git a/paralleltag/modules/texts/ztext/tr/nt.czz b/paralleltag/modules/texts/ztext/tr/nt.czz Binary files differnew file mode 100644 index 0000000..3068e58 --- /dev/null +++ b/paralleltag/modules/texts/ztext/tr/nt.czz diff --git a/paralleltag/src/org/crosswire/modedit/.swp b/paralleltag/src/org/crosswire/modedit/.swp Binary files differnew file mode 100644 index 0000000..665e9c1 --- /dev/null +++ b/paralleltag/src/org/crosswire/modedit/.swp diff --git a/paralleltag/src/org/crosswire/modedit/About.java b/paralleltag/src/org/crosswire/modedit/About.java new file mode 100644 index 0000000..9eebbfb --- /dev/null +++ b/paralleltag/src/org/crosswire/modedit/About.java @@ -0,0 +1,120 @@ +package org.crosswire.modedit; + +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; +import javax.swing.text.html.*; +import java.lang.StringBuffer; +import java.io.StringReader; + +/** + * <p>Title: Proxy configuration</p> + * <p>Description: prompts User to configer his/her Proxy</p> + * <p>Copyright: Copyright (c) 2002</p> + * <p>Organisation: </p> + * @author Christian Frommeyer + * @version 1.0 + */ + +public class About extends JDialog { + BorderLayout mainLayout = new BorderLayout(); + JPanel buttonPanel = new JPanel(); + GridLayout buttonPanelLayout = new GridLayout(); + JButton okButton = new JButton(); + + private boolean ok = false; + private JPanel jPanel1 = new JPanel(); + private JPanel jPanel2 = new JPanel(); + private BorderLayout borderLayout1 = new BorderLayout(); + private JLabel jLabel1 = new JLabel(); + private GridLayout gridLayout1 = new GridLayout(); + private JLabel jLabel2 = new JLabel(); + private JPanel jPanel3 = new JPanel(); + private JScrollPane jScrollPane1 = new JScrollPane(); + private BorderLayout borderLayout2 = new BorderLayout(); + private JEditorPane jEditorPane1 = new JEditorPane(); + private JLabel jLabel3 = new JLabel(); + + public About() { + try { + jbInit(); + } + catch(Exception e) { + e.printStackTrace(); + } + } + + + private void jbInit() throws Exception { + this.setModal(true); + this.setSize(new Dimension(591, 604)); + this.setTitle("About ModEdit"); + this.getContentPane().setLayout(mainLayout); + buttonPanel.setLayout(buttonPanelLayout); + okButton.setText("OK"); + okButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + button_actionPerformed(e); + } + }); + jPanel1.setLayout(borderLayout1); + jLabel1.setText("Module Editor (c) 2002 CrossWire Bible Society"); + jPanel2.setLayout(gridLayout1); + gridLayout1.setColumns(1); + gridLayout1.setRows(0); + jLabel2.setText("-- licensed under the terms of the GNU GPL"); + jPanel3.setLayout(borderLayout2); + HTMLEditorKit htmlKit = new HTMLEditorKit(); + jEditorPane1.setEditable(false); + jEditorPane1.setEditorKit(htmlKit); + jEditorPane1.setText(""); + HTMLDocument doc = (HTMLDocument)jEditorPane1.getDocument(); + StringBuffer sb = new StringBuffer(); + sb.append("<html><body>"); + sb.append("<h1>Markup Guidelines</h1>"); + sb.append("<ul>"); + sb.append("<li><b>What To Tag</b> - All words in the English should be enclosed in a Greek tag <i>except</i> words marked with {FI}word{Fi} tags, which are declared as 'added' (see {tags} below). Even if you don't feel the translation is good or valid (and may be justifiably correct), the words should still be marked. Our job with this project is only to <u>tag the translator's choices, not critique them.<br>"); + sb.append("<li><b>The Article</b> - Articles that appear in the Greek <u><i>should <b>not</b> be used to tag English</i></u> <b>unless</b> the article has only an <b>implied noun</b>. If the noun is actually present in the Greek (98% of the time), any article in English should be marked <b>with the noun</b>. These empty article tags will be programmatically combined with the greek noun and the noun marked 'definite' or 'indefinite' after the tagging project is complete.<br><br>eg. OIKOS (a house); hO (empty) OIKOS (the house).</li><br>"); + sb.append("<li><b>Genitive and Dative</b> - Typically in the KJV, the genitive and dative forms of nouns are translated with 'of' and 'to' respectively. The English 'of' or 'to' should be included in the genitive or dative noun tag.<br><br>eg. OIKON (to a house); hOU (empty) OIKOU (of the house)</li><br>"); + sb.append("<li><b>Tag Placement</b> - Tags should not include spaces (_) unless between multiple words for the tag. Tags should never be nested or crossed, ie. the start or end of a tag should never be placed <b>between</b> the start and end of another tag.</li><br>"); + sb.append("<li><b>Split Tags</b> - Use the [Split] button only when absolutely necessary, when the translation string is discontiguous. The button will toggle on/off the split status of the tag, so only 1 split for a tag is possible.</li><br>"); + sb.append("<li><b>UNSURE</b> - Leave a note. Any notes on verses will be reviewed. In some instances, KJV phrases were translated from Latin sources. You will probably not find a Greek counterpart to mark these English phrases. Do the best you can and leave a note.</li><br>"); + sb.append("<li><b>{tags}</b> - You may see tags marked with <b>{ }</b> symbols in the text. These represent 'General Bible Format' markers and are typically for presentation, but some can be helpful to your markup. Some you'll see in the KJV text:<ul>"); + sb.append("<li><b>{CM}</b> - Paragraph break.</li>"); + sb.append("<li><b>{FR} {Fr}</b> - Start and end of 'words of Jesus' (red-letter Bibles use these). Remember: FR = Format Red</li>"); + sb.append("<li><b>{FI} {Fi}</b> - Start and end of <b>translation change (added)</b> words. These, by definition <u><i>should not be tagged</i></u> with Greek. Remember: FI = Format Italics</li>"); + sb.append("</ul>"); +// sb.append("<li><b></b> - </li>"); +// sb.append(""); + sb.append("</ul>"); + sb.append("</br>"); + sb.append("</body></html>"); + StringReader sr = new StringReader(sb.toString()); + jEditorPane1.getEditorKit().read(sr, doc, 0); + jEditorPane1.setCaretPosition(0); + + + jEditorPane1.setToolTipText(""); + jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jLabel3.setText(".v1.0.3"); + buttonPanel.add(okButton, null); + this.getContentPane().add(jPanel1, BorderLayout.CENTER); + jPanel1.add(jPanel2, BorderLayout.NORTH); + jPanel2.add(jLabel1, null); + jPanel2.add(jLabel3, null); + jPanel2.add(jLabel2, null); + jPanel1.add(jPanel3, BorderLayout.CENTER); + jPanel3.add(jScrollPane1, BorderLayout.CENTER); + jScrollPane1.getViewport().add(jEditorPane1, null); + + this.getContentPane().add(buttonPanel, BorderLayout.SOUTH); + } + + void button_actionPerformed(ActionEvent e) { + if (e.getActionCommand().equals(okButton.getActionCommand())) ok = true; + else ok = false; + this.hide(); + } + + +}
\ No newline at end of file diff --git a/paralleltag/src/org/crosswire/modedit/Application1.java b/paralleltag/src/org/crosswire/modedit/Application1.java new file mode 100644 index 0000000..7399641 --- /dev/null +++ b/paralleltag/src/org/crosswire/modedit/Application1.java @@ -0,0 +1,42 @@ +package org.crosswire.modedit; + +import javax.swing.UIManager; +import java.awt.*; + +public class Application1 { + boolean packFrame = false; + + //Construct the application + public Application1() { + Frame1 frame = new Frame1(); + //Validate frames that have preset sizes + //Pack frames that have useful preferred size info, e.g. from their layout + if (packFrame) { + frame.pack(); + } + else { + frame.validate(); + } + //Center the window + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension frameSize = frame.getSize(); + if (frameSize.height > screenSize.height) { + frameSize.height = screenSize.height; + } + if (frameSize.width > screenSize.width) { + frameSize.width = screenSize.width; + } + frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + frame.setVisible(true); + } + //Main method + public static void main(String[] args) { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } + catch(Exception e) { + e.printStackTrace(); + } + new Application1(); + } +}
\ No newline at end of file diff --git a/paralleltag/src/org/crosswire/modedit/Frame1.java b/paralleltag/src/org/crosswire/modedit/Frame1.java new file mode 100644 index 0000000..3b56502 --- /dev/null +++ b/paralleltag/src/org/crosswire/modedit/Frame1.java @@ -0,0 +1,36 @@ +package org.crosswire.modedit; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class Frame1 extends JFrame { + JPanel contentPane; + BorderLayout borderLayout1 = new BorderLayout(); + + //Construct the frame + public Frame1() { + enableEvents(AWTEvent.WINDOW_EVENT_MASK); + try { + jbInit(); + } + catch(Exception e) { + e.printStackTrace(); + } + } + //Component initialization + private void jbInit() throws Exception { + //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]"))); + contentPane = (JPanel) this.getContentPane(); + contentPane.setLayout(borderLayout1); + this.setSize(new Dimension(400, 300)); + this.setTitle("Frame Title"); + } + //Overridden so we can exit when window is closed + protected void processWindowEvent(WindowEvent e) { + super.processWindowEvent(e); + if (e.getID() == WindowEvent.WINDOW_CLOSING) { + System.exit(0); + } + } +}
\ No newline at end of file diff --git a/paralleltag/src/org/crosswire/modedit/MainFrame.java b/paralleltag/src/org/crosswire/modedit/MainFrame.java new file mode 100644 index 0000000..ad598ef --- /dev/null +++ b/paralleltag/src/org/crosswire/modedit/MainFrame.java @@ -0,0 +1,2087 @@ +package org.crosswire.modedit; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.text.html.*; +import javax.swing.text.*; +import javax.swing.event.*; +import java.io.*; +import javax.swing.border.*; +import java.net.URLEncoder; +import java.net.URLDecoder; +//import com.borland.jbcl.layout.*; +import java.util.Hashtable; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Properties; +import java.util.zip.ZipOutputStream; +import java.util.zip.ZipEntry; +import java.net.URL; +import java.net.URLConnection; +import java.util.Date; +import java.text.SimpleDateFormat; +import java.lang.Cloneable; + +public class MainFrame extends JFrame { + JPanel contentPane; + Font newFont = null; + BorderLayout contentPaneLayout = new BorderLayout(); + JPanel rightPanel = new JPanel(); + JPanel leftPanel = new JPanel(); + JPanel currentTagPanel = new JPanel(); + JPanel textPanel = new JPanel(); + BorderLayout leftPanelLayout = new BorderLayout(); + JEditorPane translatedTextEditor = new JEditorPane() { + public boolean isManagingFocus() { return true; } + }; + GridLayout textPanelLayout = new GridLayout(); + JTextArea greekTextEditor = new JTextArea() { + public boolean isManagingFocus() { return true; } + }; + JPanel signSavePanel = new JPanel(); + JPanel tagPanel = new JPanel(); + BorderLayout currentTagPanelLayout = new BorderLayout(); + JLabel currentTagLabel = new JLabel(); + GridLayout tagPanelLayout = new GridLayout(); + JTextField currentTagText = new JTextField(); + JPanel currentActionPanel = new JPanel(); + JLabel currentActionLabel = new JLabel(); + JLabel actionLabel = new JLabel(); + JButton signSaveButton = new JButton(); + JButton guessTagButton = new JButton(); + JPanel loginPanel = new JPanel(); + JLabel userIDLabel = new JLabel(); + JTextField userIDText = new JTextField(); + JButton loginButton = new JButton(); + JLabel loginStatusLabel = new JLabel(); + GridLayout loginPanelLayout = new GridLayout(); + BorderLayout rightPanelLayout = new BorderLayout(); + int currentCaret = -1; + Object greekHighlight; + + /**Construct the frame*/ + public MainFrame() { + enableEvents(AWTEvent.WINDOW_EVENT_MASK); + try { + jbInit(); + } + catch(Exception e) { + e.printStackTrace(); + } + } + + private JEditorPane strongTextEditor = new JEditorPane(); + private TitledBorder translatedTextEditorBorder; + private TitledBorder greekTextEditorBorder; + private TitledBorder strongTextEditorBorder; + private Hashtable tags = new Hashtable(); + private JScrollPane strongTextScroll = new JScrollPane(); + private JScrollPane translatedTextScroll = new JScrollPane(); + private JScrollPane greekTextScroll = new JScrollPane(); + private JPanel aPanel = new JPanel(); + private JPanel currentVersePanel = new JPanel(); + private BorderLayout aPanelLayout = new BorderLayout(); + private JLabel currentVerseLabel = new JLabel(); + private JTextField currentVerseText = new JTextField(); + private GridLayout currentVersePanelLayout = new GridLayout(); + private JButton loadVerseButton = new JButton(); + private TitledBorder currentVersePanelBorder; + private TitledBorder loginPanelBorder; + private JPanel bPanel = new JPanel(); + private JPanel strongPanel = new JPanel(); + private JTextField wordText = new JTextField(); + private GridLayout strongPanelLayout = new GridLayout(); + private JTextField morphText = new JTextField(); + private JTextField strongText = new JTextField(); + private BorderLayout bPanelLayout = new BorderLayout(); + private TitledBorder signSavePanelBorder; + private JPanel cPanel = new JPanel(); + + boolean localTR = false; + boolean localTarget = false; + boolean localThayer = false; + boolean localImages = false; + String util = "./modedit"; + + static String startTag1 = "<a href=\"http://SID:"; + static String startTag2 = "\"><img border=0 src=\"http://www.crosswire.org/images/starttag"; + static String startTag3 = ".gif\"></a>"; + static String endTag1 = "<a href=\"http://EID:"; + static String endTag2 = "\"><img border=0 src=\"http://www.crosswire.org/images/endtag"; + static String endTag3 = ".gif\"></a>"; + + private String userID = null; + private String loginToken = null; + + private String proxyHost = null; + private String proxyPort = null; + private boolean useProxy = false; + + public String currentKey = null; + private JPanel currentRangePanel = new JPanel(); + private JLabel currentRangeLabel = new JLabel(); + private JTextField rangeText = new JTextField(); + private GridLayout currentRangePanelLayout = new GridLayout(); + private BorderLayout cPanelLayout = new BorderLayout(); + private TitledBorder currentRangePanelBorder; + private JButton exportRangeButton = new JButton(); + private TitledBorder leftPanelBorder; + private JMenuBar jMenuBar1 = new JMenuBar(); + private JMenu jMenu1 = new JMenu(); + private JMenuItem jMenuItem1 = new JMenuItem(); + private JMenu jMenu2 = new JMenu(); + private JMenuItem jMenuItem2 = new JMenuItem(); + private JLabel jLabel1 = new JLabel(); + private JScrollPane jScrollPane1 = new JScrollPane(); + private JTextArea notesText = new JTextArea(); + private BorderLayout borderLayout1 = new BorderLayout(); + private JPanel jPanel1 = new JPanel(); + private BorderLayout borderLayout2 = new BorderLayout(); + private TitledBorder titledBorder1; + private JMenu jMenu3 = new JMenu(); + private JMenuItem jMenuItem3 = new JMenuItem(); + private JPanel jPanel2 = new JPanel(); + private JButton jButton1 = new JButton(); + + /**Component initialization*/ + private void jbInit() throws Exception { + //setIconImage(Toolkit.getDefaultToolkit().createImage(MainFrame.class.getResource("[Your Icon]"))); + contentPane = (JPanel) this.getContentPane(); + try { + loadFont(); + } + catch (Exception e){} + + HTMLEditorKit htmlKit = new HTMLEditorKit(); + currentVersePanelBorder = new TitledBorder(""); + loginPanelBorder = new TitledBorder(""); + signSavePanelBorder = new TitledBorder(""); + currentRangePanelBorder = new TitledBorder(""); + leftPanelBorder = new TitledBorder(""); + titledBorder1 = new TitledBorder(""); + translatedTextEditor.setEditable(false); + translatedTextEditor.setEditorKit(htmlKit); + translatedTextEditor.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(KeyEvent e) { + translatedTextEditor_keyPressed(e); + } + }); + + HTMLEditorKit htmlKit3 = new HTMLEditorKit(); + strongTextEditor.setEditable(false); + strongTextEditor.setEditorKit(htmlKit3); + + HTMLEditorKit htmlKit2 = new HTMLEditorKit(); + greekTextEditor.setLineWrap(true); + greekTextEditor.setEditable(false); + greekTextEditor.setWrapStyleWord(true); + greekTextEditor.addKeyListener(new MainFrame_greekTextEditor_keyAdapter(this)); + greekTextEditor.addMouseListener(new MainFrame_greekTextEditor_mouseAdapter(this)); +// greekTextEditor.setEditorKit(htmlKit2); + + translatedTextEditorBorder = new TitledBorder(""); + greekTextEditorBorder = new TitledBorder(""); + strongTextEditorBorder = new TitledBorder(""); +// translatedTextEditor.setFont(new java.awt.Font("Monospaced", 0, 14)); + if (newFont != null) { + translatedTextEditor.setFont(newFont); + } + translatedTextEditor.setBorder(translatedTextEditorBorder); + translatedTextEditor.addKeyListener(new MainFrame_translatedTextEditor_keyAdapter(this)); + translatedTextEditor.addMouseMotionListener(new MainFrame_translatedTextEditor_mouseMotionAdapter(this)); + translatedTextEditor.addMouseListener(new MainFrame_translatedTextEditor_mouseAdapter(this)); + translatedTextEditor.addHyperlinkListener(new Hyperactive()); + HTMLDocument doc = (HTMLDocument)translatedTextEditor.getDocument(); + doc.setPreservesUnknownTags(true); + + contentPane.setLayout(contentPaneLayout); + this.setJMenuBar(jMenuBar1); + this.setSize(new Dimension(587, 564)); + this.setTitle("Module Editor"); + this.addKeyListener(new MainFrame_this_keyAdapter(this)); + leftPanel.setLayout(leftPanelLayout); + textPanelLayout.setRows(3); + textPanelLayout.setColumns(1); + textPanel.setLayout(textPanelLayout); + greekTextEditor.setBackground(Color.lightGray); + greekTextEditor.setFont(new java.awt.Font("Dialog", 0, 18)); + greekTextEditor.setBorder(greekTextEditorBorder); + currentTagPanel.setLayout(currentTagPanelLayout); + currentTagLabel.setText("Current Tag"); + tagPanel.setLayout(tagPanelLayout); + currentTagText.setText("0"); + currentActionLabel.setText("Current Action:"); + actionLabel.setText("[none]"); + signSaveButton.setText("Sign & Save"); + signSaveButton.addActionListener(new MainFrame_signSaveButton_actionAdapter(this)); + guessTagButton.setText("Guess at all tags"); + guessTagButton.addActionListener(new MainFrame_guessTagButton_actionAdapter(this)); + rightPanel.setLayout(rightPanelLayout); + userIDLabel.setText("UserID"); + loginButton.setText("Login"); + loginButton.addActionListener(new MainFrame_loginButton_actionAdapter(this)); + loginStatusLabel.setBorder(BorderFactory.createLineBorder(Color.black)); + loginStatusLabel.setText("Not Logged In"); + loginPanel.setLayout(loginPanelLayout); + strongTextEditor.setBackground(Color.lightGray); + strongTextEditor.setBorder(strongTextEditorBorder); + if (newFont != null) { + strongTextEditor.setFont(newFont); + } + rightPanel.setBorder(BorderFactory.createEtchedBorder()); + loginPanel.setBorder(loginPanelBorder); + greekTextScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + translatedTextScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + aPanel.setLayout(aPanelLayout); + currentVerseLabel.setText("Current Verse"); + currentVersePanel.setLayout(currentVersePanelLayout); + currentVersePanelLayout.setColumns(1); + currentVersePanelLayout.setRows(0); + loadVerseButton.setText("Load"); + loadVerseButton.addActionListener(new MainFrame_loadVerseButton_actionAdapter(this)); + currentVersePanel.setBorder(currentVersePanelBorder); + currentVerseText.addKeyListener(new MainFrame_currentVerseText_keyAdapter(this)); + strongPanel.setLayout(strongPanelLayout); + strongPanelLayout.setColumns(1); + strongPanelLayout.setRows(0); + bPanel.setLayout(bPanelLayout); + signSavePanel.setLayout(borderLayout1); + signSavePanel.setBorder(signSavePanelBorder); + contentPane.addKeyListener(new MainFrame_contentPane_keyAdapter(this)); + currentRangeLabel.setText("Current Range"); + currentRangePanel.setLayout(currentRangePanelLayout); + cPanel.setLayout(cPanelLayout); + currentRangePanelLayout.setColumns(1); + currentRangePanelLayout.setRows(0); + currentRangePanel.setBorder(currentRangePanelBorder); + exportRangeButton.setText("Export"); + exportRangeButton.addActionListener(new MainFrame_exportRangeButton_actionAdapter(this)); + leftPanel.setBorder(leftPanelBorder); + jMenu1.setText("File"); + jMenuItem1.setText("Exit"); + jMenuItem1.addActionListener(new MainFrame_jMenuItem1_actionAdapter(this)); + jMenu2.setText("Settings"); + jMenuItem2.setText("Proxy"); + jMenuItem2.addActionListener(new MainFrame_jMenuItem2_actionAdapter(this)); + jLabel1.setText("Notes"); + jPanel1.setLayout(borderLayout2); + jPanel1.setBorder(titledBorder1); + jMenu3.setText("Help"); + jMenuItem3.setText("Guidelines"); + jMenuItem3.addActionListener(new MainFrame_jMenuItem3_actionAdapter(this)); + jButton1.setText("Split"); + jButton1.addActionListener(new MainFrame_jButton1_actionAdapter(this)); + contentPane.add(rightPanel, BorderLayout.EAST); + rightPanel.add(loginPanel, BorderLayout.NORTH); + loginPanel.add(userIDLabel, null); + loginPanel.add(userIDText, null); + loginPanel.add(loginButton, null); + loginPanel.add(loginStatusLabel, null); + rightPanel.add(aPanel, BorderLayout.CENTER); + aPanel.add(currentRangePanel, BorderLayout.NORTH); + currentVersePanel.add(currentVerseLabel, null); + currentVersePanel.add(currentVerseText, null); + currentVersePanel.add(loadVerseButton, null); + currentVersePanel.add(guessTagButton, null); + aPanel.add(bPanel, BorderLayout.CENTER); + bPanel.add(signSavePanel, BorderLayout.CENTER); + strongPanel.add(wordText, null); + strongPanel.add(strongText, null); + strongPanel.add(morphText, null); + currentTagPanel.add(jPanel2, BorderLayout.EAST); + jPanel2.add(jButton1, null); + contentPane.add(leftPanel, BorderLayout.CENTER); + leftPanel.add(currentTagPanel, BorderLayout.SOUTH); + currentTagPanel.add(tagPanel, BorderLayout.WEST); + tagPanelLayout.setRows(3); + tagPanelLayout.setColumns(1); + loginPanelLayout.setRows(4); + loginPanelLayout.setColumns(1); + tagPanel.add(currentTagLabel, null); + tagPanel.add(currentTagText, null); + tagPanel.add(currentActionPanel, null); + currentActionPanel.add(currentActionLabel, null); + currentActionPanel.add(actionLabel, null); + currentTagPanel.add(strongPanel, BorderLayout.CENTER); + signSavePanel.add(signSaveButton, BorderLayout.SOUTH); + signSavePanel.add(jPanel1, BorderLayout.CENTER); + jPanel1.add(jLabel1, BorderLayout.NORTH); + jPanel1.add(jScrollPane1, BorderLayout.CENTER); + jScrollPane1.getViewport().add(notesText, null); + bPanel.add(cPanel, BorderLayout.NORTH); + cPanel.add(currentVersePanel, BorderLayout.NORTH); + currentRangePanel.add(currentRangeLabel, null); + currentRangePanel.add(rangeText, null); + currentRangePanel.add(exportRangeButton, null); + leftPanel.add(textPanel, BorderLayout.CENTER); + textPanel.add(translatedTextScroll, null); + translatedTextScroll.getViewport().add(translatedTextEditor, null); + textPanel.add(greekTextScroll, null); + greekTextScroll.getViewport().add(greekTextEditor, null); + textPanel.add(strongTextScroll, null); + strongTextScroll.getViewport().add(strongTextEditor, null); + jMenuBar1.add(jMenu1); + jMenuBar1.add(jMenu2); + jMenuBar1.add(jMenu3); + jMenu1.add(jMenuItem1); + jMenu2.add(jMenuItem2); + jMenu3.add(jMenuItem3); + + Highlighter h = greekTextEditor.getHighlighter(); + DefaultHighlighter.DefaultHighlightPainter hp = new DefaultHighlighter.DefaultHighlightPainter(Color.yellow); + greekHighlight = h.addHighlight(0, 0, hp); + + loadPreferences(); + } + + + protected void finalize() throws Throwable { + super.finalize(); + } + + + /**Overridden so we can exit when window is closed*/ + protected void processWindowEvent(WindowEvent e) { + super.processWindowEvent(e); + if (e.getID() == WindowEvent.WINDOW_CLOSING) { + savePreferences(); + System.exit(0); + } + } + + void signSaveButton_actionPerformed(ActionEvent e) { + + // assert we are ok to save something + if (currentKey == null) { + JOptionPane.showMessageDialog(this, "No key selected"); + return; + } + if (getUserID() == null) { + JOptionPane.showMessageDialog(this, "Not logged in"); + return; + } + + String entry = getRawEntry(); + StringBuffer result = new StringBuffer(); + if (!localTarget) + callServer("action=w&key=" + URLEncoder.encode(currentKey) +"&uid=" + userID + "<ok=" + loginToken + "&mod=Target&text=" + URLEncoder.encode(entry), result); + else { + try { + FileOutputStream fos = new FileOutputStream("entry.txt"); + fos.write(entry.getBytes("UTF-8")); + fos.close(); + callLocalAgent(new String[] {util, "f", "Target", currentKey, "entry.txt"}, result, false); + } + catch (Exception e1) { e1.printStackTrace(); } + } + + if (result.length() > 1) { + stripChar(result, '\n'); + stripChar(result, '\r'); + loadVerse(result.toString()); + } + else { + // failed + login(null); + JOptionPane.showMessageDialog(this, "Unable to save edits to the server, try to re-login."); + } + } + + private void loadFont() { + try { + URLConnection connection = new URL("file:font.ttf").openConnection(); + InputStream is = connection.getInputStream(); + Font font = Font.createFont(Font.TRUETYPE_FONT, is); + newFont = font.deriveFont((float)18.0); + is.close(); + } + catch (Exception ex) { System.out.println("no custom font found"); } + + } + + void loadPreferences() { + Properties props = new Properties(); + + try { + props.load(new FileInputStream("ModEdit.properties")); + } + catch (Exception e) {e.printStackTrace();} + + localTarget = props.getProperty("localTarget", "false").equalsIgnoreCase("true"); + localTR = props.getProperty("localTR", "false").equalsIgnoreCase("true"); + localThayer = props.getProperty("localThayer", "false").equalsIgnoreCase("true"); + localImages = props.getProperty("localImages", "false").equalsIgnoreCase("true"); + + if (localImages) { + startTag2 = "\"><img border=0 src=\"file:images/starttag"; + endTag2 = "\"><img border=0 src=\"file:images/endtag"; + } + + rangeText.setText(props.getProperty("currentRange", "jn")); + userIDText.setText(props.getProperty("userID", "")); + + useProxy = (props.getProperty("useProxy", "false").equals("true")); + proxyHost = props.getProperty("proxyHost", "[none]"); + proxyPort = props.getProperty("proxyPort", "8080"); + + loadVerse(props.getProperty("lastVerse", "jn 1:1")); + if (!localTarget) + exportRangeButton.setVisible(false); + + } + + void savePreferences() { + Properties props = new Properties(); + props.setProperty("localTarget", (localTarget) ? "true" : "false"); + props.setProperty("localTR", (localTR) ? "true" : "false"); + props.setProperty("localThayer", (localThayer) ? "true" : "false"); + props.setProperty("localImages", (localImages) ? "true" : "false"); + props.setProperty("currentRange", rangeText.getText()); + props.setProperty("userID", userIDText.getText()); + props.setProperty("lastVerse", currentKey); + props.setProperty("proxyHost", proxyHost); + props.setProperty("proxyPort", proxyPort); + props.setProperty("useProxy", (useProxy) ? "true" : "false"); + try { + props.store(new FileOutputStream("ModEdit.properties"), "ModEdit Properties"); + } + catch (Exception e) { e.printStackTrace(); } + + } + + void loadTextArea(JTextArea control, StringBuffer agentResult) { + try { + StringBuffer newText = agentResult; + stripTags(newText); + int pos = newText.toString().indexOf('|'); + if (pos > -1) { + newText.delete(0,pos+1); + } + control.setText(newText.toString()); + } + catch(Exception e) { + e.printStackTrace(); + } + } + + void loadHTML(JEditorPane control, StringBuffer agentResult) { + try { + StringBuffer newText = agentResult; + String htmlstr = newText.toString(); + int pos = newText.toString().indexOf('|'); + if (pos > -1) { + newText.delete(0,pos+1); + } + htmlstr = newText.toString(); + newText.insert(0, "<html>"); + int tagPos = newText.toString().indexOf("<br />"); + while (tagPos > -1) { + int endPos = newText.toString().indexOf('>', tagPos+1); + newText.delete(tagPos, endPos+1); + if (tagPos < newText.length()) + newText.insert(tagPos, "<br>"); + tagPos = newText.toString().indexOf("<br />"); + } + htmlstr = newText.toString(); + setHTML(control, newText); + control.setCaretPosition(0); + } + catch(Exception e) { + e.printStackTrace(); + } + } + + public int callLocalAgent(String command[], StringBuffer result, boolean html) { + int retVal = -1; + try { +System.out.println("running command:"); +for (int i = 0; i < command.length; i++) + System.out.println("["+command[i]+"]"); + //result.flush(); + //return 0; + java.lang.Process p = Runtime.getRuntime().exec(command); + + InputStream is = p.getInputStream(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + BufferedInputStream bis = new BufferedInputStream(is); + + int len; + byte inBuf[] = new byte[8192]; + do { + len = bis.read(inBuf, 0, 8192); + if (len != -1) + bos.write(inBuf, 0, len); + } while (len != -1); + StringBuffer newText = new StringBuffer(new String(bos.toByteArray(), "UTF-8")); + result.append(newText.toString()); + + // silly replacement for DOS nl encoding + StringBuffer crlf = new StringBuffer(" "); + crlf.setCharAt(0, (char)13); + crlf.setCharAt(1, (char)10); + StringBuffer lf = new StringBuffer(" "); + lf.setCharAt(0, (char)10); + replaceString(result, crlf.toString(), lf.toString()); + replaceString(result, "\n", (html) ? "<br>": "\n "); + + retVal = p.waitFor(); + } + catch (Exception e) {e.printStackTrace();} + return retVal; + } + + int callServer(String command, StringBuffer result) { + try { + String lookupURL = "http://www.crosswire.org/sword/kjv2003/modedit.jsp?" + command; + URLConnection connection = new URL(lookupURL).openConnection(); + InputStream is = connection.getInputStream(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + BufferedInputStream bis = new BufferedInputStream(is); + + int len; + byte inBuf[] = new byte[8192]; + do { + len = bis.read(inBuf, 0, 8192); + if (len != -1) + bos.write(inBuf, 0, len); + } while (len != -1); + StringBuffer newText = new StringBuffer(new String(bos.toByteArray(), "UTF-8")); + result.append(newText.toString()); + } + catch(Exception e) { + e.printStackTrace(); + } + return 0; + } + + + public void exportRange(String key, String fileName) { + try { + StringBuffer agentResult = new StringBuffer(); + callLocalAgent(new String[] {util, "e", "Target", key}, agentResult, false); + ZipOutputStream zstream = new ZipOutputStream(new FileOutputStream(fileName)); + zstream.putNextEntry(new ZipEntry("key")); + zstream.write(key.getBytes()); + zstream.putNextEntry(new ZipEntry("nt")); + copyFile(zstream, "nt"); + zstream.putNextEntry(new ZipEntry("nt.vss")); + copyFile(zstream, "nt.vss"); + zstream.close(); + } + catch (Exception e) { e.printStackTrace(); } + } + + + void copyFile(OutputStream os, String fileName) { + try { + FileInputStream fin = new FileInputStream(fileName); + byte [] buffer = new byte[ 20000 ]; + int len; + while ((len = fin.read(buffer)) > 0) { + os.write(buffer, 0, len); + } + fin.close(); + } + catch (Exception e) { e.printStackTrace(); } + } + + + + void showStrongs() { + TagInfo tagInfo = (TagInfo)tags.get(Integer.toString(getCurrentTag())); + if (tagInfo == null) + return; + try { + StringBuffer agentResult = new StringBuffer(); + if (tagInfo.thayerCache.length() < 1) { + if (!localThayer) + callServer("action=h&mod=Thayer&key="+tagInfo.strong, agentResult); + else callLocalAgent(new String[] {util, "h", "Thayer", tagInfo.strong}, agentResult, true); + tagInfo.thayerCache = agentResult.toString(); + } + agentResult = new StringBuffer(tagInfo.thayerCache); + loadHTML(strongTextEditor, agentResult); + } catch (Throwable t) { + t.printStackTrace(); + } + strongText.setText(tagInfo.strong); + morphText.setText(tagInfo.morph); + wordText.setText(tagInfo.word); + + try { + greekTextEditor.getHighlighter().changeHighlight(greekHighlight, tagInfo.start, tagInfo.end); + } + catch (Exception e) { e.printStackTrace(); } + } + + class Hyperactive implements HyperlinkListener { + + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + JEditorPane pane = (JEditorPane) e.getSource(); + try { + String url = e.getURL().toString(); + int id = e.getURL().getPort(); + if (url.indexOf("SID") > -1) { + setCurrentAction(id, "MoveTag"); + } + else if (url.indexOf("EID") > -1) { + setCurrentAction(id, "SizeTag"); + } + else { + setCurrentAction(id, "[none]"); + } + } catch (Throwable t) { + t.printStackTrace(); + } + } + } + } + + void translatedTextEditor_mouseClicked(MouseEvent e) { + } + + void translatedTextEditor_mouseDragged(MouseEvent e) { + Point clickPoint = e.getPoint(); + int position = translatedTextEditor.viewToModel(clickPoint); + boolean sizeTag = false; + if (!getCurrentAction().equals("[none]")) { + if (getCurrentAction().equals("SizeTag")) + sizeTag = true; + if (position != currentCaret) { + currentCaret = position; + moveTag(getCurrentTag(), position, sizeTag); + } + } + + } + + + void stripChar(StringBuffer buf, char ch) { + // remove silly new lines added by editor kit + // better way? + int pos = buf.toString().indexOf(ch); + while (pos > -1) { + buf.deleteCharAt(pos); + pos = buf.toString().indexOf(ch); + } + } + + + void replaceString(StringBuffer buf, String ch, String r) { + int pos = buf.toString().indexOf(ch); + while (pos > -1) { + buf.replace(pos, pos+ch.length(), r); + pos = buf.toString().indexOf(ch, pos+1); + } + } + + void replaceChar(StringBuffer buf, char ch, char r) { + int pos = buf.toString().indexOf(ch); + while (pos > -1) { + buf.setCharAt(pos, r); + pos = buf.toString().indexOf(ch); + } + } + + void stripJunk(StringBuffer html) { + // remove silly new lines added by editor kit + // better way? + int pos = html.toString().indexOf('\n'); + while (pos > -1) { + html.deleteCharAt(pos); + while (pos < html.length()) { + if (html.charAt(pos) == ' ') + html.deleteCharAt(pos); + else break; + } + pos = html.toString().indexOf('\n'); + } + } + + + StringBuffer getHTML(JEditorPane editor) { + HTMLDocument doc = (HTMLDocument)editor.getDocument(); + StringWriter writer = new StringWriter(); + try { + editor.getEditorKit().write(writer, doc, 0, doc.getLength()); + } + catch(Exception ex) { + ex.printStackTrace(); + } + + StringBuffer html = writer.getBuffer(); + replaceString(html, "’", "'"); + + int escPos = html.toString().indexOf("&#"); + while (escPos > -1) { + int endPos = html.toString().indexOf(';', escPos+"&#".length()+1); + String val = html.substring(escPos+2, endPos); + html.delete(escPos, endPos+1); + html.insert(escPos, (char)Integer.parseInt(val)); + escPos = html.toString().indexOf("&#"); + } + + // remove silly new lines added by editor kit + stripJunk(html); + + return html; + } + + void setHTML(JEditorPane editor, StringBuffer html) { + HTMLDocument doc = (HTMLDocument)editor.getDocument(); + try { + editor.setText(""); + editor.getEditorKit().read(new StringReader(html.toString()), doc, 0); + } + catch(Exception ex) { + ex.printStackTrace(); + } + } + + void slideTag(int offset, boolean sizeTag) { + slideTag(getCurrentTag(), offset, sizeTag, "y", "y"); + } + + + String getStartTag(TagInfo tag, String color) { + return startTag1 + tag.id + startTag2 + color + tag.type + startTag3; + } + + String getEndTag(TagInfo tag, String color) { + return endTag1 + tag.id + endTag2 + color + tag.type + endTag3; + } + + + void slideTag(int tagNum, int offset, boolean sizeTag, String startColor, String endColor) { + slideTag(tagNum, offset, sizeTag, startColor, endColor, false); + } + + void slideTag(int tagNum, int offset, boolean sizeTag, String startColor, String endColor, boolean delete) { + slideTag(tagNum, offset, sizeTag, startColor, endColor, delete, -1); + } + + void slideTag(int tagNum, int offset, boolean sizeTag, String startColor, String endColor, boolean delete, int addSplitID) { + + TagInfo tagInfo = (TagInfo)tags.get(Integer.toString(tagNum)); + + // assert we have a valid tag + if (tagInfo == null) + return; + + String startTag = (delete) ? "" : getStartTag(tagInfo, startColor); + String endTag = (delete) ? "" : getEndTag(tagInfo, endColor); + if (addSplitID > -1) { + TagInfo splitInfo = (TagInfo)tags.get(Integer.toString(addSplitID)); + endTag += getStartTag(splitInfo, "r") + getEndTag(splitInfo, "r"); + } + String startSearch = startTag1+Integer.toString(tagNum)+"\">"; + String endSearch = endTag1+Integer.toString(tagNum)+"\">"; + + boolean addNewImage = false; + + StringBuffer html = getHTML(translatedTextEditor); + String htmlstr = html.toString(); + + int tagStart = html.toString().indexOf(startSearch); + int endStart = html.toString().indexOf(endSearch); + + // remove current images + if (!sizeTag) { + if (tagStart >= 0) { + addNewImage = true; + int end = html.toString().indexOf('>', tagStart+1); + end = html.toString().indexOf('>', end+1); + end = html.toString().indexOf('>', end+1); + if (offset != 0) + html.replace(tagStart, end+1, "$$$"); + else { + html.replace(tagStart, end+1, startTag); + } + } + else addNewImage = false; + } + + htmlstr = html.toString(); + // recompute + endStart = html.toString().indexOf(endSearch); + + if (addNewImage || (sizeTag)) { + if (endStart >= 0) { + int end = html.toString().indexOf('>', endStart+1); + end = html.toString().indexOf('>', end+1); + end = html.toString().indexOf('>', end+1); + if (addNewImage) { + if (offset != 0) + html.delete(endStart, end+1); + else html.replace(endStart, end+1, endTag); + } + else html.replace(endStart, end+1, "$$$"); + addNewImage = true; + } + else addNewImage = false; + } + + htmlstr = html.toString(); + // recompute + int targetStart = html.toString().indexOf("$$$"); + while (offset != 0 && targetStart > -1) { + if (offset > 0) { + if (targetStart+3 < html.length()) { + char moveChar = html.charAt(targetStart+3); + if ((moveChar != '<') && (moveChar != '{')) { + html.deleteCharAt(targetStart+3); + html.insert(targetStart, moveChar); + } + else if (sizeTag) + break; + else if (moveChar == '<') { + String tagKey = null; + int pos = html.toString().indexOf(startTag1, targetStart); + // if we're another tag jump over + if (pos == targetStart+3) { + int end = html.toString().indexOf('\"', pos+startTag1.length()); + if (end > -1) { + tagKey = html.substring(pos+startTag1.length(), end); + pos = html.toString().indexOf(endTag1+tagKey+"\"", pos); + if (pos > -1) { + end = html.toString().indexOf('>', pos); + end = html.toString().indexOf('>', end+1); + end = html.toString().indexOf('>', end+1); + if (++end < html.length()) { + html.insert(end, "$$$"); + html.delete(targetStart, targetStart+3); + } + } + } + } + } + else if (moveChar == '{') { + int end = html.toString().indexOf('}', targetStart+3); + if (++end < html.length()) { + html.insert(end, "$$$"); + html.delete(targetStart, targetStart+3); + } + } + } + else break; + offset--; + } + if (offset < 0) { + if (targetStart-1 >= 0) { + char moveChar = html.charAt(targetStart-1); + if ((moveChar != '>') && (moveChar != '}')) { + html.deleteCharAt(targetStart-1); + html.insert(targetStart+2, moveChar); + } + else if (sizeTag) + break; + else if (moveChar == '>') { + String tagKey = null; + int end; + int pos = html.toString().lastIndexOf(endTag1, targetStart); + if (pos > -1) { + end = html.toString().indexOf('>', pos); + end = html.toString().indexOf('>', end+1); + end = html.toString().indexOf('>', end+1); + // if we're another tag jump over + if (end == targetStart-1) { + end = html.toString().indexOf('\"', pos+endTag1.length()); + if (end > -1) { + tagKey = html.substring(pos+startTag1.length(), end); + pos = html.toString().lastIndexOf(startTag1+tagKey+"\"", pos); + if (pos > -1) { + html.delete(targetStart, targetStart+3); + html.insert(pos, "$$$"); + } + } + } + } + } + else if (moveChar == '}') { + int pos = html.toString().lastIndexOf('{', targetStart); + if (pos > -1) { + html.delete(targetStart, targetStart+3); + html.insert(pos, "$$$"); + } + } + } + else break; + offset++; + } + } + + htmlstr = html.toString(); + + // replace place holder with image tag + targetStart = html.toString().indexOf("$$$"); + if (targetStart >= 0) { + if (addNewImage) + html.replace(targetStart, targetStart+3, (sizeTag) ? endTag:startTag+endTag); + else html.delete(targetStart, targetStart+3); + } + htmlstr = html.toString(); + setHTML(translatedTextEditor, html); + } //end of slideTag + + + int getTagFromPosition(int offset) { + + int position = offset; + int retVal = 0; + + //remove selection + translatedTextEditor.setSelectionEnd(translatedTextEditor.getSelectionStart()); + + if (position != currentCaret) { + currentCaret = position; + + String startSearch = startTag1; + String endSearch = endTag1; + + HTMLDocument doc = (HTMLDocument)translatedTextEditor.getDocument(); + try { + translatedTextEditor.getEditorKit().read(new StringReader("$$$"), doc, position); + } + catch(Exception ex) { + ex.printStackTrace(); + } + + StringBuffer html = getHTML(translatedTextEditor); + + String htmlstr = html.toString(); + + int targetStart = html.toString().indexOf("$$$"); + + if (targetStart > -1) { // better be + html.delete(targetStart, targetStart + 3); + } + + + int endStart = html.toString().indexOf(endSearch, targetStart); + int tagStart = html.toString().indexOf(startSearch, targetStart); + + if (endStart < tagStart) { + int begin = endStart+endSearch.length(); + int end = html.toString().indexOf('\"', begin); + if (end > endStart) { + String tagNum = html.substring(begin, end); + retVal = Integer.parseInt(tagNum); + } + } + setHTML(translatedTextEditor, html); + } + return retVal; + } + + void moveTag(int tagNum, int position, boolean sizeTag) { + + //remove selection + translatedTextEditor.setSelectionEnd(translatedTextEditor.getSelectionStart()); + + TagInfo tagInfo = (TagInfo)tags.get(Integer.toString(tagNum)); + + String startTag = getStartTag(tagInfo, "y"); + String endTag = getEndTag(tagInfo, "y"); + String startSearch = startTag1+Integer.toString(tagNum)+"\">"; + String endSearch = endTag1+Integer.toString(tagNum)+"\">"; + + boolean addNewImage = false; + + HTMLDocument doc = (HTMLDocument)translatedTextEditor.getDocument(); + try { + translatedTextEditor.getEditorKit().read(new StringReader("$$$"), doc, position); + } + catch(Exception ex) { + ex.printStackTrace(); + } + + StringBuffer html = getHTML(translatedTextEditor); + String htmlstr = html.toString(); + + int targetStart = html.toString().indexOf("$$$"); + int tagStart = html.toString().indexOf(startSearch); + int endStart = html.toString().indexOf(endSearch); + boolean beforeStart = false; + if (targetStart < tagStart) + beforeStart = true; + + // remove current images + if (!sizeTag) { + if (tagStart >= 0) { + addNewImage = true; + int end = html.toString().indexOf('>', tagStart+1); + end = html.toString().indexOf('>', end+1); + end = html.toString().indexOf('>', end+1); + html.delete(tagStart, end+1); + } + else addNewImage = false; + } + + // recompute + endStart = html.toString().indexOf(endSearch); + + if (addNewImage || (sizeTag && !beforeStart)) { + if (endStart >= 0) { + addNewImage = true; + int end = html.toString().indexOf('>', endStart+1); + end = html.toString().indexOf('>', end+1); + end = html.toString().indexOf('>', end+1); + html.delete(endStart, end+1); + } + else addNewImage = false; + } + + // recompute + targetStart = html.toString().indexOf("$$$"); + + htmlstr = html.toString(); + + // replace place holder with image tag + if (targetStart >= 0) { + if (addNewImage) + html.replace(targetStart, targetStart+3, (sizeTag) ? endTag:startTag+endTag); + else html.delete(targetStart, targetStart+3); + } + htmlstr = html.toString(); + setHTML(translatedTextEditor, html); + } + + + void translatedTextEditor_keyTyped(KeyEvent e) { + } + + + void setCurrentAction(int tag, String action) { + int lastTag = getCurrentTag(); + boolean changedTag = false; + + // Set last tag to green + if (lastTag != tag) { + changedTag = true; + slideTag(getCurrentTag(), 0, false, "g", "g"); + slideTag(tag, 0, false, "y", "y"); + } + + currentTagText.setText(Integer.toString(tag)); + + if ((!getCurrentAction().equals("MoveTag") || changedTag) && (action.equals("MoveTag"))) { + slideTag(getCurrentTag(), 0, false, "y", "y"); + } + else if ((!getCurrentAction().equals("SizeTag") || changedTag) && (action.equals("SizeTag"))) { + slideTag(getCurrentTag(), 0, false, "g", "y"); + } + else if ((!getCurrentAction().equals("[none]") || changedTag) && (action.equals("[none]"))) { + slideTag(getCurrentTag(), 0, false, "g", "g"); + } + actionLabel.setText(action); + if (changedTag) { + showStrongs(); + } + } + + + public String getCurrentAction() { + return actionLabel.getText(); + } + + + public int getCurrentTag() { + int retVal = -1; + try { retVal = Integer.parseInt(currentTagText.getText().trim()); } catch (Exception e) {} + return retVal; + } + + + void translatedTextEditor_keyPressed(KeyEvent e) { + handleKeyboard(e); + } + + + void handleKeyboard(KeyEvent e) { + + + boolean sizeTag = true; + if (getCurrentAction().equals("MoveTag")) + sizeTag = false; + + if (!getCurrentAction().equals("[none]")) { + if (e.getKeyCode() == e.VK_LEFT) { + slideTag(-1, sizeTag); + } + else if (e.getKeyCode() == e.VK_RIGHT) { + slideTag(1, sizeTag); + } + } + if (e.getKeyCode() == e.VK_TAB) { + if (e.isShiftDown()) + previousTag(); + else nextTag(); + } + else if (e.getKeyCode() == e.VK_UP) { + previousTag(); + } + else if (e.getKeyCode() == e.VK_DOWN) { + nextTag(); + } + else if (e.getKeyCode() == e.VK_SPACE) { + if (getCurrentAction().equals("MoveTag")) + setCurrentAction(getCurrentTag(), "SizeTag"); + else if (getCurrentAction().equals("SizeTag")) { + setCurrentAction(getCurrentTag(), "[none]"); + } + else if (getCurrentAction().equals("[none]")) { + setCurrentAction(getCurrentTag(), "MoveTag"); + } + } + } + + + public void loadStrongsTable(String key) { + try { + StringBuffer text = new StringBuffer(); + + if (!localTR) + callServer("action=a&key=" + URLEncoder.encode(key) +"&mod=TR", text); + else callLocalAgent(new String[] {util, "a", "TR", key}, text, false); + + BufferedReader br = new BufferedReader(new StringReader(text.toString())); + String line; + tags = new Hashtable(); + while ((line = br.readLine()) != null) { + String [] entry = new String[4]; + int pos = line.indexOf('|'); + int start = 0; + int type = 0; + while (pos > -1) { + StringBuffer sb = new StringBuffer(line.substring(start, pos)); + stripTags(sb); + entry[type] = sb.toString().trim(); + type++; + start = pos + 1; + pos = line.indexOf('|', start); + } + StringBuffer sb = new StringBuffer(line.substring(start, line.length())); + stripTags(sb); + entry[type] = sb.toString().trim(); + if (type < 2) + continue; + entry[1] = new Integer(entry[1]).toString(); // strip preceeding 000.. + if (entry[0].equals("Word")) { + TagInfo tag = (TagInfo)tags.get(entry[1]); + if (tag == null) { + tag = new TagInfo(entry[1]); + tags.put(entry[1], tag); + } + if (entry[2].equals("Morph")) { + tag.morph = entry[3]; + if (tag.morph.startsWith("V")) + tag.type = "verb"; + } + if (entry[2].equals("MorphClass")) { + tag.morphClass = entry[3]; + } + if (entry[2].equals("Lemma")) { + tag.strong = entry[3].substring(1, entry[3].length()); + if (tag.strong.equals("3588")) + tag.type = "art"; + } + if (entry[2].equals("Text")) { + tag.word = entry[3]; + } + } + } + } + catch(Exception e) { + e.printStackTrace(); + } + } + + + public void loadTranslationFrequencies(TagInfo tag) { + try { + StringBuffer text = new StringBuffer(); + + if (!localThayer) + callServer("action=a&key=" + URLEncoder.encode(tag.strong) +"&mod=Thayer", text); + else callLocalAgent(new String[] {util, "a", "Thayer", tag.strong}, text, false); + + BufferedReader br = new BufferedReader(new StringReader(text.toString())); + String line; + + tag.translations = new Hashtable(); + + while ((line = br.readLine()) != null) { + try { + String [] entry = new String[4]; + int pos = line.indexOf('|'); + int start = 0; + int type = 0; + while (pos > -1) { + StringBuffer sb = new StringBuffer(line.substring(start, pos)); + stripTags(sb); + entry[type] = sb.toString().trim(); + type++; + start = pos + 1; + pos = line.indexOf('|', start); + } + StringBuffer sb = new StringBuffer(line.substring(start, line.length())); + stripTags(sb); + entry[type] = sb.toString().trim(); + if (type < 2) + continue; + entry[1] = new Integer(entry[1]).toString(); // strip preceeding 000.. + if (entry[0].equals("AVPhrase")) { + TransInfo trans = (TransInfo)tag.translations.get(entry[1]); + if (trans == null) { + trans = new TransInfo(entry[1]); + tag.translations.put(entry[1], trans); + } + if (entry[2].equals("Phrase")) { + trans.english = entry[3]; + } + if (entry[2].equals("Alt")) { + trans.english2 = entry[3]; + } + if (entry[2].equals("CompoundedWith")) { + trans.compoundedWith = entry[3]; + } + if (entry[2].equals("Frequency")) { + trans.frequency = Integer.parseInt(entry[3]); + } + } + } + catch (Exception e1) { e1.printStackTrace(); } + } + } + catch(Exception e) { + e.printStackTrace(); + } + } + + + public void computeTagOffsets() { + Object [] tagKeys = tags.keySet().toArray(); + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } + }); + String greek = greekTextEditor.getText(); + int pos = 0; + for (int i = 0; i < tagKeys.length; i++) { + TagInfo tag = (TagInfo)tags.get(tagKeys[i]); + int start = greek.indexOf(tag.word, pos); + if (start > -1) { + tag.start = start; + tag.end = start + tag.word.length(); + pos = tag.end; + } + } + } + + + public void confirmAllStrongs(StringBuffer text) { + Object [] tagKeys = tags.keySet().toArray(); + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } + }); + for (int i = 0; i < tagKeys.length; i ++) { + // look for tag already in text + TagInfo tagInfo = (TagInfo)tags.get(tagKeys[i]); + boolean found = false; + int pos = text.toString().indexOf("<w_src=\""+tagKeys[i]+"\""); + boolean splitHandled = false; + while (pos > -1) { + tagInfo = (TagInfo)tags.get(tagKeys[i]); + int end = text.toString().indexOf(">", pos); + if (end > -1) { + // check if we're a split tag + String tagText = text.substring(pos, end+1); + int split = tagText.indexOf("splitID=\""); + if (split > -1) { +// int sEnd = tagText.indexOf("\"", split+9); +// if (sEnd > -1) { +// String splitKey = tagText.substring(split+9, sEnd); + // only allow one split + if (!splitHandled) { + tagInfo = addSplitTag(Integer.parseInt(tagInfo.id), false); + int pos1 = text.toString().indexOf("\"", pos+1); + int end1 = text.toString().indexOf("\"", pos1+1); + text.replace(pos1+1, end1, tagInfo.id); + splitHandled = true; + } +// } + } + int endWord = text.toString().indexOf("</w>", end); + // recompute end in case we are different size e.g. "4" -> "26" + end = text.toString().indexOf(">", pos); + if (endWord > -1) { + text.replace(endWord, endWord+4, getEndTag(tagInfo, "r")); + text.replace(pos, end+1, getStartTag(tagInfo, "r")); + found = true; + } + } + pos = text.toString().indexOf("<w_src=\""+tagKeys[i]+"\"", pos+1); + } + if (!found) { + text.append(getStartTag(tagInfo, "r")); + text.append(getEndTag(tagInfo, "r")); + } + } + } + + + public void loadVerse(String key) { + try { + StringBuffer text = new StringBuffer(); + + if (!localTarget) + callServer("action=r&key=" + URLEncoder.encode(key) +"&mod=Target", text); + else callLocalAgent(new String[] {util, "r", "Target", key}, text, false); + String htmlstr = text.toString(); + + stripChar(text, '\n'); + stripChar(text, '\r'); + if (text.charAt(text.length()-1) == ' ') + text.setLength(text.length()-1); // trip trailing space from return + htmlstr = text.toString(); + // grab key from front + int pos = text.toString().indexOf('|'); + if (pos > -1) { + key = text.substring(0, pos); + text.delete(0,pos+1); + } + + // grab any note tags + notesText.setText(""); + pos = text.toString().indexOf("<note type=\"strongsMarkup\""); + while (pos > -1) { + int end = text.toString().indexOf('>', pos+1); + if (end > -1) + text.delete(pos, end+1); + end = text.toString().indexOf("</note>", pos); + if (end > -1) { + String note = text.substring(pos, end); + note = URLDecoder.decode(note); + notesText.setText(notesText.getText() + note); + text.delete(pos, end+7); + } + pos = text.toString().indexOf("<resp "); + } + // remove all resp tags for now + pos = text.toString().indexOf("<resp "); + while (pos > -1) { + int end = text.toString().indexOf('>', pos+1); + if (end > -1) + text.delete(pos, end+1); + pos = text.toString().indexOf("<resp "); + } + + htmlstr = text.toString(); + replaceChar(text, ' ', '_'); + htmlstr = text.toString(); + loadStrongsTable(key); + + StringBuffer agentResult = new StringBuffer(); + if (!localTR) + callServer("action=h&key=" + URLEncoder.encode(key) +"&mod=TR", agentResult); + else callLocalAgent(new String[] {util, "h", "TR", key}, agentResult, true); + loadTextArea(greekTextEditor, agentResult); + + computeTagOffsets(); + + text.insert(0, "<HTML><BODY>"); + + confirmAllStrongs(text); + + htmlstr = text.toString(); + + text.append("</BODY></HTML>"); + setHTML(translatedTextEditor, text); + translatedTextEditor.setCaretPosition(0); + currentKey = key; + currentVerseText.setText(currentKey); + setCurrentAction(0, "[none]"); + } + catch(Exception e) { + e.printStackTrace(); + } + } + + public void replaceTagsWithHolders(StringBuffer newText) { + String startSearch = startTag1; + String endSearch = endTag1; + int tagPos = newText.toString().indexOf(endSearch); + while (tagPos > -1) { + int endPos = newText.toString().indexOf('>', tagPos+endSearch.length()+1); + newText.delete(tagPos, endPos+1); + newText.insert(tagPos, '|'); + tagPos = newText.toString().indexOf(endSearch); + } + tagPos = newText.toString().indexOf(startSearch); + while (tagPos > -1) { + int endPos = newText.toString().indexOf('>', tagPos+startSearch.length()+1); + newText.delete(tagPos, endPos+1); + newText.insert(tagPos, '|'); + tagPos = newText.toString().indexOf(startSearch); + } + } + + void stripTags(StringBuffer newText) { + int tagPos = newText.toString().indexOf('<'); + while (tagPos > -1) { + int endPos = newText.toString().indexOf('>', tagPos+1); + newText.delete(tagPos, endPos+1); + if (tagPos < newText.length()) + newText.insert(tagPos, ' '); + tagPos = newText.toString().indexOf('<'); + } + } + + void loadVerseButton_actionPerformed(ActionEvent e) { + loadVerse(currentVerseText.getText()); + } + + void currentVerseText_keyTyped(KeyEvent e) { + } + + void this_keyPressed(KeyEvent e) { + if (e.getKeyCode() == e.VK_ENTER) { + loadVerse(currentVerseText.getText()); + } + else if (e.getKeyCode() == e.VK_TAB) { + nextTag(); + } + } + + void guessTagButton_actionPerformed(ActionEvent e) { + guessTagPositions(); + } + + public void guessTagPositions() { + Object [] tagKeys = tags.keySet().toArray(); + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } + }); + for (int i = 0; i < tagKeys.length; i++) { + moveTag(Integer.parseInt((String)tagKeys[i]), 1, false); + } + for (int i = 0; i < tagKeys.length; i++) { + TagInfo tagInfo = (TagInfo)tags.get(tagKeys[i]); + + // ignore definite article for now + if (tagInfo.strong.equals("3588")) + continue; + + String text = translatedTextEditor.getText(); + StringBuffer sb = new StringBuffer(text); + replaceTagsWithHolders(sb); + stripTags(sb); + stripJunk(sb); + stripChar(sb, ' '); + replaceChar(sb, '_', ' '); + text = sb.toString().trim().toUpperCase(); + + loadTranslationFrequencies(tagInfo); + Object [] transKeys = tagInfo.translations.keySet().toArray(); + java.util.Arrays.sort(transKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } + }); + TransInfo best = null; + for (int j = 0; j < transKeys.length; j++) { + TransInfo ti = (TransInfo)tagInfo.translations.get(transKeys[j]); + + // skip CompoundedWith, for now. works a little better. + if (ti.compoundedWith != null) + continue; + + // twice, once for english and once for english2 + for (int k = 0; k < 2; k++) { + String english = (k > 0) ? ti.english2 : ti.english; + + if (english == null) + continue; + + english = english.toUpperCase(); + + // be sure to skip 'misc' entries + if (english.equalsIgnoreCase("MISC")) + continue; + + int attempt = text.indexOf(english); + while (attempt > -1) { + if (getTagFromPosition(attempt+1) == 0) { // FOUND + if (attempt > 0) { + if (java.lang.Character.isLetter(text.charAt(attempt-1))) { + attempt = text.indexOf(english, attempt+1); + continue; // FOUND, but midword + } + } + if (best != null) { + if (english.length() <= best.english.length()) { + attempt = text.indexOf(english, attempt+1); + continue; // FOUND, but smaller in length + } + // sure we have a larger match, but is it at least near the previous match + if (attempt > best.start + 7) { + attempt = text.indexOf(english, attempt+1); + continue; // FOUND, but too far away + } + ti.wholeWord = true; + try { if (java.lang.Character.isLetter(text.charAt(attempt + best.english.length()))) ti.wholeWord = false; } catch (Exception e1) {} + if (!ti.wholeWord && best.wholeWord) { // if we're not a whole word match, and we have a previous whole world match, keep previous + attempt = text.indexOf(english, attempt+1); + continue; // FOUND, but smaller in length + } + } + best = ti; + best.english = english; // in case english2 is better + best.start = attempt; + best.wholeWord = true; + try { if (java.lang.Character.isLetter(text.charAt(attempt+best.english.length()))) best.wholeWord = false; } catch (Exception e1) {} + } + attempt = text.indexOf(english, attempt+1); + } + } + } + if (best != null) { + int end = best.start+best.english.length(); + + // check for definite article + if (best.start >= 4) { + if (text.substring(best.start-4, best.start).equalsIgnoreCase("the ")) { + if ((best.start - 5) > -1) { + if (!Character.isLetter(text.charAt(best.start-5))) { + best.start -= 4; + } + } + } + } + + // check for indefinite article + if (best.start >= 2) { + if (text.substring(best.start-2, best.start).equalsIgnoreCase("a ")) { + if ((best.start - 3) > -1) { + if (!Character.isLetter(text.charAt(best.start-3))) { + best.start -= 2; + } + } + } + } + + // check for genitive 'of' + if (best.start >= 3) { + if (tagInfo.morph.indexOf('G') > -1) { + if (text.substring(best.start-3, best.start).equalsIgnoreCase("of ")) { + if ((best.start - 4) > -1) { + if (!Character.isLetter(text.charAt(best.start-4))) { + best.start -= 3; + } + } + } + } + } + + // include rest of word + while (end < text.length()) { + if (!Character.isLetter(text.charAt(end))) + break; + end++; + } + + moveTag(Integer.parseInt((String)tagKeys[i]), best.start + 1, false); + moveTag(Integer.parseInt((String)tagKeys[i]), end + 1, true); + } + } + for (int i = 0; i < tagKeys.length; i++) { + slideTag(Integer.parseInt((String)tagKeys[i]), 0, false, "r", "r"); + } + } + + void exportRangeButton_actionPerformed(ActionEvent e) { + exportRange(rangeText.getText(), "export.zip"); + JOptionPane.showMessageDialog(this, "File [export.zip] written."); + } + + void previousTag() { + Object [] tagKeys = tags.keySet().toArray(); + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o2) - Integer.parseInt((String)o1); } + }); + int tag = getCurrentTag(); + boolean found = false; + int i; + for (i = 0; i < tagKeys.length; i++) { + if (found) { + setCurrentAction(Integer.parseInt((String)tagKeys[i]), "MoveTag"); + break; + } + if (tag == Integer.parseInt((String)tagKeys[i])) + found = true; + } + if (found && (i == tagKeys.length)) + setCurrentAction(Integer.parseInt((String)tagKeys[0]), "MoveTag"); + } + + + void nextTag() { + Object [] tagKeys = tags.keySet().toArray(); + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } + }); + int tag = getCurrentTag(); + boolean found = false; + int i; + for (i = 0; i < tagKeys.length; i++) { + if (found) { + setCurrentAction(Integer.parseInt((String)tagKeys[i]), "MoveTag"); + break; + } + if (tag == Integer.parseInt((String)tagKeys[i])) + found = true; + } + if (found && (i == tagKeys.length)) + setCurrentAction(Integer.parseInt((String)tagKeys[0]), "MoveTag"); + } + + void greekTextEditor_mouseClicked(MouseEvent e) { + Point clickPoint = e.getPoint(); + int position = greekTextEditor.viewToModel(clickPoint); + Object [] tagKeys = tags.keySet().toArray(); + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } + }); + for (int i = 0; i < tagKeys.length; i++) { + TagInfo ti = (TagInfo)tags.get(tagKeys[i]); + if ((position >= ti.start) && (position <= ti.end+1)) { + setCurrentAction(Integer.parseInt((String)tagKeys[i]), "MoveTag"); + break; + } + } + } + + + public String getUserID() { + return userID; + } + + + public int login(String userID) { + // no validation right now + if (userID != null) { + if (userID.length() > 0) { + if (localTarget) { + this.userID = userID; + loginStatusLabel.setText("["+userID+"] logged in."); + return 0; + } + else { + String passwd = JOptionPane.showInputDialog(this, "Please enter your password", "Password", JOptionPane.QUESTION_MESSAGE); + if (passwd != null) { + StringBuffer result = new StringBuffer(); + callServer("action=l&uid=" + URLEncoder.encode(userID) +"&passwd=" + URLEncoder.encode(passwd), result); + stripChar(result, '\n'); + String ltok = result.toString().trim(); + if (ltok.length() > 1) { + loginToken = ltok; + this.userID = userID; + loginStatusLabel.setText("["+userID+"] logged in."); + return 0; + } + else { + JOptionPane.showMessageDialog(this, "Incorrect Login"); + } + } + } + } + } + loginStatusLabel.setText("Not Logged In"); + this.userID = null; + return -1; + } + + + public String getRawEntry() { + StringBuffer text = getHTML(translatedTextEditor); + replaceChar(text, '_', ' '); + int pos = text.toString().indexOf("<body>"); + if (pos > -1) + text.delete(0, pos+6); + + String htmlstr = text.toString(); + + String startSearch = startTag1; + String endSearch = endTag1; + int tagPos = text.toString().indexOf(endSearch); + while (tagPos > -1) { + int endPos = text.toString().indexOf('>', tagPos+endSearch.length()+1); + endPos = text.toString().indexOf('>', endPos+1); + endPos = text.toString().indexOf('>', endPos+1); + text.delete(tagPos, endPos+1); + text.insert(tagPos, "</w>"); + tagPos = text.toString().indexOf(endSearch); + } + tagPos = text.toString().indexOf(startSearch); + while (tagPos > -1) { + int endPos = text.toString().indexOf('\"', tagPos+startSearch.length()+1); + String tagKey = text.substring(tagPos+startSearch.length(), endPos); + TagInfo ti = (TagInfo)tags.get(tagKey); + String src = (ti.splitID == null) ? ti.id : ti.splitID; + String wordTag = "<w src=\"" + src + "\""; + if (ti.strong != null) + wordTag += " lemma=\"x-Strongs:G"+ti.strong+"\""; + if (ti.morph != null) + wordTag += " morph=\"x-Robinson:"+ti.morph+"\""; + + // not correct OSIS encoding, but we're saving our ID as splitID even though the main tag doesn't have an equiv splitID + if (ti.splitID != null) + wordTag += " splitID=\""+ti.id+"\""; + + wordTag += ">"; + + endPos = text.toString().indexOf('>', tagPos+startSearch.length()+1); + endPos = text.toString().indexOf('>', endPos+1); + endPos = text.toString().indexOf('>', endPos+1); + text.delete(tagPos, endPos+1); + text.insert(tagPos, wordTag); + tagPos = text.toString().indexOf(startSearch); + } + pos = text.toString().indexOf("</body>"); + if (pos > -1) + text.delete(pos, text.length()); + String notes = notesText.getText().trim(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH:mm"); + String currentDate = formatter.format(new Date()); + + if (notes.length() > 0) + text.append("<note type=\"strongsMarkup\" name=\""+getUserID()+"\" date=\""+currentDate+"\"/>"+URLEncoder.encode(notes)+"</note>"); + text.append("<resp type=\"strongsMarkup\" name=\""+getUserID()+"\" date=\""+currentDate+"\"/>"); + return text.toString(); + } + + + void contentPane_keyPressed(KeyEvent e) { + if (e.getKeyCode() == e.VK_TAB) + nextTag(); + } + + void greekTextEditor_keyPressed(KeyEvent e) { + handleKeyboard(e); + } + + void jToggleButton1_actionPerformed(ActionEvent e) { + exportRange(rangeText.getText(), "export.zip"); + } + + void loginButton_actionPerformed(ActionEvent e) { + login(userIDText.getText()); + } + + void jMenuItem1_actionPerformed(ActionEvent e) { + processWindowEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING)); + } + + void jMenuItem2_actionPerformed(ActionEvent e) { + ProxyDialog pd = new ProxyDialog(useProxy,proxyHost,proxyPort); + pd.validate(); + pd.show(); + if (pd.isOK()) { + String proxy; String port; + if ((proxy = pd.getProxy()) != null) { + port = pd.getPort(); + if (pd.isKeepSettings()) { + proxyHost = proxy; + proxyPort = port; + } + Properties prop = System.getProperties(); + prop.put("http.proxyHost", proxy); + prop.put("http.proxyPort", port); + } + } + } + + + public void deleteTag(int tag) { + slideTag(tag, 0, false, "y", "y", true); + tags.remove(Integer.toString(tag)); + } + + + public TagInfo addSplitTag(int tag) { + return addSplitTag(tag, true); + } + + public TagInfo addSplitTag(int tag, boolean createMarkup) { + Object [] tagKeys = tags.keySet().toArray(); + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } + }); + int highest = Integer.parseInt((String)tagKeys[tagKeys.length-1]); + TagInfo tagInfo = (TagInfo)tags.get(Integer.toString(tag)); + TagInfo newTag = (TagInfo)tagInfo.clone(); + highest++; + newTag.id = Integer.toString(highest); + tags.put(Integer.toString(highest), newTag); + newTag.splitID = Integer.toString(tag); + newTag.type = "split"; + if (createMarkup) + slideTag(tag, 0, false, "y", "y", false, highest); + return newTag; + } + + + public void toggleSplitTag(int tag) { + TagInfo tagInfo = (TagInfo)tags.get(Integer.toString(tag)); + + if (tagInfo == null) + return; + + String tagKey = (tagInfo.splitID == null) ? tagInfo.id : tagInfo.splitID; + + // see if we have any splits already and delete them + Object [] tagKeys = tags.keySet().toArray(); + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } + }); + boolean split = true; + for (int i = 0; i < tagKeys.length; i++) { + TagInfo ti = (TagInfo)tags.get(tagKeys[i]); + if (tagKey.equals(ti.splitID)) { + deleteTag(Integer.parseInt(ti.id)); + split = false; + } + } + if (split) { + addSplitTag(Integer.parseInt(tagInfo.id)); + } + } + + + void jMenuItem3_actionPerformed(ActionEvent e) { + About aboutBox = new About(); + aboutBox.validate(); + aboutBox.show(); + } + + void jButton1_actionPerformed(ActionEvent e) { + toggleSplitTag(getCurrentTag()); + } +} + + +class MainFrame_translatedTextEditor_mouseAdapter extends java.awt.event.MouseAdapter { + MainFrame adaptee; + + MainFrame_translatedTextEditor_mouseAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void mouseClicked(MouseEvent e) { + adaptee.translatedTextEditor_mouseClicked(e); + } +} + +class MainFrame_translatedTextEditor_mouseMotionAdapter extends java.awt.event.MouseMotionAdapter { + MainFrame adaptee; + + MainFrame_translatedTextEditor_mouseMotionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void mouseDragged(MouseEvent e) { + adaptee.translatedTextEditor_mouseDragged(e); + } +} + +class MainFrame_translatedTextEditor_keyAdapter extends java.awt.event.KeyAdapter { + private MainFrame adaptee; + + MainFrame_translatedTextEditor_keyAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void keyTyped(KeyEvent e) { + adaptee.translatedTextEditor_keyTyped(e); + } +} + + +class TagInfo implements Cloneable { + public TagInfo(String id) { this.id = id; } + public Hashtable translations = null; + public String id; + public String strong; + public String morph; + public String morphClass; + public String word; + public int start = 0; + public int end = 0; + public String splitID = null; + public String thayerCache = ""; + public String type = ""; + public Object clone() { Object ret = null; try { ret = super.clone(); } catch (Exception e) { e.printStackTrace(); } return ret; } + +} + + +class TransInfo { + public TransInfo(String id) { this.id = id; } + public String id; + public String english; + public String english2; + public String compoundedWith = null; + public int frequency = 0; + public int start = 0; + public boolean wholeWord; +} + +class MainFrame_loadVerseButton_actionAdapter implements java.awt.event.ActionListener { + private MainFrame adaptee; + + MainFrame_loadVerseButton_actionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { + adaptee.loadVerseButton_actionPerformed(e); + } +} + +class MainFrame_currentVerseText_keyAdapter extends java.awt.event.KeyAdapter { + private MainFrame adaptee; + + MainFrame_currentVerseText_keyAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void keyTyped(KeyEvent e) { + adaptee.currentVerseText_keyTyped(e); + } +} + +class MainFrame_this_keyAdapter extends java.awt.event.KeyAdapter { + private MainFrame adaptee; + + MainFrame_this_keyAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void keyPressed(KeyEvent e) { + adaptee.this_keyPressed(e); + } +} + +class MainFrame_guessTagButton_actionAdapter implements java.awt.event.ActionListener { + private MainFrame adaptee; + + MainFrame_guessTagButton_actionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { + adaptee.guessTagButton_actionPerformed(e); + } +} + +class MainFrame_signSaveButton_actionAdapter implements java.awt.event.ActionListener { + private MainFrame adaptee; + + MainFrame_signSaveButton_actionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { + adaptee.signSaveButton_actionPerformed(e); + } +} + +class MainFrame_greekTextEditor_mouseAdapter extends java.awt.event.MouseAdapter { + private MainFrame adaptee; + + MainFrame_greekTextEditor_mouseAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void mouseClicked(MouseEvent e) { + adaptee.greekTextEditor_mouseClicked(e); + } +} + +class MainFrame_contentPane_keyAdapter extends java.awt.event.KeyAdapter { + private MainFrame adaptee; + + MainFrame_contentPane_keyAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void keyPressed(KeyEvent e) { + adaptee.contentPane_keyPressed(e); + } +} + +class MainFrame_greekTextEditor_keyAdapter extends java.awt.event.KeyAdapter { + private MainFrame adaptee; + + MainFrame_greekTextEditor_keyAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void keyPressed(KeyEvent e) { + adaptee.greekTextEditor_keyPressed(e); + } +} + +class MainFrame_exportRangeButton_actionAdapter implements java.awt.event.ActionListener { + private MainFrame adaptee; + + MainFrame_exportRangeButton_actionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { + adaptee.exportRangeButton_actionPerformed(e); + } +} + +class MainFrame_loginButton_actionAdapter implements java.awt.event.ActionListener { + private MainFrame adaptee; + + MainFrame_loginButton_actionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { + adaptee.loginButton_actionPerformed(e); + } +} + +class MainFrame_jMenuItem1_actionAdapter implements java.awt.event.ActionListener { + private MainFrame adaptee; + + MainFrame_jMenuItem1_actionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { + adaptee.jMenuItem1_actionPerformed(e); + } +} + +class MainFrame_jMenuItem2_actionAdapter implements java.awt.event.ActionListener { + private MainFrame adaptee; + + MainFrame_jMenuItem2_actionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { + adaptee.jMenuItem2_actionPerformed(e); + } +} + +class MainFrame_jMenuItem3_actionAdapter implements java.awt.event.ActionListener { + private MainFrame adaptee; + + MainFrame_jMenuItem3_actionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { + adaptee.jMenuItem3_actionPerformed(e); + } +} + +class MainFrame_jButton1_actionAdapter implements java.awt.event.ActionListener { + private MainFrame adaptee; + + MainFrame_jButton1_actionAdapter(MainFrame adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { + adaptee.jButton1_actionPerformed(e); + } +} diff --git a/paralleltag/src/org/crosswire/modedit/ModEdit.java b/paralleltag/src/org/crosswire/modedit/ModEdit.java new file mode 100644 index 0000000..0737116 --- /dev/null +++ b/paralleltag/src/org/crosswire/modedit/ModEdit.java @@ -0,0 +1,42 @@ +package org.crosswire.modedit; + +import javax.swing.UIManager; +import java.awt.*; + +public class ModEdit { + boolean packFrame = false; + + /**Construct the application*/ + public ModEdit() { + MainFrame frame = new MainFrame(); + //Validate frames that have preset sizes + //Pack frames that have useful preferred size info, e.g. from their layout + if (packFrame) { + frame.pack(); + } + else { + frame.validate(); + } + //Center the window + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension frameSize = frame.getSize(); + if (frameSize.height > screenSize.height) { + frameSize.height = screenSize.height; + } + if (frameSize.width > screenSize.width) { + frameSize.width = screenSize.width; + } + frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + frame.setVisible(true); + } + /**Main method*/ + public static void main(String[] args) { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } + catch(Exception e) { + e.printStackTrace(); + } + new ModEdit(); + } +} diff --git a/paralleltag/src/org/crosswire/modedit/ProxyDialog.java b/paralleltag/src/org/crosswire/modedit/ProxyDialog.java new file mode 100644 index 0000000..7cbb024 --- /dev/null +++ b/paralleltag/src/org/crosswire/modedit/ProxyDialog.java @@ -0,0 +1,150 @@ +package org.crosswire.modedit; + +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; + +/** + * <p>Title: Proxy configuration</p> + * <p>Description: prompts User to configer his/her Proxy</p> + * <p>Copyright: Copyright (c) 2002</p> + * <p>Organisation: </p> + * @author Christian Frommeyer + * @version 1.0 + */ + +public class ProxyDialog extends JDialog { + BorderLayout mainLayout = new BorderLayout(); + JPanel buttonPanel = new JPanel(); + GridLayout buttonPanelLayout = new GridLayout(); + JButton cancelButton = new JButton(); + JButton okButton = new JButton(); + Component component1; + Component component2; + Box centerBox; + JTextField proxyField = new JTextField(); + JTextField portField = new JTextField(); + GridLayout textFieldPanelLayout = new GridLayout(); + GridLayout labelPanelLayout = new GridLayout(); + BorderLayout centerPanelLayout = new BorderLayout(); + JCheckBox proxyCheckBox = new JCheckBox(); + JLabel portLabel = new JLabel(); + JLabel proxyLabel = new JLabel(); + JPanel labelPanel = new JPanel(); + JPanel textFieldPanel = new JPanel(); + JPanel centerPanel = new JPanel(); + Component component3; + JTextArea instructionText = new JTextArea(); + + private boolean ok = false; + private JCheckBox keepCheckBox = new JCheckBox(); + + public ProxyDialog(boolean useProxy, String proxy, String port) { + try { + jbInit(); + if (useProxy) { + this.proxyCheckBox.setSelected(true); + if (proxy != null) this.proxyField.setText(proxy); + if (port != null) this.portField.setText(port); + } + } + catch(Exception e) { + e.printStackTrace(); + } + } + private void jbInit() throws Exception { + component1 = Box.createHorizontalStrut(50); + component2 = Box.createHorizontalStrut(50); + component3 = Box.createVerticalStrut(20); + centerBox = Box.createVerticalBox(); + this.setModal(true); + this.setSize(new Dimension(489, 213)); + this.setTitle("Proxy-Configuration"); + this.getContentPane().setLayout(mainLayout); + buttonPanel.setLayout(buttonPanelLayout); + cancelButton.setText("Cancel"); + cancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + button_actionPerformed(e); + } + }); + okButton.setText("OK"); + okButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + button_actionPerformed(e); + } + }); + proxyField.setEnabled(false); + proxyField.setText("[none]"); + portField.setEnabled(false); + portField.setText("8080"); + textFieldPanelLayout.setRows(2); + labelPanelLayout.setRows(2); + proxyCheckBox.setText("I need a proxy"); + proxyCheckBox.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + proxyCheckBox_itemStateChanged(e); + } + }); + portLabel.setText("Port:"); + proxyLabel.setText("Proxy:"); + labelPanel.setLayout(labelPanelLayout); + textFieldPanel.setLayout(textFieldPanelLayout); + centerPanel.setLayout(centerPanelLayout); + centerPanel.setMaximumSize(new Dimension(2147483647, 84)); + labelPanel.setPreferredSize(new Dimension(60, 30)); + instructionText.setMaximumSize(new Dimension(2147483647, 45)); + instructionText.setOpaque(false); + instructionText.setRequestFocusEnabled(false); + instructionText.setText("Please configure your Proxy-Server and Port here if you need one " + + "to connect to the Internet"); + instructionText.setEditable(false); + instructionText.setLineWrap(true); + instructionText.setWrapStyleWord(true); + keepCheckBox.setEnabled(false); + keepCheckBox.setSelected(true); + keepCheckBox.setText("keep settings"); + buttonPanel.add(cancelButton, null); + buttonPanel.add(okButton, null); + this.getContentPane().add(component2, BorderLayout.EAST); + this.getContentPane().add(component1, BorderLayout.WEST); + this.getContentPane().add(buttonPanel, BorderLayout.SOUTH); + this.getContentPane().add(centerBox, BorderLayout.CENTER); + centerPanel.add(textFieldPanel, BorderLayout.CENTER); + textFieldPanel.add(proxyField, null); + textFieldPanel.add(portField, null); + centerPanel.add(labelPanel, BorderLayout.WEST); + labelPanel.add(proxyLabel, null); + labelPanel.add(portLabel, null); + centerPanel.add(proxyCheckBox, BorderLayout.NORTH); + centerPanel.add(keepCheckBox, BorderLayout.SOUTH); + centerBox.add(instructionText, null); + this.getContentPane().add(component3, BorderLayout.NORTH); + centerBox.add(centerPanel, null); + } + + void proxyCheckBox_itemStateChanged(ItemEvent e) { + this.proxyField.setEnabled(this.proxyCheckBox.isSelected()); + this.portField.setEnabled(this.proxyCheckBox.isSelected()); + this.keepCheckBox.setEnabled(this.proxyCheckBox.isSelected()); + } + + public String getProxy() { + if (this.proxyCheckBox.isSelected()) return this.proxyField.getText(); + else return null; + } + + public String getPort() { + if (this.proxyCheckBox.isSelected()) return this.portField.getText(); + else return null; + } + + public boolean isKeepSettings() { return (this.proxyCheckBox.isSelected() && this.keepCheckBox.isSelected()); } + public boolean isOK() { return ok; } + + void button_actionPerformed(ActionEvent e) { + if (e.getActionCommand().equals(okButton.getActionCommand())) ok = true; + else ok = false; + this.hide(); + } +} diff --git a/paralleltag/src/org/crosswire/modedit/change.log b/paralleltag/src/org/crosswire/modedit/change.log new file mode 100644 index 0000000..9ed2e94 --- /dev/null +++ b/paralleltag/src/org/crosswire/modedit/change.log @@ -0,0 +1,71 @@ +Package: + untitled4 -> modedit + +Classes: + Frame1 -> MainFrame + Application1 -> ModEdit + + jPanel1 -> signSavePanel + jPanel2 -> tagPanel + jPanel3 -> rightPanel + jPanel4 -> leftPanel + jPanel5 -> currentTagPanel + jPanel6 -> textPanel + jPanel7 -> currentActionPanel + jPanel8 -> loginPanel + jPanel9 -> aPanel + jPanel10 -> currentVersePanel + jPanel11 -> bPanel + jPanel12 -> strongPanel + jPanel13 -> cPanel + jPanel14 -> currentRangePanel + + borderLayout1 -> contentPaneLayout + borderLayout2 -> leftPanelLayout + borderLayout3 -> currentTagPanelLayout + borderLayout4 -> rightPanelLayout + borderLayout5 -> aPanelLayout + borderLayout6 -> bPanelLayout + borderLayout7 -> cPanelLayout + gridLayout1 -> textPanelLayout + gridLayout2 -> tagPanelLayout + gridLayout3 -> loginPanelLayout + gridLayout4 -> currentVersePanelLayout + gridLayout5 -> strongPanelLayout + gridLayout6 -> signSavePanelLayout + gridLayout7 -> currentRangePanelLayout + + titledBorder1 -> [removed] + titledBorder2 -> [removed] + titledBorder3 -> translatedTextEditorBorder + titledBorder4 -> greekTextEditorBorder + titledBorder5 -> strongTextEditorBorder + titledBorder6 -> currentVersePanelBorder + titledBorder7 -> loginPanelBorder + titledBorder8 -> signSavePanelBorder + titledBorder9 -> currentRangePanelBorder + titledBorder10 -> leftPanelBorder + + jEditorPane1 -> translatedTextEditor + jEditorPane2 -> greekTextEditor + jEditorPane3 -> strongTextEditor + + jLabel1 -> currentTagLabel + jLabel2 -> currentActionLabel + jLabel3 -> actionLabel + jLabel4 -> userIDLabel + jLabel6 -> currentVerseLabel + jLabel7 -> currentRangeLabel + + jTextField1 -> currentTagText + jTextField3 -> currentVerseText + + jScrollPane1 -> strongTextScroll + jScrollPane2 -> translatedTextScroll + jScrollPane3 -> greekTextScroll + + jButton1 -> signSaveButton + jButton2 -> guessTagButton + jButton3 -> exportRangeButton + jButton4 -> loginButton + jButton5 -> loadVerseButton diff --git a/paralleltag/src/org/crosswire/modedit/diff b/paralleltag/src/org/crosswire/modedit/diff new file mode 100644 index 0000000..78daaf3 --- /dev/null +++ b/paralleltag/src/org/crosswire/modedit/diff @@ -0,0 +1,1045 @@ +--- MainFrame.java Sun Nov 10 15:37:11 2002 ++++ /home/scribe/jbproject/untitled4/src/untitled4/Frame1.java Sun Nov 10 01:09:37 2002 +@@ -1,4 +1,4 @@ +-package modedit; ++package untitled4; + + import java.awt.*; + import java.awt.event.*; +@@ -19,44 +19,44 @@ + import java.net.URL; + import java.net.URLConnection; + +-public class MainFrame extends JFrame { ++public class Frame1 extends JFrame { + JPanel contentPane; +- BorderLayout contentPaneLayout = new BorderLayout(); +- JPanel rightPanel = new JPanel(); +- JPanel leftPanel = new JPanel(); +- JPanel currentTagPanel = new JPanel(); +- JPanel textPanel = new JPanel(); +- BorderLayout leftPanelLayout = new BorderLayout(); +- JEditorPane translatedTextEditor = new JEditorPane() { ++ BorderLayout borderLayout1 = new BorderLayout(); ++ JPanel jPanel3 = new JPanel(); ++ JPanel jPanel4 = new JPanel(); ++ JPanel jPanel5 = new JPanel(); ++ JPanel jPanel6 = new JPanel(); ++ BorderLayout borderLayout2 = new BorderLayout(); ++ JEditorPane jEditorPane1 = new JEditorPane() { + public boolean isManagingFocus() { return true; } + }; +- GridLayout textPanelLayout = new GridLayout(); +- JTextArea greekTextEditor = new JTextArea() { ++ GridLayout gridLayout1 = new GridLayout(); ++ JTextArea jEditorPane2 = new JTextArea() { + public boolean isManagingFocus() { return true; } + }; +- JPanel signSavePanel = new JPanel(); +- JPanel tagPanel = new JPanel(); +- BorderLayout currentTagPanelLayout = new BorderLayout(); +- JLabel currentTagLabel = new JLabel(); +- GridLayout tagPanelLayout = new GridLayout(); +- JTextField currentTagText = new JTextField(); +- JPanel currentActionPanel = new JPanel(); +- JLabel currentActionLabel = new JLabel(); +- JLabel actionLabel = new JLabel(); +- JButton signSaveButton = new JButton(); +- JButton guessTagButton = new JButton(); +- JPanel loginPanel = new JPanel(); +- JLabel userIDLabel = new JLabel(); ++ JPanel jPanel1 = new JPanel(); ++ JPanel jPanel2 = new JPanel(); ++ BorderLayout borderLayout3 = new BorderLayout(); ++ JLabel jLabel1 = new JLabel(); ++ GridLayout gridLayout2 = new GridLayout(); ++ JTextField jTextField1 = new JTextField(); ++ JPanel jPanel7 = new JPanel(); ++ JLabel jLabel2 = new JLabel(); ++ JLabel jLabel3 = new JLabel(); ++ JButton jButton1 = new JButton(); ++ JButton jButton2 = new JButton(); ++ JPanel jPanel8 = new JPanel(); ++ JLabel jLabel4 = new JLabel(); + JTextField userIDText = new JTextField(); +- JButton loginButton = new JButton(); ++ JButton jButton4 = new JButton(); + JLabel loginStatusLabel = new JLabel(); +- GridLayout loginPanelLayout = new GridLayout(); +- BorderLayout rightPanelLayout = new BorderLayout(); ++ GridLayout gridLayout3 = new GridLayout(); ++ BorderLayout borderLayout4 = new BorderLayout(); + int currentCaret = -1; + Object greekHighlight; + + /**Construct the frame*/ +- public MainFrame() { ++ public Frame1() { + enableEvents(AWTEvent.WINDOW_EVENT_MASK); + try { + jbInit(); +@@ -66,33 +66,36 @@ + } + } + +- private JEditorPane strongTextEditor = new JEditorPane(); +- private TitledBorder translatedTextEditorBorder; +- private TitledBorder greekTextEditorBorder; +- private TitledBorder strongTextEditorBorder; ++ ++ private JEditorPane jEditorPane3 = new JEditorPane(); ++ private TitledBorder titledBorder1; ++ private TitledBorder titledBorder2; ++ private TitledBorder titledBorder3; ++ private TitledBorder titledBorder4; ++ private TitledBorder titledBorder5; + private Hashtable tags = new Hashtable(); +- private JScrollPane strongTextScroll = new JScrollPane(); +- private JScrollPane translatedTextScroll = new JScrollPane(); +- private JScrollPane greekTextScroll = new JScrollPane(); +- private JPanel aPanel = new JPanel(); +- private JPanel currentVersePanel = new JPanel(); +- private BorderLayout aPanelLayout = new BorderLayout(); +- private JLabel currentVerseLabel = new JLabel(); +- private JTextField currentVerseText = new JTextField(); +- private GridLayout currentVersePanelLayout = new GridLayout(); +- private JButton loadVerseButton = new JButton(); +- private TitledBorder currentVersePanelBorder; +- private TitledBorder loginPanelBorder; +- private JPanel bPanel = new JPanel(); +- private JPanel strongPanel = new JPanel(); ++ private JScrollPane jScrollPane1 = new JScrollPane(); ++ private JScrollPane jScrollPane2 = new JScrollPane(); ++ private JScrollPane jScrollPane3 = new JScrollPane(); ++ private JPanel jPanel9 = new JPanel(); ++ private JPanel jPanel10 = new JPanel(); ++ private BorderLayout borderLayout5 = new BorderLayout(); ++ private JLabel jLabel6 = new JLabel(); ++ private JTextField jTextField3 = new JTextField(); ++ private GridLayout gridLayout4 = new GridLayout(); ++ private JButton jButton5 = new JButton(); ++ private TitledBorder titledBorder6; ++ private TitledBorder titledBorder7; ++ private JPanel jPanel11 = new JPanel(); ++ private JPanel jPanel12 = new JPanel(); + private JTextField wordText = new JTextField(); +- private GridLayout strongPanelLayout = new GridLayout(); ++ private GridLayout gridLayout5 = new GridLayout(); + private JTextField morphText = new JTextField(); + private JTextField strongText = new JTextField(); +- private BorderLayout bPanelLayout = new BorderLayout(); +- private GridLayout signSavePanelLayout = new GridLayout(); +- private TitledBorder signSavePanelBorder; +- private JPanel cPanel = new JPanel(); ++ private BorderLayout borderLayout6 = new BorderLayout(); ++ private GridLayout gridLayout6 = new GridLayout(); ++ private TitledBorder titledBorder8; ++ private JPanel jPanel13 = new JPanel(); + + boolean localTR = false; + boolean localKJV = false; +@@ -111,165 +114,163 @@ + + private String userID = null; + +- private String proxyHost = null; +- private String proxyPort = null; +- private boolean useProxy = false; +- + public String currentKey = null; +- private JPanel currentRangePanel = new JPanel(); +- private JLabel currentRangeLabel = new JLabel(); ++ private JPanel jPanel14 = new JPanel(); ++ private JLabel jLabel7 = new JLabel(); + private JTextField rangeText = new JTextField(); +- private GridLayout currentRangePanelLayout = new GridLayout(); +- private BorderLayout cPanelLayout = new BorderLayout(); +- private TitledBorder currentRangePanelBorder; +- private JButton exportRangeButton = new JButton(); +- private TitledBorder leftPanelBorder; ++ private GridLayout gridLayout7 = new GridLayout(); ++ private BorderLayout borderLayout7 = new BorderLayout(); ++ private TitledBorder titledBorder9; ++ private JButton jButton3 = new JButton(); ++ private TitledBorder titledBorder10; + + /**Component initialization*/ + private void jbInit() throws Exception { +- //setIconImage(Toolkit.getDefaultToolkit().createImage(MainFrame.class.getResource("[Your Icon]"))); ++ //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]"))); + contentPane = (JPanel) this.getContentPane(); + + HTMLEditorKit htmlKit = new HTMLEditorKit(); +- currentVersePanelBorder = new TitledBorder(""); +- loginPanelBorder = new TitledBorder(""); +- signSavePanelBorder = new TitledBorder(""); +- currentRangePanelBorder = new TitledBorder(""); +- leftPanelBorder = new TitledBorder(""); +- translatedTextEditor.setEditable(false); +- translatedTextEditor.setEditorKit(htmlKit); +- translatedTextEditor.addKeyListener(new java.awt.event.KeyAdapter() { ++ titledBorder6 = new TitledBorder(""); ++ titledBorder7 = new TitledBorder(""); ++ titledBorder8 = new TitledBorder(""); ++ titledBorder9 = new TitledBorder(""); ++ titledBorder10 = new TitledBorder(""); ++ jEditorPane1.setEditable(false); ++ jEditorPane1.setEditorKit(htmlKit); ++ jEditorPane1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(KeyEvent e) { +- translatedTextEditor_keyPressed(e); ++ jEditorPane1_keyPressed(e); + } + }); + + HTMLEditorKit htmlKit3 = new HTMLEditorKit(); +- strongTextEditor.setEditable(false); +- strongTextEditor.setEditorKit(htmlKit3); ++ jEditorPane3.setEditable(false); ++ jEditorPane3.setEditorKit(htmlKit3); + + HTMLEditorKit htmlKit2 = new HTMLEditorKit(); +- greekTextEditor.setLineWrap(true); +- greekTextEditor.setEditable(false); +- greekTextEditor.setWrapStyleWord(true); +- greekTextEditor.addKeyListener(new MainFrame_greekTextEditor_keyAdapter(this)); +- greekTextEditor.addMouseListener(new MainFrame_greekTextEditor_mouseAdapter(this)); +-// greekTextEditor.setEditorKit(htmlKit2); +- +- translatedTextEditorBorder = new TitledBorder(""); +- greekTextEditorBorder = new TitledBorder(""); +- strongTextEditorBorder = new TitledBorder(""); +- translatedTextEditor.setBorder(translatedTextEditorBorder); +- translatedTextEditor.addKeyListener(new MainFrame_translatedTextEditor_keyAdapter(this)); +- translatedTextEditor.addMouseMotionListener(new MainFrame_translatedTextEditor_mouseMotionAdapter(this)); +- translatedTextEditor.addMouseListener(new MainFrame_translatedTextEditor_mouseAdapter(this)); +- translatedTextEditor.addHyperlinkListener(new Hyperactive()); +- HTMLDocument doc = (HTMLDocument)translatedTextEditor.getDocument(); ++ jEditorPane2.setLineWrap(true); ++ jEditorPane2.setEditable(false); ++ jEditorPane2.setWrapStyleWord(true); ++ jEditorPane2.addKeyListener(new Frame1_jEditorPane2_keyAdapter(this)); ++ jEditorPane2.addMouseListener(new Frame1_jEditorPane2_mouseAdapter(this)); ++// jEditorPane2.setEditorKit(htmlKit2); ++ ++ titledBorder1 = new TitledBorder(""); ++ titledBorder2 = new TitledBorder(""); ++ titledBorder3 = new TitledBorder(""); ++ titledBorder4 = new TitledBorder(""); ++ titledBorder5 = new TitledBorder(""); ++ jEditorPane1.setBorder(titledBorder3); ++ jEditorPane1.addKeyListener(new Frame1_jEditorPane1_keyAdapter(this)); ++ jEditorPane1.addMouseMotionListener(new Frame1_jEditorPane1_mouseMotionAdapter(this)); ++ jEditorPane1.addMouseListener(new Frame1_jEditorPane1_mouseAdapter(this)); ++ jEditorPane1.addHyperlinkListener(new Hyperactive()); ++ HTMLDocument doc = (HTMLDocument)jEditorPane1.getDocument(); + doc.setPreservesUnknownTags(true); + +- contentPane.setLayout(contentPaneLayout); ++ contentPane.setLayout(borderLayout1); + this.setSize(new Dimension(587, 564)); +- this.setTitle("Module Editor"); +- this.addKeyListener(new MainFrame_this_keyAdapter(this)); +- leftPanel.setLayout(leftPanelLayout); +- textPanelLayout.setRows(3); +- textPanelLayout.setColumns(1); +- textPanel.setLayout(textPanelLayout); +- greekTextEditor.setBorder(greekTextEditorBorder); +- currentTagPanel.setLayout(currentTagPanelLayout); +- currentTagLabel.setText("Current Tag"); +- tagPanel.setLayout(tagPanelLayout); +- currentTagText.setText("0"); +- currentActionLabel.setText("Current Action:"); +- actionLabel.setText("[none]"); +- signSaveButton.setText("Sign & Save"); +- signSaveButton.addActionListener(new MainFrame_signSaveButton_actionAdapter(this)); +- guessTagButton.setText("Guess at all tags"); +- guessTagButton.addActionListener(new MainFrame_guessTagButton_actionAdapter(this)); +- rightPanel.setLayout(rightPanelLayout); +- userIDLabel.setText("UserID"); +- loginButton.setText("Login"); +- loginButton.addActionListener(new MainFrame_loginButton_actionAdapter(this)); ++ this.setTitle("Frame Title"); ++ this.addKeyListener(new Frame1_this_keyAdapter(this)); ++ jPanel4.setLayout(borderLayout2); ++ gridLayout1.setRows(3); ++ gridLayout1.setColumns(1); ++ jPanel6.setLayout(gridLayout1); ++ jEditorPane2.setBorder(titledBorder4); ++ jPanel5.setLayout(borderLayout3); ++ jLabel1.setText("Current Tag"); ++ jPanel2.setLayout(gridLayout2); ++ jTextField1.setText("0"); ++ jLabel2.setText("Current Action:"); ++ jLabel3.setText("[none]"); ++ jButton1.setText("Sign & Save"); ++ jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this)); ++ jButton2.setText("Guess at all tags"); ++ jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this)); ++ jPanel3.setLayout(borderLayout4); ++ jLabel4.setText("UserID"); ++ jButton4.setText("Login"); ++ jButton4.addActionListener(new Frame1_jButton4_actionAdapter(this)); + loginStatusLabel.setBorder(BorderFactory.createLineBorder(Color.black)); + loginStatusLabel.setText("Not Logged In"); +- loginPanel.setLayout(loginPanelLayout); +- strongTextEditor.setBorder(strongTextEditorBorder); +- rightPanel.setBorder(BorderFactory.createEtchedBorder()); +- loginPanel.setBorder(loginPanelBorder); +- greekTextScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); +- translatedTextScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); +- aPanel.setLayout(aPanelLayout); +- currentVerseLabel.setText("Current Verse"); +- currentVersePanel.setLayout(currentVersePanelLayout); +- currentVersePanelLayout.setColumns(1); +- currentVersePanelLayout.setRows(0); +- loadVerseButton.setText("Load"); +- loadVerseButton.addActionListener(new MainFrame_loadVerseButton_actionAdapter(this)); +- currentVersePanel.setBorder(currentVersePanelBorder); +- currentVerseText.addKeyListener(new MainFrame_currentVerseText_keyAdapter(this)); +- strongPanel.setLayout(strongPanelLayout); +- strongPanelLayout.setColumns(1); +- strongPanelLayout.setRows(0); +- bPanel.setLayout(bPanelLayout); +- signSavePanel.setLayout(signSavePanelLayout); +- signSavePanelLayout.setColumns(1); +- signSavePanelLayout.setRows(0); +- signSavePanel.setBorder(signSavePanelBorder); +- contentPane.addKeyListener(new MainFrame_contentPane_keyAdapter(this)); +- currentRangeLabel.setText("Current Range"); +- currentRangePanel.setLayout(currentRangePanelLayout); +- cPanel.setLayout(cPanelLayout); +- currentRangePanelLayout.setColumns(1); +- currentRangePanelLayout.setRows(0); +- currentRangePanel.setBorder(currentRangePanelBorder); +- exportRangeButton.setText("Export"); +- exportRangeButton.addActionListener(new MainFrame_exportRangeButton_actionAdapter(this)); +- leftPanel.setBorder(leftPanelBorder); +- contentPane.add(rightPanel, BorderLayout.EAST); +- rightPanel.add(loginPanel, BorderLayout.NORTH); +- loginPanel.add(userIDLabel, null); +- loginPanel.add(userIDText, null); +- loginPanel.add(loginButton, null); +- loginPanel.add(loginStatusLabel, null); +- rightPanel.add(aPanel, BorderLayout.CENTER); +- aPanel.add(currentRangePanel, BorderLayout.NORTH); +- currentVersePanel.add(currentVerseLabel, null); +- currentVersePanel.add(currentVerseText, null); +- currentVersePanel.add(loadVerseButton, null); +- currentVersePanel.add(guessTagButton, null); +- aPanel.add(bPanel, BorderLayout.CENTER); +- bPanel.add(signSavePanel, BorderLayout.SOUTH); +- strongPanel.add(wordText, null); +- strongPanel.add(strongText, null); +- strongPanel.add(morphText, null); +- contentPane.add(leftPanel, BorderLayout.CENTER); +- leftPanel.add(currentTagPanel, BorderLayout.SOUTH); +- currentTagPanel.add(tagPanel, BorderLayout.WEST); +- tagPanelLayout.setRows(3); +- tagPanelLayout.setColumns(1); +- loginPanelLayout.setRows(4); +- loginPanelLayout.setColumns(1); +- tagPanel.add(currentTagLabel, null); +- tagPanel.add(currentTagText, null); +- tagPanel.add(currentActionPanel, null); +- currentActionPanel.add(currentActionLabel, null); +- currentActionPanel.add(actionLabel, null); +- currentTagPanel.add(strongPanel, BorderLayout.CENTER); +- signSavePanel.add(signSaveButton, null); +- bPanel.add(cPanel, BorderLayout.CENTER); +- cPanel.add(currentVersePanel, BorderLayout.NORTH); +- currentRangePanel.add(currentRangeLabel, null); +- currentRangePanel.add(rangeText, null); +- currentRangePanel.add(exportRangeButton, null); +- leftPanel.add(textPanel, BorderLayout.CENTER); +- textPanel.add(translatedTextScroll, null); +- translatedTextScroll.getViewport().add(translatedTextEditor, null); +- textPanel.add(greekTextScroll, null); +- greekTextScroll.getViewport().add(greekTextEditor, null); +- textPanel.add(strongTextScroll, null); +- strongTextScroll.getViewport().add(strongTextEditor, null); ++ jPanel8.setLayout(gridLayout3); ++ jEditorPane3.setBorder(titledBorder5); ++ jPanel3.setBorder(BorderFactory.createEtchedBorder()); ++ jPanel8.setBorder(titledBorder7); ++ jScrollPane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); ++ jScrollPane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); ++ jPanel9.setLayout(borderLayout5); ++ jLabel6.setText("Current Verse"); ++ jPanel10.setLayout(gridLayout4); ++ gridLayout4.setColumns(1); ++ gridLayout4.setRows(0); ++ jButton5.setText("Load"); ++ jButton5.addActionListener(new Frame1_jButton5_actionAdapter(this)); ++ jPanel10.setBorder(titledBorder6); ++ jTextField3.addKeyListener(new Frame1_jTextField3_keyAdapter(this)); ++ jPanel12.setLayout(gridLayout5); ++ gridLayout5.setColumns(1); ++ gridLayout5.setRows(0); ++ jPanel11.setLayout(borderLayout6); ++ jPanel1.setLayout(gridLayout6); ++ gridLayout6.setColumns(1); ++ gridLayout6.setRows(0); ++ jPanel1.setBorder(titledBorder8); ++ contentPane.addKeyListener(new Frame1_contentPane_keyAdapter(this)); ++ jLabel7.setText("Current Range"); ++ jPanel14.setLayout(gridLayout7); ++ jPanel13.setLayout(borderLayout7); ++ gridLayout7.setColumns(1); ++ gridLayout7.setRows(0); ++ jPanel14.setBorder(titledBorder9); ++ jButton3.setText("Export"); ++ jButton3.addActionListener(new Frame1_jButton3_actionAdapter(this)); ++ jPanel4.setBorder(titledBorder10); ++ contentPane.add(jPanel3, BorderLayout.EAST); ++ jPanel3.add(jPanel8, BorderLayout.NORTH); ++ jPanel8.add(jLabel4, null); ++ jPanel8.add(userIDText, null); ++ jPanel8.add(jButton4, null); ++ jPanel8.add(loginStatusLabel, null); ++ jPanel3.add(jPanel9, BorderLayout.CENTER); ++ jPanel9.add(jPanel14, BorderLayout.NORTH); ++ jPanel10.add(jLabel6, null); ++ jPanel10.add(jTextField3, null); ++ jPanel10.add(jButton5, null); ++ jPanel10.add(jButton2, null); ++ jPanel9.add(jPanel11, BorderLayout.CENTER); ++ jPanel11.add(jPanel1, BorderLayout.SOUTH); ++ jPanel12.add(wordText, null); ++ jPanel12.add(strongText, null); ++ jPanel12.add(morphText, null); ++ contentPane.add(jPanel4, BorderLayout.CENTER); ++ jPanel4.add(jPanel5, BorderLayout.SOUTH); ++ jPanel5.add(jPanel2, BorderLayout.WEST); ++ gridLayout2.setRows(3); ++ gridLayout2.setColumns(1); ++ gridLayout3.setRows(4); ++ gridLayout3.setColumns(1); ++ jPanel2.add(jLabel1, null); ++ jPanel2.add(jTextField1, null); ++ jPanel2.add(jPanel7, null); ++ jPanel7.add(jLabel2, null); ++ jPanel7.add(jLabel3, null); ++ jPanel5.add(jPanel12, BorderLayout.CENTER); ++ jPanel1.add(jButton1, null); ++ jPanel11.add(jPanel13, BorderLayout.CENTER); ++ jPanel13.add(jPanel10, BorderLayout.NORTH); ++ jPanel14.add(jLabel7, null); ++ jPanel14.add(rangeText, null); ++ jPanel14.add(jButton3, null); ++ jPanel4.add(jPanel6, BorderLayout.CENTER); ++ jPanel6.add(jScrollPane2, null); ++ jScrollPane2.getViewport().add(jEditorPane1, null); ++ jPanel6.add(jScrollPane3, null); ++ jScrollPane3.getViewport().add(jEditorPane2, null); ++ jPanel6.add(jScrollPane1, null); ++ jScrollPane1.getViewport().add(jEditorPane3, null); + +- Highlighter h = greekTextEditor.getHighlighter(); ++ Highlighter h = jEditorPane2.getHighlighter(); + DefaultHighlighter.DefaultHighlightPainter hp = new DefaultHighlighter.DefaultHighlightPainter(Color.yellow); + greekHighlight = h.addHighlight(0, 0, hp); + +@@ -291,7 +292,7 @@ + } + } + +- void signSaveButton_actionPerformed(ActionEvent e) { ++ void jButton1_actionPerformed(ActionEvent e) { + + // assert we are ok to save something + if (currentKey == null) { +@@ -338,35 +339,12 @@ + + rangeText.setText(props.getProperty("currentRange", "jn")); + userIDText.setText(props.getProperty("userID", "")); +- +- useProxy = (props.getProperty("useProxy", "false").equals("true")); +- proxyHost = props.getProperty("proxyHost", "[none]"); +- proxyPort = props.getProperty("proxyPort", "8080"); +- //Show Proxy-Dialog if there is anything not local +- if (!(localImages && localKJV &&localTR && localThayer)) { +- ProxyDialog pd = new ProxyDialog(useProxy,proxyHost,proxyPort); +- pd.validate(); +- pd.show(); +- if (pd.isOK()) { +- String proxy; String port; +- if ((proxy = pd.getProxy()) != null) { +- port = pd.getPort(); +- if (pd.isKeepSettings()) { +- proxyHost = proxy; +- proxyPort = port; +- } +- Properties prop = System.getProperties(); +- prop.put("http.proxyHost", proxy); +- prop.put("http.proxyPort", port); +- } +- } else System.exit(0); +- } //end Proxy config +- + loadVerse(props.getProperty("lastVerse", "jn 1:1")); + if (!localKJV) +- exportRangeButton.setVisible(false); ++ jButton3.setVisible(false); + } + ++ + void savePreferences() { + Properties props = new Properties(); + props.setProperty("localKJV", (localKJV) ? "true" : "false"); +@@ -376,9 +354,6 @@ + props.setProperty("currentRange", rangeText.getText()); + props.setProperty("userID", userIDText.getText()); + props.setProperty("lastVerse", currentKey); +- props.setProperty("proxyHost", proxyHost); +- props.setProperty("proxyPort", proxyPort); +- props.setProperty("useProxy", (useProxy) ? "true" : "false"); + try { + props.store(new FileOutputStream("ModEdit.properties"), "ModEdit Properties"); + } +@@ -386,6 +361,9 @@ + + } + ++ ++ ++ + void loadTextArea(JTextArea control, StringBuffer agentResult) { + try { + StringBuffer newText = agentResult; +@@ -401,6 +379,7 @@ + } + } + ++ + void loadHTML(JEditorPane control, StringBuffer agentResult) { + try { + StringBuffer newText = agentResult; +@@ -457,6 +436,7 @@ + return retVal; + } + ++ + int callServer(String command, StringBuffer result) { + try { + String lookupURL = "http://www.crosswire.org/sword/kjv2003/modedit.jsp?" + command; +@@ -521,7 +501,7 @@ + if (!localThayer) + callServer("action=h&mod=Thayer&key="+tagInfo.strong, agentResult); + else callLocalAgent(new String[] {util, "h", "Thayer", tagInfo.strong}, agentResult, true); +- loadHTML(strongTextEditor, agentResult); ++ loadHTML(jEditorPane3, agentResult); + + } catch (Throwable t) { + t.printStackTrace(); +@@ -531,7 +511,7 @@ + wordText.setText(tagInfo.word); + + try { +- greekTextEditor.getHighlighter().changeHighlight(greekHighlight, tagInfo.start, tagInfo.end); ++ jEditorPane2.getHighlighter().changeHighlight(greekHighlight, tagInfo.start, tagInfo.end); + } + catch (Exception e) { e.printStackTrace(); } + } +@@ -560,12 +540,23 @@ + } + } + +- void translatedTextEditor_mouseClicked(MouseEvent e) { ++ void jEditorPane1_mouseClicked(MouseEvent e) { + } + +- void translatedTextEditor_mouseDragged(MouseEvent e) { ++class Frame1_jEditorPane1_mouseAdapter extends java.awt.event.MouseAdapter { ++ Frame1 adaptee; ++ ++ Frame1_jEditorPane1_mouseAdapter(Frame1 adaptee) { ++ this.adaptee = adaptee; ++ } ++ public void mouseClicked(MouseEvent e) { ++ adaptee.jEditorPane1_mouseClicked(e); ++ } ++ } ++ ++ void jEditorPane1_mouseDragged(MouseEvent e) { + Point clickPoint = e.getPoint(); +- int position = translatedTextEditor.viewToModel(clickPoint); ++ int position = jEditorPane1.viewToModel(clickPoint); + boolean sizeTag = false; + if (!getCurrentAction().equals("[none]")) { + if (getCurrentAction().equals("SizeTag")) +@@ -628,10 +619,10 @@ + + boolean addNewImage = false; + +- HTMLDocument doc = (HTMLDocument)translatedTextEditor.getDocument(); ++ HTMLDocument doc = (HTMLDocument)jEditorPane1.getDocument(); + StringWriter writer = new StringWriter(); + try { +- translatedTextEditor.getEditorKit().write(writer, doc, 0, doc.getLength()); ++ jEditorPane1.getEditorKit().write(writer, doc, 0, doc.getLength()); + } + catch(Exception ex) { + ex.printStackTrace(); +@@ -785,13 +776,13 @@ + } + htmlstr = html.toString(); + try { +- translatedTextEditor.setText(""); +- translatedTextEditor.getEditorKit().read(new StringReader(html.toString()), doc, 0); ++ jEditorPane1.setText(""); ++ jEditorPane1.getEditorKit().read(new StringReader(html.toString()), doc, 0); + } + catch(Exception ex) { + ex.printStackTrace(); + } +- } //end of slideTag ++ } + + + int getTagFromPosition(int offset) { +@@ -800,7 +791,7 @@ + int retVal = 0; + + //remove selection +- translatedTextEditor.setSelectionEnd(translatedTextEditor.getSelectionStart()); ++ jEditorPane1.setSelectionEnd(jEditorPane1.getSelectionStart()); + + if (position != currentCaret) { + currentCaret = position; +@@ -810,9 +801,9 @@ + String startSearch = startTag1; + String endSearch = endTag1; + +- HTMLDocument doc = (HTMLDocument)translatedTextEditor.getDocument(); ++ HTMLDocument doc = (HTMLDocument)jEditorPane1.getDocument(); + try { +- translatedTextEditor.getEditorKit().read(new StringReader("$$$"), doc, position); ++ jEditorPane1.getEditorKit().read(new StringReader("$$$"), doc, position); + } + catch(Exception ex) { + ex.printStackTrace(); +@@ -820,7 +811,7 @@ + + StringWriter writer = new StringWriter(); + try { +- translatedTextEditor.getEditorKit().write(writer, doc, 0, doc.getLength()); ++ jEditorPane1.getEditorKit().write(writer, doc, 0, doc.getLength()); + } + catch(Exception ex) { + ex.printStackTrace(); +@@ -855,8 +846,8 @@ + } + + try { +- translatedTextEditor.setText(""); +- translatedTextEditor.getEditorKit().read(new StringReader(html.toString()), doc, 0); ++ jEditorPane1.setText(""); ++ jEditorPane1.getEditorKit().read(new StringReader(html.toString()), doc, 0); + } + catch(Exception ex) { + ex.printStackTrace(); +@@ -868,7 +859,7 @@ + void moveTag(int tagNum, int position, boolean sizeTag) { + + //remove selection +- translatedTextEditor.setSelectionEnd(translatedTextEditor.getSelectionStart()); ++ jEditorPane1.setSelectionEnd(jEditorPane1.getSelectionStart()); + + String startTag = startTag1+Integer.toString(tagNum)+startTag2; + String endTag = endTag1+Integer.toString(tagNum)+endTag2; +@@ -877,9 +868,9 @@ + + boolean addNewImage = false; + +- HTMLDocument doc = (HTMLDocument)translatedTextEditor.getDocument(); ++ HTMLDocument doc = (HTMLDocument)jEditorPane1.getDocument(); + try { +- translatedTextEditor.getEditorKit().read(new StringReader("$$$"), doc, position); ++ jEditorPane1.getEditorKit().read(new StringReader("$$$"), doc, position); + } + catch(Exception ex) { + ex.printStackTrace(); +@@ -887,7 +878,7 @@ + + StringWriter writer = new StringWriter(); + try { +- translatedTextEditor.getEditorKit().write(writer, doc, 0, doc.getLength()); ++ jEditorPane1.getEditorKit().write(writer, doc, 0, doc.getLength()); + } + catch(Exception ex) { + ex.printStackTrace(); +@@ -948,8 +939,8 @@ + } + htmlstr = html.toString(); + try { +- translatedTextEditor.setText(""); +- translatedTextEditor.getEditorKit().read(new StringReader(html.toString()), doc, 0); ++ jEditorPane1.setText(""); ++ jEditorPane1.getEditorKit().read(new StringReader(html.toString()), doc, 0); + } + catch(Exception ex) { + ex.printStackTrace(); +@@ -957,7 +948,7 @@ + } + + +- void translatedTextEditor_keyTyped(KeyEvent e) { ++ void jEditorPane1_keyTyped(KeyEvent e) { + } + + +@@ -978,8 +969,8 @@ + else if ((!getCurrentAction().equals("[none]")) && (action.equals("[none]"))) { + slideTag(getCurrentTag(), 0, false, startTag2g, endTag2g); + } +- actionLabel.setText(action); +- currentTagText.setText(Integer.toString(tag)); ++ jLabel3.setText(action); ++ jTextField1.setText(Integer.toString(tag)); + if (lastTag != tag) { + showStrongs(); + } +@@ -987,16 +978,16 @@ + + + public String getCurrentAction() { +- return actionLabel.getText(); ++ return jLabel3.getText(); + } + + + public int getCurrentTag() { +- return Integer.parseInt(currentTagText.getText()); ++ return Integer.parseInt(jTextField1.getText()); + } + + +- void translatedTextEditor_keyPressed(KeyEvent e) { ++ void jEditorPane1_keyPressed(KeyEvent e) { + handleKeyboard(e); + } + +@@ -1158,7 +1149,7 @@ + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } + }); +- String greek = greekTextEditor.getText(); ++ String greek = jEditorPane2.getText(); + int pos = 0; + for (int i = 0; i < tagKeys.length; i++) { + TagInfo tag = (TagInfo)tags.get(tagKeys[i]); +@@ -1242,21 +1233,21 @@ + + text.append("</BODY></HTML>"); + BufferedReader in = new BufferedReader(new StringReader(text.toString())); +- translatedTextEditor.setText(""); +- HTMLDocument doc = (HTMLDocument)translatedTextEditor.getDocument(); +- translatedTextEditor.getEditorKit().read(in, doc, 0); +- translatedTextEditor.setCaretPosition(0); ++ jEditorPane1.setText(""); ++ HTMLDocument doc = (HTMLDocument)jEditorPane1.getDocument(); ++ jEditorPane1.getEditorKit().read(in, doc, 0); ++ jEditorPane1.setCaretPosition(0); + + StringBuffer agentResult = new StringBuffer(); + if (!localTR) + callServer("action=h&key=" + URLEncoder.encode(key) +"&mod=TR", agentResult); + else callLocalAgent(new String[] {util, "h", "TR", key}, agentResult, true); +- loadTextArea(greekTextEditor, agentResult); ++ loadTextArea(jEditorPane2, agentResult); + + computeTagOffsets(); + + currentKey = key; +- currentVerseText.setText(currentKey); ++ jTextField3.setText(currentKey); + } + catch(Exception e) { + e.printStackTrace(); +@@ -1293,23 +1284,23 @@ + } + } + +- void loadVerseButton_actionPerformed(ActionEvent e) { +- loadVerse(currentVerseText.getText()); ++ void jButton5_actionPerformed(ActionEvent e) { ++ loadVerse(jTextField3.getText()); + } + +- void currentVerseText_keyTyped(KeyEvent e) { ++ void jTextField3_keyTyped(KeyEvent e) { + } + + void this_keyPressed(KeyEvent e) { + if (e.getKeyCode() == e.VK_ENTER) { +- loadVerse(currentVerseText.getText()); ++ loadVerse(jTextField3.getText()); + } + else if (e.getKeyCode() == e.VK_TAB) { + nextTag(); + } + } + +- void guessTagButton_actionPerformed(ActionEvent e) { ++ void jButton2_actionPerformed(ActionEvent e) { + guessTagPositions(); + } + +@@ -1322,7 +1313,7 @@ + moveTag(Integer.parseInt((String)tagKeys[i]), 1, false); + } + for (int i = 0; i < tagKeys.length; i++) { +- String text = translatedTextEditor.getText(); ++ String text = jEditorPane1.getText(); + StringBuffer sb = new StringBuffer(text); + replaceTagsWithHolders(sb); + stripTags(sb); +@@ -1379,7 +1370,7 @@ + } + } + +- void exportRangeButton_actionPerformed(ActionEvent e) { ++ void jButton3_actionPerformed(ActionEvent e) { + exportRange(rangeText.getText(), "export.zip"); + JOptionPane.showMessageDialog(this, "File [export.zip] written."); + } +@@ -1425,9 +1416,9 @@ + setCurrentAction(Integer.parseInt((String)tagKeys[0]), "MoveTag"); + } + +- void greekTextEditor_mouseClicked(MouseEvent e) { ++ void jEditorPane2_mouseClicked(MouseEvent e) { + Point clickPoint = e.getPoint(); +- int position = greekTextEditor.viewToModel(clickPoint); ++ int position = jEditorPane2.viewToModel(clickPoint); + Object [] tagKeys = tags.keySet().toArray(); + java.util.Arrays.sort(tagKeys, new Comparator() { + public int compare(Object o1, Object o2) { return Integer.parseInt((String)o1) - Integer.parseInt((String)o2); } +@@ -1461,10 +1452,10 @@ + + + public String getRawEntry() { +- HTMLDocument doc = (HTMLDocument)translatedTextEditor.getDocument(); ++ HTMLDocument doc = (HTMLDocument)jEditorPane1.getDocument(); + StringWriter writer = new StringWriter(); + try { +- translatedTextEditor.getEditorKit().write(writer, doc, 0, doc.getLength()); ++ jEditorPane1.getEditorKit().write(writer, doc, 0, doc.getLength()); + } + catch(Exception ex) { + ex.printStackTrace(); +@@ -1522,7 +1513,7 @@ + nextTag(); + } + +- void greekTextEditor_keyPressed(KeyEvent e) { ++ void jEditorPane2_keyPressed(KeyEvent e) { + handleKeyboard(e); + } + +@@ -1530,7 +1521,7 @@ + exportRange(rangeText.getText(), "export.zip"); + } + +- void loginButton_actionPerformed(ActionEvent e) { ++ void jButton4_actionPerformed(ActionEvent e) { + login(userIDText.getText()); + } + +@@ -1538,36 +1529,25 @@ + } + + +-class MainFrame_translatedTextEditor_mouseAdapter extends java.awt.event.MouseAdapter { +- MainFrame adaptee; +- +- MainFrame_translatedTextEditor_mouseAdapter(MainFrame adaptee) { +- this.adaptee = adaptee; +- } +- public void mouseClicked(MouseEvent e) { +- adaptee.translatedTextEditor_mouseClicked(e); +- } +-} +- +-class MainFrame_translatedTextEditor_mouseMotionAdapter extends java.awt.event.MouseMotionAdapter { +- MainFrame adaptee; ++class Frame1_jEditorPane1_mouseMotionAdapter extends java.awt.event.MouseMotionAdapter { ++ Frame1 adaptee; + +- MainFrame_translatedTextEditor_mouseMotionAdapter(MainFrame adaptee) { ++ Frame1_jEditorPane1_mouseMotionAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void mouseDragged(MouseEvent e) { +- adaptee.translatedTextEditor_mouseDragged(e); ++ adaptee.jEditorPane1_mouseDragged(e); + } + } + +-class MainFrame_translatedTextEditor_keyAdapter extends java.awt.event.KeyAdapter { +- private MainFrame adaptee; ++class Frame1_jEditorPane1_keyAdapter extends java.awt.event.KeyAdapter { ++ private Frame1 adaptee; + +- MainFrame_translatedTextEditor_keyAdapter(MainFrame adaptee) { ++ Frame1_jEditorPane1_keyAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void keyTyped(KeyEvent e) { +- adaptee.translatedTextEditor_keyTyped(e); ++ adaptee.jEditorPane1_keyTyped(e); + } + } + +@@ -1594,32 +1574,32 @@ + public boolean wholeWord; + } + +-class MainFrame_loadVerseButton_actionAdapter implements java.awt.event.ActionListener { +- private MainFrame adaptee; ++class Frame1_jButton5_actionAdapter implements java.awt.event.ActionListener { ++ private Frame1 adaptee; + +- MainFrame_loadVerseButton_actionAdapter(MainFrame adaptee) { ++ Frame1_jButton5_actionAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { +- adaptee.loadVerseButton_actionPerformed(e); ++ adaptee.jButton5_actionPerformed(e); + } + } + +-class MainFrame_currentVerseText_keyAdapter extends java.awt.event.KeyAdapter { +- private MainFrame adaptee; ++class Frame1_jTextField3_keyAdapter extends java.awt.event.KeyAdapter { ++ private Frame1 adaptee; + +- MainFrame_currentVerseText_keyAdapter(MainFrame adaptee) { ++ Frame1_jTextField3_keyAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void keyTyped(KeyEvent e) { +- adaptee.currentVerseText_keyTyped(e); ++ adaptee.jTextField3_keyTyped(e); + } + } + +-class MainFrame_this_keyAdapter extends java.awt.event.KeyAdapter { +- private MainFrame adaptee; ++class Frame1_this_keyAdapter extends java.awt.event.KeyAdapter { ++ private Frame1 adaptee; + +- MainFrame_this_keyAdapter(MainFrame adaptee) { ++ Frame1_this_keyAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void keyPressed(KeyEvent e) { +@@ -1627,43 +1607,43 @@ + } + } + +-class MainFrame_guessTagButton_actionAdapter implements java.awt.event.ActionListener { +- private MainFrame adaptee; ++class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener { ++ private Frame1 adaptee; + +- MainFrame_guessTagButton_actionAdapter(MainFrame adaptee) { ++ Frame1_jButton2_actionAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { +- adaptee.guessTagButton_actionPerformed(e); ++ adaptee.jButton2_actionPerformed(e); + } + } + +-class MainFrame_signSaveButton_actionAdapter implements java.awt.event.ActionListener { +- private MainFrame adaptee; ++class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener { ++ private Frame1 adaptee; + +- MainFrame_signSaveButton_actionAdapter(MainFrame adaptee) { ++ Frame1_jButton1_actionAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { +- adaptee.signSaveButton_actionPerformed(e); ++ adaptee.jButton1_actionPerformed(e); + } + } + +-class MainFrame_greekTextEditor_mouseAdapter extends java.awt.event.MouseAdapter { +- private MainFrame adaptee; ++class Frame1_jEditorPane2_mouseAdapter extends java.awt.event.MouseAdapter { ++ private Frame1 adaptee; + +- MainFrame_greekTextEditor_mouseAdapter(MainFrame adaptee) { ++ Frame1_jEditorPane2_mouseAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void mouseClicked(MouseEvent e) { +- adaptee.greekTextEditor_mouseClicked(e); ++ adaptee.jEditorPane2_mouseClicked(e); + } + } + +-class MainFrame_contentPane_keyAdapter extends java.awt.event.KeyAdapter { +- private MainFrame adaptee; ++class Frame1_contentPane_keyAdapter extends java.awt.event.KeyAdapter { ++ private Frame1 adaptee; + +- MainFrame_contentPane_keyAdapter(MainFrame adaptee) { ++ Frame1_contentPane_keyAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void keyPressed(KeyEvent e) { +@@ -1671,35 +1651,35 @@ + } + } + +-class MainFrame_greekTextEditor_keyAdapter extends java.awt.event.KeyAdapter { +- private MainFrame adaptee; ++class Frame1_jEditorPane2_keyAdapter extends java.awt.event.KeyAdapter { ++ private Frame1 adaptee; + +- MainFrame_greekTextEditor_keyAdapter(MainFrame adaptee) { ++ Frame1_jEditorPane2_keyAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void keyPressed(KeyEvent e) { +- adaptee.greekTextEditor_keyPressed(e); ++ adaptee.jEditorPane2_keyPressed(e); + } + } + +-class MainFrame_exportRangeButton_actionAdapter implements java.awt.event.ActionListener { +- private MainFrame adaptee; ++class Frame1_jButton3_actionAdapter implements java.awt.event.ActionListener { ++ private Frame1 adaptee; + +- MainFrame_exportRangeButton_actionAdapter(MainFrame adaptee) { ++ Frame1_jButton3_actionAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { +- adaptee.exportRangeButton_actionPerformed(e); ++ adaptee.jButton3_actionPerformed(e); + } + } + +-class MainFrame_loginButton_actionAdapter implements java.awt.event.ActionListener { +- private MainFrame adaptee; ++class Frame1_jButton4_actionAdapter implements java.awt.event.ActionListener { ++ private Frame1 adaptee; + +- MainFrame_loginButton_actionAdapter(MainFrame adaptee) { ++ Frame1_jButton4_actionAdapter(Frame1 adaptee) { + this.adaptee = adaptee; + } + public void actionPerformed(ActionEvent e) { +- adaptee.loginButton_actionPerformed(e); ++ adaptee.jButton4_actionPerformed(e); + } + } diff --git a/paralleltag/target/README b/paralleltag/target/README new file mode 100644 index 0000000..b372cac --- /dev/null +++ b/paralleltag/target/README @@ -0,0 +1,2 @@ +place your nt and nt.vss files here for your module. +The text should have spaces turned to _ for removal of all ambiguity. |