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 ac...@apache.org on 2008/07/18 20:02:37 UTC

svn commit: r677983 - /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/

Author: acumiskey
Date: Fri Jul 18 11:02:36 2008
New Revision: 677983

URL: http://svn.apache.org/viewvc?rev=677983&view=rev
Log:
More optimizations and cleanups.

Modified:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageContent.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageInputDescriptor.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageRasterData.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageSegment.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapCodedFont.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectContainer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PageObject.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PreprocessPresentationObject.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceGroup.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceObject.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElement.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageContent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageContent.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageContent.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageContent.java Fri Jul 18 11:02:36 2008
@@ -90,6 +90,7 @@
     /**
      * Sets the image size parameters
      * resolution, hsize and vsize.
+     * 
      * @param hresol The horizontal resolution of the image.
      * @param vresol The vertical resolution of the image.
      * @param hsize The horizontal size of the image.
@@ -101,6 +102,7 @@
 
     /**
      * Sets the image encoding.
+     * 
      * @param encoding The image encoding.
      */
     public void setImageEncoding(byte encoding) {
@@ -109,6 +111,7 @@
 
     /**
      * Sets the image compression.
+     * 
      * @param compression The image compression.
      */
     public void setImageCompression(byte compression) {
@@ -117,6 +120,7 @@
 
     /**
      * Sets the image IDE size.
+     * 
      * @param size The IDE size.
      */
     public void setImageIDESize(byte size) {
@@ -125,6 +129,7 @@
 
     /**
      * Sets the image IDE color model.
+     * 
      * @param colorModel    the IDE color model.
      */
     public void setImageIDEColorModel(byte colorModel) {
@@ -133,15 +138,14 @@
 
     /**
      * Set the data of the image.
+     * 
      * @param data the image data
      */
     public void setImageData(byte[] data) {
         this.imageData = data;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     protected void writeContent(OutputStream os) throws IOException {
         if (imageSizeParameter != null) {
             imageSizeParameter.write(os);
@@ -161,9 +165,7 @@
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     protected void writeStart(OutputStream os) throws IOException {
         byte[] data = new byte[] {
             (byte)0x91, // ID
@@ -173,9 +175,7 @@
         os.write(data);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     protected void writeEnd(OutputStream os) throws IOException {
         byte[] data = new byte[] {
             (byte)0x93, // ID
@@ -186,17 +186,16 @@
 
     /**
      * Helper method to return the start of the image segment.
+     * 
      * @return byte[] The data stream.
      */
     private byte[] getImageDataStart(int len) {
-
         byte[] data = new byte[] {
             (byte)0xFE, // ID
             (byte)0x92, // ID
             0x00, // Length
             0x00, // Length
         };
-
         byte[] l = BinaryUtils.convert(len, 2);
         data[2] = l[0];
         data[3] = l[1];
@@ -206,6 +205,7 @@
 
     /**
      * Helper method to return the image encoding parameter.
+     * 
      * @return byte[] The data stream.
      */
     private byte[] getImageEncodingParameter() {
@@ -220,6 +220,7 @@
 
     /**
      * Helper method to return the external algorithm parameter.
+     * 
      * @return byte[] The data stream.
      */
     private byte[] getExternalAlgorithmParameter() {
@@ -246,6 +247,7 @@
 
     /**
      * Helper method to return the image encoding parameter.
+     * 
      * @return byte[] The data stream.
      */
     private byte[] getImageIDESizeParameter() {
@@ -259,6 +261,7 @@
 
     /**
      * Helper method to return the external algorithm parameter.
+     * 
      * @return byte[] The data stream.
      */
     private byte[] getIDEStructureParameter() {

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageInputDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageInputDescriptor.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageInputDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageInputDescriptor.java Fri Jul 18 11:02:36 2008
@@ -40,16 +40,10 @@
     public void write(OutputStream os) throws IOException {
 
         byte[] data = new byte[45];
-
-        data[0] = 0x5A;
-        data[1] = 0x00;
+        copySF(data, Type.DESCRIPTOR, Category.IM_IMAGE);
+        
+        data[1] = 0x00; // length
         data[2] = 0x2C;
-        data[3] = (byte) 0xD3;
-        data[4] = (byte) 0xA6;
-        data[5] = (byte) 0x7B;
-        data[6] = 0x00;
-        data[7] = 0x00;
-        data[8] = 0x00;
 
         // Constant data.
         data[9] = 0x00;
@@ -127,12 +121,12 @@
         data[44] = (byte)0xFF;
 
         os.write(data);
-
     }
 
     /**
      * Sets the resolution information for the raster image
      * the default value is a resolution of 240 dpi.
+     * 
      * @param resolution The resolution value
      */
     public void setResolution(int resolution) {

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageRasterData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageRasterData.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageRasterData.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageRasterData.java Fri Jul 18 11:02:36 2008
@@ -60,22 +60,13 @@
 
     /** {@inheritDoc} */
     public void write(OutputStream os) throws IOException {
-
         byte[] data = new byte[9];
-
-        data[0] = 0x5A;
-
+        copySF(data, Type.DATA, Category.IM_IMAGE);
+        
         // The size of the structured field
-        byte[] x = BinaryUtils.convert(rasterData.length + 8, 2);
-        data[1] = x[0];
-        data[2] = x[1];
-
-        data[3] = (byte) 0xD3;
-        data[4] = (byte) 0xEE;
-        data[5] = (byte) 0x7B;
-        data[6] = 0x00;
-        data[7] = 0x00;
-        data[8] = 0x00;
+        byte[] len = BinaryUtils.convert(rasterData.length + 8, 2);
+        data[1] = len[0];
+        data[2] = len[1];
 
         os.write(data);
         os.write(rasterData);

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageSegment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageSegment.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageSegment.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageSegment.java Fri Jul 18 11:02:36 2008
@@ -54,6 +54,7 @@
     /**
      * Constructor for the image segment with the specified name,
      * the name must be a fixed length of eight characters.
+     * 
      * @param name The name of the image.
      */
     public ImageSegment(String name) {

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapCodedFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapCodedFont.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapCodedFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapCodedFont.java Fri Jul 18 11:02:36 2008
@@ -47,30 +47,20 @@
     /**
      * The collection of map coded fonts (maximum of 254)
      */
-    private List fontList = null;
+    private List/*<FontDefinition>*/ fontList = new java.util.ArrayList();
 
     /**
      * Constructor for the MapCodedFont
      */
     public MapCodedFont() {
-        fontList = new java.util.ArrayList();
     }
 
     /** {@inheritDoc} */
     public void write(OutputStream os) throws IOException {
-        byte[] startData = new byte[] {
-            0x5A,
-            0x00, // Reserved
-            0x00, // Reserved
-            (byte)0xD3,
-            (byte)0xAB, // Format 2
-            (byte)0x8A,
-            0x00, // Reserved
-            0x00, // Reserved
-            0x00, // Reserved
-        };
-        
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+        byte[] startData = new byte[9];
+        copySF(startData, Type.MAP, Category.CODED_FONT);
         baos.write(startData);
 
         Iterator iter = fontList.iterator();

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java Fri Jul 18 11:02:36 2008
@@ -80,11 +80,7 @@
         }
     }
 
-    /**
-     * Accessor method to write the AFP datastream for the Map Page Overlay
-     * @param os The stream to write to
-     * @throws java.io.IOException if an I/O exception occurred
-     */
+    /** {@inheritDoc} */
     public void write(OutputStream os) throws IOException {
         int oLayCount = getOverlays().size();
         int recordlength = oLayCount * 18;
@@ -102,8 +98,8 @@
 
         // Structured field ID for a MPO
         data[3] = (byte) 0xD3;
-        data[4] = (byte) 0xAB;
-        data[5] = (byte) 0xD8;
+        data[4] = (byte) Type.MAP;
+        data[5] = (byte) Category.PAGE_OVERLAY;
 
         data[6] = 0x00; // Reserved
         data[7] = 0x00; // Reserved

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java Fri Jul 18 11:02:36 2008
@@ -32,7 +32,6 @@
 /**
  * The Object Area Descriptor structured field specifies the size and attributes
  * of an object area presentation space.
- *
  */
 public class ObjectAreaDescriptor extends AbstractDescriptor {
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectContainer.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectContainer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectContainer.java Fri Jul 18 11:02:36 2008
@@ -23,9 +23,6 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
-import org.apache.fop.render.afp.DataObjectInfo;
-import org.apache.fop.render.afp.modca.triplets.FullyQualifiedNameTriplet;
-import org.apache.fop.render.afp.modca.triplets.ObjectClassificationTriplet;
 import org.apache.fop.render.afp.tools.BinaryUtils;
 
 /**
@@ -41,9 +38,6 @@
     /** the object data */
     private byte[] objectData = null;
 
-//    /** the data object info */
-//    private DataObjectInfo dataObjectInfo;
-    
     /**
      * Default constructor
      */
@@ -69,35 +63,6 @@
         this.dataObj = dataObj;        
     }
 
-//    /** {@inheritDoc} */
-//    public AbstractNamedAFPObject getDataObject() {
-//        return this.dataObj;
-//    }
-//    
-//    /** {@inheritDoc} */
-//    public DataObjectInfo getDataObjectInfo() {
-//        return this.dataObjectInfo;
-//    }
-
-//    /** {@inheritDoc} */
-//    public void setDataObjectInfo(DataObjectInfo dataObjectInfo) {
-//        this.dataObjectInfo = dataObjectInfo;
-//        
-//        Registry registry = Registry.getInstance();
-//        Registry.ObjectType objectType = registry.getObjectType(dataObjectInfo);
-//        if (objectType != null) {
-//            super.setObjectClassification(
-//                    ObjectClassificationTriplet.CLASS_TIME_VARIANT_PRESENTATION_OBJECT,
-//                    objectType);
-//        } else {
-//            log.warn("no object type for " + dataObjectInfo.getUri());
-//        }
-//        super.setFullyQualifiedName(
-//                FullyQualifiedNameTriplet.TYPE_REPLACE_FIRST_GID_NAME,
-//                FullyQualifiedNameTriplet.FORMAT_CHARSTR,
-//                dataObjectInfo.getUri());
-//    }
-
     /** {@inheritDoc} */
     protected void writeStart(OutputStream os) throws IOException {
         // create object data from data object
@@ -122,8 +87,7 @@
         
         // write out object data in chunks of object container data
         for (int i = 0; i <= objectData.length; i += ObjectContainerData.MAX_DATA_LEN) {
-            ObjectContainerData objectContainerData = new ObjectContainerData(objectData, i);
-            objectContainerData.write(os);
+            new ObjectContainerData(objectData, i).write(os);
         }
     }
     
@@ -142,32 +106,36 @@
         /** The maximum object container data length */ 
         private static final int MAX_DATA_LEN = 32759;
         
+        private byte[] objData = null;
+        
+        private int startIndex;
+        
         /**
          * Main constructor
          * 
          * @param objData the object data
          */
         public ObjectContainerData(byte[] objData, int startIndex) {
+            this.objData = objData;
+            this.startIndex = startIndex;
+        }
+        
+        /** {@inheritDoc} */
+        public void write(OutputStream os) throws IOException {
             int dataLen = MAX_DATA_LEN;
             if (startIndex + MAX_DATA_LEN >= objData.length) {
                 dataLen = objData.length - startIndex - 1;
             }
-            byte[] len = BinaryUtils.convert(8 + dataLen, 2);
             byte[] data = new byte[9 + dataLen];
-            data[0] = 0x5A; // Structured field identifier 
+            copySF(data, Type.DATA, Category.OBJECT_CONTAINER);
+
+            byte[] len = BinaryUtils.convert(8 + dataLen, 2);
             data[1] = len[0]; // Length byte 1
             data[2] = len[1]; // Length byte 2
-            data[3] = (byte)0xD3; // Structured field id byte 1
-            data[4] = (byte)0xEE; // Structured field id byte 2
-            data[5] = getCategoryCode(); // Structured field id byte 3
-            data[6] = 0x00; // Flags
-            data[7] = 0x00; // Reserved
-            data[8] = 0x00; // Reserved
             
             // copy object data chunk
             System.arraycopy(objData, startIndex, data, 9, dataLen);
-            
-            super.setData(data);
+            os.write(data);
         }
         
         /** {@inheritDoc} */
@@ -177,14 +145,5 @@
                 + ")";
         }
 
-        /** {@inheritDoc} */
-        protected byte getCategoryCode() {
-            return (byte)0x92;
-        }
-    }
-
-    /** {@inheritDoc} */
-    protected byte getCategoryCode() {
-        return (byte)0x92;
     }
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PageObject.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PageObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PageObject.java Fri Jul 18 11:02:36 2008
@@ -96,54 +96,6 @@
         addObject(ipo);
     }
 
-//    /**
-//     * @return a new page segment object
-//     */
-//    private PageSegment createPageSegment() {
-//        String name = PAGE_SEGMENT_NAME_PREFIX
-//        + StringUtils.lpad(String.valueOf(++pageSegmentCount), '0', 5);
-//        PageSegment pageSegment = new PageSegment(name);
-//        return pageSegment;
-//    }
-    
-//    /**
-//     * @return the current page segment
-//     */
-//    private PageSegment getCurrentPageSegment() {
-//        if (currentPageSegment == null) {
-//            this.currentPageSegment = createPageSegment();        
-//            super.addObject(currentPageSegment);
-//        }
-//        return this.currentPageSegment;
-//    }
-//    
-//    private static final String PAGE_SEGMENT_NAME_PREFIX = "PSG";
-
-//    /**
-//     * Starts a new page segment and makes it current.
-//     */
-//    public void startPageSegment() {
-//        getCurrentPageSegment();
-//    }
-//
-//    /**
-//     * Ends the current page segment.
-//     */
-//    public void endPageSegment() {
-//        this.currentPageSegment = null;
-//    }
-
-//    /**
-//     * {@inheritDoc}
-//     */
-//    protected void addObject(AbstractAFPObject obj) {
-////        if (currentPageSegment != null) {
-////            getCurrentPageSegment().addObject(obj);
-////        } else {
-//            super.addObject(obj);
-////        }
-//    }
-
     /**
      * This method will create shading on the page using the specified
      * coordinates (the shading contrast is controlled via the red, green blue

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PreprocessPresentationObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PreprocessPresentationObject.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PreprocessPresentationObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PreprocessPresentationObject.java Fri Jul 18 11:02:36 2008
@@ -96,18 +96,13 @@
     public void writeStart(OutputStream os) throws IOException {
         super.writeStart(os);
 
-        byte[] l = BinaryUtils.convert(19 + getTripletDataLength(), 2);
         byte[] data = new byte[9];
-        data[0] = 0x5A; // Structured field identifier
+        copySF(data, Type.PROCESS, Category.DATA_RESOURCE);
+
+        byte[] l = BinaryUtils.convert(19 + getTripletDataLength(), 2);
         data[1] = l[0]; // Length byte 1
         data[2] = l[1]; // Length byte 1
-        data[3] = (byte)0xD3; // Structured field id byte 1
-        data[4] = (byte)0xAD; // Structured field id byte 2
-        data[5] = (byte)0xC3; // Structured field id byte 3
-        data[6] = 0x00; // Flags
-        data[7] = 0x00; // Reserved
-        data[8] = 0x00; // Reserved
-        
+
         os.write(data);
     }
     
@@ -147,8 +142,4 @@
         super.writeContent(os);
     }
 
-    /** {@inheritDoc} */
-    protected byte getCategoryCode() {
-        return (byte)0xC3;
-    }
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java Fri Jul 18 11:02:36 2008
@@ -63,17 +63,13 @@
 
     /** {@inheritDoc} */
     public void write(OutputStream os) throws IOException {
-
         byte[] data = new byte[23];
-        data[0] = 0x5A;
-        data[1] = 0x00;
+        
+        copySF(data, Type.MIGRATION, Category.PRESENTATION_TEXT);
+
+        data[1] = 0x00; // length
         data[2] = 0x16;
-        data[3] = (byte) 0xD3;
-        data[4] = (byte) 0xB1;
-        data[5] = (byte) 0x9B;
-        data[6] = 0x00;
-        data[7] = 0x00;
-        data[8] = 0x00;
+
         data[9] = 0x00;
         data[10] = 0x00;
 
@@ -99,7 +95,6 @@
         data[22] = 0x00;
 
         os.write(data);
-
     }
 
 }
\ No newline at end of file

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceGroup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceGroup.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceGroup.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceGroup.java Fri Jul 18 11:02:36 2008
@@ -21,16 +21,11 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.Collection;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.fop.render.afp.DataObjectCache;
-import org.apache.fop.render.afp.DataObjectInfo;
 import org.apache.fop.render.afp.ResourceInfo;
-import org.apache.fop.render.afp.ResourceLevel;
-import org.apache.fop.render.afp.tools.StringUtils;
 
 /**
  * A Resource Group contains a set of overlays.
@@ -106,24 +101,24 @@
 //        return includeObj;
 //    }
     
-    /**
-     * Checks if a named object is of a valid type to be added to a resource group
-     * 
-     * @param namedObj a named object
-     * @return true if the named object is of a valid type to be added to a resource group
-     */
-    private boolean isValidObjectType(AbstractNamedAFPObject namedObj) {
-        return (namedObj instanceof Overlay
-                || namedObj instanceof ResourceObject
-                || namedObj instanceof PageSegment
-                || namedObj instanceof GraphicsObject
-                || namedObj instanceof ImageObject
-                || namedObj instanceof ObjectContainer
-                || namedObj instanceof Document
-                // || namedObj instanceof FormMap
-                // || namedObj instanceof BarcodeObject 
-                );
-    }
+//    /**
+//     * Checks if a named object is of a valid type to be added to a resource group
+//     * 
+//     * @param namedObj a named object
+//     * @return true if the named object is of a valid type to be added to a resource group
+//     */
+//    private boolean isValidObjectType(AbstractNamedAFPObject namedObj) {
+//        return (namedObj instanceof Overlay
+//                || namedObj instanceof ResourceObject
+//                || namedObj instanceof PageSegment
+//                || namedObj instanceof GraphicsObject
+//                || namedObj instanceof ImageObject
+//                || namedObj instanceof ObjectContainer
+//                || namedObj instanceof Document
+//                // || namedObj instanceof FormMap
+//                // || namedObj instanceof BarcodeObject 
+//                );
+//    }
 
     /**
      * Add this object cache resource info to this resource group

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceObject.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ResourceObject.java Fri Jul 18 11:02:36 2008
@@ -49,46 +49,7 @@
      */
     public void setDataObject(AbstractNamedAFPObject obj) {
         this.namedObject = obj;
-//        
-//        String fqn = obj.getFullyQualifiedName();
-//        if (fqn != null) {
-//            super.setFullyQualifiedName(
-//                FullyQualifiedNameTriplet.TYPE_REPLACE_FIRST_GID_NAME,
-//                FullyQualifiedNameTriplet.FORMAT_CHARSTR,
-//                fqn);
-//        }
-//        
-//        byte type;
-//        if (obj instanceof ObjectContainer) {
-//            type = ResourceObjectTypeTriplet.OBJECT_CONTAINER;
-//        } else if (obj instanceof ImageObject) {
-//            type = ResourceObjectTypeTriplet.IMAGE_OBJECT;
-//        } else if (obj instanceof GraphicsObject) {
-//            type = ResourceObjectTypeTriplet.GRAPHICS_OBJECT;
-//        } else if (obj instanceof Document) {
-//            type = ResourceObjectTypeTriplet.DOCUMENT_OBJECT;
-//        } else if (obj instanceof PageSegment) {
-//            type = ResourceObjectTypeTriplet.PAGE_SEGMENT_OBJECT;
-//        } else if (obj instanceof Overlay) {
-//            type = ResourceObjectTypeTriplet.OVERLAY_OBJECT;
-//        } else {
-//            throw new UnsupportedOperationException(
-//                    "Unsupported resource object type " + obj);
-//        }
-//        getTriplets().add(new ResourceObjectTypeTriplet(type));
-    }
-
-//    /** {@inheritDoc} */
-//    public void setDataObjectInfo(DataObjectInfo dataObjectInfo) {
-//        this.dataObjectInfo = dataObjectInfo;
-//        
-//        if (namedObject instanceof ObjectContainer) {
-//            Registry.ObjectType objectType = dataObjectInfo.getObjectType();
-//            super.setObjectClassification(
-//                    ObjectClassificationTriplet.CLASS_TIME_INVARIANT_PAGINATED_PRESENTATION_OBJECT,
-//                    objectType);
-//        }
-//    }
+    }
         
     /** {@inheritDoc} */
     protected void writeStart(OutputStream os) throws IOException {

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElement.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElement.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElement.java Fri Jul 18 11:02:36 2008
@@ -49,72 +49,41 @@
     /**
      * Name of the key, used within the TLE
      */
-    private String tleName = null;
+    private String name = null;
 
     /**
      * Value returned by the key
      */
-    private String tleValue = null;
-
-    /**
-     * Byte representaion of the name
-     */
-    private byte[] tleByteName = null;
-
-    /**
-     * Byte representaion of the value
-     */
-    private byte[] tleByteValue = null;
+    private String value = null;
 
     /**
      * Construct a tag logical element with the name and value specified.
+     * 
      * @param name the name of the tag logical element
      * @param value the value of the tag logical element
      */
     public TagLogicalElement(String name, String value) {
-
-        this.tleName = name;
-        this.tleValue = value;
-
-        try {
-
-            this.tleByteName = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
-            this.tleByteValue = value.getBytes(AFPConstants.EBCIDIC_ENCODING);
-
-        } catch (UnsupportedEncodingException usee) {
-
-            this.tleByteName = name.getBytes();
-            this.tleByteValue = value.getBytes();
-            log.warn(
-                "Constructor:: UnsupportedEncodingException translating the name "
-                + name);
-
-        }
-
+        this.name = name;
+        this.value = value;
     }
 
-    /**
-     * Accessor method to obtain the byte array AFP datastream for the
-     * TagLogicalElement.
-     * @param os The outputsteam stream
-     * @throws java.io.IOException if an I/O exception occurred
-     */
+    /** {@inheritDoc} */
     public void write(OutputStream os) throws IOException {
 
-        byte[] data = new byte[17 + tleName.length() + tleValue.length()];
+        byte[] data = new byte[17 + name.length() + value.length()];
 
         data[0] = 0x5A;
         // Set the total record length
         byte[] rl1
-            = BinaryUtils.convert(16 + tleName.length() + tleValue.length(), 2);
+            = BinaryUtils.convert(16 + name.length() + value.length(), 2);
         //Ignore first byte
         data[1] = rl1[0];
         data[2] = rl1[1];
 
         // Structured field ID for a TLE
         data[3] = (byte) 0xD3;
-        data[4] = (byte) 0xA0;
-        data[5] = (byte) 0x90;
+        data[4] = (byte) Type.ATTRIBUTE;
+        data[5] = (byte) Category.PROCESS_ELEMENT;
 
         data[6] = 0x00; // Reserved
         data[7] = 0x00; // Reserved
@@ -122,12 +91,25 @@
 
         //Use 2 triplets, attrubute name and value (the key for indexing)
 
-        byte[] rl2 = BinaryUtils.convert(tleName.length() + 4, 1);
+        byte[] rl2 = BinaryUtils.convert(name.length() + 4, 1);
         data[9] = rl2[0]; // length of the triplet, including this field
         data[10] = 0x02; //Identifies it as a FQN triplet
         data[11] = 0x0B; // GID format
         data[12] = 0x00;
 
+        byte[] tleByteName = null;
+        byte[] tleByteValue = null;
+        try {
+            tleByteName = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
+            tleByteValue = value.getBytes(AFPConstants.EBCIDIC_ENCODING);
+        } catch (UnsupportedEncodingException usee) {
+            tleByteName = name.getBytes();
+            tleByteValue = value.getBytes();
+            log.warn(
+                "Constructor:: UnsupportedEncodingException translating the name "
+                + name);
+        }
+
         int pos = 13;
         for (int i = 0; i < tleByteName.length; i++) {
             data[pos++] = tleByteName[i];

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java?rev=677983&r1=677982&r2=677983&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java Fri Jul 18 11:02:36 2008
@@ -34,6 +34,7 @@
 
     /**
      * Constructor for the TagLogicalElementBean.
+     * 
      * @param key the key attribute
      * @param value the value attribute
      */
@@ -44,6 +45,7 @@
 
     /**
      * Getter for the key attribute.
+     * 
      * @return the key
      */
     public String getKey() {
@@ -52,6 +54,7 @@
 
     /**
      * Getter for the value attribute.
+     * 
      * @return the value
      */
     public String getValue() {



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