Made some changes to the OnlineTranslationTool. Now when text is redisplayed as links, is shows up with the declension marks.

This commit is contained in:
amontano 2005-02-28 03:04:01 +00:00
parent ff130e6fb1
commit d4dc004c2a
3 changed files with 70 additions and 75 deletions

View file

@ -165,7 +165,8 @@ public class LocalTibetanScanner extends TibetanScanner
if (lastCompSil!=null) if (lastCompSil!=null)
{ {
w = new Word(lastCompWord, lastCompSil.getDefs()); if (lastCompWord.equals(wordActual)) w = new Word(lastCompWord, lastCompSil.getDefs());
else w = new Word(lastCompWord, wordActual, lastCompSil.getDefs());
wordList.addLast(w); wordList.addLast(w);
this.resetAll(); this.resetAll();
@ -202,7 +203,8 @@ public class LocalTibetanScanner extends TibetanScanner
while (lastCompSil!=null) while (lastCompSil!=null)
{ {
w = new Word(lastCompWord, lastCompSil.getDefs()); if (lastCompWord.equals(wordActual)) w = new Word(lastCompWord, lastCompSil.getDefs());
else w = new Word(lastCompWord, wordActual, lastCompSil.getDefs());
wordList.addLast(w); wordList.addLast(w);
this.resetAll(); this.resetAll();

View file

@ -354,9 +354,9 @@ public class OnLineScannerFilter extends HttpServlet
if (words[i] instanceof Word) if (words[i] instanceof Word)
{ {
word = new SwingWord((Word)words[i]); word = new SwingWord((Word)words[i]);
if (word.getDefs().getDictionarySource()!=null) // if (word.getDefs().getDictionarySource()!=null)
pw.print(word.getLink()); pw.print(word.getLink());
else pw.print(word.getWylie() + " "); // else pw.print(word.getWylie() + " ");
} }
else else
{ {
@ -407,33 +407,23 @@ public class OnLineScannerFilter extends HttpServlet
word = new SwingWord(words[j]); word = new SwingWord(words[j]);
defs = word.getDefs(); defs = word.getDefs();
ds = defs.getDictionarySource(); ds = defs.getDictionarySource();
if (ds==null || ds.isEmpty()) continue;
pw.println(" <tr>"); pw.println(" <tr>");
tag = ds.getTag(0); if (ds!=null && !ds.isEmpty()) tag = ds.getTag(0);
// else tag = null; else tag = "&nbsp;";
/*if (tag!=null)
{*/
pw.println(" <td width=\"20%\" rowspan=\""+ defs.def.length +"\" valign=\"top\">"+ word.getBookmark(tibetan) +"</td>"); pw.println(" <td width=\"20%\" rowspan=\""+ defs.def.length +"\" valign=\"top\">"+ word.getBookmark(tibetan) +"</td>");
pw.println(" <td width=\"12%\">"+ tag +"</td>"); pw.println(" <td width=\"12%\">"+ tag +"</td>");
pw.println(" <td width=\"68%\">" + defs.def[0] + "</td>"); pw.println(" <td width=\"68%\">" + defs.def[0] + "</td>");
/*}
else
{
pw.println(" <td width=\"20%\" rowspan=\""+ defs.def.length +"\" valign=\"top\">"+ words[j].getBookmark(tibetan) +"</td>");
pw.println(" <td width=\"80%\" colspan=\"2\">" + defs.def[0] + "</td>");
}*/
pw.println(" </tr>"); pw.println(" </tr>");
for (i=1; i<defs.def.length; i++) for (i=1; i<defs.def.length; i++)
{ {
pw.println(" <tr>"); pw.println(" <tr>");
if (ds!=null) tag = ds.getTag(i); if (ds!=null && !ds.isEmpty()) tag = ds.getTag(i);
else tag = null; else tag = "&nbsp;";
if (tag!=null)
{
pw.println(" <td width=\"12%\">"+ tag +"</td>"); pw.println(" <td width=\"12%\">"+ tag +"</td>");
pw.println(" <td width=\"68%\">" + defs.def[i] + "</td>"); pw.println(" <td width=\"68%\">" + defs.def[i] + "</td>");
} //else pw.println(" <td width=\"80%\" colspan=\"2\">" + defs.def[i] + "</td>");
else pw.println(" <td width=\"80%\" colspan=\"2\">" + defs.def[i] + "</td>");
pw.println(" </tr>"); pw.println(" </tr>");
} }
} }

View file

@ -76,10 +76,13 @@ public class SwingWord extends Word
return getLink(false); return getLink(false);
} }
/** Returns the word marked up as a link.
*
*/
public String getLink(boolean tibetan) public String getLink(boolean tibetan)
{ {
String localWord, result=null; String localWord, result=null;
// String result;
if (wordSinDec==null) localWord = super.token; if (wordSinDec==null) localWord = super.token;
else localWord = wordSinDec; else localWord = wordSinDec;
if (tibetan) if (tibetan)