vmote 2003/07/03 10:04:56
Modified: src/java/org/apache/fop/rtf/rtflib/rtfdoc RtfJforCmd.java
RtfLineBreak.java RtfList.java RtfListItem.java
src/java/org/apache/fop/rtf/rtflib/testdocs SimpleLists.java
Log:
style changes only, mostly javadoc comments and refactoring of names
Revision Changes Path
1.7 +20 -21
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfJforCmd.java
Index: RtfJforCmd.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfJforCmd.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RtfJforCmd.java 2 Jul 2003 14:49:39 -0000 1.6
+++ RtfJforCmd.java 3 Jul 2003 17:04:55 -0000 1.7
@@ -63,45 +63,46 @@
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);
@@ -111,7 +112,5 @@
}
-
-
}
1.4 +6 -3
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfLineBreak.java
Index: RtfLineBreak.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfLineBreak.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RtfLineBreak.java 30 Jun 2003 06:10:05 -0000 1.3
+++ RtfLineBreak.java 3 Jul 2003 17:04:55 -0000 1.4
@@ -71,12 +71,15 @@
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;
}
1.5 +65 -30 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfList.java
Index: RtfList.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RtfList.java 2 Jul 2003 16:59:54 -0000 1.4
+++ RtfList.java 3 Jul 2003 17:04:55 -0000 1.5
@@ -61,45 +61,71 @@
import java.io.Writer;
import java.io.IOException;
-/** Model of an RTF list, which can contain RTF list items
- * @author Bertrand Delacretaz [EMAIL PROTECTED]
+/**
+ * Model of an RTF list, which can contain RTF list items
+ * @author Bertrand Delacretaz [EMAIL PROTECTED]
* @author Christopher Scott, [EMAIL PROTECTED]
*/
-
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 @@
//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 @@
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 @@
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 @@
* 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;
}
}
1.6 +21 -13
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListItem.java
Index: RtfListItem.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListItem.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RtfListItem.java 2 Jul 2003 16:59:54 -0000 1.5
+++ RtfListItem.java 3 Jul 2003 17:04:55 -0000 1.6
@@ -68,8 +68,8 @@
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 @@
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 @@
/** 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);
}
1.4 +2 -2
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleLists.java
Index: SimpleLists.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleLists.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SimpleLists.java 30 Jun 2003 17:45:33 -0000 1.3
+++ SimpleLists.java 3 Jul 2003 17:04:56 -0000 1.4
@@ -83,7 +83,7 @@
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);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]