Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.console.gui.threads.GuiParsingThread Class Reference

List of all members.

Public Member Functions

 GuiParsingThread (JTextPane xmlTextPane)
void run ()
void keyPressed (KeyEvent e)
void keyReleased (KeyEvent e)
void keyTyped (KeyEvent e)
void setOutputPane (JTextPane rightPane)
void caretUpdate (CaretEvent e)

Detailed Description

This class defines a GuiParsingThread

Author:
Nicolas Modrzyk
Version:
1.0

Definition at line 43 of file GuiParsingThread.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.console.gui.threads.GuiParsingThread.GuiParsingThread JTextPane  xmlTextPane  ) 
 

Creates a new GuiParsingThread.java object

Parameters:
xmlTextPane panel that contains the xml to parse

Definition at line 59 of file GuiParsingThread.java.

00060   {
00061     this.xmlTextPane = xmlTextPane;
00062     //xmlTextPane.addCaretListener(this);
00063     /*
00064      * try { this.dtdparser = new DTDParser(this.getClass().getResource(
00065      * "/c-jdbc-controller.dtd")); dtd = dtdparser.parse(); } catch (Exception
00066      * e) { e.printStackTrace(); }
00067      */
00068   }


Member Function Documentation

void org.objectweb.cjdbc.console.gui.threads.GuiParsingThread.caretUpdate CaretEvent  e  ) 
 

See also:
javax.swing.event.CaretListener#caretUpdate(javax.swing.event.CaretEvent)

Definition at line 136 of file GuiParsingThread.java.

00137   {
00138     //    int pos = e.getDot();
00139     //    String string = xmlTextPane.getText();
00140     //    int low = string.indexOf("<", pos);
00141     //    int sup = string.indexOf(">", pos);
00142     //    int end = string.indexOf("/>", pos);
00143     //    int close = string.indexOf("</", pos);
00144     //
00145     //    System.out.println("low:" + low + ":sup:" + sup + ":end:" + end +
00146     //     ":close:"
00147     //        + close);
00148     //
00149     //    String element = null;
00150     //    if (low == -1 && end == -1 && close == -1)
00151     //    {
00152     //      //System.out.println("0");
00153     //      // end of the file last tag
00154     //      if (sup == -1)
00155     //        sup = string.length() - 2;
00156     //      int ind = sup;
00157     //      while (string.charAt(ind) != '/')
00158     //        ind--;
00159     //      element = string.substring(ind + 1, sup);
00160     //    }
00161     //    else if (lt(sup, low) && lt(sup, end) && lt(sup, close))
00162     //    {
00163     //      //System.out.println("1");
00164     //      // we search for an opening tag, like <tag>
00165     //      int ind = sup;
00166     //      while (string.charAt(ind) != '<')
00167     //        ind--;
00168     //      element = string.substring(ind + 1, string.indexOf(' ', ind));
00169     //    }
00170     //    else if (lt(end, sup) && lt(end, low) && lt(end, close))
00171     //    {
00172     //      //System.out.println("2");
00173     //      //we search for a standalone closed tag <tag/>
00174     //      int ind = end;
00175     //      while (string.charAt(ind) != '<')
00176     //        ind--;
00177     //      element = string.substring(ind + 1, string.indexOf(' ', ind));
00178     //    }
00179     //    else if (lt(low, sup) && lt(low, end) && lt(low, close))
00180     //    {
00181     //      //System.out.println("3");
00182     //      //we search for the next starting tag <tag>
00183     //      element = string.substring(low + 1, nextLow(string, low));
00184     //    }
00185     //    else if (lt(close, sup) && lt(close, end) && close == low)
00186     //    {
00187     //      //System.out.println("4");
00188     //      //we search for the name of the closing tag <tag>...</tag>
00189     //      int space = string.indexOf('>', close + 2);
00190     //      element = string.substring(close + 2, space);
00191     //    }
00192     //
00193     //    DTDElement elm = (DTDElement) dtd.elements.get(element);
00194     //    //System.out.println(element);
00195     //    
00196     //    Hashtable attributes = elm.attributes;
00197     //    Enumeration enume = attributes.keys();
00198     //    while (enume.hasMoreElements())
00199     //    {
00200     //      DTDAttribute att = (DTDAttribute) attributes.get(enume.nextElement());
00201     //      ////System.out.println(att.name+":"+att.defaultValue);
00202     //    }
00203 
00204   }

void org.objectweb.cjdbc.console.gui.threads.GuiParsingThread.keyPressed KeyEvent  e  ) 
 

See also:
java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)

Definition at line 100 of file GuiParsingThread.java.

00101   {
00102     synchronized (this)
00103     {
00104       this.notify();
00105     }
00106   }

void org.objectweb.cjdbc.console.gui.threads.GuiParsingThread.keyReleased KeyEvent  e  ) 
 

See also:
java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)

Definition at line 111 of file GuiParsingThread.java.

00112   {
00113   }

void org.objectweb.cjdbc.console.gui.threads.GuiParsingThread.keyTyped KeyEvent  e  ) 
 

See also:
java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)

Definition at line 118 of file GuiParsingThread.java.

00119   {
00120 
00121   }

void org.objectweb.cjdbc.console.gui.threads.GuiParsingThread.run  ) 
 

See also:
java.lang.Runnable#run()

Definition at line 73 of file GuiParsingThread.java.

References org.objectweb.cjdbc.common.xml.XmlValidator.getExceptions().

00074   {
00075     while (true)
00076     {
00077       synchronized (this)
00078       {
00079         try
00080         {
00081           wait();
00082         }
00083         catch (InterruptedException e)
00084         {
00085         }
00086         XmlValidator validator = new XmlValidator("c-jdbc-controller.dtd",
00087             xmlTextPane.getText());
00088         StringBuffer buffer = new StringBuffer();
00089         ArrayList exceptions = validator.getExceptions();
00090         for (int i = 0; i < exceptions.size(); i++)
00091           buffer.append(((Exception) (exceptions.get(i))).getMessage() + "\n");
00092         outputPane.setText(buffer.toString());
00093       }
00094     }
00095   }

void org.objectweb.cjdbc.console.gui.threads.GuiParsingThread.setOutputPane JTextPane  rightPane  ) 
 

Set the output panel for this parsing thread

Parameters:
rightPane the pane to display the output

Definition at line 128 of file GuiParsingThread.java.

00129   {
00130     this.outputPane = rightPane;
00131   }


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:02:38 2005 for C-JDBC by  doxygen 1.3.9.1