Factored TibetanDocument into two classes, one that is a
DefaultStyledDocument, and another consisting entirely of static utility methods for processing Tibetan text. Moved TibetanDocument.DuffData into its own class. I think this makes things a bit more transparent, and gets us a little closer to making clean use of Swing.
This commit is contained in:
parent
5249c48807
commit
abcf8f19b3
25 changed files with 1490 additions and 1337 deletions
|
@ -25,7 +25,6 @@ import javax.swing.text.JTextComponent;
|
|||
import java.awt.event.*;
|
||||
import java.awt.datatransfer.*;
|
||||
import org.thdl.tib.input.DuffPane;
|
||||
import org.thdl.tib.text.TibetanDocument;
|
||||
|
||||
/** Inputs a Tibetan text and displays the words with
|
||||
their definitions through through a graphical interfase using a
|
||||
|
@ -244,7 +243,7 @@ public class AppletScannerFilter extends JApplet implements ActionListener, Focu
|
|||
{
|
||||
try
|
||||
{
|
||||
((TibetanDocument)t.getDocument()).remove(t.getSelectionStart(), t.getSelectionEnd());
|
||||
t.getDocument().remove(t.getSelectionStart(), t.getSelectionEnd());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.thdl.tib.scanner;
|
|||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
import org.thdl.tib.text.TibetanDocument;
|
||||
import org.thdl.tib.text.TibetanDocument.DuffData;
|
||||
import org.thdl.tib.text.TibTextUtils;
|
||||
import org.thdl.tib.text.DuffData;
|
||||
|
||||
/** Stores the words being displayed in a DictionaryTable.
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class DictionaryTableModel extends AbstractTableModel
|
|||
try
|
||||
{
|
||||
for (i=0; i<array.length; i++)
|
||||
arrayTibetan[i]=TibetanDocument.getTibetanMachineWeb(array[i].getWylie());
|
||||
arrayTibetan[i]=TibTextUtils.getTibetanMachineWeb(array[i].getWylie());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -122,4 +122,4 @@ public class DictionaryTableModel extends AbstractTableModel
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import javax.swing.border.*;
|
|||
import javax.swing.text.*;
|
||||
import org.thdl.tib.input.DuffPane;
|
||||
import org.thdl.tib.text.*;
|
||||
import org.thdl.tib.text.TibetanDocument.DuffData;
|
||||
import org.thdl.tib.text.DuffData;
|
||||
import java.io.Serializable;
|
||||
|
||||
/** Used by DictionaryTable to display a Tibetan word or phrase
|
||||
|
@ -133,7 +133,8 @@ public class DuffCellRenderer extends DuffPane implements TableCellRenderer, Ser
|
|||
catch (Exception e)
|
||||
{
|
||||
System.out.println(e);
|
||||
ThdlDebug.noteIffyCode();
|
||||
}
|
||||
doc.insertDuff(0, (DuffData []) value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import javax.swing.*;
|
|||
import javax.swing.event.*;
|
||||
import javax.swing.table.*;
|
||||
import org.thdl.tib.input.DuffPane;
|
||||
import org.thdl.tib.text.TibetanDocument;
|
||||
|
||||
/** Graphical interfase to be used by applications and applets
|
||||
to input a Tibetan text (in Roman or Tibetan script) and
|
||||
|
@ -142,7 +141,7 @@ public class DuffScannerPanel extends ScannerPanel
|
|||
|
||||
in = "";
|
||||
if (showingTibetan)
|
||||
in = ((TibetanDocument)duffInput.getDocument()).getWylie();
|
||||
in = duffInput.getWylie();
|
||||
else
|
||||
in = txtInput.getText();
|
||||
|
||||
|
@ -192,7 +191,7 @@ public class DuffScannerPanel extends ScannerPanel
|
|||
}
|
||||
if (!enabled && showingTibetan)
|
||||
{
|
||||
txtInput.setText(((TibetanDocument)duffInput.getDocument()).getWylie());
|
||||
txtInput.setText(duffInput.getWylie());
|
||||
table.activateTibetan(false);
|
||||
cl.last(inputPanel);
|
||||
showingTibetan = false;
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.awt.*;
|
|||
import java.awt.datatransfer.*;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import org.thdl.tib.input.DuffPane;
|
||||
import org.thdl.tib.text.TibetanDocument;
|
||||
|
||||
public class WindowScannerFilter implements WindowListener, FocusListener, ActionListener, ItemListener
|
||||
{
|
||||
|
@ -339,7 +338,7 @@ public class WindowScannerFilter implements WindowListener, FocusListener, Actio
|
|||
{
|
||||
try
|
||||
{
|
||||
((TibetanDocument)t.getDocument()).remove(t.getSelectionStart(), t.getSelectionEnd());
|
||||
t.getDocument().remove(t.getSelectionStart(), t.getSelectionEnd());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue