You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/08/03 20:37:39 UTC

svn commit: r227245 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/PageNumber.java fo/flow/PageNumberCitation.java layoutmgr/inline/PageNumberCitationLayoutManager.java layoutmgr/inline/PageNumberLayoutManager.java

Author: jeremias
Date: Wed Aug  3 11:37:31 2005
New Revision: 227245

URL: http://svn.apache.org/viewcvs?rev=227245&view=rev
Log:
Proper handling of the color property on page-number and page-number-citatition.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java?rev=227245&r1=227244&r2=227245&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java Wed Aug  3 11:37:31 2005
@@ -21,7 +21,9 @@
 import org.xml.sax.Locator;
 
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
@@ -68,6 +70,9 @@
     private int wrapOption;
     //  End of property values
 
+    // Properties which are not explicitely listed but are still applicable 
+    private ColorType color;
+    
     /**
      * @param parent FONode that is the parent of this object
      */
@@ -103,6 +108,9 @@
         visibility = pList.get(PR_VISIBILITY).getEnum();
         wordSpacing = pList.get(PR_WORD_SPACING).getSpace();
         wrapOption = pList.get(PR_WRAP_OPTION).getEnum();
+
+        // implicit properties
+        color = pList.get(Constants.PR_COLOR).getColorType();
     }
 
     /**
@@ -129,23 +137,22 @@
             invalidChildError(loc, nsURI, localName);
     }
 
-    /**
-     * Return the Common Font Properties.
-     */
+    /** @return the Common Font Properties. */
     public CommonFont getCommonFont() {
         return commonFont;
     }
 
-    /**
-     * Return the Common Border, Padding, and Background Properties.
-     */
+    /** @return the "color" property. */
+    public ColorType getColor() {
+        return color;
+    }
+
+    /** @return the Common Border, Padding, and Background Properties. */
     public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
         return commonBorderPaddingBackground;
     }
 
-    /**
-     * @return the "id" property.
-     */
+    /** @return the "id" property. */
     public String getId() {
         return id;
     }
@@ -155,16 +162,12 @@
         return textDecoration; 
     }
 
-    /**
-     * @see org.apache.fop.fo.FONode#getName()
-     */
+    /** @see org.apache.fop.fo.FONode#getName() */
     public String getName() {
         return "fo:page-number";
     }
 
-    /**
-     * @see org.apache.fop.fo.FObj#getNameId()
-     */
+    /** @see org.apache.fop.fo.FObj#getNameId() */
     public int getNameId() {
         return FO_PAGE_NUMBER;
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java?rev=227245&r1=227244&r2=227245&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java Wed Aug  3 11:37:31 2005
@@ -21,7 +21,9 @@
 import org.xml.sax.Locator;
 
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
@@ -72,6 +74,9 @@
     private int wrapOption;
     // End of property values
 
+    // Properties which are not explicitely listed but are still applicable 
+    private ColorType color;
+
     /**
      * @param parent FONode that is the parent of this object
      */
@@ -108,6 +113,9 @@
         visibility = pList.get(PR_VISIBILITY).getEnum();
         wordSpacing = pList.get(PR_WORD_SPACING).getSpace();
         wrapOption = pList.get(PR_WRAP_OPTION).getEnum();
+        
+        // implicit properties
+        color = pList.get(Constants.PR_COLOR).getColorType();
     }
 
     /**
@@ -129,42 +137,37 @@
             invalidChildError(loc, nsURI, localName);
     }
 
-    /**
-     * Return the Common Font Properties.
-     */
+    /** @return the Common Font Properties. */
     public CommonFont getCommonFont() {
         return commonFont;
     }
 
+    /** @return the "color" property. */
+    public ColorType getColor() {
+        return color;
+    }
+
     /** @return the "text-decoration" property. */
     public CommonTextDecoration getTextDecoration() {
         return textDecoration; 
     }
     
-    /**
-     * Return the "id" property.
-     */
+    /** @return the "id" property. */
     public String getId() {
         return id;
     }
 
-    /**
-     * Return the "ref-id" property.
-     */
+    /** @return the "ref-id" property. */
     public String getRefId() {
         return refId;
     }
      
-    /**
-     * @see org.apache.fop.fo.FObj#getName()
-     */
+    /** @see org.apache.fop.fo.FObj#getName() */
     public String getName() {
         return "fo:page-number-citation";
     }
 
-    /**
-     * @see org.apache.fop.fo.FObj#getNameId()
-     */
+    /** @see org.apache.fop.fo.FObj#getNameId() */
     public int getNameId() {
         return FO_PAGE_NUMBER_CITATION;
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java?rev=227245&r1=227244&r2=227245&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java Wed Aug  3 11:37:31 2005
@@ -105,6 +105,7 @@
         inline.setOffset(font.getAscender());
         inline.addTrait(Trait.FONT_NAME, font.getFontName());
         inline.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize()));
+        inline.addTrait(Trait.COLOR, fobj.getColor());
         TraitSetter.addTextDecoration(inline, fobj.getTextDecoration());
         
         return inline;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java?rev=227245&r1=227244&r2=227245&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java Wed Aug  3 11:37:31 2005
@@ -48,23 +48,24 @@
 
     public InlineArea get(LayoutContext context) {
         // get page string from parent, build area
-        TextArea inline = new TextArea();
+        TextArea text = new TextArea();
         String str = getCurrentPV().getPageNumberString();
         int width = 0;
         for (int count = 0; count < str.length(); count++) {
             width += font.getCharWidth(str.charAt(count));
         }
-        inline.setTextArea(str);
-        inline.setIPD(width);
-        inline.setBPD(font.getAscender() - font.getDescender());
-        inline.setOffset(font.getAscender());
-        inline.addTrait(Trait.FONT_NAME, font.getFontName());
-        inline.addTrait(Trait.FONT_SIZE,
+        text.setTextArea(str);
+        text.setIPD(width);
+        text.setBPD(font.getAscender() - font.getDescender());
+        text.setOffset(font.getAscender());
+        text.addTrait(Trait.FONT_NAME, font.getFontName());
+        text.addTrait(Trait.FONT_SIZE,
                         new Integer(font.getFontSize()));
+        text.addTrait(Trait.COLOR, fobj.getColor());
 
-        TraitSetter.addTextDecoration(inline, fobj.getTextDecoration());
+        TraitSetter.addTextDecoration(text, fobj.getTextDecoration());
 
-        return inline;
+        return text;
     }
     
     



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org