From: William Victor Mote Date: Thu, 3 Jul 2003 17:04:56 +0000 (+0000) Subject: style changes only, mostly javadoc comments and refactoring of names X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1359 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b70380dcfec07b3d05c1b045e40d779a774f71d7;p=xmlgraphics-fop.git style changes only, mostly javadoc comments and refactoring of names git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196564 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfJforCmd.java b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfJforCmd.java index 15346147a..eff8f9c6c 100644 --- a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfJforCmd.java +++ b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfJforCmd.java @@ -63,45 +63,46 @@ import java.io.Writer; import java.util.Iterator; import java.io.IOException; -/* - * RtfJforCmd process "jfor-cmd" - * +/** + * Process "jfor-cmd" */ public class RtfJforCmd extends RtfContainer { - private final String PARA_KEEP_ON = "para-keep:on"; - private final String PARA_KEEP_OFF = "para-keep:off"; + private static final String PARA_KEEP_ON = "para-keep:on"; + private static final String PARA_KEEP_OFF = "para-keep:off"; - private final RtfAttributes m_attrib; - private ParagraphKeeptogetherContext m_paragraphKeeptogetherContext; + private final RtfAttributes attrib; + private ParagraphKeeptogetherContext paragraphKeeptogetherContext; RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException { super((RtfContainer)parent, w); - m_attrib = attrs; - m_paragraphKeeptogetherContext = ParagraphKeeptogetherContext.getInstance(); + attrib = attrs; + paragraphKeeptogetherContext = ParagraphKeeptogetherContext.getInstance(); } - + /** + * + * @return true (alway) + */ public boolean isEmpty() { return true; } - + /** + * Execute all jfor-cmd commands + * TODO: Consider creating one class for each jfor command. + */ public void process() { - - //Execute all jfor-cmd commands - //TODO create one class for each jfor command ? - - for (Iterator it = m_attrib.nameIterator(); it.hasNext();) { + for (Iterator it = attrib.nameIterator(); it.hasNext();) { final String cmd = (String)it.next(); if (cmd.equals(PARA_KEEP_ON)) { - m_paragraphKeeptogetherContext.keepTogetherOpen(); + paragraphKeeptogetherContext.keepTogetherOpen(); } else if (cmd.equals(PARA_KEEP_OFF)) { - m_paragraphKeeptogetherContext.keepTogetherClose(); + paragraphKeeptogetherContext.keepTogetherClose(); } else { // this.getRtfFile ().getLog ().logInfo // ("JFOR-CMD ignored, command not recognised:"+cmd); @@ -112,6 +113,4 @@ public class RtfJforCmd extends RtfContainer { } - - } \ No newline at end of file diff --git a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfLineBreak.java b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfLineBreak.java index 59b709fcb..35c7b697f 100755 --- a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfLineBreak.java +++ b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfLineBreak.java @@ -71,12 +71,15 @@ public class RtfLineBreak extends RtfElement { super((RtfContainer)parent, w); } - /** overridden to write our attributes before our content */ + /** + * Overridden to write our attributes before our content + * @throws IOException for I/O problems + */ protected void writeRtfContent() throws IOException { writeControlWord("line"); } - /** true if this element would generate no "useful" RTF content */ + /** @return true if this element would generate no "useful" RTF content */ public boolean isEmpty() { return false; } diff --git a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfList.java b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfList.java index a24ce0b68..d4ecb0def 100755 --- a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfList.java +++ b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfList.java @@ -61,45 +61,71 @@ package org.apache.fop.rtf.rtflib.rtfdoc; import java.io.Writer; import java.io.IOException; -/** Model of an RTF list, which can contain RTF list items - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch +/** + * Model of an RTF list, which can contain RTF list items + * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch * @author Christopher Scott, scottc@westinghouse.com */ - public class RtfList extends RtfContainer { - private RtfListItem m_item; - private RtfListTable m_listTable; - private final boolean m_hasTableParent; + private RtfListItem item; + private RtfListTable listTable; + private final boolean hasTableParent; /** list numbering style. * Could add more variables, for now we simply differentiate between bullets and numbering */ - private NumberingStyle m_numberingStyle; + private NumberingStyle numberingStyle; + + /** + * Inner static class to handle numbering styles. + */ public static class NumberingStyle { - public boolean isBulletedList = true; + private boolean isBulletedList = true; + + /** + * accessor for isBulletedList + * @return isBulletedList + */ + public boolean getIsBulletedList() { + return isBulletedList; + } + + /** + * set isBulletedList + * @param isBL boolean value to set + */ + public void setIsBulletedList(boolean isBL) { + isBulletedList = isBL; + } } /** Create an RTF list as a child of given container with given attributes */ RtfList(RtfContainer parent, Writer w, RtfAttributes attr) throws IOException { super((RtfContainer)parent, w, attr); - m_numberingStyle = new NumberingStyle(); + numberingStyle = new NumberingStyle(); //create a new list table entry for the list - m_listTable = (getRtfFile()).startListTable(attr); - m_listTable.setParentList(this); + listTable = (getRtfFile()).startListTable(attr); + listTable.setParentList(this); // find out if we are nested in a table - m_hasTableParent = this.getParentOfClass(RtfTable.class) != null; + hasTableParent = this.getParentOfClass(RtfTable.class) != null; } - /** change numbering style */ + /** + * Change numbering style + * @param ns NumberingSytle to set + */ public void setNumberingStyle(NumberingStyle ns) { - m_numberingStyle = ns; + numberingStyle = ns; } - /** overridden to setup the list: start a group with appropriate attributes */ + /** + * Overridden to setup the list: start a group with appropriate attributes + * @throws IOException for I/O problems + */ protected void writeRtfPrefix() throws IOException { // pard causes word97 (and sometimes 2000 too) to crash if the list is nested in a table - if (!m_hasTableParent) { + if (!hasTableParent) { writeControlWord("pard"); } @@ -116,12 +142,12 @@ public class RtfList extends RtfContainer { //Modified by Chris Scott //fixes second line indentation - if (m_numberingStyle.isBulletedList) { + if (numberingStyle.isBulletedList) { // bulleted list writeControlWord("pnlvlblt"); writeControlWord("ilvl0"); writeOneAttribute(RtfListTable.LIST_NUMBER, - (m_listTable.getListNumber()).toString()); + (listTable.getListNumber()).toString()); writeOneAttribute("pnindent", attrib.getValue(RtfListTable.LIST_INDENT)); writeControlWord("pnf1"); @@ -136,7 +162,7 @@ public class RtfList extends RtfContainer { writeControlWord("pnlvlbody"); writeControlWord("ilvl0"); writeOneAttribute(RtfListTable.LIST_NUMBER, - (m_numberingStyle.isBulletedList) ? "2" : "0"); + (numberingStyle.isBulletedList) ? "2" : "0"); writeControlWord("pndec"); writeOneAttribute("pnstart", attrib.getValue(RtfListTable.LIST_START_AT)); @@ -147,10 +173,13 @@ public class RtfList extends RtfContainer { writeGroupMark(false); writeOneAttribute(RtfListTable.LIST_NUMBER, - (m_listTable.getListNumber()).toString()); + (listTable.getListNumber()).toString()); } - /** end the list group */ + /** + * End the list group + * @throws IOException for I/O problems + */ protected void writeRtfSuffix() throws IOException { // close group that encloses the whole list writeGroupMark(false); @@ -159,22 +188,28 @@ public class RtfList extends RtfContainer { * but pard causes word97 (and sometimes 2000 too) to crash if the list * is nested in a table */ - if (!m_hasTableParent) { + if (!hasTableParent) { writeControlWord("pard"); } } - /** close current list item and start a new one */ + /** + * Close current list item and start a new one + * @return new RtfListItem + * @throws IOException for I/O problems + */ public RtfListItem newListItem() throws IOException { - if (m_item != null) { - m_item.close(); + if (item != null) { + item.close(); } - m_item = new RtfListItem(this, writer); - return m_item; + item = new RtfListItem(this, writer); + return item; } - /** true if this is a bulleted list (as opposed to numbered list) */ + /** + * @return true if this is a bulleted list (as opposed to numbered list) + */ public boolean isBulletedList() { - return m_numberingStyle.isBulletedList; + return numberingStyle.isBulletedList; } } \ No newline at end of file diff --git a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListItem.java b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListItem.java index 6682aff3b..fc590879c 100755 --- a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListItem.java +++ b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListItem.java @@ -68,8 +68,8 @@ import java.io.IOException; public class RtfListItem extends RtfContainer implements IRtfParagraphContainer { - private RtfList m_parentList; - private RtfParagraph m_paragraph; + private RtfList parentList; + private RtfParagraph paragraph; /** special RtfParagraph that writes list item setup code before its content */ private class RtfListItemParagraph extends RtfParagraph { @@ -82,7 +82,7 @@ implements IRtfParagraphContainer { protected void writeRtfPrefix() throws IOException { super.writeRtfPrefix(); // for bulleted list, add list item setup group before paragraph contents - if (m_parentList.isBulletedList()) { + if (parentList.isBulletedList()) { writeGroupMark(true); writeControlWord("pntext"); writeControlWord("f" + RtfFontManager.getInstance().getFontNumber("Symbol")); @@ -101,26 +101,34 @@ implements IRtfParagraphContainer { /** Create an RTF list item as a child of given container with default attributes */ RtfListItem(RtfList parent, Writer w) throws IOException { super((RtfContainer)parent, w); - m_parentList = parent; + parentList = parent; } /** Create an RTF list item as a child of given container with given attributes */ RtfListItem(RtfList parent, Writer w, RtfAttributes attr) throws IOException { super((RtfContainer)parent, w, attr); - m_parentList = parent; + parentList = parent; } - /** close current paragraph and start a new one */ - /** close current paragraph if any and start a new one */ + /** + * Close current paragraph if any and start a new one + * @param attrs attributes of new paragraph + * @return new RtfParagraph + * @throws IOException for I/O problems + */ public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException { - if (m_paragraph != null) { - m_paragraph.close(); + if (paragraph != null) { + paragraph.close(); } - m_paragraph = new RtfListItemParagraph(this, attrs); - return m_paragraph; + paragraph = new RtfListItemParagraph(this, attrs); + return paragraph; } - /** close current paragraph if any and start a new one with default attributes */ + /** + * Close current paragraph if any and start a new one with default attributes + * @return new RtfParagraph + * @throws IOException for I/O problems + */ public RtfParagraph newParagraph() throws IOException { return newParagraph(null); } diff --git a/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleLists.java b/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleLists.java index 859645eb3..e1ae51bfe 100755 --- a/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleLists.java +++ b/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleLists.java @@ -83,7 +83,7 @@ class SimpleLists extends TestDocument { sect.newParagraph().newText("Now a numbered list (4 items):"); final RtfList.NumberingStyle nn = new RtfList.NumberingStyle(); - nn.isBulletedList = false; + nn.setIsBulletedList(false); makeList(sect, 3, 4, nn); }