[Htmlparser-cvs] htmlparser/src/org/htmlparser/beans BeanyBaby.java,1.24,1.25 FilterBean.java,1.2,1.
Brought to you by:
derrickoswald
From: Derrick O. <der...@us...> - 2005-05-15 11:49:13
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31674/src/org/htmlparser/beans Modified Files: BeanyBaby.java FilterBean.java HTMLLinkBean.java HTMLTextBean.java LinkBean.java StringBean.java Log Message: Documentation revamp part four. Remove some checkstyle warnings. Index: HTMLLinkBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/HTMLLinkBean.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** HTMLLinkBean.java 10 Apr 2005 23:20:42 -0000 1.22 --- HTMLLinkBean.java 15 May 2005 11:49:03 -0000 1.23 *************** *** 42,46 **** * Created on December 24, 2002, 3:49 PM */ ! public class HTMLLinkBean extends JList implements Serializable, PropertyChangeListener { /** --- 42,51 ---- * Created on December 24, 2002, 3:49 PM */ ! public class HTMLLinkBean ! extends ! JList ! implements ! Serializable, ! PropertyChangeListener { /** *************** *** 77,87 **** public Dimension getMinimumSize () { ! FontMetrics metrics; int width; int height; ! metrics = getFontMetrics (getFont ()); ! width = metrics.stringWidth ("http://localhost"); ! height = metrics.getLeading () + metrics.getHeight () + metrics.getDescent (); return (new Dimension (width, height)); --- 82,92 ---- public Dimension getMinimumSize () { ! FontMetrics met; int width; int height; ! met = getFontMetrics (getFont ()); ! width = met.stringWidth ("http://localhost"); ! height = met.getLeading () + met.getHeight () + met.getDescent (); return (new Dimension (width, height)); *************** *** 102,106 **** /** * Remove a PropertyChangeListener from the listener list. ! * This removes a PropertyChangeListener that was registered for all properties. * <p><em>Delegates to the underlying StringBean</em> * @param listener The PropertyChangeListener to be removed. --- 107,111 ---- /** * Remove a PropertyChangeListener from the listener list. ! * This removes a registered PropertyChangeListener. * <p><em>Delegates to the underlying StringBean</em> * @param listener The PropertyChangeListener to be removed. *************** *** 189,196 **** // javax.swing.JFrame frame = new javax.swing.JFrame (); // frame.getContentPane ().setLayout (new BorderLayout ()); ! // frame.getContentPane ().add (new JScrollPane (lb), BorderLayout.CENTER); // frame.addWindowListener (new java.awt.event.WindowListener () { // public void windowOpened (java.awt.event.WindowEvent e) {} ! // public void windowClosing (java.awt.event.WindowEvent e) {System.exit (0);} // public void windowClosed (java.awt.event.WindowEvent e) {} // public void windowDeiconified (java.awt.event.WindowEvent e) {} --- 194,205 ---- // javax.swing.JFrame frame = new javax.swing.JFrame (); // frame.getContentPane ().setLayout (new BorderLayout ()); ! // frame.getContentPane ().add (new JScrollPane (lb), ! // BorderLayout.CENTER); // frame.addWindowListener (new java.awt.event.WindowListener () { // public void windowOpened (java.awt.event.WindowEvent e) {} ! // public void windowClosing (java.awt.event.WindowEvent e) ! // { ! // System.exit (0); ! // } // public void windowClosed (java.awt.event.WindowEvent e) {} // public void windowDeiconified (java.awt.event.WindowEvent e) {} Index: FilterBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/FilterBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FilterBean.java 10 Apr 2005 23:20:42 -0000 1.2 --- FilterBean.java 15 May 2005 11:49:03 -0000 1.3 *************** *** 50,55 **** */ public class FilterBean ! implements ! Serializable { /** --- 50,55 ---- */ public class FilterBean ! implements ! Serializable { /** *************** *** 128,140 **** oldText = ""; mNodes = nodes; ! if (null != mNodes) // TODO: fix this null problem if StringBean finds no nodes newText = getText (); ! else newText = ""; if (null == newText) newText = ""; ! mPropertySupport.firePropertyChange (PROP_NODES_PROPERTY, oldValue, nodes); if (!newText.equals (oldText)) ! mPropertySupport.firePropertyChange (PROP_TEXT_PROPERTY, oldText, newText); } } --- 128,142 ---- oldText = ""; mNodes = nodes; ! if (null != mNodes) // TODO: fix this null problem newText = getText (); ! else // StringBean finds no nodes newText = ""; if (null == newText) newText = ""; ! mPropertySupport.firePropertyChange ( ! PROP_NODES_PROPERTY, oldValue, nodes); if (!newText.equals (oldText)) ! mPropertySupport.firePropertyChange ( ! PROP_TEXT_PROPERTY, oldText, newText); } } *************** *** 145,153 **** * Subsequent filters are applied to the output of the prior filter. * @return A list of nodes passed through all filters. ! * @throws ParserException If an encoding change occurs or there is some other problem. */ protected NodeList applyFilters () ! throws ! ParserException { NodeList ret; --- 147,156 ---- * Subsequent filters are applied to the output of the prior filter. * @return A list of nodes passed through all filters. ! * @throws ParserException If an encoding change occurs ! * or there is some other problem. */ protected NodeList applyFilters () ! throws ! ParserException { NodeList ret; *************** *** 158,162 **** for (int i = 0; i < getFilters ().length; i++) if (0 == i) ! ret = mParser.parse (getFilters ()[0]); else ret = ret.extractAllNodesThatMatch (getFilters ()[i]); --- 161,165 ---- for (int i = 0; i < getFilters ().length; i++) if (0 == i) ! ret = mParser.parse (getFilters ()[0]); else ret = ret.extractAllNodesThatMatch (getFilters ()[i]); *************** *** 214,218 **** /** * Remove a PropertyChangeListener from the listener list. ! * This removes a PropertyChangeListener that was registered for all properties. * @param listener The PropertyChangeListener to be removed. */ --- 217,221 ---- /** * Remove a PropertyChangeListener from the listener list. ! * This removes a registered PropertyChangeListener. * @param listener The PropertyChangeListener to be removed. */ *************** *** 234,238 **** { if (null == mNodes) ! setNodes (); return (mNodes); --- 237,241 ---- { if (null == mNodes) ! setNodes (); return (mNodes); *************** *** 262,266 **** old = getURL (); conn = getConnection (); ! if (((null == old) && (null != url)) || ((null != old) && !old.equals (url))) { try --- 265,270 ---- old = getURL (); conn = getConnection (); ! if (((null == old) && (null != url)) || ((null != old) ! && !old.equals (url))) { try *************** *** 270,275 **** else mParser.setURL (url); ! mPropertySupport.firePropertyChange (PROP_URL_PROPERTY, old, getURL ()); ! mPropertySupport.firePropertyChange (PROP_CONNECTION_PROPERTY, conn, mParser.getConnection ()); setNodes (); } --- 274,281 ---- else mParser.setURL (url); ! mPropertySupport.firePropertyChange ( ! PROP_URL_PROPERTY, old, getURL ()); ! mPropertySupport.firePropertyChange ( ! PROP_CONNECTION_PROPERTY, conn, mParser.getConnection ()); setNodes (); } *************** *** 304,308 **** url = getURL (); conn = getConnection (); ! if (((null == conn) && (null != connection)) || ((null != conn) && !conn.equals (connection))) { try --- 310,315 ---- url = getURL (); conn = getConnection (); ! if (((null == conn) && (null != connection)) || ((null != conn) ! && !conn.equals (connection))) { try *************** *** 312,317 **** else mParser.setConnection (connection); ! mPropertySupport.firePropertyChange (PROP_URL_PROPERTY, url, getURL ()); ! mPropertySupport.firePropertyChange (PROP_CONNECTION_PROPERTY, conn, mParser.getConnection ()); setNodes (); } --- 319,326 ---- else mParser.setConnection (connection); ! mPropertySupport.firePropertyChange ( ! PROP_URL_PROPERTY, url, getURL ()); ! mPropertySupport.firePropertyChange ( ! PROP_CONNECTION_PROPERTY, conn, mParser.getConnection ()); setNodes (); } *************** *** 371,378 **** /** ! * Convenience method to apply a {@link StringBean} to the results of filtering. ! * This may yield duplicate or multiple text elements if the node list contains nodes from ! * two or more levels in the same nested tag heirarchy, but if the node list ! * contains only one tag, it provides access to the text within the node. * @return The textual contents of the nodes that pass through the filter set, * as collected by the StringBean. --- 380,388 ---- /** ! * Convenience method to apply a {@link StringBean} to the filter results. ! * This may yield duplicate or multiple text elements if the node list ! * contains nodes from two or more levels in the same nested tag heirarchy, ! * but if the node list contains only one tag, it provides access to the ! * text within the node. * @return The textual contents of the nodes that pass through the filter set, * as collected by the StringBean. Index: HTMLTextBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/HTMLTextBean.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** HTMLTextBean.java 10 Apr 2005 23:20:42 -0000 1.23 --- HTMLTextBean.java 15 May 2005 11:49:03 -0000 1.24 *************** *** 41,45 **** * Created on December 24, 2002, 3:49 PM */ ! public class HTMLTextBean extends JTextArea implements Serializable, PropertyChangeListener { /** --- 41,50 ---- * Created on December 24, 2002, 3:49 PM */ ! public class HTMLTextBean ! extends ! JTextArea ! implements ! Serializable, ! PropertyChangeListener { /** *************** *** 63,73 **** public Dimension getMinimumSize () { ! FontMetrics metrics; int width; int height; ! metrics = getFontMetrics (getFont ()); ! width = metrics.stringWidth ("Hello World"); ! height = metrics.getLeading () + metrics.getHeight () + metrics.getDescent (); return (new Dimension (width, height)); --- 68,78 ---- public Dimension getMinimumSize () { ! FontMetrics met; int width; int height; ! met = getFontMetrics (getFont ()); ! width = met.stringWidth ("Hello World"); ! height = met.getLeading () + met.getHeight () + met.getDescent (); return (new Dimension (width, height)); *************** *** 88,92 **** /** * Remove a PropertyChangeListener from the listener list. ! * This removes a PropertyChangeListener that was registered for all properties. * <p><em>Delegates to the underlying StringBean</em> * @param listener The PropertyChangeListener to be removed. --- 93,97 ---- /** * Remove a PropertyChangeListener from the listener list. ! * This removes a registered PropertyChangeListener. * <p><em>Delegates to the underlying StringBean</em> * @param listener The PropertyChangeListener to be removed. *************** *** 178,188 **** /** * Set the 'replace non breaking spaces' state. ! * @param replace_space <code>true</code> if non-breaking spaces (character '\u00a0', * numeric character reference &160; or character entity reference ) * are to be replaced with normal spaces (character '\u0020'). */ ! public void setReplaceNonBreakingSpaces (boolean replace_space) { ! getBean ().setReplaceNonBreakingSpaces (replace_space); } --- 183,193 ---- /** * Set the 'replace non breaking spaces' state. ! * @param replace <code>true</code> if non-breaking spaces (character '\u00a0', * numeric character reference &160; or character entity reference ) * are to be replaced with normal spaces (character '\u0020'). */ ! public void setReplaceNonBreakingSpaces (boolean replace) { ! getBean ().setReplaceNonBreakingSpaces (replace); } *************** *** 206,215 **** /** * Set the current 'collapse whitespace' state. ! * @param collapse_whitespace If <code>true</code>, sequences of whitespace * will be reduced to a single space. */ ! public void setCollapse (boolean collapse_whitespace) { ! getBean ().setCollapse (collapse_whitespace); } --- 211,220 ---- /** * Set the current 'collapse whitespace' state. ! * @param collapse If <code>true</code>, sequences of whitespace * will be reduced to a single space. */ ! public void setCollapse (boolean collapse) { ! getBean ().setCollapse (collapse); } *************** *** 259,266 **** // javax.swing.JFrame frame = new javax.swing.JFrame (); // frame.getContentPane ().setLayout (new BorderLayout ()); ! // frame.getContentPane ().add (new JScrollPane (tb), BorderLayout.CENTER); // frame.addWindowListener (new java.awt.event.WindowListener () { // public void windowOpened (java.awt.event.WindowEvent e) {} ! // public void windowClosing (java.awt.event.WindowEvent e) {System.exit (0);} // public void windowClosed (java.awt.event.WindowEvent e) {} // public void windowDeiconified (java.awt.event.WindowEvent e) {} --- 264,275 ---- // javax.swing.JFrame frame = new javax.swing.JFrame (); // frame.getContentPane ().setLayout (new BorderLayout ()); ! // frame.getContentPane ().add (new JScrollPane (tb), ! // BorderLayout.CENTER); // frame.addWindowListener (new java.awt.event.WindowListener () { // public void windowOpened (java.awt.event.WindowEvent e) {} ! // public void windowClosing (java.awt.event.WindowEvent e) ! // { ! // System.exit (0); ! // } // public void windowClosed (java.awt.event.WindowEvent e) {} // public void windowDeiconified (java.awt.event.WindowEvent e) {} Index: LinkBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/LinkBean.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** LinkBean.java 10 Apr 2005 23:20:42 -0000 1.31 --- LinkBean.java 15 May 2005 11:49:03 -0000 1.32 *************** *** 35,39 **** import java.util.Vector; - import org.htmlparser.Node; import org.htmlparser.NodeFilter; import org.htmlparser.Parser; --- 35,38 ---- *************** *** 170,174 **** /** * Remove a PropertyChangeListener from the listener list. ! * This removes a PropertyChangeListener that was registered for all properties. * @param listener The PropertyChangeListener to be removed. */ --- 169,173 ---- /** * Remove a PropertyChangeListener from the listener list. ! * This removes a registered PropertyChangeListener. * @param listener The PropertyChangeListener to be removed. */ *************** *** 200,204 **** oldValue = mLinks; mLinks = urls; ! mPropertySupport.firePropertyChange (PROP_LINKS_PROPERTY, oldValue, mLinks); } } --- 199,204 ---- oldValue = mLinks; mLinks = urls; ! mPropertySupport.firePropertyChange ( ! PROP_LINKS_PROPERTY, oldValue, mLinks); } } *************** *** 219,223 **** { mLinks = extractLinks (); ! mPropertySupport.firePropertyChange (PROP_LINKS_PROPERTY, null, mLinks); } catch (ParserException hpe) --- 219,224 ---- { mLinks = extractLinks (); ! mPropertySupport.firePropertyChange ( ! PROP_LINKS_PROPERTY, null, mLinks); } catch (ParserException hpe) *************** *** 248,257 **** old = getURL (); ! if (((null == old) && (null != url)) || ((null != old) && !old.equals (url))) { try { mParser.setURL (url); ! mPropertySupport.firePropertyChange (PROP_URL_PROPERTY, old, getURL ()); setLinks (); } --- 249,260 ---- old = getURL (); ! if (((null == old) && (null != url)) || ((null != old) ! && !old.equals (url))) { try { mParser.setURL (url); ! mPropertySupport.firePropertyChange ( ! PROP_URL_PROPERTY, old, getURL ()); setLinks (); } *************** *** 296,300 **** { if (0 >= args.length) ! System.out.println ("Usage: java -classpath htmlparser.jar org.htmlparser.beans.LinkBean <http://whatever_url>"); else { --- 299,304 ---- { if (0 >= args.length) ! System.out.println ("Usage: java -classpath htmlparser.jar" ! + " org.htmlparser.beans.LinkBean <http://whatever_url>"); else { Index: StringBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/StringBean.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** StringBean.java 10 Apr 2005 23:20:42 -0000 1.43 --- StringBean.java 15 May 2005 11:49:03 -0000 1.44 *************** *** 90,96 **** /** ! * Property name in event where the 'replace non-breaking spaces' state changes. */ ! public static final String PROP_REPLACE_SPACE_PROPERTY = "replaceNonBreakingSpaces"; /** --- 90,98 ---- /** ! * Property name in event where the 'replace non-breaking spaces' ! * state changes. */ ! public static final String PROP_REPLACE_SPACE_PROPERTY = ! "replaceNonBreakingSpaces"; /** *************** *** 107,116 **** * A newline. */ ! private static final String newline = System.getProperty ("line.separator"); /** ! * The length of the newline. */ ! private static final int newline_size = newline.length (); /** --- 109,118 ---- * A newline. */ ! private static final String NEWLINE = System.getProperty ("line.separator"); /** ! * The length of the NEWLINE. */ ! private static final int NEWLINE_SIZE = NEWLINE.length (); /** *************** *** 141,146 **** /** ! * If <code>true</code> sequences of whitespace characters are replaced with a ! * single space character. */ protected boolean mCollapse; --- 143,148 ---- /** ! * If <code>true</code> sequences of whitespace characters are replaced ! * with a single space character. */ protected boolean mCollapse; *************** *** 201,213 **** * Except if the buffer is empty. */ ! protected void carriage_return () { int length; length = mBuffer.length (); ! if ( (0 != length) // why bother appending newlines to the beginning of a buffer ! && ( (newline_size <= length) // not enough chars to hold a newline ! && (!mBuffer.substring (length - newline_size, length).equals (newline)))) ! mBuffer.append (newline); } --- 203,216 ---- * Except if the buffer is empty. */ ! protected void carriageReturn () { int length; length = mBuffer.length (); ! if ((0 != length) // don't append newlines to the beginning of a buffer ! && ((NEWLINE_SIZE <= length) // not enough chars to hold a NEWLINE ! && (!mBuffer.substring ( ! length - NEWLINE_SIZE, length).equals (NEWLINE)))) ! mBuffer.append (NEWLINE); } *************** *** 243,249 **** { length = buffer.length (); ! state = ( (0 == length) ! || (buffer.charAt (length - 1) == ' ') ! || ((newline_size <= length) && buffer.substring (length - newline_size, length).equals (newline))) ? 0 : 1; for (int i = 0; i < chars; i++) { --- 246,255 ---- { length = buffer.length (); ! state = ((0 == length) ! || (buffer.charAt (length - 1) == ' ') ! || ((NEWLINE_SIZE <= length) ! && buffer.substring ( ! length - NEWLINE_SIZE, length).equals (NEWLINE))) ! ? 0 : 1; for (int i = 0; i < chars; i++) { *************** *** 302,306 **** oldValue = mStrings; mStrings = strings; ! mPropertySupport.firePropertyChange (PROP_STRINGS_PROPERTY, oldValue, strings); } } --- 308,313 ---- oldValue = mStrings; mStrings = strings; ! mPropertySupport.firePropertyChange ( ! PROP_STRINGS_PROPERTY, oldValue, strings); } } *************** *** 394,398 **** /** * Remove a PropertyChangeListener from the listener list. ! * This removes a PropertyChangeListener that was registered for all properties. * @param listener The PropertyChangeListener to be removed. */ --- 401,405 ---- /** * Remove a PropertyChangeListener from the listener list. ! * This removes a registered PropertyChangeListener. * @param listener The PropertyChangeListener to be removed. */ *************** *** 409,413 **** * Return the textual contents of the URL. * This is the primary output of the bean. ! * @return The user visible (what would be seen in a browser) text from the URL. */ public String getStrings () --- 416,420 ---- * Return the textual contents of the URL. * This is the primary output of the bean. ! * @return The user visible (what would be seen in a browser) text. */ public String getStrings () *************** *** 445,449 **** { mLinks = links; ! mPropertySupport.firePropertyChange (PROP_LINKS_PROPERTY, oldValue, links); resetStrings (); } --- 452,457 ---- { mLinks = links; ! mPropertySupport.firePropertyChange ( ! PROP_LINKS_PROPERTY, oldValue, links); resetStrings (); } *************** *** 473,477 **** old = getURL (); conn = getConnection (); ! if (((null == old) && (null != url)) || ((null != old) && !old.equals (url))) { try --- 481,486 ---- old = getURL (); conn = getConnection (); ! if (((null == old) && (null != url)) || ((null != old) ! && !old.equals (url))) { try *************** *** 481,486 **** else mParser.setURL (url); ! mPropertySupport.firePropertyChange (PROP_URL_PROPERTY, old, getURL ()); ! mPropertySupport.firePropertyChange (PROP_CONNECTION_PROPERTY, conn, mParser.getConnection ()); setStrings (); } --- 490,497 ---- else mParser.setURL (url); ! mPropertySupport.firePropertyChange ( ! PROP_URL_PROPERTY, old, getURL ()); ! mPropertySupport.firePropertyChange ( ! PROP_CONNECTION_PROPERTY, conn, mParser.getConnection ()); setStrings (); } *************** *** 495,500 **** * Get the current 'replace non breaking spaces' state. * @return <code>true</code> if non-breaking spaces (character '\u00a0', ! * numeric character reference &#160; or character entity reference &nbsp;) ! * are to be replaced with normal spaces (character '\u0020'). */ public boolean getReplaceNonBreakingSpaces () --- 506,512 ---- * Get the current 'replace non breaking spaces' state. * @return <code>true</code> if non-breaking spaces (character '\u00a0', ! * numeric character reference &#160; or character entity ! * reference &nbsp;) are to be replaced with normal ! * spaces (character '\u0020'). */ public boolean getReplaceNonBreakingSpaces () *************** *** 507,521 **** * If the setting is changed after the URL has been set, the text from the * URL will be reacquired, which is possibly expensive. ! * @param replace_space <code>true</code> if non-breaking spaces (character '\u00a0', ! * numeric character reference &#160; or character entity reference &nbsp;) ! * are to be replaced with normal spaces (character '\u0020'). */ ! public void setReplaceNonBreakingSpaces (boolean replace_space) { boolean oldValue = mReplaceSpace; ! if (oldValue != replace_space) { ! mReplaceSpace = replace_space; ! mPropertySupport.firePropertyChange (PROP_REPLACE_SPACE_PROPERTY, oldValue, replace_space); resetStrings (); } --- 519,535 ---- * If the setting is changed after the URL has been set, the text from the * URL will be reacquired, which is possibly expensive. ! * @param replace <code>true</code> if non-breaking spaces ! * (character '\u00a0', numeric character reference &#160; ! * or character entity reference &nbsp;) are to be replaced with normal ! * spaces (character '\u0020'). */ ! public void setReplaceNonBreakingSpaces (boolean replace) { boolean oldValue = mReplaceSpace; ! if (oldValue != replace) { ! mReplaceSpace = replace; ! mPropertySupport.firePropertyChange (PROP_REPLACE_SPACE_PROPERTY, ! oldValue, replace); resetStrings (); } *************** *** 525,530 **** * Get the current 'collapse whitespace' state. * If set to <code>true</code> this emulates the operation of browsers ! * in interpretting text where <quote>user agents should collapse input white ! * space sequences when producing output inter-word space</quote>. * See HTML specification section 9.1 White space * <a href="http://www.w3.org/TR/html4/struct/text.html#h-9.1"> --- 539,544 ---- * Get the current 'collapse whitespace' state. * If set to <code>true</code> this emulates the operation of browsers ! * in interpretting text where <quote>user agents should collapse input ! * white space sequences when producing output inter-word space</quote>. * See HTML specification section 9.1 White space * <a href="http://www.w3.org/TR/html4/struct/text.html#h-9.1"> *************** *** 532,536 **** * @return <code>true</code> if sequences of whitespace (space '\u0020', * tab '\u0009', form feed '\u000C', zero-width space '\u200B', ! * carriage-return '\r' and newline '\n') are to be replaced with a single * space. */ --- 546,550 ---- * @return <code>true</code> if sequences of whitespace (space '\u0020', * tab '\u0009', form feed '\u000C', zero-width space '\u200B', ! * carriage-return '\r' and NEWLINE '\n') are to be replaced with a single * space. */ *************** *** 544,557 **** * If the setting is changed after the URL has been set, the text from the * URL will be reacquired, which is possibly expensive. ! * @param collapse_whitespace If <code>true</code>, sequences of whitespace * will be reduced to a single space. */ ! public void setCollapse (boolean collapse_whitespace) { boolean oldValue = mCollapse; ! if (oldValue != collapse_whitespace) { ! mCollapse = collapse_whitespace; ! mPropertySupport.firePropertyChange (PROP_COLLAPSE_PROPERTY, oldValue, collapse_whitespace); resetStrings (); } --- 558,572 ---- * If the setting is changed after the URL has been set, the text from the * URL will be reacquired, which is possibly expensive. ! * @param collapse If <code>true</code>, sequences of whitespace * will be reduced to a single space. */ ! public void setCollapse (boolean collapse) { boolean oldValue = mCollapse; ! if (oldValue != collapse) { ! mCollapse = collapse; ! mPropertySupport.firePropertyChange ( ! PROP_COLLAPSE_PROPERTY, oldValue, collapse); resetStrings (); } *************** *** 581,585 **** url = getURL (); conn = getConnection (); ! if (((null == conn) && (null != connection)) || ((null != conn) && !conn.equals (connection))) { try --- 596,601 ---- url = getURL (); conn = getConnection (); ! if (((null == conn) && (null != connection)) ! || ((null != conn) && !conn.equals (connection))) { try *************** *** 589,594 **** else mParser.setConnection (connection); ! mPropertySupport.firePropertyChange (PROP_URL_PROPERTY, url, getURL ()); ! mPropertySupport.firePropertyChange (PROP_CONNECTION_PROPERTY, conn, mParser.getConnection ()); setStrings (); } --- 605,612 ---- else mParser.setConnection (connection); ! mPropertySupport.firePropertyChange ( ! PROP_URL_PROPERTY, url, getURL ()); ! mPropertySupport.firePropertyChange ( ! PROP_CONNECTION_PROPERTY, conn, mParser.getConnection ()); setStrings (); } *************** *** 617,621 **** text = Translate.decode (text); if (getReplaceNonBreakingSpaces ()) ! text = text.replace ('\u00a0',' '); if (getCollapse ()) collapse (mBuffer, text); --- 635,639 ---- text = Translate.decode (text); if (getReplaceNonBreakingSpaces ()) ! text = text.replace ('\u00a0', ' '); if (getCollapse ()) collapse (mBuffer, text); *************** *** 629,633 **** /** ! * Appends a newline to the output if the tag breaks flow, and * possibly sets the state of the PRE and SCRIPT flags. * @param tag The tag to examine. --- 647,651 ---- /** ! * Appends a NEWLINE to the output if the tag breaks flow, and * possibly sets the state of the PRE and SCRIPT flags. * @param tag The tag to examine. *************** *** 652,656 **** mIsStyle = true; if (tag.breaksFlow ()) ! carriage_return (); } --- 670,674 ---- mIsStyle = true; if (tag.breaksFlow ()) ! carriageReturn (); } *************** *** 679,683 **** { if (0 >= args.length) ! System.out.println ("Usage: java -classpath htmlparser.jar org.htmlparser.beans.StringBean <http://whatever_url>"); else { --- 697,702 ---- { if (0 >= args.length) ! System.out.println ("Usage: java -classpath htmlparser.jar" ! + " org.htmlparser.beans.StringBean <http://whatever_url>"); else { Index: BeanyBaby.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/BeanyBaby.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** BeanyBaby.java 10 Apr 2005 23:20:42 -0000 1.24 --- BeanyBaby.java 15 May 2005 11:49:03 -0000 1.25 *************** *** 37,40 **** --- 37,41 ---- import java.awt.event.WindowEvent; import java.beans.PropertyChangeListener; + import java.util.Vector; import javax.swing.JCheckBoxMenuItem; *************** *** 57,66 **** * Bread crumb trail of visited URLs. */ ! java.util.Vector mTrail; /** * Current position on the bread crumb trail. */ ! int mCrumb; /** Creates new form BeanyBaby */ --- 58,67 ---- * Bread crumb trail of visited URLs. */ ! protected Vector mTrail; /** * Current position on the bread crumb trail. */ ! protected int mCrumb; /** Creates new form BeanyBaby */ *************** *** 68,77 **** { initComponents (); ! mTrail = new java.util.Vector (25); mCrumb = -1; // shenanigans to get the splitter bar at the midpoint setVisible (true); ! mSplitPane.setDividerLocation(0.5); setVisible (false); --- 69,78 ---- { initComponents (); ! mTrail = new Vector (); mCrumb = -1; // shenanigans to get the splitter bar at the midpoint setVisible (true); ! mSplitPane.setDividerLocation (0.5); // 50% for each pane setVisible (false); *************** *** 118,126 **** name = event.getPropertyName (); if (name.equals (StringBean.PROP_LINKS_PROPERTY)) ! mLinks.setSelected (((Boolean)event.getNewValue ()).booleanValue ()); else if (name.equals (StringBean.PROP_COLLAPSE_PROPERTY)) ! mCollapse.setSelected (((Boolean)event.getNewValue ()).booleanValue ()); else if (name.equals (StringBean.PROP_REPLACE_SPACE_PROPERTY)) ! mNobreak.setSelected (((Boolean)event.getNewValue ()).booleanValue ()); } } --- 119,130 ---- name = event.getPropertyName (); if (name.equals (StringBean.PROP_LINKS_PROPERTY)) ! mLinks.setSelected ( ! ((Boolean)event.getNewValue ()).booleanValue ()); else if (name.equals (StringBean.PROP_COLLAPSE_PROPERTY)) ! mCollapse.setSelected ( ! ((Boolean)event.getNewValue ()).booleanValue ()); else if (name.equals (StringBean.PROP_REPLACE_SPACE_PROPERTY)) ! mNobreak.setSelected ( ! ((Boolean)event.getNewValue ()).booleanValue ()); } } *************** *** 192,197 **** // MouseListener interface // /** ! * Invoked when the mouse button has been clicked (pressed and released) on a component. * @param event Details on the mouse event. */ --- 196,203 ---- // MouseListener interface // + /** ! * Invoked when the mouse button has been clicked on a component. ! * A mouse click is a press and release of a mouse button. * @param event Details on the mouse event. */ *************** *** 244,248 **** // API control // ! /** * Set the URL for the bean. --- 250,254 ---- // API control // ! /** * Set the URL for the bean. *************** *** 372,377 **** }//GEN-END:initComponents ! /** Exit the Application */ ! private void exitForm (WindowEvent evt) {//GEN-FIRST:event_exitForm System.exit (0); --- 378,384 ---- }//GEN-END:initComponents ! /** Exit the Application ! * @param event Details about the window event. */ ! private void exitForm (WindowEvent event) {//GEN-FIRST:event_exitForm System.exit (0); |