vmote       2003/07/03 00:29:41

  Modified:    src/java/org/apache/fop/rtf/rtflib/rtfdoc
                        RtfExtraRowSet.java RtfFile.java RtfHeader.java
                        RtfHyperLink.java
  Log:
  style changes only, mostly javadoc comments and refactoring of names
  
  Revision  Changes    Path
  1.7       +26 -16    
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfExtraRowSet.java
  
  Index: RtfExtraRowSet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfExtraRowSet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RtfExtraRowSet.java       2 Jul 2003 16:59:54 -0000       1.6
  +++ RtfExtraRowSet.java       3 Jul 2003 07:29:41 -0000       1.7
  @@ -82,7 +82,7 @@
   
   public class RtfExtraRowSet extends RtfContainer {
       // TODO what is idnum?
  -    final int DEFAULT_IDNUM = 0;
  +    static final int DEFAULT_IDNUM = 0;
   
       /** Parent table context
        * (added by Boris Poudérous on july 2002 in order to process nested tables)
  @@ -93,12 +93,12 @@
        *  RtfTableCells that must be rendered in extra rows.
        *  This holds a cell with positioning information
        */
  -    private final List m_cells = new LinkedList();
  +    private final List cells = new LinkedList();
       private static class PositionedCell
       implements Comparable {
  -        final RtfTableCell cell;
  -        final int xOffset;
  -        final int rowIndex;
  +        private final RtfTableCell cell;
  +        private final int xOffset;
  +        private final int rowIndex;
   
           PositionedCell(RtfTableCell c, int index, int offset) {
               cell = c;
  @@ -140,7 +140,7 @@
       }
   
       /** our maximum row index */
  -    private int m_maxRowIndex;
  +    private int maxRowIndex;
   
       /** an RtfExtraRowSet has no parent, it is only used temporary during
        *  generation of RTF for an RtfTableRow
  @@ -162,7 +162,7 @@
               if (e instanceof RtfTableRow) {
                   addRow((RtfTableRow)e, rowIndex, xOffset);
                   rowIndex++;
  -                m_maxRowIndex = Math.max(rowIndex, m_maxRowIndex);
  +                maxRowIndex = Math.max(rowIndex, maxRowIndex);
               }
           }
           return rowIndex;
  @@ -174,7 +174,7 @@
               final RtfElement e = (RtfElement)it.next();
               if (e instanceof RtfTableCell) {
                   final RtfTableCell c = (RtfTableCell)e;
  -                m_cells.add(new PositionedCell(c, rowIndex, xOffset));
  +                cells.add(new PositionedCell(c, rowIndex, xOffset));
                   xOffset += c.getCellWidth();
               }
           }
  @@ -189,19 +189,23 @@
       throws IOException {
           final RtfTableCell c = new RtfTableCell(null, writer, cellWidth,
                   parentCellAttributes, DEFAULT_IDNUM);
  -        m_cells.add(new PositionedCell(c, rowIndex, xOffset));
  +        cells.add(new PositionedCell(c, rowIndex, xOffset));
           return c;
       }
   
  -    /** render extra RtfTableRows containing all the extra RtfTableCells that we 
contain */
  +    /**
  +     * render extra RtfTableRows containing all the extra RtfTableCells that we
  +     * contain
  +     * @throws IOException for I/O problems
  +     */
       protected void writeRtfContent() throws IOException {
           // sort cells by rowIndex and xOffset
  -        Collections.sort(m_cells);
  +        Collections.sort(cells);
   
           // process all extra cells by rendering them into extra rows
           List rowCells = null;
           int rowIndex = -1;
  -        for (Iterator it = m_cells.iterator(); it.hasNext();) {
  +        for (Iterator it = cells.iterator(); it.hasNext();) {
               final PositionedCell pc = (PositionedCell)it.next();
               if (pc.rowIndex != rowIndex) {
                   // starting a new row, render previous one
  @@ -309,9 +313,11 @@
           return empty;
       }
   
  -    /** As this contains cells from several rows, we say that it's empty
  -     *  only if we have no cells.
  -     *  writeRow makes the decision about rendering specific rows
  +    /**
  +     * As this contains cells from several rows, we say that it's empty
  +     * only if we have no cells.
  +     * writeRow makes the decision about rendering specific rows
  +     * @return false (always)
        */
       public boolean isEmpty() {
           return false;
  @@ -325,6 +331,10 @@
          return this.parentITableColumnsInfo;
        }
   
  +     /**
  +      *
  +      * @param parentITableColumnsInfo table context to set
  +      */
        public void setParentITableColumnsInfo (ITableColumnsInfo 
parentITableColumnsInfo) {
          this.parentITableColumnsInfo = parentITableColumnsInfo;
        }
  
  
  
  1.8       +89 -44    xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfFile.java
  
  Index: RtfFile.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfFile.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RtfFile.java      2 Jul 2003 16:59:54 -0000       1.7
  +++ RtfFile.java      3 Jul 2003 07:29:41 -0000       1.8
  @@ -76,15 +76,19 @@
   
   public class RtfFile
   extends RtfContainer {
  -    private RtfHeader m_header;
  -    private RtfPageArea m_pageArea;
  -    private RtfListTable m_listTable;
  -    private RtfDocumentArea m_docArea;
  +    private RtfHeader header;
  +    private RtfPageArea pageArea;
  +    private RtfListTable listTable;
  +    private RtfDocumentArea docArea;
   //    private ConverterLogChannel m_log;
  -    private RtfContainer m_listTableContainer;
  +    private RtfContainer listTableContainer;
       private int listNum = 0;
   
  -    /** Create an RTF file that outputs to the given Writer */
  +    /**
  +     * Create an RTF file that outputs to the given Writer
  +     * @param w the Writer to write to
  +     * @throws IOException for I/O problems
  +     */
       public RtfFile(Writer w) throws IOException {
           super(null, w);
       }
  @@ -106,101 +110,142 @@
   //        return m_log;
   //    }
   
  -    /** If called, must be called before startDocumentArea */
  +    /**
  +     * If called, must be called before startDocumentArea
  +     * @return the new RtfHeader
  +     * @throws IOException for I/O problems
  +     */
       public RtfHeader startHeader()
       throws IOException {
  -        if (m_header != null) {
  +        if (header != null) {
               throw new RtfStructureException("startHeader called more than once");
           }
  -        m_header = new RtfHeader(this, writer);
  -        m_listTableContainer = new RtfContainer(this, writer);
  -        return m_header;
  +        header = new RtfHeader(this, writer);
  +        listTableContainer = new RtfContainer(this, writer);
  +        return header;
       }
   
  -    /** Creates the list table.*/
  +    /**
  +     * Creates the list table.
  +     * @param attr attributes for the RtfListTable
  +     * @return the new RtfListTable
  +     * @throws IOException for I/O problems
  +     */
       public RtfListTable startListTable(RtfAttributes attr)
       throws IOException {
           listNum++;
  -        m_listTable = new RtfListTable(this, writer, new Integer(listNum), attr);
  -        m_listTableContainer.addChild(m_listTable);
  -        return m_listTable;
  +        listTable = new RtfListTable(this, writer, new Integer(listNum), attr);
  +        listTableContainer.addChild(listTable);
  +        return listTable;
       }
   
  -    /** Closes the RtfHeader if not done yet, and starts the docment area.
  -        Like startDocumentArea, is only called once. This is not optimal,
  -        must be able to have multiple page definition, and corresponding
  -        Document areas */
  +    /**
  +     * Closes the RtfHeader if not done yet, and starts the docment area.
  +     * Like startDocumentArea, is only called once. This is not optimal,
  +     * must be able to have multiple page definition, and corresponding
  +     * Document areas
  +     * @return the RtfPageArea
  +     * @throws IOException for I/O problems
  +     * @throws RtfStructureException for illegal RTF structure
  +     */
       public RtfPageArea startPageArea()
       throws IOException, RtfStructureException {
  -        if (m_pageArea != null) {
  +        if (pageArea != null) {
               throw new RtfStructureException("startPageArea called more than once");
           }
           // create an empty header if there was none
  -        if (m_header == null) {
  +        if (header == null) {
               startHeader();
           }
  -        m_header.close();
  -        m_pageArea = new RtfPageArea(this, writer);
  -        addChild(m_pageArea);
  -        return m_pageArea;
  +        header.close();
  +        pageArea = new RtfPageArea(this, writer);
  +        addChild(pageArea);
  +        return pageArea;
       }
   
  -    /** Call startPageArea if needed and return the page area object. */
  +    /**
  +     * Call startPageArea if needed and return the page area object.
  +     * @return the RtfPageArea
  +     * @throws IOException for I/O problems
  +     * @throws RtfStructureException for illegal RTF structure
  +     */
       public RtfPageArea getPageArea()
       throws IOException, RtfStructureException {
  -        if (m_pageArea == null) {
  +        if (pageArea == null) {
               return startPageArea();
           }
  -        return m_pageArea;
  +        return pageArea;
       }
   
  -    /** Closes the RtfHeader if not done yet, and starts the document area.
  -     *  Must be called once only.
  +    /**
  +     * Closes the RtfHeader if not done yet, and starts the document area.
  +     * Must be called once only.
  +     * @return the RtfDocumentArea
  +     * @throws IOException for I/O problems
  +     * @throws RtfStructureException for illegal RTF structure
        */
       public RtfDocumentArea startDocumentArea()
       throws IOException, RtfStructureException {
  -        if (m_docArea != null) {
  +        if (docArea != null) {
               throw new RtfStructureException("startDocumentArea called more than 
once");
           }
           // create an empty header if there was none
  -        if (m_header == null) {
  +        if (header == null) {
               startHeader();
           }
  -        m_header.close();
  -        m_docArea = new RtfDocumentArea(this, writer);
  -        addChild(m_docArea);
  -        return m_docArea;
  +        header.close();
  +        docArea = new RtfDocumentArea(this, writer);
  +        addChild(docArea);
  +        return docArea;
       }
   
   
   
  -    /** Call startDocumentArea if needed and return the document area object. */
  +    /**
  +     * Call startDocumentArea if needed and return the document area object.
  +     * @return the RtfDocumentArea
  +     * @throws IOException for I/O problems
  +     * @throws RtfStructureException for illegal RTF structure
  +     */
       public RtfDocumentArea getDocumentArea()
       throws IOException, RtfStructureException {
  -        if (m_docArea == null) {
  +        if (docArea == null) {
               return startDocumentArea();
           }
  -        return m_docArea;
  +        return docArea;
       }
   
  -    /** overridden to write RTF prefix code, what comes before our children */
  +    /**
  +     * overridden to write RTF prefix code, what comes before our children
  +     * @throws IOException for I/O problems
  +     */
       protected void writeRtfPrefix() throws IOException {
           writeGroupMark(true);
           writeControlWord("rtf1");
       }
   
  -    /** overridden to write RTF suffix code, what comes after our children */
  +    /**
  +     * overridden to write RTF suffix code, what comes after our children
  +     * @throws IOException for I/O problems
  +     */
       protected void writeRtfSuffix() throws IOException {
           writeGroupMark(false);
       }
   
  -    /** must be called when done creating the document */
  +    /**
  +     * must be called when done creating the document
  +     * @throws IOException for I/O problems
  +     */
       public synchronized void flush() throws IOException {
           writeRtf();
           writer.flush();
       }
   
  -    /** minimal test and usage example */
  +    /**
  +     * minimal test and usage example
  +     * @param args command-line arguments
  +     * @throws Exception for problems
  +     */
       public static void main(String args[])
       throws Exception {
           Writer w = null;
  
  
  
  1.8       +6 -6      xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfHeader.java
  
  Index: RtfHeader.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfHeader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RtfHeader.java    2 Jul 2003 16:59:54 -0000       1.7
  +++ RtfHeader.java    3 Jul 2003 07:29:41 -0000       1.8
  @@ -72,8 +72,8 @@
    */
   
   class RtfHeader extends RtfContainer {
  -    private final String m_charset = "ansi";
  -    private final Map m_userProperties = new HashMap();
  +    private final String charset = "ansi";
  +    private final Map userProperties = new HashMap();
   
       /** Create an RTF header */
       RtfHeader(RtfFile f, Writer w) throws IOException {
  @@ -84,7 +84,7 @@
   
       /** Overridden to write our own data before our children's data */
       protected void writeRtfContent() throws IOException {
  -        writeControlWord(m_charset);
  +        writeControlWord(charset);
           writeUserProperties();
           RtfColorTable.getInstance().writeColors(this);
           super.writeRtfContent();
  @@ -95,10 +95,10 @@
   
       /** write user properties if any */
       private void writeUserProperties() throws IOException {
  -        if (m_userProperties.size() > 0) {
  +        if (userProperties.size() > 0) {
               writeGroupMark(true);
               writeStarControlWord("userprops");
  -            for (Iterator it = m_userProperties.entrySet().iterator(); 
it.hasNext();) {
  +            for (Iterator it = userProperties.entrySet().iterator(); it.hasNext();) 
{
                   final Map.Entry entry = (Map.Entry)it.next();
                   writeGroupMark(true);
                   writeControlWord("propname");
  
  
  
  1.7       +28 -9     
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfHyperLink.java
  
  Index: RtfHyperLink.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfHyperLink.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RtfHyperLink.java 2 Jul 2003 16:59:54 -0000       1.6
  +++ RtfHyperLink.java 3 Jul 2003 07:29:41 -0000       1.7
  @@ -88,9 +88,11 @@
       /**
        * Default constructor.
        *
  -     * @param container a <code>RtfContainer</code> value
  +     * @param parent a <code>RtfContainer</code> value
        * @param writer a <code>Writer</code> value
  -     * @param attributes a <code>RtfAttributes</code> value
  +     * @param str text of the link
  +     * @param attr a <code>RtfAttributes</code> value
  +     * @throws IOException for I/O problems
        */
       public RtfHyperLink (IRtfTextContainer parent, Writer writer, String str, 
RtfAttributes attr)
           throws IOException {
  @@ -146,15 +148,22 @@
       // @@ IRtfContainer implementation
       //////////////////////////////////////////////////
   
  -    /** close current text run if any and start a new one with default attributes
  -     *  @param str if not null, added to the RtfText created
  +    /**
  +     * close current text run if any and start a new one with default attributes
  +     * @param str if not null, added to the RtfText created
  +     * @throws IOException for I/O problems
  +     * @return new RtfText object
        */
       public RtfText newText (String str) throws IOException {
           return newText (str, null);
       }
   
  -    /** close current text run if any and start a new one
  -     *  @param str if not null, added to the RtfText created
  +    /**
  +     * close current text run if any and start a new one
  +     * @param str if not null, added to the RtfText created
  +     * @param attr attributes of text to add
  +     * @throws IOException for I/O problems
  +     * @return the new RtfText object
        */
       public RtfText newText (String str, RtfAttributes attr) throws IOException {
           closeAll ();
  @@ -162,7 +171,10 @@
           return mText;
       }
   
  -    /** IRtfTextContainer requirement: return a copy of our attributes */
  +    /**
  +     * IRtfTextContainer requirement:
  +     * @return a copy of our attributes
  +     */
       public RtfAttributes getTextContainerAttributes() {
           if (attrib == null) {
               return null;
  @@ -171,7 +183,10 @@
       }
   
   
  -    /** add a line break */
  +    /**
  +     * add a line break
  +     * @throws IOException for I/O problems
  +     */
       public void newLineBreak () throws IOException {
           new RtfLineBreak (this, writer);
       }
  @@ -218,6 +233,10 @@
           this.url = this.url.replace (' ', RtfBookmark.REPLACE_CHARACTER);
       }
   
  +    /**
  +     *
  +     * @return false (always)
  +     */
       public boolean isEmpty () {
           return false;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to