CVS: jfor/src/org/jfor/jfor/converter TableContext.java,1.9,1.10

Phil Chu <[email protected]> Sat, 25 Oct 2003 16:23:09 -0700
Newsgroups gmane.text.xml.jfor.cvs
Message-ID <[email protected]>
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/converter
In directory sc8-pr-cvs1:/tmp/cvs-serv12634

Modified Files:
	TableContext.java 
Log Message:
replace regex usage with exact string match - removes requirement of jdk/jre 1.4

Index: TableContext.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/TableContext.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** TableContext.java	24 Oct 2003 04:42:29 -0000	1.9
--- TableContext.java	25 Oct 2003 23:23:06 -0000	1.10
***************
*** 2,6 ****
  
  import java.util.*;
- import java.util.regex.*;
  import org.jfor.jfor.rtflib.rtfdoc.RtfAttributes;
  import org.xml.sax.Attributes;
--- 2,5 ----
***************
*** 64,67 ****
--- 63,69 ----
  // $Id$
  // $Log$
+ // Revision 1.10  2003/10/25 23:23:06  philipchu
+ // replace regex usage with exact string match - removes requirement of jdk/jre 1.4
+ //
  // Revision 1.9  2003/10/24 04:42:29  philipchu
  // Support for proportional-column-width. Requires JRE/JDK 1.4 for regex.
***************
*** 121,127 ****
      private final ArrayList m_colRowSpanningAttrs = new ArrayList();  //Added by Peter Herweg on 2002-06-29
     
-     // Phil Chu - check for proportional-column-width in table columns
-     private Matcher m_matcher = Pattern.compile("proportional-column-width\\(([0-9]+)\\)").matcher("");
- 
      TableContext(BuilderContext ctx)
      {
--- 123,126 ----
***************
*** 132,139 ****
      throws ValueConversionException
      {
! 	// Phil Chu - distinguish proportional-column-width by using Integer instead of Float
! 	m_matcher.reset(strWidth);
! 	if (m_matcher.find()) {
! 	    m_colWidths.add(new Integer(m_matcher.group(1)));
  	} else {
  	    m_colWidths.add(new Float(FoUnitsConverter.getInstance().convertToTwips(strWidth)));
--- 131,140 ----
      throws ValueConversionException
      {
! 	// if column-width is a proportional-column-width,
! 	// distinguish using an Integer instead of a Float
! 	if (strWidth.startsWith("proportional-column-width")) {
! 	    int begin = strWidth.indexOf("(")+1;
! 	    int end = strWidth.indexOf(")",begin);
! 	    m_colWidths.add(new Integer(strWidth.substring(begin,end)));
  	} else {
  	    m_colWidths.add(new Float(FoUnitsConverter.getInstance().convertToTwips(strWidth)));



-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/