vmote 2003/07/02 09:13:30
Modified: src/java/org/apache/fop/rtf/rtflib/rtfdoc RtfAttributes.java
RtfBefore.java RtfBookmark.java
RtfBookmarkContainerImpl.java RtfColorTable.java
RtfContainer.java
Log:
style changes only, mostly javadoc comments and refactoring of names
Revision Changes Path
1.4 +71 -37
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfAttributes.java
Index: RtfAttributes.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfAttributes.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RtfAttributes.java 30 Jun 2003 06:10:05 -0000 1.3
+++ RtfAttributes.java 2 Jul 2003 16:13:29 -0000 1.4
@@ -70,10 +70,13 @@
public class RtfAttributes
implements java.lang.Cloneable {
- private HashMap m_values = new HashMap();
+ private HashMap values = new HashMap();
- /** set attributes from a other attributes object.
- * @return this object, for chaining calls
+ /**
+ * Set attributes from another attributes object
+ * @param attrs RtfAttributes object whose elements will be copied into this
+ * instance
+ * @return this object, for chaining calls
*/
public RtfAttributes set (RtfAttributes attrs) {
if (attrs != null) {
@@ -106,100 +109,131 @@
return this;
}
- /** set an attribute that has no value.
- * @return this object, for chaining calls
+ /**
+ * set an attribute that has no value.
+ * @param name name of attribute to set
+ * @return this object, for chaining calls
*/
public RtfAttributes set(String name) {
- m_values.put(name, null);
+ values.put(name, null);
return this;
}
- /** unset an attribute that has no value
- * @return this object, for chaining calls
+ /**
+ * unset an attribute that has no value
+ * @param name name of attribute to unset
+ * @return this object, for chaining calls
*/
public RtfAttributes unset(String name) {
- m_values.remove(name);
+ values.remove(name);
return this;
}
- /** debugging log */
+ /**
+ * debugging log
+ * @return String representation of object
+ */
public String toString() {
- return m_values.toString() + "(" + super.toString() + ")";
+ return values.toString() + "(" + super.toString() + ")";
}
- /** implement cloning */
+ /**
+ * implement cloning
+ * @return cloned Object
+ */
public Object clone() {
final RtfAttributes result = new RtfAttributes();
- result.m_values = (HashMap)m_values.clone();
+ result.values = (HashMap)values.clone();
// Added by Normand Masse
// indicate the XSL attributes used to build the Rtf attributes
- if (m_xsl_attributes != null) {
- result.m_xsl_attributes = new
org.xml.sax.helpers.AttributesImpl(m_xsl_attributes);
+ if (xslAttributes != null) {
+ result.xslAttributes = new
org.xml.sax.helpers.AttributesImpl(xslAttributes);
}
return result;
}
- /** set an attribute that has an integer value
- * @return this object, for chaining calls
+ /**
+ * Set an attribute that has an integer value
+ * @param name name of attribute
+ * @param value value of attribute
+ * @return this (which now contains the new entry), for chaining calls
*/
public RtfAttributes set(String name, int value) {
- m_values.put(name, new Integer(value));
+ values.put(name, new Integer(value));
return this;
}
+ /**
+ * Set an attribute that has a String value
+ * @param name name of attribute
+ * @param type value of attribute
+ * @return this (which now contains the new entry)
+ */
public RtfAttributes set(String name, String type) {
- m_values.put(name, type);
+ values.put(name, type);
return this;
}
- /** get the value of an attribute, null if not found */
+ /**
+ * @param name String containing attribute name
+ * @return the value of an attribute, null if not found
+ */
public Object getValue(String name) {
- return m_values.get(name);
+ return values.get(name);
}
- /** true if given attribute is set */
+ /**
+ * @param name String containing attribute name
+ * @return true if given attribute is set
+ */
public boolean isSet(String name) {
- return m_values.containsKey(name);
+ return values.containsKey(name);
}
- /** return an Iterator on all names that are set */
+ /** @return an Iterator on all names that are set */
public Iterator nameIterator() {
- return m_values.keySet().iterator();
+ return values.keySet().iterator();
}
- private Attributes m_xsl_attributes = null;
+ private Attributes xslAttributes = null;
- // Added by Normand Masse
- // Used for attribute inheritance
+ /**
+ * Added by Normand Masse
+ * Used for attribute inheritance
+ * @return Attributes
+ */
public Attributes getXslAttributes() {
- return m_xsl_attributes;
+ return xslAttributes;
}
- // Added by Normand Masse
- // Used for attribute inheritance
+ /**
+ * Added by Normand Masse
+ * Used for attribute inheritance
+ * @param pAttribs attributes
+ */
public void setXslAttributes(Attributes pAttribs) {
if (pAttribs == null) {
return;
}
// copy/replace the xsl attributes into the current attributes
- if (m_xsl_attributes != null) {
+ if (xslAttributes != null) {
for (int i = 0; i < pAttribs.getLength(); i++) {
String wKey = pAttribs.getQName(i);
- int wPos = m_xsl_attributes.getIndex(wKey);
+ int wPos = xslAttributes.getIndex(wKey);
if (wPos == -1) {
-
((AttributesImpl)m_xsl_attributes).addAttribute(pAttribs.getURI(i),
+ ((AttributesImpl)xslAttributes).addAttribute(pAttribs.getURI(i),
pAttribs.getLocalName(i), pAttribs.getQName(i),
pAttribs.getType(i), pAttribs.getValue(i));
} else {
- ((AttributesImpl)m_xsl_attributes).setAttribute(wPos,
pAttribs.getURI(i),
+ ((AttributesImpl)xslAttributes).setAttribute(wPos,
pAttribs.getURI(i),
pAttribs.getLocalName(i), pAttribs.getQName(i),
pAttribs.getType(i), pAttribs.getValue(i));
}
}
} else {
- m_xsl_attributes = new org.xml.sax.helpers.AttributesImpl(pAttribs);
+ xslAttributes = new org.xml.sax.helpers.AttributesImpl(pAttribs);
}
}
}
1.5 +5 -1 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBefore.java
Index: RtfBefore.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBefore.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RtfBefore.java 2 Jul 2003 14:49:39 -0000 1.4
+++ RtfBefore.java 2 Jul 2003 16:13:29 -0000 1.5
@@ -66,6 +66,7 @@
/**RtfBefore attributes*/
public static final String HEADER = "header";
+ /** String array of attribute names */
public static final String[] HEADER_ATTR = new String[]{
HEADER
};
@@ -74,6 +75,9 @@
super(parent, w, attrs);
}
+ /**
+ * @see RtfAfterBeforeBase#writeMyAttributes
+ */
protected void writeMyAttributes() throws IOException {
writeAttributes(attrib, HEADER_ATTR);
}
1.7 +4 -2
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBookmark.java
Index: RtfBookmark.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBookmark.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RtfBookmark.java 30 Jun 2003 20:42:20 -0000 1.6
+++ RtfBookmark.java 2 Jul 2003 16:13:29 -0000 1.7
@@ -184,7 +184,9 @@
this.writeGroupMark (false);
}
- /** 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 bookmark == null || bookmark.trim().length() == 0;
}
1.5 +2 -2
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBookmarkContainerImpl.java
Index: RtfBookmarkContainerImpl.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBookmarkContainerImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RtfBookmarkContainerImpl.java 30 Jun 2003 06:10:05 -0000 1.4
+++ RtfBookmarkContainerImpl.java 2 Jul 2003 16:13:29 -0000 1.5
@@ -73,7 +73,7 @@
//////////////////////////////////////////////////
/** Rtf bookmark */
- RtfBookmark mBookmark = null;
+ private RtfBookmark mBookmark = null;
//////////////////////////////////////////////////
1.5 +7 -6
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfColorTable.java
Index: RtfColorTable.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfColorTable.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RtfColorTable.java 30 Jun 2003 06:10:05 -0000 1.4
+++ RtfColorTable.java 2 Jul 2003 16:13:29 -0000 1.5
@@ -74,9 +74,9 @@
//////////////////////////////////////////////////
// Defines the bit moving for the colors
- private static int RED = 16;
- private static int GREEN = 8;
- private static int BLUE = 0;
+ private static final int RED = 16;
+ private static final int GREEN = 8;
+ private static final int BLUE = 0;
//////////////////////////////////////////////////
@@ -164,8 +164,9 @@
// @@ Public methods
//////////////////////////////////////////////////
- /** get the RTF number of a named color
- * @return null if name not found
+ /**
+ * @param name a named color
+ * @return the RTF number of a named color, or null if name not found
*/
public Integer getColorNumber (String name) {
return (Integer)namedColors.get(name.toLowerCase());
1.6 +48 -26
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfContainer.java
Index: RtfContainer.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfContainer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RtfContainer.java 30 Jun 2003 06:10:05 -0000 1.5
+++ RtfContainer.java 2 Jul 2003 16:13:29 -0000 1.6
@@ -70,9 +70,9 @@
*/
public class RtfContainer extends RtfElement {
- private LinkedList m_children; // 'final' removed by Boris Poudérous on
07/22/2002
- private RtfOptions m_options = new RtfOptions();
- private RtfElement m_lastChild;
+ private LinkedList children; // 'final' removed by Boris Poudérous on
07/22/2002
+ private RtfOptions options = new RtfOptions();
+ private RtfElement lastChild;
/** Create an RTF container as a child of given container */
RtfContainer(RtfContainer parent, Writer w) throws IOException {
@@ -82,15 +82,22 @@
/** Create an RTF container as a child of given container with given attributes
*/
RtfContainer(RtfContainer parent, Writer w, RtfAttributes attr) throws
IOException {
super(parent, w, attr);
- m_children = new LinkedList();
+ children = new LinkedList();
}
- /** set options */
+ /**
+ * set options
+ * @param opt options to set
+ */
public void setOptions(RtfOptions opt) {
- m_options = opt;
+ options = opt;
}
- /** add a child element to this */
+ /**
+ * add a child element to this
+ * @param e child element to add
+ * @throws RtfStructureException for trying to add an invalid child (??)
+ */
protected void addChild(RtfElement e)
throws RtfStructureException {
if (isClosed()) {
@@ -116,37 +123,46 @@
*/
}
- m_children.add(e);
- m_lastChild = e;
+ children.add(e);
+ lastChild = e;
}
- /** return a copy of our children's list */
+ /**
+ * @return a copy of our children's list
+ */
public List getChildren() {
- return (List)m_children.clone();
+ return (List)children.clone();
}
- /** return the number of children */
+ /**
+ * @return the number of children
+ */
public int getChildCount() {
- return m_children.size();
+ return children.size();
}
/**
* Add by Boris Poudérous on 07/22/2002
* Set the children list
+ * @param children list of child objects
+ * @return true if process succeeded
*/
public boolean setChildren (List children) {
if (children instanceof LinkedList) {
- this.m_children = (LinkedList)children;
+ this.children = (LinkedList)children;
return true;
}
return false;
}
- /** write RTF code of all our children */
+ /**
+ * write RTF code of all our children
+ * @throws IOException for I/O problems
+ */
protected void writeRtfContent()
throws IOException {
- for (Iterator it = m_children.iterator(); it.hasNext();) {
+ for (Iterator it = children.iterator(); it.hasNext();) {
final RtfElement e = (RtfElement)it.next();
e.writeRtf();
}
@@ -154,13 +170,13 @@
/** return our options */
RtfOptions getOptions() {
- return m_options;
+ return options;
}
/** true if this (recursively) contains at least one RtfText object */
boolean containsText() {
boolean result = false;
- for (Iterator it = m_children.iterator(); it.hasNext();) {
+ for (Iterator it = children.iterator(); it.hasNext();) {
final RtfElement e = (RtfElement)it.next();
if (e instanceof RtfText) {
result = !e.isEmpty();
@@ -180,32 +196,38 @@
void dump(Writer w, int indent)
throws IOException {
super.dump(w, indent);
- for (Iterator it = m_children.iterator(); it.hasNext();) {
+ for (Iterator it = children.iterator(); it.hasNext();) {
final RtfElement e = (RtfElement)it.next();
e.dump(w, indent + 1);
}
}
- /** minimal debugging display */
+ /**
+ * minimal debugging display
+ * @return String representation of object contents
+ */
public String toString() {
return super.toString() + " (" + getChildCount() + " children)";
}
- /** don't write any RTF if empty of if our options block it */
+ /**
+ * @return false if empty or if our options block writing
+ */
protected boolean okToWriteRtf() {
boolean result = super.okToWriteRtf() && !isEmpty();
- if (result && !m_options.renderContainer(this)) {
+ if (result && !options.renderContainer(this)) {
result = false;
}
return result;
}
- /** true if this element would generate no "useful" RTF content.
- * For an RtfContainer, true if it has no children where isEmpty() is false
+ /**
+ * @return true if this element would generate no "useful" RTF content,
+ * i.e. (for RtfContainer) true if it has no children where isEmpty() is false
*/
public boolean isEmpty() {
boolean result = true;
- for (Iterator it = m_children.iterator(); it.hasNext();) {
+ for (Iterator it = children.iterator(); it.hasNext();) {
final RtfElement e = (RtfElement)it.next();
if (!e.isEmpty()) {
result = false;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]