Thread: [FOray-commit] SF.net SVN: foray: [8871] trunk/foray (Page 8)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-03-16 02:48:17
|
Revision: 8871
http://svn.sourceforge.net/foray/?rev=8871&view=rev
Author: victormote
Date: 2007-03-15 19:48:17 -0700 (Thu, 15 Mar 2007)
Log Message:
-----------
1. Move the RunLength filter logic to the PS module.
2. Add a test of the RunLength encoding logic.
Modified Paths:
--------------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java
trunk/foray/foray-render/src/java/org/foray/render/ps/RunLengthEncodeOutputStream.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthFilter.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthFilter.java
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2007-03-16 00:06:35 UTC (rev 8870)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2007-03-16 02:48:17 UTC (rev 8871)
@@ -26,11 +26,16 @@
* $LastChangedBy$
*/
+/*
+ * Known contributors:
+ * Eric SCHAEFFER,
+ * Kelly A. Campbell
+ */
+
package org.foray.ps.filter;
/**
* A PostScript filter object.
- * @author Eric SCHAEFFER, Kelly A. Campbell
*/
public abstract class PSFilter {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java 2007-03-16 00:06:35 UTC (rev 8870)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java 2007-03-16 02:48:17 UTC (rev 8871)
@@ -38,18 +38,43 @@
static final long serialVersionUID = 397143470309213006L;
/**
- * No-parameter constructor.
+ * Create a new PSFilterException.
+ * Identical to {@link Exception#Exception(java.lang.String)}
+ * @param message The detail message. The detail message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @see Exception#Exception(java.lang.String)
*/
- public PSFilterException() {
- super();
+ public PSFilterException(final String message) {
+ super(message);
}
/**
- * Constructor taking an exception message.
- * @param message The message accompanying the exception.
+ * Create a new PSFilterException.
+ * Identical to {@link Exception#Exception(java.lang.Throwable)}
+ * @param cause The cause (which is saved for later retrieval by the
+ * {@link #getCause()} method).
+ * (A <tt>null</tt> value is permitted, and indicates that the cause is
+ * nonexistent or unknown.)
+ * @see Exception#Exception(java.lang.Throwable)
*/
- public PSFilterException(final String message) {
- super(message);
+ public PSFilterException(final Throwable cause) {
+ super(cause);
}
+ /**
+ * Create a new PSFilterException.
+ * Identical to {@link Exception#Exception(java.lang.String,
+ * java.lang.Throwable)}
+ * @param message The detail message. The detail message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @param cause The cause (which is saved for later retrieval by the
+ * {@link #getCause()} method).
+ * (A <tt>null</tt> value is permitted, and indicates that the cause is
+ * nonexistent or unknown.)
+ * @see Exception#Exception(java.lang.String, java.lang.Throwable)
+ */
+ public PSFilterException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
}
Added: trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthFilter.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthFilter.java 2007-03-16 02:48:17 UTC (rev 8871)
@@ -0,0 +1,242 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+/*
+ * Known contributors:
+ * Original author: Stephen Wolke (mailto:sm...@ge...)
+ */
+
+package org.foray.ps.filter;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Acts as either a RunLengthEncode Filter or a RunLengthDecode filter.
+ */
+public class RunLengthFilter extends PSFilter {
+
+ /** The number of bytes necessary to know beforew we know whether we have
+ * a sequence or not. */
+ private static final int QTY_START_SEQUENCE_HEADER_BYTES = 3;
+
+ /** The maximum number of bytes that can be encoded in one run. */
+ private static final int MAX_SEQUENCE_COUNT = 127;
+
+ /** The end-of-data marker. */
+ private static final int END_OF_DATA = 128;
+
+ /** The maximum number of values that can be encoded in one byte. */
+ private static final int BYTE_MAX = 256;
+
+ /** Status indicator: we don't know whether in a sequence or not. */
+ private static final int NOT_IDENTIFY_SEQUENCE = 0;
+
+ /** Status indicator: we are at the start of a sequence. */
+ private static final int START_SEQUENCE = 1;
+
+ /** Status indicator: we are in a sequence. */
+ private static final int IN_SEQUENCE = 2;
+
+ /** Status indicator: we are not in a sequence. */
+ private static final int NOT_IN_SEQUENCE = 3;
+
+ /** The number of bytes in the current run. */
+ private int runCount = 0;
+
+ /** The current status of the processed data. */
+ private int isSequence = NOT_IDENTIFY_SEQUENCE;
+
+ /** The buffer in which the runs are accumulated. */
+ private byte[] runBuffer = new byte[MAX_SEQUENCE_COUNT + 1];
+
+ /** The "output stream" to which the encoded data is written as it is
+ * encoded. This is eventually dumped as a byte array. */
+ private OutputStream encodeStream = new ByteArrayOutputStream();
+
+ /**
+ * Constructor.
+ * @param encodeStream The output stream to which the encoded data should
+ * be written.
+ */
+ public RunLengthFilter(final OutputStream encodeStream) {
+ this.encodeStream = encodeStream;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return "/RunLengthDecode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDecodeParms() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public byte[] encode(final byte[] data) throws PSFilterException {
+ try {
+ for (int i = 0; i < data.length; i++) {
+ this.encode(data[i]);
+ }
+ } catch (final IOException e) {
+ throw new PSFilterException(e);
+ }
+ try {
+ flushEncode();
+ } catch (final IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public byte[] decode(final byte[] input) {
+ /* TODO: Implement this. */
+ return input;
+ }
+
+ /**
+ * Encodes one byte, writing what it can to the output buffer.
+ * @param b The unencoded byte.
+ * @throws IOException For error writing to output stream.
+ */
+ public void encode(final byte b) throws IOException {
+ this.runBuffer[this.runCount] = b;
+
+ switch (this.runCount) {
+ case 0:
+ this.runCount = 0;
+ this.isSequence = NOT_IDENTIFY_SEQUENCE;
+ this.runCount++;
+ break;
+ case 1:
+ if (this.runBuffer[this.runCount]
+ != this.runBuffer[this.runCount - 1]) {
+ this.isSequence = NOT_IN_SEQUENCE;
+ }
+ this.runCount++;
+ break;
+ case 2:
+ if (this.runBuffer[this.runCount]
+ != this.runBuffer[this.runCount - 1]) {
+ this.isSequence = NOT_IN_SEQUENCE;
+ } else {
+ if (this.isSequence == NOT_IN_SEQUENCE) {
+ this.isSequence = START_SEQUENCE;
+ } else {
+ isSequence = IN_SEQUENCE;
+ }
+ }
+ this.runCount++;
+ break;
+ case MAX_SEQUENCE_COUNT:
+ if (this.isSequence == IN_SEQUENCE) {
+ encodeStream.write(BYTE_MAX - (MAX_SEQUENCE_COUNT - 1));
+ encodeStream.write(this.runBuffer[this.runCount - 1]);
+ this.runBuffer[0] = this.runBuffer[this.runCount];
+ this.runCount = 1;
+ } else {
+ encodeStream.write(MAX_SEQUENCE_COUNT);
+ encodeStream.write(this.runBuffer, 0, this.runCount + 1);
+ this.runCount = 0;
+ }
+ this.isSequence = NOT_IDENTIFY_SEQUENCE;
+ break;
+ default:
+ switch (this.isSequence) {
+ case IN_SEQUENCE:
+ if (this.runBuffer[this.runCount]
+ != this.runBuffer[this.runCount - 1]) {
+ encodeStream.write(BYTE_MAX - (this.runCount - 1));
+ encodeStream.write(this.runBuffer[this.runCount - 1]);
+ this.runBuffer[0] = this.runBuffer[this.runCount];
+ this.runCount = 1;
+ this.isSequence = NOT_IDENTIFY_SEQUENCE;
+ break;
+ }
+ this.runCount++;
+ break;
+ case NOT_IN_SEQUENCE:
+ if (this.runBuffer[this.runCount]
+ == this.runBuffer[this.runCount - 1]) {
+ this.isSequence = START_SEQUENCE;
+ }
+ this.runCount++;
+ break;
+ case START_SEQUENCE:
+ if (this.runBuffer[this.runCount]
+ == this.runBuffer[this.runCount - 1]) {
+ encodeStream.write(
+ this.runCount - QTY_START_SEQUENCE_HEADER_BYTES);
+ encodeStream.write(this.runBuffer, 0, this.runCount - 2);
+ this.runBuffer[0] = this.runBuffer[this.runCount];
+ this.runBuffer[1] = this.runBuffer[this.runCount];
+ this.runBuffer[2] = this.runBuffer[this.runCount];
+ this.runCount = QTY_START_SEQUENCE_HEADER_BYTES;
+ this.isSequence = IN_SEQUENCE;
+ break;
+ }
+ this.isSequence = NOT_IN_SEQUENCE;
+ this.runCount++;
+ break;
+ }
+ }
+
+ }
+
+ /**
+ * Writes any unwritten data in the encoding buffer.
+ * @throws IOException For errors writing to the output stream.
+ */
+ public void flushEncode() throws IOException {
+ switch (this.isSequence) {
+ case IN_SEQUENCE:
+ encodeStream.write(BYTE_MAX - (this.runCount - 1));
+ encodeStream.write(this.runBuffer[this.runCount - 1]);
+ break;
+ default:
+ encodeStream.write(this.runCount - 1);
+ encodeStream.write(this.runBuffer, 0, this.runCount);
+ }
+
+ encodeStream.write(END_OF_DATA);
+
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthFilter.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java 2007-03-16 00:06:35 UTC (rev 8870)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java 2007-03-16 02:48:17 UTC (rev 8871)
@@ -29,6 +29,7 @@
package org.foray.ps;
import org.foray.ps.filter.TestASCII85Filter;
+import org.foray.ps.filter.TestRunLengthFilter;
import junit.framework.Test;
import junit.framework.TestCase;
@@ -45,7 +46,10 @@
*/
public static Test suite() {
final TestSuite testSuite = new TestSuite();
+
testSuite.addTestSuite(TestASCII85Filter.class);
+ testSuite.addTestSuite(TestRunLengthFilter.class);
+
return testSuite;
}
Added: trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthFilter.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthFilter.java (rev 0)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthFilter.java 2007-03-16 02:48:17 UTC (rev 8871)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2006 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps.filter;
+
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+/**
+ * JUnit test class for the class {@link RunLengthFilter}.
+ */
+public class TestRunLengthFilter extends TestCase {
+
+/**
+ * Unit test for encoding a small sequence of bytes.
+ * @throws PSFilterException for input errors.
+ */
+public void testEncode() throws PSFilterException {
+ /* The input is a run of one byte, then two bytes, then three bytes, then
+ * four bytes, then five bytes. The sequence is (in bytes, not chars)
+ * "ABBCCCDDDDEEEEE". */
+ final byte[] testInput = new byte[] {0x41, 0x42, 0x42, 0x43, 0x43, 0x43,
+ 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45};
+ /* The expected output starts with a run of 3 intact bytes, followed by a
+ * run of 3 duplicated bytes, followed by a run of 4 duplicated bytes,
+ * followed by a run of 5 duplicated bytes. */
+ final byte[] expectedOutput = new byte[] {
+ /* The first run. */
+ 0x02, 0x41, 0x42, 0x42,
+ /* The second run. */
+ (byte) (257 - 3), 0x43,
+ /* The third run. */
+ (byte) (257 - 4), 0x44,
+ /* The fourth run. */
+ (byte) 257 - 5, 0x45,
+ /* The "I am done" byte. */
+ (byte) 128};
+ final ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ final RunLengthFilter filter = new RunLengthFilter(stream);
+ filter.encode(testInput);
+ final byte[] output = stream.toByteArray();
+ assertTrue(Arrays.equals(expectedOutput, output));
+}
+
+}
Property changes on: trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthFilter.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/RunLengthEncodeOutputStream.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/RunLengthEncodeOutputStream.java 2007-03-16 00:06:35 UTC (rev 8870)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/RunLengthEncodeOutputStream.java 2007-03-16 02:48:17 UTC (rev 8871)
@@ -28,39 +28,22 @@
package org.foray.render.ps;
+import org.foray.ps.filter.PSFilterException;
+import org.foray.ps.filter.RunLengthFilter;
+
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* This class applies a RunLengthEncode filter to the stream.
- *
- * TODO: This class needs to be converted to
- * org.foray.ps.filter.RunLengthFilter and then this class should be deprecated.
- *
- * @author <a href="mailto:sm...@ge...">Stephen Wolke</a>
*/
-
public class RunLengthEncodeOutputStream extends FilterOutputStream
implements Finalizable {
- /* TODO: Most of this logic belongs in the PostScript module, with the
- * filter. */
- private static final int QTY_START_SEQUENCE_HEADER_BYTES = 3;
- private static final int MAX_SEQUENCE_COUNT = 127;
- private static final int END_OF_DATA = 128;
- private static final int BYTE_MAX = 256;
+ /** The filter used to filter the content before it is written. */
+ private RunLengthFilter filter;
- private static final int NOT_IDENTIFY_SEQUENCE = 0;
- private static final int START_SEQUENCE = 1;
- private static final int IN_SEQUENCE = 2;
- private static final int NOT_IN_SEQUENCE = 3;
-
- private int runCount = 0;
- private int isSequence = NOT_IDENTIFY_SEQUENCE;
- private byte[] runBuffer = new byte[MAX_SEQUENCE_COUNT + 1];
-
-
/**
* Constructor for the RunLengthEncode Filter.
*
@@ -68,151 +51,50 @@
*/
public RunLengthEncodeOutputStream(final OutputStream out) {
super(out);
+ this.filter = new RunLengthFilter(out);
}
-
/**
- * Writes a byte.
- * @see java.io.OutputStream#write(int)
- * @param b the <code>byte</code>.
- * @exception IOException if an I/O error occurs. In particular,
- * an <code>IOException</code> may be thrown if the
- * output stream has been closed.
+ * {@inheritDoc}
*/
- public void write(final byte b) throws IOException {
- this.runBuffer[this.runCount] = b;
-
- switch (this.runCount) {
- case 0:
- this.runCount = 0;
- this.isSequence = NOT_IDENTIFY_SEQUENCE;
- this.runCount++;
- break;
- case 1:
- if (this.runBuffer[this.runCount]
- != this.runBuffer[this.runCount - 1]) {
- this.isSequence = NOT_IN_SEQUENCE;
- }
- this.runCount++;
- break;
- case 2:
- if (this.runBuffer[this.runCount]
- != this.runBuffer[this.runCount - 1]) {
- this.isSequence = NOT_IN_SEQUENCE;
+ public void write(final byte[] b) throws IOException {
+ byte[] output;
+ try {
+ output = this.filter.encode(b);
+ } catch (final PSFilterException e) {
+ if (e.getCause() instanceof IOException) {
+ throw (IOException) e.getCause();
} else {
- if (this.isSequence == NOT_IN_SEQUENCE) {
- this.isSequence = START_SEQUENCE;
- } else {
- isSequence = IN_SEQUENCE;
- }
+ throw new IOException(e.getMessage());
}
- this.runCount++;
- break;
- case MAX_SEQUENCE_COUNT:
- if (this.isSequence == IN_SEQUENCE) {
- out.write(BYTE_MAX - (MAX_SEQUENCE_COUNT - 1));
- out.write(this.runBuffer[this.runCount - 1]);
- this.runBuffer[0] = this.runBuffer[this.runCount];
- this.runCount = 1;
- } else {
- out.write(MAX_SEQUENCE_COUNT);
- out.write(this.runBuffer, 0, this.runCount + 1);
- this.runCount = 0;
- }
- this.isSequence = NOT_IDENTIFY_SEQUENCE;
- break;
- default:
- switch (this.isSequence) {
- case IN_SEQUENCE:
- if (this.runBuffer[this.runCount]
- != this.runBuffer[this.runCount - 1]) {
- out.write(BYTE_MAX - (this.runCount - 1));
- out.write(this.runBuffer[this.runCount - 1]);
- this.runBuffer[0] = this.runBuffer[this.runCount];
- this.runCount = 1;
- this.isSequence = NOT_IDENTIFY_SEQUENCE;
- break;
- }
- this.runCount++;
- break;
- case NOT_IN_SEQUENCE:
- if (this.runBuffer[this.runCount]
- == this.runBuffer[this.runCount - 1]) {
- this.isSequence = START_SEQUENCE;
- }
- this.runCount++;
- break;
- case START_SEQUENCE:
- if (this.runBuffer[this.runCount]
- == this.runBuffer[this.runCount - 1]) {
- out.write(this.runCount - QTY_START_SEQUENCE_HEADER_BYTES);
- out.write(this.runBuffer, 0, this.runCount - 2);
- this.runBuffer[0] = this.runBuffer[this.runCount];
- this.runBuffer[1] = this.runBuffer[this.runCount];
- this.runBuffer[2] = this.runBuffer[this.runCount];
- this.runCount = QTY_START_SEQUENCE_HEADER_BYTES;
- this.isSequence = IN_SEQUENCE;
- break;
- }
- this.isSequence = NOT_IN_SEQUENCE;
- this.runCount++;
- break;
- }
}
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void write(final byte[] b)
- throws IOException {
-
+ this.write(output);
for (int i = 0; i < b.length; i++) {
this.write(b[i]);
}
}
-
/**
* {@inheritDoc}
*/
- public void write(final byte[] b, final int off, final int len)
- throws IOException {
-
- for (int i = 0; i < len; i++) {
- this.write(b[off + i]);
- }
+ public void write(final int b) throws IOException {
+ this.filter.encode((byte) b);
}
-
/**
* Flushes the the stream and writes out the trailer, but, unlike close(),
* without closing the stream.
*
* @exception IOException if an I/O error occurs.
*/
- public void finalizeStream()
- throws IOException {
- switch (this.isSequence) {
- case IN_SEQUENCE:
- out.write(BYTE_MAX - (this.runCount - 1));
- out.write(this.runBuffer[this.runCount - 1]);
- break;
- default:
- out.write(this.runCount - 1);
- out.write(this.runBuffer, 0, this.runCount);
- }
-
- out.write(END_OF_DATA);
-
+ public void finalizeStream() throws IOException {
+ this.filter.flushEncode();
flush();
if (out instanceof Finalizable) {
((Finalizable) out).finalizeStream();
}
}
-
/**
* Closes the stream.
*
@@ -225,4 +107,3 @@
}
}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-16 13:56:36
|
Revision: 8872
http://svn.sourceforge.net/foray/?rev=8872&view=rev
Author: victormote
Date: 2007-03-16 06:56:31 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
1. Move the PS filters toward subclassing the standard Java filter streams.
2. Remove one filter class from the Renderer package.
Modified Paths:
--------------
trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthFilter.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
Removed Paths:
-------------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthFilter.java
trunk/foray/foray-render/src/java/org/foray/render/ps/RunLengthEncodeOutputStream.java
Added: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java 2007-03-16 13:56:31 UTC (rev 8872)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy: victormote $
+ */
+
+/*
+ * Known contributors:
+ * Eric SCHAEFFER,
+ * Kelly A. Campbell
+ */
+
+package org.foray.ps.filter;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FilterOutputStream;
+import java.io.OutputStream;
+
+/**
+ * A PostScript filter object.
+ */
+public abstract class PSEncodeFilter extends FilterOutputStream {
+
+ /** Tracks whether this filter has already been applied to the data. */
+ private boolean applied = false;
+
+ /**
+ * Constructor.
+ * @param outputStream The underlying output stream to which the encoded
+ * data should be written.
+ * Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
+ * needed in a byte array instead of being written to an actual stream.
+ */
+ public PSEncodeFilter(final OutputStream outputStream) {
+ super(outputStream);
+ }
+
+ /**
+ * Indicates whether this filter has already been applied to the input.
+ * @return True iff this filter has already been applied to the input.
+ */
+ public boolean isApplied() {
+ return this.applied;
+ }
+
+ /**
+ * Set the applied attribute to the given value. This attribute is
+ * used to determine if this filter is just a placeholder for the
+ * decodeparms and dictionary entries, or if the filter needs to
+ * actually encode the data. For example if the raw data is copied
+ * out of an image file in it's compressed format, then this
+ * should be set to true and the filter options should be set to
+ * those which the raw data was encoded with.
+ * @param b The new "applied" value.
+ */
+ public void setApplied(final boolean b) {
+ this.applied = b;
+ }
+
+ /**
+ * Return a PostScript name representation of the filter, e.g. /FlateEncode.
+ * @return A PostScript name representation of the filter.
+ */
+ public abstract String getName();
+
+ /**
+ * Return a parameter dictionary for this filter, or null if there is
+ * none.
+ * @return The parameter dictionary for this filter.
+ */
+ public abstract String getDecodeParms();
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java 2007-03-16 13:56:31 UTC (rev 8872)
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+/*
+ * Known contributors:
+ * Original author: Stephen Wolke (mailto:sm...@ge...)
+ */
+
+package org.foray.ps.filter;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Acts as either a RunLengthEncode Filter or a RunLengthDecode filter.
+ */
+public class RunLengthEncodeFilter extends PSEncodeFilter {
+
+ /** The number of bytes necessary to know before we know whether we have
+ * a sequence or not. */
+ private static final int QTY_START_SEQUENCE_HEADER_BYTES = 3;
+
+ /** The maximum number of bytes that can be encoded in one run. */
+ private static final int MAX_SEQUENCE_COUNT = 127;
+
+ /** The end-of-data marker. */
+ private static final int END_OF_DATA = 128;
+
+ /** The maximum number of values that can be encoded in one byte. */
+ private static final int BYTE_MAX = 256;
+
+ /** Status indicator: we don't know whether in a sequence or not. */
+ private static final int NOT_IDENTIFY_SEQUENCE = 0;
+
+ /** Status indicator: we are at the start of a sequence. */
+ private static final int START_SEQUENCE = 1;
+
+ /** Status indicator: we are in a sequence. */
+ private static final int IN_SEQUENCE = 2;
+
+ /** Status indicator: we are not in a sequence. */
+ private static final int NOT_IN_SEQUENCE = 3;
+
+ /** The number of bytes in the current run. */
+ private int runCount = 0;
+
+ /** The current status of the processed data. */
+ private int isSequence = NOT_IDENTIFY_SEQUENCE;
+
+ /** The buffer in which the runs are accumulated. */
+ private byte[] runBuffer = new byte[MAX_SEQUENCE_COUNT + 1];
+
+ /**
+ * Constructor.
+ * @param encodeStream The output stream to which the encoded data should
+ * be written.
+ */
+ public RunLengthEncodeFilter(final OutputStream encodeStream) {
+ super(encodeStream);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return "/RunLengthEncode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDecodeParms() {
+ return null;
+ }
+
+ /**
+ * Encodes one byte, writing what it can to the output buffer.
+ * @param b The unencoded byte.
+ * @throws IOException For error writing to output stream.
+ */
+ public void write(final int b) throws IOException {
+ this.runBuffer[this.runCount] = (byte) b;
+
+ switch (this.runCount) {
+ case 0:
+ this.runCount = 0;
+ this.isSequence = NOT_IDENTIFY_SEQUENCE;
+ this.runCount++;
+ break;
+ case 1:
+ if (this.runBuffer[this.runCount]
+ != this.runBuffer[this.runCount - 1]) {
+ this.isSequence = NOT_IN_SEQUENCE;
+ }
+ this.runCount++;
+ break;
+ case 2:
+ if (this.runBuffer[this.runCount]
+ != this.runBuffer[this.runCount - 1]) {
+ this.isSequence = NOT_IN_SEQUENCE;
+ } else {
+ if (this.isSequence == NOT_IN_SEQUENCE) {
+ this.isSequence = START_SEQUENCE;
+ } else {
+ isSequence = IN_SEQUENCE;
+ }
+ }
+ this.runCount++;
+ break;
+ case MAX_SEQUENCE_COUNT:
+ if (this.isSequence == IN_SEQUENCE) {
+ out.write(BYTE_MAX - (MAX_SEQUENCE_COUNT - 1));
+ out.write(this.runBuffer[this.runCount - 1]);
+ this.runBuffer[0] = this.runBuffer[this.runCount];
+ this.runCount = 1;
+ } else {
+ out.write(MAX_SEQUENCE_COUNT);
+ out.write(this.runBuffer, 0, this.runCount + 1);
+ this.runCount = 0;
+ }
+ this.isSequence = NOT_IDENTIFY_SEQUENCE;
+ break;
+ default:
+ switch (this.isSequence) {
+ case IN_SEQUENCE:
+ if (this.runBuffer[this.runCount]
+ != this.runBuffer[this.runCount - 1]) {
+ out.write(BYTE_MAX - (this.runCount - 1));
+ out.write(this.runBuffer[this.runCount - 1]);
+ this.runBuffer[0] = this.runBuffer[this.runCount];
+ this.runCount = 1;
+ this.isSequence = NOT_IDENTIFY_SEQUENCE;
+ break;
+ }
+ this.runCount++;
+ break;
+ case NOT_IN_SEQUENCE:
+ if (this.runBuffer[this.runCount]
+ == this.runBuffer[this.runCount - 1]) {
+ this.isSequence = START_SEQUENCE;
+ }
+ this.runCount++;
+ break;
+ case START_SEQUENCE:
+ if (this.runBuffer[this.runCount]
+ == this.runBuffer[this.runCount - 1]) {
+ out.write(this.runCount - QTY_START_SEQUENCE_HEADER_BYTES);
+ out.write(this.runBuffer, 0, this.runCount - 2);
+ this.runBuffer[0] = this.runBuffer[this.runCount];
+ this.runBuffer[1] = this.runBuffer[this.runCount];
+ this.runBuffer[2] = this.runBuffer[this.runCount];
+ this.runCount = QTY_START_SEQUENCE_HEADER_BYTES;
+ this.isSequence = IN_SEQUENCE;
+ break;
+ }
+ this.isSequence = NOT_IN_SEQUENCE;
+ this.runCount++;
+ break;
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void flush() throws IOException {
+ switch (this.isSequence) {
+ case IN_SEQUENCE: {
+ out.write(BYTE_MAX - (this.runCount - 1));
+ out.write(this.runBuffer[this.runCount - 1]);
+ break;
+ }
+ default: {
+ out.write(this.runCount - 1);
+ out.write(this.runBuffer, 0, this.runCount);
+ }
+ }
+ out.write(END_OF_DATA);
+ super.flush();
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Deleted: trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthFilter.java 2007-03-16 02:48:17 UTC (rev 8871)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthFilter.java 2007-03-16 13:56:31 UTC (rev 8872)
@@ -1,242 +0,0 @@
-/*
- * Copyright 2007 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-/*
- * Known contributors:
- * Original author: Stephen Wolke (mailto:sm...@ge...)
- */
-
-package org.foray.ps.filter;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * Acts as either a RunLengthEncode Filter or a RunLengthDecode filter.
- */
-public class RunLengthFilter extends PSFilter {
-
- /** The number of bytes necessary to know beforew we know whether we have
- * a sequence or not. */
- private static final int QTY_START_SEQUENCE_HEADER_BYTES = 3;
-
- /** The maximum number of bytes that can be encoded in one run. */
- private static final int MAX_SEQUENCE_COUNT = 127;
-
- /** The end-of-data marker. */
- private static final int END_OF_DATA = 128;
-
- /** The maximum number of values that can be encoded in one byte. */
- private static final int BYTE_MAX = 256;
-
- /** Status indicator: we don't know whether in a sequence or not. */
- private static final int NOT_IDENTIFY_SEQUENCE = 0;
-
- /** Status indicator: we are at the start of a sequence. */
- private static final int START_SEQUENCE = 1;
-
- /** Status indicator: we are in a sequence. */
- private static final int IN_SEQUENCE = 2;
-
- /** Status indicator: we are not in a sequence. */
- private static final int NOT_IN_SEQUENCE = 3;
-
- /** The number of bytes in the current run. */
- private int runCount = 0;
-
- /** The current status of the processed data. */
- private int isSequence = NOT_IDENTIFY_SEQUENCE;
-
- /** The buffer in which the runs are accumulated. */
- private byte[] runBuffer = new byte[MAX_SEQUENCE_COUNT + 1];
-
- /** The "output stream" to which the encoded data is written as it is
- * encoded. This is eventually dumped as a byte array. */
- private OutputStream encodeStream = new ByteArrayOutputStream();
-
- /**
- * Constructor.
- * @param encodeStream The output stream to which the encoded data should
- * be written.
- */
- public RunLengthFilter(final OutputStream encodeStream) {
- this.encodeStream = encodeStream;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return "/RunLengthDecode";
- }
-
- /**
- * {@inheritDoc}
- */
- public String getDecodeParms() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public byte[] encode(final byte[] data) throws PSFilterException {
- try {
- for (int i = 0; i < data.length; i++) {
- this.encode(data[i]);
- }
- } catch (final IOException e) {
- throw new PSFilterException(e);
- }
- try {
- flushEncode();
- } catch (final IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public byte[] decode(final byte[] input) {
- /* TODO: Implement this. */
- return input;
- }
-
- /**
- * Encodes one byte, writing what it can to the output buffer.
- * @param b The unencoded byte.
- * @throws IOException For error writing to output stream.
- */
- public void encode(final byte b) throws IOException {
- this.runBuffer[this.runCount] = b;
-
- switch (this.runCount) {
- case 0:
- this.runCount = 0;
- this.isSequence = NOT_IDENTIFY_SEQUENCE;
- this.runCount++;
- break;
- case 1:
- if (this.runBuffer[this.runCount]
- != this.runBuffer[this.runCount - 1]) {
- this.isSequence = NOT_IN_SEQUENCE;
- }
- this.runCount++;
- break;
- case 2:
- if (this.runBuffer[this.runCount]
- != this.runBuffer[this.runCount - 1]) {
- this.isSequence = NOT_IN_SEQUENCE;
- } else {
- if (this.isSequence == NOT_IN_SEQUENCE) {
- this.isSequence = START_SEQUENCE;
- } else {
- isSequence = IN_SEQUENCE;
- }
- }
- this.runCount++;
- break;
- case MAX_SEQUENCE_COUNT:
- if (this.isSequence == IN_SEQUENCE) {
- encodeStream.write(BYTE_MAX - (MAX_SEQUENCE_COUNT - 1));
- encodeStream.write(this.runBuffer[this.runCount - 1]);
- this.runBuffer[0] = this.runBuffer[this.runCount];
- this.runCount = 1;
- } else {
- encodeStream.write(MAX_SEQUENCE_COUNT);
- encodeStream.write(this.runBuffer, 0, this.runCount + 1);
- this.runCount = 0;
- }
- this.isSequence = NOT_IDENTIFY_SEQUENCE;
- break;
- default:
- switch (this.isSequence) {
- case IN_SEQUENCE:
- if (this.runBuffer[this.runCount]
- != this.runBuffer[this.runCount - 1]) {
- encodeStream.write(BYTE_MAX - (this.runCount - 1));
- encodeStream.write(this.runBuffer[this.runCount - 1]);
- this.runBuffer[0] = this.runBuffer[this.runCount];
- this.runCount = 1;
- this.isSequence = NOT_IDENTIFY_SEQUENCE;
- break;
- }
- this.runCount++;
- break;
- case NOT_IN_SEQUENCE:
- if (this.runBuffer[this.runCount]
- == this.runBuffer[this.runCount - 1]) {
- this.isSequence = START_SEQUENCE;
- }
- this.runCount++;
- break;
- case START_SEQUENCE:
- if (this.runBuffer[this.runCount]
- == this.runBuffer[this.runCount - 1]) {
- encodeStream.write(
- this.runCount - QTY_START_SEQUENCE_HEADER_BYTES);
- encodeStream.write(this.runBuffer, 0, this.runCount - 2);
- this.runBuffer[0] = this.runBuffer[this.runCount];
- this.runBuffer[1] = this.runBuffer[this.runCount];
- this.runBuffer[2] = this.runBuffer[this.runCount];
- this.runCount = QTY_START_SEQUENCE_HEADER_BYTES;
- this.isSequence = IN_SEQUENCE;
- break;
- }
- this.isSequence = NOT_IN_SEQUENCE;
- this.runCount++;
- break;
- }
- }
-
- }
-
- /**
- * Writes any unwritten data in the encoding buffer.
- * @throws IOException For errors writing to the output stream.
- */
- public void flushEncode() throws IOException {
- switch (this.isSequence) {
- case IN_SEQUENCE:
- encodeStream.write(BYTE_MAX - (this.runCount - 1));
- encodeStream.write(this.runBuffer[this.runCount - 1]);
- break;
- default:
- encodeStream.write(this.runCount - 1);
- encodeStream.write(this.runBuffer, 0, this.runCount);
- }
-
- encodeStream.write(END_OF_DATA);
-
- }
-
-}
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthFilter.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthFilter.java 2007-03-16 02:48:17 UTC (rev 8871)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthFilter.java 2007-03-16 13:56:31 UTC (rev 8872)
@@ -29,20 +29,21 @@
package org.foray.ps.filter;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.util.Arrays;
import junit.framework.TestCase;
/**
- * JUnit test class for the class {@link RunLengthFilter}.
+ * JUnit test class for the class {@link RunLengthEncodeFilter}.
*/
public class TestRunLengthFilter extends TestCase {
/**
* Unit test for encoding a small sequence of bytes.
- * @throws PSFilterException for input errors.
+ * @throws IOException For filter writing errors.
*/
-public void testEncode() throws PSFilterException {
+public void testEncode() throws IOException {
/* The input is a run of one byte, then two bytes, then three bytes, then
* four bytes, then five bytes. The sequence is (in bytes, not chars)
* "ABBCCCDDDDEEEEE". */
@@ -63,8 +64,9 @@
/* The "I am done" byte. */
(byte) 128};
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
- final RunLengthFilter filter = new RunLengthFilter(stream);
- filter.encode(testInput);
+ final RunLengthEncodeFilter filter = new RunLengthEncodeFilter(stream);
+ filter.write(testInput);
+ filter.flush();
final byte[] output = stream.toByteArray();
assertTrue(Arrays.equals(expectedOutput, output));
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2007-03-16 02:48:17 UTC (rev 8871)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2007-03-16 13:56:31 UTC (rev 8872)
@@ -36,6 +36,7 @@
import org.foray.common.WKConstants;
import org.foray.output.OutputConfig;
import org.foray.ps.FOrayBoundingBox;
+import org.foray.ps.filter.RunLengthEncodeFilter;
import org.foray.render.PrintRenderer;
import org.axsl.areaR.Area;
@@ -830,7 +831,7 @@
if (this.psLevel >= POSTSCRIPT_LEVEL_3) {
out = new FlateEncodeOutputStream(out);
} else {
- out = new RunLengthEncodeOutputStream(out);
+ out = new RunLengthEncodeFilter(out);
}
}
out.write(imgmap);
@@ -1302,7 +1303,7 @@
/**
* Returns the {@link PSFont} that should be used for a given
- * {@link FontUse} instance.
+ * {@link FontUse} instance.
* @param fontUse The font use for which a PSFont instance is needed.
* @return The PSFont.
*/
Deleted: trunk/foray/foray-render/src/java/org/foray/render/ps/RunLengthEncodeOutputStream.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/RunLengthEncodeOutputStream.java 2007-03-16 02:48:17 UTC (rev 8871)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/RunLengthEncodeOutputStream.java 2007-03-16 13:56:31 UTC (rev 8872)
@@ -1,109 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.render.ps;
-
-import org.foray.ps.filter.PSFilterException;
-import org.foray.ps.filter.RunLengthFilter;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * This class applies a RunLengthEncode filter to the stream.
- */
-public class RunLengthEncodeOutputStream extends FilterOutputStream
- implements Finalizable {
-
- /** The filter used to filter the content before it is written. */
- private RunLengthFilter filter;
-
- /**
- * Constructor for the RunLengthEncode Filter.
- *
- * @param out The OutputStream to write to
- */
- public RunLengthEncodeOutputStream(final OutputStream out) {
- super(out);
- this.filter = new RunLengthFilter(out);
- }
-
- /**
- * {@inheritDoc}
- */
- public void write(final byte[] b) throws IOException {
- byte[] output;
- try {
- output = this.filter.encode(b);
- } catch (final PSFilterException e) {
- if (e.getCause() instanceof IOException) {
- throw (IOException) e.getCause();
- } else {
- throw new IOException(e.getMessage());
- }
- }
- this.write(output);
- for (int i = 0; i < b.length; i++) {
- this.write(b[i]);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void write(final int b) throws IOException {
- this.filter.encode((byte) b);
- }
-
- /**
- * Flushes the the stream and writes out the trailer, but, unlike close(),
- * without closing the stream.
- *
- * @exception IOException if an I/O error occurs.
- */
- public void finalizeStream() throws IOException {
- this.filter.flushEncode();
- flush();
- if (out instanceof Finalizable) {
- ((Finalizable) out).finalizeStream();
- }
- }
-
- /**
- * Closes the stream.
- *
- * @exception IOException if an I/O error occurs.
- */
- public void close()
- throws IOException {
- finalizeStream();
- super.close();
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-16 14:31:18
|
Revision: 8875
http://svn.sourceforge.net/foray/?rev=8875&view=rev
Author: victormote
Date: 2007-03-16 07:31:08 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
Move the flate encoder to PS, and make it extend PSEncodeFilter.
Modified Paths:
--------------
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
Removed Paths:
-------------
trunk/foray/foray-render/src/java/org/foray/render/ps/FlateEncodeOutputStream.java
Added: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2007-03-16 14:31:08 UTC (rev 8875)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy: victormote $
+ */
+
+package org.foray.ps.filter;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.zip.DeflaterOutputStream;
+
+/**
+ * This class applies a FlateEncode filter to the stream.
+ */
+public class FlateEncodeFilter extends PSEncodeFilter {
+
+ /** The wrapped output stream, not to be confused with the underlying
+ * output stream. This class passes all output to the deflater stream to
+ * do the real work. */
+ private DeflaterOutputStream deflaterOutputStream;
+
+ /**
+ * Constructor.
+ * @param outputStream The underlying output stream to which the encoded
+ * data should be written.
+ * Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
+ * needed in a byte array instead of being written to an actual stream.
+ */
+ public FlateEncodeFilter(final OutputStream outputStream) {
+ super(outputStream);
+ this.deflaterOutputStream = new DeflaterOutputStream(outputStream);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return "FlateEncode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDecodeParms() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void write(final int b) throws IOException {
+ this.deflaterOutputStream.write(b);
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Deleted: trunk/foray/foray-render/src/java/org/foray/render/ps/FlateEncodeOutputStream.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/FlateEncodeOutputStream.java 2007-03-16 14:11:38 UTC (rev 8874)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/FlateEncodeOutputStream.java 2007-03-16 14:31:08 UTC (rev 8875)
@@ -1,62 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.render.ps;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.zip.DeflaterOutputStream;
-
-/**
- * This class applies a FlateEncode filter to the stream. It is basically the
- * normal DeflaterOutputStream except now conformi
- *
- * TODO: This class needs to be deprecated in favor of
- * org.foray.ps.filter.FlateFilter. Make sure any features in this class
- * are merged into that one.
- *
- * @author Jeremias Maerki
- */
-public class FlateEncodeOutputStream extends DeflaterOutputStream
- implements Finalizable {
-
-
- public FlateEncodeOutputStream(final OutputStream out) {
- super(out);
- }
-
-
- public void finalizeStream() throws IOException {
- finish();
- flush();
- if (out instanceof Finalizable) {
- ((Finalizable) out).finalizeStream();
- }
- }
-
-}
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2007-03-16 14:11:38 UTC (rev 8874)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2007-03-16 14:31:08 UTC (rev 8875)
@@ -36,6 +36,7 @@
import org.foray.common.WKConstants;
import org.foray.output.OutputConfig;
import org.foray.ps.FOrayBoundingBox;
+import org.foray.ps.filter.FlateEncodeFilter;
import org.foray.ps.filter.RunLengthEncodeFilter;
import org.foray.render.PrintRenderer;
@@ -829,7 +830,7 @@
//nop
} else {
if (this.psLevel >= POSTSCRIPT_LEVEL_3) {
- out = new FlateEncodeOutputStream(out);
+ out = new FlateEncodeFilter(out);
} else {
out = new RunLengthEncodeFilter(out);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-16 17:27:20
|
Revision: 8879
http://svn.sourceforge.net/foray/?rev=8879&view=rev
Author: victormote
Date: 2007-03-16 10:27:10 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
Add method to return the name of the reciprocal filter.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2007-03-16 17:13:22 UTC (rev 8878)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2007-03-16 17:27:10 UTC (rev 8879)
@@ -76,6 +76,13 @@
}
/**
+ * {@inheritDoc}
+ */
+ public String getDecodeName() {
+ return "";
+ }
+
+ /**
* Return a parameter dictionary for this filter, or null.
* @return The parameter dictionary. In this case, null.
*/
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-16 17:13:22 UTC (rev 8878)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-16 17:27:10 UTC (rev 8879)
@@ -271,7 +271,7 @@
final PSEncodeFilter filter = filters.get(i);
filter.setApplied(true);
// place the names in our local List in reverse order
- names.add(0, filter.getName());
+ names.add(0, filter.getDecodeName());
parms.add(0, filter.getDecodeParms());
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2007-03-16 17:13:22 UTC (rev 8878)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2007-03-16 17:27:10 UTC (rev 8879)
@@ -115,6 +115,13 @@
/**
* {@inheritDoc}
*/
+ public String getDecodeName() {
+ return "/ASCII85Decode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public String getDecodeParms() {
return null;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2007-03-16 17:13:22 UTC (rev 8878)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2007-03-16 17:27:10 UTC (rev 8879)
@@ -72,6 +72,13 @@
/**
* {@inheritDoc}
*/
+ public String getDecodeName() {
+ return "/ASCIIHexDecode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public String getDecodeParms() {
return null;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java 2007-03-16 17:13:22 UTC (rev 8878)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java 2007-03-16 17:27:10 UTC (rev 8879)
@@ -65,6 +65,13 @@
/**
* {@inheritDoc}
*/
+ public String getDecodeName() {
+ return "/CCITTFaxDecode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public String getDecodeParms() {
return this.decodeParms;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java 2007-03-16 17:13:22 UTC (rev 8878)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java 2007-03-16 17:27:10 UTC (rev 8879)
@@ -62,6 +62,13 @@
/**
* {@inheritDoc}
*/
+ public String getDecodeName() {
+ return "/DCTDecode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public String getDecodeParms() {
return null;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2007-03-16 17:13:22 UTC (rev 8878)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2007-03-16 17:27:10 UTC (rev 8879)
@@ -59,12 +59,19 @@
* {@inheritDoc}
*/
public String getName() {
- return "FlateEncode";
+ return "/FlateEncode";
}
/**
* {@inheritDoc}
*/
+ public String getDecodeName() {
+ return "/FlateDecode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public String getDecodeParms() {
return null;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java 2007-03-16 17:13:22 UTC (rev 8878)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java 2007-03-16 17:27:10 UTC (rev 8879)
@@ -80,6 +80,15 @@
public abstract String getName();
/**
+ * Return the PostScript name of the filter that should be used to decode
+ * content encoded by this filter.
+ * For example, if this filter is "/FlateEncode", this method should
+ * return "/FlateDecode".
+ * @return The name of the decode filter.
+ */
+ public abstract String getDecodeName();
+
+ /**
* Return a parameter dictionary for this filter, or null if there is
* none.
* @return The parameter dictionary for this filter.
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java 2007-03-16 17:13:22 UTC (rev 8878)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java 2007-03-16 17:27:10 UTC (rev 8879)
@@ -94,6 +94,13 @@
/**
* {@inheritDoc}
*/
+ public String getDecodeName() {
+ return "/RunLengthDecode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public String getDecodeParms() {
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-16 14:11:38
|
Revision: 8874
http://svn.sourceforge.net/foray/?rev=8874&view=rev
Author: victormote
Date: 2007-03-16 07:11:38 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
Rename some filter classes for clarity and consistency, and as a first step toward separating the encode and decode functions int separate classes.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestASCII85Filter.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateDecodeFilter.java
Removed Paths:
-------------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/CCITTFaxFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/DCTFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java 2007-03-16 13:57:58 UTC (rev 8873)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java 2007-03-16 14:11:38 UTC (rev 8874)
@@ -28,7 +28,7 @@
package org.foray.font.format;
-import org.foray.ps.filter.ASCIIHexFilter;
+import org.foray.ps.filter.AsciiHexEncodeFilter;
import org.foray.ps.filter.PSFilter;
import java.io.IOException;
@@ -163,8 +163,8 @@
return unEncoded;
}
case PSFilter.PSDATA_ASCII_HEX: {
- return ASCIIHexFilter.encodeArray(unEncoded, 0, unEncoded.length,
- Type1PFBFile.DEFAULT_LINE_LENGTH);
+ return AsciiHexEncodeFilter.encodeArray(unEncoded, 0,
+ unEncoded.length, Type1PFBFile.DEFAULT_LINE_LENGTH);
}
default: {
return null;
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-16 13:57:58 UTC (rev 8873)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-16 14:11:38 UTC (rev 8874)
@@ -28,9 +28,9 @@
package org.foray.pdf.object;
-import org.foray.ps.filter.ASCII85Filter;
-import org.foray.ps.filter.ASCIIHexFilter;
-import org.foray.ps.filter.FlateFilter;
+import org.foray.ps.filter.Ascii85EncodeFilter;
+import org.foray.ps.filter.AsciiHexEncodeFilter;
+import org.foray.ps.filter.FlateDecodeFilter;
import org.foray.ps.filter.PSFilter;
import org.foray.ps.filter.PSFilterException;
@@ -119,11 +119,11 @@
return;
}
if (filterType.equals("flate")) {
- addFilter(new FlateFilter());
+ addFilter(new FlateDecodeFilter());
} else if (filterType.equals("ascii-85")) {
- addFilter(new ASCII85Filter());
+ addFilter(new Ascii85EncodeFilter());
} else if (filterType.equals("ascii-hex")) {
- addFilter(new ASCIIHexFilter());
+ addFilter(new AsciiHexEncodeFilter());
} else if (filterType.equals("")) {
return;
} else {
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2007-03-16 13:57:58 UTC (rev 8873)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2007-03-16 14:11:38 UTC (rev 8874)
@@ -34,8 +34,8 @@
package org.foray.pdf.object;
-import org.foray.ps.filter.CCITTFaxFilter;
-import org.foray.ps.filter.DCTFilter;
+import org.foray.ps.filter.CcittFaxEncodeFilter;
+import org.foray.ps.filter.DctEncodeFilter;
import org.foray.ps.filter.PSFilter;
import org.axsl.graphicR.Graphic;
@@ -171,7 +171,7 @@
private PSFilter getFilter() throws GraphicException {
PSFilter filter = null;
if (graphic.getGraphicType() == Graphic.Type.JPEG) {
- filter = new DCTFilter();
+ filter = new DctEncodeFilter();
filter.setApplied(true);
return filter;
}
@@ -182,18 +182,18 @@
case UNCOMPRESSED:
return null;
case CCITT_GROUP_3:
- filter = new CCITTFaxFilter();
+ filter = new CcittFaxEncodeFilter();
filter.setApplied(true);
return filter;
case CCITT_GROUP_4:
- final CCITTFaxFilter ccf = new CCITTFaxFilter();
+ final CcittFaxEncodeFilter ccf = new CcittFaxEncodeFilter();
filter = ccf;
filter.setApplied(true);
ccf.setDecodeParms("<< /K -1 /Columns "
+ graphic.pixelWidth() + " >>");
return filter;
case JPEG:
- filter = new DCTFilter();
+ filter = new DctEncodeFilter();
filter.setApplied(true);
return filter;
default:
Deleted: trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java 2007-03-16 13:57:58 UTC (rev 8873)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java 2007-03-16 14:11:38 UTC (rev 8874)
@@ -1,234 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.ps.filter;
-
-import org.foray.common.WKConstants;
-
-import java.io.ByteArrayOutputStream;
-
-/**
- * Acts as either an ASCII85Encode Filter or an ASCII85Decode filter.
- * The ASCII base-85 encoding produces five ASCII characters for every four
- * bytes of binary data.
- */
-public class ASCII85Filter extends PSFilter {
-
- /** Mask needed during encoding. */
- private static final long MASK_BYTE_1 =
- ((long) WKConstants.MAX_8_BIT_UNSIGNED_INT)
- << WKConstants.SHIFT_3_BYTES;
-
- /** Mask needed during encoding. */
- private static final long MASK_BYTE_2 =
- ((long) WKConstants.MAX_8_BIT_UNSIGNED_INT)
- << WKConstants.SHIFT_2_BYTES;
-
- /** Mask needed during encoding. */
- private static final long MASK_BYTE_3 =
- ((long) WKConstants.MAX_8_BIT_UNSIGNED_INT)
- << WKConstants.SHIFT_1_BYTE;
-
- /** Mask needed during encoding. */
- private static final long MASK_BYTE_4 = WKConstants.MAX_8_BIT_UNSIGNED_INT;
-
- /** The minimum encoded value in a byte. */
- private static final byte MINIMUM_ENCODED_VALUE = 33;
-
- /** The maximum encoded value in a byte. */
- private static final byte MAXIMUM_ENCODED_VALUE = 117;
-
- /** Constant specified in the PostScript standard indicating five
- * consecutive encoded zeroes. */
- private static final char ASCII85_ZERO = 'z';
-
- /** Constant specified in the PostScript standard indicating the value added
- * to all encoded binary data to ensure that they are ASCII characters. */
- private static final char ASCII85_START = '!';
-
- /** End-of-data marker specified in the PostScript standard, that is,
- * "~>". */
- private static final byte[] ASCII85_EOD = { 0x7E, 0x3E };
-
- /** The radix in which Base-85 numbers are stored. */
- private static final long BASE_85_4 = 85;
-
- /** The size, in bytes, of each unencoded block (4 unencoded bytes are
- * equal to 5 encoded bytes). */
- private static final byte UNENCODED_BLOCK_SIZE = 4;
-
- /** The size, in bytes, of each encoded block (4 unencoded bytes are
- * equal to 5 encoded bytes). */
- private static final byte ENCODED_BLOCK_SIZE = 5;
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return "/ASCII85Decode";
- }
-
- /**
- * {@inheritDoc}
- */
- public String getDecodeParms() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public byte[] encode(final byte[] data) throws PSFilterException {
- final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- int i;
- byte[] unencodedBytes;
-
- // first encode the majority of the data
- // each 4 byte group becomes a 5 byte group
- for (i = 0; i + UNENCODED_BLOCK_SIZE <= data.length;
- i += UNENCODED_BLOCK_SIZE) {
- unencodedBytes = new byte[UNENCODED_BLOCK_SIZE];
- for (int j = 0; j < unencodedBytes.length; j++) {
- unencodedBytes[j] = data[i + j];
- }
- final long val = encodeAsLong(unencodedBytes);
- final byte[] conv = convertWord(val);
- buffer.write(conv, 0, conv.length);
- }
-
- // now take care of the trailing few bytes.
- // with n leftover bytes, we append 0 bytes to make a full group of 4
- // then convert like normal (except not applying the special zero rule)
- // and write out the first n+1 bytes from the result
- if (i < data.length) {
- final int n = data.length - i;
- unencodedBytes = new byte[UNENCODED_BLOCK_SIZE];
- for (int j = 0; j < unencodedBytes.length; j++) {
- if (j < n) {
- unencodedBytes[j] = data[i++];
- } else {
- unencodedBytes[j] = 0;
- }
- }
-
- final long val = encodeAsLong(unencodedBytes);
- byte[] conv = convertWord(val);
-
- // special rule for handling zeros at the end
- if (val == 0) {
- conv = new byte[ENCODED_BLOCK_SIZE];
- for (int j = 0; j < conv.length; j++) {
- conv[j] = (byte) '!';
- }
- }
- buffer.write(conv, 0, n + 1);
- }
- // finally write the two character end of data marker
- buffer.write(ASCII85Filter.ASCII85_EOD, 0,
- ASCII85Filter.ASCII85_EOD.length);
- final byte[] result = buffer.toByteArray();
- return result;
- }
-
- /**
- * Converts 4 bytes to a big-endian long.
- * @param bytes The bytes to be converted.
- * @return The long containing the 4 byte values.
- */
- protected static long encodeAsLong(final byte[] bytes) {
- if (bytes == null
- || bytes.length != UNENCODED_BLOCK_SIZE) {
- return -1;
- }
- int index = 0;
- final long byte1 = (((long) bytes[index]) << WKConstants.SHIFT_3_BYTES)
- & MASK_BYTE_1;
- index ++;
- final long byte2 = (((long) bytes[index]) << WKConstants.SHIFT_2_BYTES)
- & MASK_BYTE_2;
- index ++;
- final long byte3 = (((long) bytes[index]) << WKConstants.SHIFT_1_BYTE)
- & MASK_BYTE_3;
- index ++;
- final long byte4 = bytes[index] & MASK_BYTE_4;
- return byte1 + byte2 + byte3 + byte4;
- }
-
- /**
- * This converts a 32 bit value (4 bytes) into 5 bytes using base 85.
- * each byte in the result starts with zero at the '!' character so
- * the resulting base85 number fits into printable ascii chars
- * @param word the 32 bit unsigned (hence the long datatype) word
- * @return 5 bytes (or a single byte of the 'z' character for word
- * values of 0)
- * @throws PSFilterException If an illegal character is found in the input.
- */
- protected static byte[] convertWord(final long word)
- throws PSFilterException {
- long wordMasked = word & 0xffffffff;
- if (wordMasked < 0) {
- wordMasked = -wordMasked;
- }
- if (wordMasked == 0) {
- final byte[] result = { (byte) ASCII85Filter.ASCII85_ZERO };
- return result;
- }
- final byte c5 = (byte) ((wordMasked % ASCII85Filter.BASE_85_4)
- + ASCII85Filter.ASCII85_START);
- wordMasked = wordMasked / ASCII85Filter.BASE_85_4;
- final byte c4 = (byte) ((wordMasked % ASCII85Filter.BASE_85_4)
- + ASCII85Filter.ASCII85_START);
- wordMasked = wordMasked / ASCII85Filter.BASE_85_4;
- final byte c3 = (byte) ((wordMasked % ASCII85Filter.BASE_85_4)
- + ASCII85Filter.ASCII85_START);
- wordMasked = wordMasked / ASCII85Filter.BASE_85_4;
- final byte c2 = (byte) ((wordMasked % ASCII85Filter.BASE_85_4)
- + ASCII85Filter.ASCII85_START);
- wordMasked = wordMasked / ASCII85Filter.BASE_85_4;
- final byte c1 = (byte) ((wordMasked % ASCII85Filter.BASE_85_4)
- + ASCII85Filter.ASCII85_START);
-
- final byte[] ret = { c1 , c2, c3, c4, c5 };
- for (int i = 0; i < ret.length; i++) {
- if (ret[i] < MINIMUM_ENCODED_VALUE
- || ret[i] > MAXIMUM_ENCODED_VALUE) {
- throw new PSFilterException("ASCII85 Filter: Illegal char "
- + "value " + new Integer(ret[i]));
- }
- }
- return ret;
- }
-
- /**
- * {@inheritDoc}
- */
- public byte[] decode(final byte[] input) {
- /* TODO: Implement this. */
- return input;
- }
-
-}
Deleted: trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java 2007-03-16 13:57:58 UTC (rev 8873)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java 2007-03-16 14:11:38 UTC (rev 8874)
@@ -1,291 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.ps.filter;
-
-import org.foray.common.StringUtil;
-import org.foray.common.WKConstants;
-
-import java.io.UnsupportedEncodingException;
-
-/**
- * A class that can act as either an ASCIIHexEncode Filter or an ASCIIHexDecode
- * filter. The static methods are suitable for direct encoding and decoding of
- * entire arrays. The instance methods are suitable for processing smaller array
- * chunks. So, for example, if you have a 1GB file that you wish to process in
- * 1KB chunks, the instance methods will help you do that.
- */
-public class ASCIIHexFilter extends PSFilter {
-
- /** End-of-data marker specified in the PostScript standard. */
- public static final byte END_OF_DATA = 0x3E;
-
- /**
- * Stores exactly one meaningful leftover byte from the end of the last
- * chunk processed that needs to be included in the next chunk to be
- * processed.
- */
- private byte leftoverByte = -1;
-
- /**
- * For decoding, stores the location of the end-of-data marker. If -1,
- * then eod has not yet been found.
- */
- private int eodLocation = -1;
-
- /**
- * Default constructor.
- */
- public ASCIIHexFilter() {
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return "/ASCIIHexDecode";
- }
-
- /**
- * {@inheritDoc}
- */
- public String getDecodeParms() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public byte[] encode(final byte[] data) {
- final byte[] tentative = ASCIIHexFilter.encodeArray(data, 0,
- data.length, -1);
- final byte[] returnArray = new byte[tentative.length + 1];
- System.arraycopy(tentative, 0, returnArray, 0, tentative.length);
- returnArray[returnArray.length - 1] = ASCIIHexFilter.END_OF_DATA;
- return returnArray;
- }
-
- /**
- * {@inheritDoc}
- */
- public byte[] decode(final byte[] input) throws PSFilterException {
- if (this.eodLocation > -1) {
- return null;
- }
- // Save the leftover byte
- final byte savedLeftoverByte = this.leftoverByte;
- int dataBytes = 0;
- if (this.leftoverByte > -1) {
- dataBytes++;
- }
- /*
- * Scan the input, looking for end-of-data character & counting data
- * bytes.
- */
- for (int i = 0; i < input.length && this.eodLocation < 0; i ++) {
- if (input[i] == ASCIIHexFilter.END_OF_DATA) {
- this.eodLocation = i;
- break;
- }
- dataBytes += countDataBytes(input[i]);
- }
- int outputLength = dataBytes / 2; // truncate any remainder
-
- this.leftoverByte = -1;
- if (dataBytes % 2 != 0) {
- // If we are at the end-of-data, make room for the zero-filled byte
- if (this.eodLocation > -1) {
- outputLength += 1;
- } else {
- // Otherwise, count backward from the end of the array to find
- // the leftovers
- for (int i = input.length - 1;
- i > 0 && this.leftoverByte < 1; i++) {
- if (countDataBytes(input[i]) == 1) {
- this.leftoverByte = input[i];
- }
- }
- }
- }
- return decodeArray(savedLeftoverByte, input, input.length,
- outputLength);
- }
-
- /**
- * Encodes the input array, starting at start and extending to byte
- * inputLength, and returns the output in a byte array.
- * @param input The input byte array.
- * @param start The first byte in input to be encoded.
- * @param size The number of bytes in input that should be encoded.
- * @param lineBreak The number of bytes to write before a line-feed should
- * be written.
- * Adding a line-feed at regular intervals breaks the output into smaller
- * chunks.
- * For example, Adobe Type1 font files in the PFA format place a line
- * break after every 72nd character in the output.
- * Any value less than 1 will result in no line-feeds being added.
- * @return The output byte array.
- * This array should be approximately twice the size of the size parameter.
- * Whitespace characters may be added to the output, so it may be somewhat
- * larger.
- */
- public static byte[] encodeArray(final byte[] input, final int start,
- final int size, final int lineBreak) {
- if (input == null || input.length < 1) {
- return null;
- }
- if (start < 0 || size < 0) {
- return null;
- }
- if (start + size > input.length) {
- return null;
- }
- final StringBuffer buffer = new StringBuffer();
- int lastLineBreak = 0;
- for (int i = start; i < start + size; i++) {
- final int val = input[i] & WKConstants.MAX_8_BIT_UNSIGNED_INT;
- if (val < WKConstants.MAX_4_BIT_UNSIGNED_VALUES) {
- buffer.append("0");
- }
- buffer.append(Integer.toHexString(val));
- if (lineBreak > 0) {
- if (buffer.length() >= lastLineBreak + lineBreak) {
- /* Append a line-feed. */
- buffer.append('\n');
- lastLineBreak = buffer.length();
- }
- }
- }
- buffer.append('\n');
- try {
- return buffer.toString().getBytes("US-ASCII");
- } catch (final UnsupportedEncodingException ue) {
- return buffer.toString().getBytes();
- }
- }
-
- /**
- * Decodes the input array, starting at byte 0 and extending to byte
- * inputLength, and returns the output in a byte array. Handles possible
- * leftover byte from a previous run.
- * @param leftoverByte The byte, if any, leftover from processing a
- * previous chunk. If there is no leftover byte, enter any negative number
- * to skip processing.
- * @param input The input byte array. This first byte of this array must
- * never be the second byte of a 2-byte "word".
- * @param inputLength The last byte of the input byte array that should be
- * examined for purposes of creating the output byte array.
- * @param outputLength The size that the output array should be.
- * @return The output byte array. It should be approximately 1/2 the size
- * of the input array (whitespace characters in the input are ignored, so it
- * may be somewhat less than 1/2 the size of the input array). Please note
- * that this routine ignores any incomplete "words" in the input.
- * @throws PSFilterException If the input array contains invalid ASCIIHex
- * characters.
- */
- public static byte[] decodeArray(final byte leftoverByte,
- final byte[] input, final int inputLength, final int outputLength)
- throws PSFilterException {
- if (outputLength < 1) {
- return null;
- }
- if (inputLength < 1) {
- return null;
- }
- final byte[] output = new byte[outputLength];
- int outputIndex = 0;
- byte byte1 = 0x00;
- byte byte2 = 0x00;
- boolean byte1Found = false;
- boolean byte2Found = false;
- // If there is a valid leftoverByte, start the processing with it.
- if (leftoverByte > -1 && countDataBytes(leftoverByte) == 1) {
- byte1 = leftoverByte;
- byte1Found = true;
- }
- for (int i = 0; i < inputLength && outputIndex < outputLength; i ++) {
- if (input[i] == ASCIIHexFilter.END_OF_DATA) {
- break;
- }
- // Skip whitespace
- if (countDataBytes(input[i]) < 1) {
- continue;
- }
- if (byte1Found && byte2Found) {
- output[outputIndex] = StringUtil.asciiHexBytesToHex(byte1,
- byte2);
- outputIndex ++;
- byte1Found = false;
- byte2Found = false;
- }
- if (byte1Found) {
- byte2 = input[i];
- byte2Found = true;
- } else {
- byte1 = input[i];
- byte1Found = true;
- }
- }
- if (outputIndex < outputLength) {
- if (byte1Found) {
- if (! byte2Found) {
- byte2 = 0x00;
- }
- output[outputIndex] = StringUtil.asciiHexBytesToHex(byte1,
- byte2);
- }
- }
- return output;
- }
-
- /**
- * Counts the number of data bytes in a byte of ASCII-Hex encoded input.
- * @param inputByte The input byte.
- * @return The number of bytes of data in <code>inputByte</code>
- * @throws PSFilterException For illegal input (byte is not ASCII Hex or
- * whitespace).
- */
- private static int countDataBytes(final byte inputByte)
- throws PSFilterException {
- switch(inputByte) {
- case 0x00: // null
- case ' ': // space
- case '\t': // tab
- case '\r': // carriage return
- case '\n': // line feed
- case '\f': // form feed
- case ASCIIHexFilter.END_OF_DATA: // '>' (end-of-data marker)
- return 0;
- }
- if (StringUtil.isASCIIHex(inputByte)) {
- return 1;
- }
- throw new PSFilterException("Illegal input for ASCIIHexDecode Filter.");
- }
-
-}
Copied: trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java (from rev 8436, trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java)
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2007-03-16 14:11:38 UTC (rev 8874)
@@ -0,0 +1,234 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps.filter;
+
+import org.foray.common.WKConstants;
+
+import java.io.ByteArrayOutputStream;
+
+/**
+ * Acts as either an ASCII85Encode Filter or an ASCII85Decode filter.
+ * The ASCII base-85 encoding produces five ASCII characters for every four
+ * bytes of binary data.
+ */
+public class Ascii85EncodeFilter extends PSFilter {
+
+ /** Mask needed during encoding. */
+ private static final long MASK_BYTE_1 =
+ ((long) WKConstants.MAX_8_BIT_UNSIGNED_INT)
+ << WKConstants.SHIFT_3_BYTES;
+
+ /** Mask needed during encoding. */
+ private static final long MASK_BYTE_2 =
+ ((long) WKConstants.MAX_8_BIT_UNSIGNED_INT)
+ << WKConstants.SHIFT_2_BYTES;
+
+ /** Mask needed during encoding. */
+ private static final long MASK_BYTE_3 =
+ ((long) WKConstants.MAX_8_BIT_UNSIGNED_INT)
+ << WKConstants.SHIFT_1_BYTE;
+
+ /** Mask needed during encoding. */
+ private static final long MASK_BYTE_4 = WKConstants.MAX_8_BIT_UNSIGNED_INT;
+
+ /** The minimum encoded value in a byte. */
+ private static final byte MINIMUM_ENCODED_VALUE = 33;
+
+ /** The maximum encoded value in a byte. */
+ private static final byte MAXIMUM_ENCODED_VALUE = 117;
+
+ /** Constant specified in the PostScript standard indicating five
+ * consecutive encoded zeroes. */
+ private static final char ASCII85_ZERO = 'z';
+
+ /** Constant specified in the PostScript standard indicating the value added
+ * to all encoded binary data to ensure that they are ASCII characters. */
+ private static final char ASCII85_START = '!';
+
+ /** End-of-data marker specified in the PostScript standard, that is,
+ * "~>". */
+ private static final byte[] ASCII85_EOD = { 0x7E, 0x3E };
+
+ /** The radix in which Base-85 numbers are stored. */
+ private static final long BASE_85_4 = 85;
+
+ /** The size, in bytes, of each unencoded block (4 unencoded bytes are
+ * equal to 5 encoded bytes). */
+ private static final byte UNENCODED_BLOCK_SIZE = 4;
+
+ /** The size, in bytes, of each encoded block (4 unencoded bytes are
+ * equal to 5 encoded bytes). */
+ private static final byte ENCODED_BLOCK_SIZE = 5;
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return "/ASCII85Decode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDecodeParms() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public byte[] encode(final byte[] data) throws PSFilterException {
+ final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ int i;
+ byte[] unencodedBytes;
+
+ // first encode the majority of the data
+ // each 4 byte group becomes a 5 byte group
+ for (i = 0; i + UNENCODED_BLOCK_SIZE <= data.length;
+ i += UNENCODED_BLOCK_SIZE) {
+ unencodedBytes = new byte[UNENCODED_BLOCK_SIZE];
+ for (int j = 0; j < unencodedBytes.length; j++) {
+ u...
[truncated message content] |
|
From: <vic...@us...> - 2007-03-16 16:46:31
|
Revision: 8876
http://svn.sourceforge.net/foray/?rev=8876&view=rev
Author: victormote
Date: 2007-03-16 09:46:26 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
Push through more of the conversion of PSFilter classes to PSEncodeFilter and PSDecodeFilter. PDF output is currently broken.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestASCII85Filter.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexDecodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSDecodeFilter.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2007-03-16 14:31:08 UTC (rev 8875)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2007-03-16 16:46:26 UTC (rev 8876)
@@ -29,8 +29,9 @@
package org.foray.pdf.object;
import org.foray.common.WKConstants;
-import org.foray.ps.filter.PSFilter;
+import org.foray.ps.filter.PSEncodeFilter;
+import java.io.OutputStream;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -52,15 +53,16 @@
/**
* Private inner class for the encryption filter.
*/
- public class EncryptionFilter extends PSFilter {
+ public class EncryptionFilter extends PSEncodeFilter {
private PDFEncryption encryption;
/**
* The constructor for the internal PDFEncryption filter.
* @param encryption The encryption object to use.
*/
- public EncryptionFilter(final PDFEncryption encryption) {
- super();
+ public EncryptionFilter(final OutputStream outputStream,
+ final PDFEncryption encryption) {
+ super(outputStream);
this.encryption = encryption;
}
@@ -411,11 +413,11 @@
}
/**
- * Creates PSFilter for the encryption object.
+ * Creates PSEncodeFilter for the encryption object.
* @return The resulting filter.
*/
- public PSFilter makeFilter() {
- return new EncryptionFilter(this);
+ public PSEncodeFilter makeFilter(final OutputStream outputStream) {
+ return new EncryptionFilter(outputStream, this);
}
/**
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2007-03-16 14:31:08 UTC (rev 8875)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2007-03-16 16:46:26 UTC (rev 8876)
@@ -87,7 +87,7 @@
this.contents.addDefaultFilters();
final PDFEncryption encryption = this.getPDFDocument().getEncryption();
if (encryption != null) {
- this.contents.addFilter(encryption.makeFilter());
+ this.contents.addEncryption(encryption);
}
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-16 14:31:08 UTC (rev 8875)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-16 16:46:26 UTC (rev 8876)
@@ -30,9 +30,8 @@
import org.foray.ps.filter.Ascii85EncodeFilter;
import org.foray.ps.filter.AsciiHexEncodeFilter;
-import org.foray.ps.filter.FlateDecodeFilter;
-import org.foray.ps.filter.PSFilter;
-import org.foray.ps.filter.PSFilterException;
+import org.foray.ps.filter.FlateEncodeFilter;
+import org.foray.ps.filter.PSEncodeFilter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -55,8 +54,12 @@
private ByteArrayOutputStream streamData;
/** The filters that should be applied to this stream. */
- private List<PSFilter> filters;
+ private List<PSEncodeFilter> filters;
+ /** The furthest upstream output stream, that is, the stream to which this
+ * should write when it has content to be written. */
+ private OutputStream out;
+
/**
* Constructor useful for creating a PDFStream that will <i>not</i> become
* part of the PDF document, in other words, a stream used as a temporary
@@ -80,7 +83,8 @@
private void initializeVariables() {
streamData = new ByteArrayOutputStream();
- filters = new ArrayList<PSFilter>();
+ out = streamData;
+ filters = new ArrayList<PSEncodeFilter>();
}
/**
@@ -90,9 +94,9 @@
public void add(final String s) {
try {
try {
- streamData.write(s.getBytes(PDFDocument.ENCODING));
+ out.write(s.getBytes(PDFDocument.ENCODING));
} catch (final UnsupportedEncodingException ue) {
- streamData.write(s.getBytes());
+ out.write(s.getBytes());
}
} catch (final IOException ex) {
ex.printStackTrace();
@@ -107,23 +111,27 @@
* flag in the filter is marked true after it has been applied to the
* data.
*/
- public void addFilter(final PSFilter filter) {
+ public void addFilter(final PSEncodeFilter filter) {
if (filter != null) {
filters.add(filter);
}
}
+ public void addEncryption(final PDFEncryption encryption) {
+ /* TODO: Add the encryption filter to the filter stack. */
+ }
+
public void addFilter(final String filterType) {
if (filterType == null) {
return;
}
if (filterType.equals("flate")) {
- addFilter(new FlateDecodeFilter());
+ addFilter(new FlateEncodeFilter(out));
} else if (filterType.equals("ascii-85")) {
- addFilter(new Ascii85EncodeFilter());
+ addFilter(new Ascii85EncodeFilter(out));
} else if (filterType.equals("ascii-hex")) {
- addFilter(new AsciiHexEncodeFilter());
+ addFilter(new AsciiHexEncodeFilter(out));
} else if (filterType.equals("")) {
return;
} else {
@@ -148,9 +156,9 @@
}
public void setData(final byte[] data) throws IOException {
- streamData.reset();
+// out.reset();
if (data != null) {
- streamData.write(data);
+ out.write(data);
}
}
@@ -236,15 +244,15 @@
// run the filters
for (int i = 0; i < filters.size(); i++) {
- final PSFilter filter = filters.get(i);
+ final PSEncodeFilter filter = filters.get(i);
// apply the filter encoding if neccessary
if (!filter.isApplied()) {
- byte[] tmp = null;
- try {
- tmp = filter.encode(streamData.toByteArray());
- } catch (final PSFilterException e) {
- throw new IOException(e.getMessage());
- }
+ final byte[] tmp = null;
+// try {
+// tmp = filter.encode(streamData.toByteArray());
+// } catch (final PSFilterException e) {
+// throw new IOException(e.getMessage());
+// }
streamData.reset();
streamData.write(tmp);
filter.setApplied(true);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java 2007-03-16 14:31:08 UTC (rev 8875)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java 2007-03-16 16:46:26 UTC (rev 8876)
@@ -67,7 +67,7 @@
pdfICCStream = new PDFICCStream(doc, iccCS);
pdfICCStream.addDefaultFilters();
if (doc.getEncryption() != null) {
- pdfICCStream.addFilter(doc.getEncryption().makeFilter());
+ pdfICCStream.addEncryption(doc.getEncryption());
}
}
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2007-03-16 14:31:08 UTC (rev 8875)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2007-03-16 16:46:26 UTC (rev 8876)
@@ -36,7 +36,7 @@
import org.foray.ps.filter.CcittFaxEncodeFilter;
import org.foray.ps.filter.DctEncodeFilter;
-import org.foray.ps.filter.PSFilter;
+import org.foray.ps.filter.PSEncodeFilter;
import org.axsl.graphicR.Graphic;
import org.axsl.graphicR.GraphicException;
@@ -67,7 +67,7 @@
private PDFStream pdfStream;
/** The PSFilter, if any, that should be applied to this XObject. */
- private PSFilter filter;
+ private PSEncodeFilter filter;
private Rectangle2D.Float contentRectangle;
@@ -85,7 +85,7 @@
getLogger().error("FISH");
}
graphic = img;
- this.filter = getFilter();
+ this.filter = getFilter(null);
this.pdfStream = createPDFStream();
this.contentRectangle = contentRectangle;
this.clipRectangle = clipRectangle;
@@ -168,10 +168,11 @@
* should be used.
* @exception GraphicException For error reading Graphic file.
*/
- private PSFilter getFilter() throws GraphicException {
- PSFilter filter = null;
+ private PSEncodeFilter getFilter(final OutputStream outputStream)
+ throws GraphicException {
+ PSEncodeFilter filter = null;
if (graphic.getGraphicType() == Graphic.Type.JPEG) {
- filter = new DctEncodeFilter();
+ filter = new DctEncodeFilter(outputStream);
filter.setApplied(true);
return filter;
}
@@ -182,18 +183,19 @@
case UNCOMPRESSED:
return null;
case CCITT_GROUP_3:
- filter = new CcittFaxEncodeFilter();
+ filter = new CcittFaxEncodeFilter(outputStream);
filter.setApplied(true);
return filter;
case CCITT_GROUP_4:
- final CcittFaxEncodeFilter ccf = new CcittFaxEncodeFilter();
+ final CcittFaxEncodeFilter ccf = new CcittFaxEncodeFilter(
+ outputStream);
filter = ccf;
filter.setApplied(true);
ccf.setDecodeParms("<< /K -1 /Columns "
+ graphic.pixelWidth() + " >>");
return filter;
case JPEG:
- filter = new DctEncodeFilter();
+ filter = new DctEncodeFilter(outputStream);
filter.setApplied(true);
return filter;
default:
@@ -214,8 +216,7 @@
stream.addFilter(filter);
}
if (this.getPDFDocument().getEncryption() != null) {
- stream.addFilter(this.getPDFDocument().getEncryption()
- .makeFilter());
+ stream.addEncryption(this.getPDFDocument().getEncryption());
}
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2007-03-16 14:31:08 UTC (rev 8875)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2007-03-16 16:46:26 UTC (rev 8876)
@@ -31,13 +31,15 @@
import org.foray.common.WKConstants;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
/**
* Acts as either an ASCII85Encode Filter or an ASCII85Decode filter.
* The ASCII base-85 encoding produces five ASCII characters for every four
* bytes of binary data.
*/
-public class Ascii85EncodeFilter extends PSFilter {
+public class Ascii85EncodeFilter extends PSEncodeFilter {
/** Mask needed during encoding. */
private static final long MASK_BYTE_1 =
@@ -85,11 +87,29 @@
/** The size, in bytes, of each encoded block (4 unencoded bytes are
* equal to 5 encoded bytes). */
private static final byte ENCODED_BLOCK_SIZE = 5;
+
+ /** The array of unencoded bytes. */
+ private final byte[] unencodedBytes = new byte[UNENCODED_BLOCK_SIZE];
+
+ /** The index into {@link #unencodedBytes}. */
+ private int unencodedIndex = 0;
+
/**
+ * Constructor.
+ * @param outputStream The underlying output stream to which the encoded
+ * data should be written.
+ * Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
+ * needed in a byte array instead of being written to an actual stream.
+ */
+ public Ascii85EncodeFilter(final OutputStream outputStream) {
+ super(outputStream);
+ }
+
+ /**
* {@inheritDoc}
*/
public String getName() {
- return "/ASCII85Decode";
+ return "/ASCII85Encode";
}
/**
@@ -102,56 +122,16 @@
/**
* {@inheritDoc}
*/
- public byte[] encode(final byte[] data) throws PSFilterException {
- final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- int i;
- byte[] unencodedBytes;
+ public void write(final int b) throws IOException {
+ unencodedBytes[this.unencodedIndex] = (byte) b;
+ this.unencodedIndex++;
- // first encode the majority of the data
- // each 4 byte group becomes a 5 byte group
- for (i = 0; i + UNENCODED_BLOCK_SIZE <= data.length;
- i += UNENCODED_BLOCK_SIZE) {
- unencodedBytes = new byte[UNENCODED_BLOCK_SIZE];
- for (int j = 0; j < unencodedBytes.length; j++) {
- unencodedBytes[j] = data[i + j];
- }
+ if (this.unencodedIndex == UNENCODED_BLOCK_SIZE) {
final long val = encodeAsLong(unencodedBytes);
final byte[] conv = convertWord(val);
- buffer.write(conv, 0, conv.length);
+ out.write(conv);
+ this.unencodedIndex = 0;
}
-
- // now take care of the trailing few bytes.
- // with n leftover bytes, we append 0 bytes to make a full group of 4
- // then convert like normal (except not applying the special zero rule)
- // and write out the first n+1 bytes from the result
- if (i < data.length) {
- final int n = data.length - i;
- unencodedBytes = new byte[UNENCODED_BLOCK_SIZE];
- for (int j = 0; j < unencodedBytes.length; j++) {
- if (j < n) {
- unencodedBytes[j] = data[i++];
- } else {
- unencodedBytes[j] = 0;
- }
- }
-
- final long val = encodeAsLong(unencodedBytes);
- byte[] conv = convertWord(val);
-
- // special rule for handling zeros at the end
- if (val == 0) {
- conv = new byte[ENCODED_BLOCK_SIZE];
- for (int j = 0; j < conv.length; j++) {
- conv[j] = (byte) '!';
- }
- }
- buffer.write(conv, 0, n + 1);
- }
- // finally write the two character end of data marker
- buffer.write(Ascii85EncodeFilter.ASCII85_EOD, 0,
- Ascii85EncodeFilter.ASCII85_EOD.length);
- final byte[] result = buffer.toByteArray();
- return result;
}
/**
@@ -185,10 +165,9 @@
* @param word the 32 bit unsigned (hence the long datatype) word
* @return 5 bytes (or a single byte of the 'z' character for word
* values of 0)
- * @throws PSFilterException If an illegal character is found in the input.
+ * @throws IOException If an illegal character is found in the input.
*/
- protected static byte[] convertWord(final long word)
- throws PSFilterException {
+ protected static byte[] convertWord(final long word) throws IOException {
long wordMasked = word & 0xffffffff;
if (wordMasked < 0) {
wordMasked = -wordMasked;
@@ -216,7 +195,7 @@
for (int i = 0; i < ret.length; i++) {
if (ret[i] < MINIMUM_ENCODED_VALUE
|| ret[i] > MAXIMUM_ENCODED_VALUE) {
- throw new PSFilterException("ASCII85 Filter: Illegal char "
+ throw new IOException("ASCII85 Filter: Illegal char "
+ "value " + new Integer(ret[i]));
}
}
@@ -226,9 +205,33 @@
/**
* {@inheritDoc}
*/
- public byte[] decode(final byte[] input) {
- /* TODO: Implement this. */
- return input;
+ public void flush() throws IOException {
+ if (this.unencodedIndex != 0) {
+ /* We have a partial word started that needs to be completed and
+ * processed. */
+
+ /* First 0-fill the remaining unencoded bytes. */
+ for (int j = this.unencodedIndex; j < unencodedBytes.length; j++) {
+ unencodedBytes[j] = 0;
+ }
+
+ final long val = encodeAsLong(unencodedBytes);
+ byte[] conv = convertWord(val);
+
+ /* special rule for handling zeros at the end. */
+ if (val == 0) {
+ conv = new byte[ENCODED_BLOCK_SIZE];
+ for (int j = 0; j < conv.length; j++) {
+ conv[j] = (byte) '!';
+ }
+ }
+ out.write(conv);
+ }
+ /* Write the two character end of data marker. */
+ out.write(Ascii85EncodeFilter.ASCII85_EOD, 0,
+ Ascii85EncodeFilter.ASCII85_EOD.length);
+
+ super.flush();
}
}
Added: trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexDecodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexDecodeFilter.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexDecodeFilter.java 2007-03-16 16:46:26 UTC (rev 8876)
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy: victormote $
+ */
+
+package org.foray.ps.filter;
+
+import org.foray.common.StringUtil;
+import org.foray.common.WKConstants;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * An ASCIIHexDecode filter.
+ * The static methods are suitable for direct decoding of entire arrays.
+ * The instance methods are suitable for processing smaller array
+ * chunks. So, for example, if you have a 1GB file that you wish to process in
+ * 1KB chunks, the instance methods will help you do that.
+ */
+public class AsciiHexDecodeFilter extends PSDecodeFilter {
+
+ /** End-of-data marker specified in the PostScript standard. */
+ public static final byte END_OF_DATA = 0x3E;
+
+ /** Stores exactly one meaningful leftover byte from the end of the last
+ * chunk processed that needs to be included in the next chunk to be
+ * processed. */
+ private byte leftoverByte = -1;
+
+ /** For decoding, stores the location of the end-of-data marker. If -1,
+ * then eod has not yet been found. */
+ private int eodLocation = -1;
+
+ /** Indicates whether the underlying input stream has been read yet. */
+ private boolean inputRead = false;
+
+ /** Buffer of bytes that have been read from our underlying input stream
+ * but not yet decoded. */
+ private byte[] encodedBuffer;
+
+ /** Buffer of bytes that have been decoded but not yet read by our
+ * client.*/
+ private byte[] decodedBuffer
+ = new byte[WKConstants.BYTES_PER_KILOBYTE];
+
+ /** The starting index in decodedBuffer which is active. */
+ private int decodedIndex = 0;
+
+ /**
+ * Constructor.
+ * @param inputStream The underlying input stream from which the encoded
+ * data should be read.
+ * Use {@link ByteArrayInputStream} if the encoded data is in a byte
+ * array instead of a normal stream.
+ */
+ public AsciiHexDecodeFilter(final InputStream inputStream) {
+ super(inputStream);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return "/ASCIIHexDecode";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int read() throws IOException {
+ if (! inputRead) {
+ readInput();
+ inputRead = true;
+ }
+ /* If we have a byte in our decoded buffer, return it. */
+ if (this.decodedIndex < this.decodedBuffer.length) {
+ this.decodedIndex ++;
+ return this.decodedBuffer[this.decodedIndex - 1];
+ } else {
+ /* Indicate end-of-file. */
+ return -1;
+ }
+ }
+
+ /**
+ * Reads all of the underlying input and decodes it.
+ * @throws IOException For errors reading the input.
+ */
+ private void readInput() throws IOException {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ boolean doneReading = false;
+ while (! doneReading) {
+ final int inputByte = in.read();
+ if (inputByte < 0) {
+ doneReading = true;
+ }
+ baos.write(inputByte);
+ }
+ this.encodedBuffer = baos.toByteArray();
+ /* Otherwise we need to read from our source and decode some data. */
+ if (this.eodLocation > -1) {
+ return;
+ }
+ // Save the leftover byte
+ final byte savedLeftoverByte = this.leftoverByte;
+ int dataBytes = 0;
+ if (this.leftoverByte > -1) {
+ dataBytes++;
+ }
+ /*
+ * Scan the input, looking for end-of-data character & counting data
+ * bytes.
+ */
+ for (int i = 0; i < this.encodedBuffer.length && this.eodLocation < 0;
+ i ++) {
+ if (this.encodedBuffer[i] == AsciiHexEncodeFilter.END_OF_DATA) {
+ this.eodLocation = i;
+ break;
+ }
+ dataBytes += AsciiHexEncodeFilter.countDataBytes(
+ this.encodedBuffer[i]);
+ }
+ int outputLength = dataBytes / 2; // truncate any remainder
+
+ this.leftoverByte = -1;
+ if (dataBytes % 2 != 0) {
+ // If we are at the end-of-data, make room for the zero-filled byte
+ if (this.eodLocation > -1) {
+ outputLength += 1;
+ } else {
+ // Otherwise, count backward from the end of the array to find
+ // the leftovers
+ for (int i = this.encodedBuffer.length - 1;
+ i > 0 && this.leftoverByte < 1; i++) {
+ if (AsciiHexEncodeFilter.countDataBytes(
+ this.encodedBuffer[i]) == 1) {
+ this.leftoverByte = this.encodedBuffer[i];
+ }
+ }
+ }
+ }
+ this.decodedBuffer = decodeArray(savedLeftoverByte, this.encodedBuffer,
+ this.encodedBuffer.length,
+ outputLength);
+ }
+
+ /**
+ * Decodes the input array, starting at byte 0 and extending to byte
+ * inputLength, and returns the output in a byte array. Handles possible
+ * leftover byte from a previous run.
+ * @param leftoverByte The byte, if any, leftover from processing a
+ * previous chunk. If there is no leftover byte, enter any negative number
+ * to skip processing.
+ * @param input The input byte array. This first byte of this array must
+ * never be the second byte of a 2-byte "word".
+ * @param inputLength The last byte of the input byte array that should be
+ * examined for purposes of creating the output byte array.
+ * @param outputLength The size that the output array should be.
+ * @return The output byte array. It should be approximately 1/2 the size
+ * of the input array (whitespace characters in the input are ignored, so it
+ * may be somewhat less than 1/2 the size of the input array). Please note
+ * that this routine ignores any incomplete "words" in the input.
+ * @throws IOException If the input array contains invalid ASCIIHex
+ * characters.
+ */
+ public static byte[] decodeArray(final byte leftoverByte,
+ final byte[] input, final int inputLength, final int outputLength)
+ throws IOException {
+ if (outputLength < 1) {
+ return null;
+ }
+ if (inputLength < 1) {
+ return null;
+ }
+ final byte[] output = new byte[outputLength];
+ int outputIndex = 0;
+ byte byte1 = 0x00;
+ byte byte2 = 0x00;
+ boolean byte1Found = false;
+ boolean byte2Found = false;
+ // If there is a valid leftoverByte, start the processing with it.
+ if (leftoverByte > -1
+ && AsciiHexEncodeFilter.countDataBytes(leftoverByte) == 1) {
+ byte1 = leftoverByte;
+ byte1Found = true;
+ }
+ for (int i = 0; i < inputLength && outputIndex < outputLength; i ++) {
+ if (input[i] == AsciiHexEncodeFilter.END_OF_DATA) {
+ break;
+ }
+ // Skip whitespace
+ if (AsciiHexEncodeFilter.countDataBytes(input[i]) < 1) {
+ continue;
+ }
+ if (byte1Found && byte2Found) {
+ output[outputIndex] = StringUtil.asciiHexBytesToHex(byte1,
+ byte2);
+ outputIndex ++;
+ byte1Found = false;
+ byte2Found = false;
+ }
+ if (byte1Found) {
+ byte2 = input[i];
+ byte2Found = true;
+ } else {
+ byte1 = input[i];
+ byte1Found = true;
+ }
+ }
+ if (outputIndex < outputLength) {
+ if (byte1Found) {
+ if (! byte2Found) {
+ byte2 = 0x00;
+ }
+ output[outputIndex] = StringUtil.asciiHexBytesToHex(byte1,
+ byte2);
+ }
+ }
+ return output;
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexDecodeFilter.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2007-03-16 14:31:08 UTC (rev 8875)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2007-03-16 16:46:26 UTC (rev 8876)
@@ -31,6 +31,9 @@
import org.foray.common.StringUtil;
import org.foray.common.WKConstants;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
/**
@@ -40,35 +43,30 @@
* chunks. So, for example, if you have a 1GB file that you wish to process in
* 1KB chunks, the instance methods will help you do that.
*/
-public class AsciiHexEncodeFilter extends PSFilter {
+public class AsciiHexEncodeFilter extends PSEncodeFilter {
/** End-of-data marker specified in the PostScript standard. */
public static final byte END_OF_DATA = 0x3E;
- /**
- * Stores exactly one meaningful leftover byte from the end of the last
- * chunk processed that needs to be included in the next chunk to be
- * processed.
- */
- private byte leftoverByte = -1;
+ /** The unwritten input bytes. */
+ private ByteArrayOutputStream unprocessedBytes;
/**
- * For decoding, stores the location of the end-of-data marker. If -1,
- * then eod has not yet been found.
+ * Constructor.
+ * @param outputStream The underlying output stream to which the encoded
+ * data should be written.
+ * Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
+ * needed in a byte array instead of being written to an actual stream.
*/
- private int eodLocation = -1;
-
- /**
- * Default constructor.
- */
- public Asci...
[truncated message content] |
|
From: <vic...@us...> - 2007-03-16 19:36:02
|
Revision: 8883
http://svn.sourceforge.net/foray/?rev=8883&view=rev
Author: victormote
Date: 2007-03-16 12:35:36 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
Use factory methods for the flate encoder and decoder so that we get the filters stacked properly.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateDecodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-16 19:26:47 UTC (rev 8882)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-16 19:35:36 UTC (rev 8883)
@@ -154,7 +154,7 @@
return;
}
if (filterType.equals("flate")) {
- addFilter(new FlateEncodeFilter(out));
+ addFilter(FlateEncodeFilter.makeFlateDecodeFilter(out));
} else if (filterType.equals("ascii-85")) {
addFilter(new Ascii85EncodeFilter(out));
} else if (filterType.equals("ascii-hex")) {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateDecodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateDecodeFilter.java 2007-03-16 19:26:47 UTC (rev 8882)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateDecodeFilter.java 2007-03-16 19:35:36 UTC (rev 8883)
@@ -29,7 +29,6 @@
package org.foray.ps.filter;
import java.io.ByteArrayInputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.util.zip.InflaterInputStream;
@@ -96,11 +95,4 @@
return "/FlateDecode";
}
- /**
- * {@inheritDoc}
- */
- public int read() throws IOException {
- return in.read();
- }
-
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2007-03-16 19:26:47 UTC (rev 8882)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2007-03-16 19:35:36 UTC (rev 8883)
@@ -29,33 +29,38 @@
package org.foray.ps.filter;
import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.DeflaterOutputStream;
/**
* This class applies a FlateEncode filter to the stream.
*/
-public class FlateEncodeFilter extends PSEncodeFilter {
+public final class FlateEncodeFilter extends PSEncodeFilter {
- /** The wrapped output stream, not to be confused with the underlying
- * output stream. This class passes all output to the deflater stream to
- * do the real work. */
- private DeflaterOutputStream deflaterOutputStream;
-
/**
* Constructor.
- * @param outputStream The underlying output stream to which the encoded
- * data should be written.
+ * @param deflaterOutputStream The underlying output stream to which the
+ * encoded data should be written.
* Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
* needed in a byte array instead of being written to an actual stream.
*/
- public FlateEncodeFilter(final OutputStream outputStream) {
- super(outputStream);
- this.deflaterOutputStream = new DeflaterOutputStream(outputStream);
+ private FlateEncodeFilter(final DeflaterOutputStream deflaterOutputStream) {
+ super(deflaterOutputStream);
}
/**
+ * Factory method to create a FlateEncodeFilter.
+ * @param outputStream The underlying output stream.
+ * @return The new FlateEncodeFilter instance.
+ */
+ public static FlateEncodeFilter makeFlateDecodeFilter(
+ final OutputStream outputStream) {
+ final DeflaterOutputStream deflaterOutputStream
+ = new DeflaterOutputStream(outputStream);
+ return new FlateEncodeFilter(deflaterOutputStream);
+ }
+
+ /**
* {@inheritDoc}
*/
public String getName() {
@@ -76,11 +81,4 @@
return null;
}
- /**
- * {@inheritDoc}
- */
- public void write(final int b) throws IOException {
- this.deflaterOutputStream.write(b);
- }
-
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2007-03-16 19:26:47 UTC (rev 8882)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2007-03-16 19:35:36 UTC (rev 8883)
@@ -831,7 +831,7 @@
//nop
} else {
if (this.psLevel >= POSTSCRIPT_LEVEL_3) {
- out = new FlateEncodeFilter(out);
+ out = FlateEncodeFilter.makeFlateDecodeFilter(out);
} else {
out = new RunLengthEncodeFilter(out);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-16 21:17:07
|
Revision: 8888
http://svn.sourceforge.net/foray/?rev=8888&view=rev
Author: victormote
Date: 2007-03-16 14:17:07 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
Rename class for clarity.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
Added Paths:
-----------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/EexecDecodeFilter.java
Removed Paths:
-------------
trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2007-03-16 21:07:11 UTC (rev 8887)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2007-03-16 21:17:07 UTC (rev 8888)
@@ -36,7 +36,7 @@
import org.foray.ps.PSInteger;
import org.foray.ps.PSInterpreter;
import org.foray.ps.PSObject;
-import org.foray.ps.filter.EncryptFilter;
+import org.foray.ps.filter.EexecDecodeFilter;
import org.foray.ps.filter.PSFilter;
import org.axsl.psR.BoundingBox;
@@ -103,9 +103,9 @@
private PSInterpreter interpreter;
/** The encryption filter used to parse this file. */
- private EncryptFilter encryptFilter = new EncryptFilter(
- EncryptFilter.EEXEC_INITIAL_KEY,
- EncryptFilter.EEXEC_RANDOM_BYTES);
+ private EexecDecodeFilter encryptFilter = new EexecDecodeFilter(
+ EexecDecodeFilter.EEXEC_INITIAL_KEY,
+ EexecDecodeFilter.EEXEC_RANDOM_BYTES);
/**
* Constructor.
@@ -444,7 +444,7 @@
* Returns the encryption filter for this font.
* @return Returns the encryptFilter.
*/
- public EncryptFilter getEncryptFilter() {
+ public EexecDecodeFilter getEncryptFilter() {
return this.encryptFilter;
}
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2007-03-16 21:07:11 UTC (rev 8887)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java 2007-03-16 21:17:07 UTC (rev 8888)
@@ -29,7 +29,7 @@
package org.foray.ps;
import org.foray.common.WKConstants;
-import org.foray.ps.filter.EncryptFilter;
+import org.foray.ps.filter.EexecDecodeFilter;
import org.apache.commons.logging.Log;
@@ -1330,9 +1330,9 @@
getInterpreter().getSystemDict());
// Get the operand for eexec
final PSObject toExec = popOperand(PSOperator.OPER_EEXEC);
- final EncryptFilter filter =
- new EncryptFilter(EncryptFilter.EEXEC_INITIAL_KEY,
- EncryptFilter.EEXEC_RANDOM_BYTES);
+ final EexecDecodeFilter filter =
+ new EexecDecodeFilter(EexecDecodeFilter.EEXEC_INITIAL_KEY,
+ EexecDecodeFilter.EEXEC_RANDOM_BYTES);
// Create the PSFile object to be executed
PSFile file = null;
if (toExec instanceof PSFile) {
Copied: trunk/foray/foray-ps/src/java/org/foray/ps/filter/EexecDecodeFilter.java (from rev 8876, trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java)
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/EexecDecodeFilter.java (rev 0)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/EexecDecodeFilter.java 2007-03-16 21:17:07 UTC (rev 8888)
@@ -0,0 +1,253 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.ps.filter;
+
+import org.foray.common.StringUtil;
+import org.foray.common.WKConstants;
+
+/**
+ * Handles the PostScript encryption used in the "eexec" operator, usually used
+ * in Type1 fonts to encrypt the actual glyph-drawing data and the /Private
+ * dictionary.
+ *
+ * Please note that although this is a true filter, it should not be used
+ * directly in PostScript or PDF output. It is used by PostScript interpreters
+ * to decode contents processed by the "eexec" operator, and is used by font
+ * writing or embedding programs that need to encrypt code to be used by that
+ * operator. It is not (to our knowledge) available as a standard filter.
+ *
+ * This filter is designed to allow chunks of data to be encoded or decoded at
+ * a time. In other words, the entire set of data does not have to be encoded
+ * or decoded as the same time, but can be done in pieces. (This was done to
+ * save memory).
+ * However, the encoding and decoding used by this filter are dependent on data
+ * previously processed.
+ * Therefore, you must process the data starting at its beginning to be able to
+ * encode or decode subsequent data.
+ * Both the encode and decode methods are stateful, i.e. they are highly
+ * dependent on keeping track of their state from one chunk to the next.
+ * Of course, there is nothing wrong with encoding or decoding your entire
+ * input in one chunk, if you wish to do so.
+ *
+ *
+ * Type1 fonts actually use a double layer of encryption, whereby the glyph
+ * definitions are encrypted using this algorithm, then a large chunk of the
+ * font file, which includes the glyph definitions, is encrypted again, also
+ * using this algorithm (although with different seeding and constants). This
+ * situation can be handled by using two instances of this class, one for the
+ * inside encryption and one for the outside.
+ *
+ * The definition of the algorithms implemented in this class can be found in
+ * Chapter 7 of the Adobe Type 1 Font Format Specification. The PostScript
+ * Language Reference Manual (2nd Edition) cites this document as the
+ * authoritative reference on the topic (see the "eexec" operator).
+ */
+public class EexecDecodeFilter extends PSFilter {
+
+ /** A magic number specified in the PostScript standard. */
+ public static final int EEXEC_INITIAL_KEY = 55665;
+
+ /** The number of random bytes specified in the PostScript standard. */
+ public static final byte EEXEC_RANDOM_BYTES = 4;
+
+ /** The number of initial bytes specified in the PostScript standard. */
+ public static final byte EEXEC_INITIAL_BYTES = 4;
+ /* TODO: Is the initial bytes the same as the random bytes? */
+
+ /** A magic number specified in the PostScript standard. */
+ private static final int ENCRYPTION_CONSTANT_1 = 52845;
+
+ /** A magic number specified in the PostScript standard. */
+ private static final int ENCRYPTION_CONSTANT_2 = 22719;
+
+ /** This is the variable "R" described in the spec. The spec calls for an
+ * unsigned 16-bit integer, but we have no such thing in java, so we use
+ * an int instead to handle the extra bit. */
+ private int encryptionKey;
+
+ /** The quantity of randomBytes that should occur at the beginning of the
+ * sequence to be processed. This is the variable "n" in the spec. */
+ private byte randomBytes;
+
+ /** Tracks the number of random bytes that still need to be discarded. The
+ * variable is needed in case not enought bytes are in the first byte array
+ * that is decrypted to use them all. */
+ private byte randomBytesToDiscard;
+
+ /** The first four bytes must be analyzed in order to figure out whether the
+ * input is in ASCII hexadecimal format or binary format. */
+ private byte[] first4Bytes = new byte[EEXEC_INITIAL_BYTES];
+
+ /** This tracks how much of the first four bytes has actually been
+ * accumulated. This is needed because we might not get all four bytes
+ * in the first chunk. */
+ private byte first4BytesIndex = 0;
+
+ /** Tracks whether the input file is in ASCII hexadecimal format. If it is
+ * false, then the input is in binary format. */
+ private boolean hexFormat = false;
+
+ /** Tracks whether we yet know what format the input file is in. It should
+ * be set to false until we have analyzed the first four bytes. */
+ private boolean formatResolved = false;
+
+ /** Helper filter used to normalize input in ASCII hex format. */
+ private AsciiHexDecodeFilter hexFilter = null;
+
+ /**
+ * Default constructor.
+ * @param encryptionKey The starting encryption key to use.
+ * @param randomBytes The quantity of random bytes that should occur at the
+ * beginning of the sequence to be processed.
+ */
+ public EexecDecodeFilter(final int encryptionKey, final byte randomBytes) {
+ this.encryptionKey = encryptionKey;
+ this.randomBytes = randomBytes;
+ this.randomBytesToDiscard = this.randomBytes;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return "";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDecodeParms() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public byte[] encode(final byte[] input) {
+ /* TODO: Implement this. */
+ return input;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public byte[] decode(final byte[] input) throws PSFilterException {
+ if (! this.formatResolved) {
+ resolveFormat(input);
+ /* If the format is not yet resolved, it is because we don't have
+ * all of the first 4 bytes yet. Fill the input array with spaces
+ * and return it. */
+ if (! this.formatResolved) {
+ for (int i = 0; i < input.length; i++) {
+ input[i] = ' ';
+ }
+ return input;
+ }
+ }
+ final byte[] output = input;
+ if (this.hexFormat) {
+ if (this.hexFilter == null) {
+// this.hexFilter = new AsciiHexDecodeFilter(null);
+ }
+// output = this.hexFilter.decode(input);
+ }
+ for (int i = 0; i < input.length; i++) {
+ output[i] = decrypt(input[i]);
+ }
+ return output;
+ }
+
+ /**
+ * Decrypts a byte of encoded (encrypted) text.
+ * @param cipherText The byte of encoded (encrypted) text to be decrypted.
+ * @return The decrypted value.
+ */
+ private byte decrypt(final byte cipherText) {
+ final byte temp = (byte) (this.encryptionKey
+ >> WKConstants.SHIFT_1_BYTE);
+ byte plainText = (byte) (cipherText ^ temp);
+ // The trick here is to get cipherText treated as unsigned
+ int unsignedCipherText = cipherText;
+ if (cipherText < 0) {
+ unsignedCipherText += WKConstants.MAX_8_BIT_UNSIGNED_VALUES;
+ }
+ long temp2 = unsignedCipherText + this.encryptionKey;
+ temp2 *= EexecDecodeFilter.ENCRYPTION_CONSTANT_1;
+ temp2 += EexecDecodeFilter.ENCRYPTION_CONSTANT_2;
+ temp2 %= WKConstants.MAX_16_BIT_UNSIGNED_VALUES;
+ this.encryptionKey = (int) temp2;
+ /*
+ * The first few bytes of the decrypted text need to be discarded.
+ * To avoid copying arrays around, we'll try to just replace them with
+ * spaces.
+ */
+ if (this.randomBytesToDiscard > 0) {
+ plainText = ' ';
+ this.randomBytesToDiscard --;
+ }
+ return plainText;
+ }
+
+ /**
+ * If possible, determines whether the input is ASCII hex or binary.
+ * @param input The array whose content should be tested.
+ */
+ private void resolveFormat(final byte[] input) {
+ byte inputIndex = 0;
+ while (this.first4BytesIndex < EEXEC_INITIAL_BYTES
+ && inputIndex < input.length) {
+ this.first4Bytes[this.first4BytesIndex] = input[inputIndex];
+ inputIndex ++;
+ this.first4BytesIndex ++;
+ }
+ if (this.first4BytesIndex < EEXEC_INITIAL_BYTES - 1) {
+ return;
+ }
+ /*
+ * Otherwise, we have the first four bytes. Section 7.2 of the Adobe
+ * Type 1 Font Format spec says that at least one of the first 4
+ * ciphertext bytes must not be one of the ASCII hexadecimal
+ * character codes (0-9, A-F, a-f). Since the binary format is one
+ * byte per ciphertext byte, all we need to do is find one byte in
+ * the first four that is outside the range for ASCII hexadecimal
+ * codes. If we find that, then the file is binary. Otherwise it is
+ * ASCII hexadecimal.
+ */
+ for (int i = 0; i < EEXEC_INITIAL_BYTES; i++) {
+ if (! StringUtil.isASCIIHex(this.first4Bytes[i])) {
+ this.hexFormat = false;
+ this.formatResolved = true;
+ return;
+ }
+ }
+ this.hexFormat = true;
+ this.formatResolved = true;
+ }
+
+}
Deleted: trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java 2007-03-16 21:07:11 UTC (rev 8887)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java 2007-03-16 21:17:07 UTC (rev 8888)
@@ -1,253 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.ps.filter;
-
-import org.foray.common.StringUtil;
-import org.foray.common.WKConstants;
-
-/**
- * Handles the PostScript encryption used in the "eexec" operator, usually used
- * in Type1 fonts to encrypt the actual glyph-drawing data and the /Private
- * dictionary.
- *
- * Please note that although this is a true filter, it should not be used
- * directly in PostScript or PDF output. It is used by PostScript interpreters
- * to decode contents processed by the "eexec" operator, and is used by font
- * writing or embedding programs that need to encrypt code to be used by that
- * operator. It is not (to our knowledge) available as a standard filter.
- *
- * This filter is designed to allow chunks of data to be encoded or decoded at
- * a time. In other words, the entire set of data does not have to be encoded
- * or decoded as the same time, but can be done in pieces. (This was done to
- * save memory).
- * However, the encoding and decoding used by this filter are dependent on data
- * previously processed.
- * Therefore, you must process the data starting at its beginning to be able to
- * encode or decode subsequent data.
- * Both the encode and decode methods are stateful, i.e. they are highly
- * dependent on keeping track of their state from one chunk to the next.
- * Of course, there is nothing wrong with encoding or decoding your entire
- * input in one chunk, if you wish to do so.
- *
- *
- * Type1 fonts actually use a double layer of encryption, whereby the glyph
- * definitions are encrypted using this algorithm, then a large chunk of the
- * font file, which includes the glyph definitions, is encrypted again, also
- * using this algorithm (although with different seeding and constants). This
- * situation can be handled by using two instances of this class, one for the
- * inside encryption and one for the outside.
- *
- * The definition of the algorithms implemented in this class can be found in
- * Chapter 7 of the Adobe Type 1 Font Format Specification. The PostScript
- * Language Reference Manual (2nd Edition) cites this document as the
- * authoritative reference on the topic (see the "eexec" operator).
- */
-public class EncryptFilter extends PSFilter {
-
- /** A magic number specified in the PostScript standard. */
- public static final int EEXEC_INITIAL_KEY = 55665;
-
- /** The number of random bytes specified in the PostScript standard. */
- public static final byte EEXEC_RANDOM_BYTES = 4;
-
- /** The number of initial bytes specified in the PostScript standard. */
- public static final byte EEXEC_INITIAL_BYTES = 4;
- /* TODO: Is the initial bytes the same as the random bytes? */
-
- /** A magic number specified in the PostScript standard. */
- private static final int ENCRYPTION_CONSTANT_1 = 52845;
-
- /** A magic number specified in the PostScript standard. */
- private static final int ENCRYPTION_CONSTANT_2 = 22719;
-
- /** This is the variable "R" described in the spec. The spec calls for an
- * unsigned 16-bit integer, but we have no such thing in java, so we use
- * an int instead to handle the extra bit. */
- private int encryptionKey;
-
- /** The quantity of randomBytes that should occur at the beginning of the
- * sequence to be processed. This is the variable "n" in the spec. */
- private byte randomBytes;
-
- /** Tracks the number of random bytes that still need to be discarded. The
- * variable is needed in case not enought bytes are in the first byte array
- * that is decrypted to use them all. */
- private byte randomBytesToDiscard;
-
- /** The first four bytes must be analyzed in order to figure out whether the
- * input is in ASCII hexadecimal format or binary format. */
- private byte[] first4Bytes = new byte[EEXEC_INITIAL_BYTES];
-
- /** This tracks how much of the first four bytes has actually been
- * accumulated. This is needed because we might not get all four bytes
- * in the first chunk. */
- private byte first4BytesIndex = 0;
-
- /** Tracks whether the input file is in ASCII hexadecimal format. If it is
- * false, then the input is in binary format. */
- private boolean hexFormat = false;
-
- /** Tracks whether we yet know what format the input file is in. It should
- * be set to false until we have analyzed the first four bytes. */
- private boolean formatResolved = false;
-
- /** Helper filter used to normalize input in ASCII hex format. */
- private AsciiHexDecodeFilter hexFilter = null;
-
- /**
- * Default constructor.
- * @param encryptionKey The starting encryption key to use.
- * @param randomBytes The quantity of random bytes that should occur at the
- * beginning of the sequence to be processed.
- */
- public EncryptFilter(final int encryptionKey, final byte randomBytes) {
- this.encryptionKey = encryptionKey;
- this.randomBytes = randomBytes;
- this.randomBytesToDiscard = this.randomBytes;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return "";
- }
-
- /**
- * {@inheritDoc}
- */
- public String getDecodeParms() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public byte[] encode(final byte[] input) {
- /* TODO: Implement this. */
- return input;
- }
-
- /**
- * {@inheritDoc}
- */
- public byte[] decode(final byte[] input) throws PSFilterException {
- if (! this.formatResolved) {
- resolveFormat(input);
- /* If the format is not yet resolved, it is because we don't have
- * all of the first 4 bytes yet. Fill the input array with spaces
- * and return it. */
- if (! this.formatResolved) {
- for (int i = 0; i < input.length; i++) {
- input[i] = ' ';
- }
- return input;
- }
- }
- final byte[] output = input;
- if (this.hexFormat) {
- if (this.hexFilter == null) {
-// this.hexFilter = new AsciiHexDecodeFilter(null);
- }
-// output = this.hexFilter.decode(input);
- }
- for (int i = 0; i < input.length; i++) {
- output[i] = decrypt(input[i]);
- }
- return output;
- }
-
- /**
- * Decrypts a byte of encoded (encrypted) text.
- * @param cipherText The byte of encoded (encrypted) text to be decrypted.
- * @return The decrypted value.
- */
- private byte decrypt(final byte cipherText) {
- final byte temp = (byte) (this.encryptionKey
- >> WKConstants.SHIFT_1_BYTE);
- byte plainText = (byte) (cipherText ^ temp);
- // The trick here is to get cipherText treated as unsigned
- int unsignedCipherText = cipherText;
- if (cipherText < 0) {
- unsignedCipherText += WKConstants.MAX_8_BIT_UNSIGNED_VALUES;
- }
- long temp2 = unsignedCipherText + this.encryptionKey;
- temp2 *= EncryptFilter.ENCRYPTION_CONSTANT_1;
- temp2 += EncryptFilter.ENCRYPTION_CONSTANT_2;
- temp2 %= WKConstants.MAX_16_BIT_UNSIGNED_VALUES;
- this.encryptionKey = (int) temp2;
- /*
- * The first few bytes of the decrypted text need to be discarded.
- * To avoid copying arrays around, we'll try to just replace them with
- * spaces.
- */
- if (this.randomBytesToDiscard > 0) {
- plainText = ' ';
- this.randomBytesToDiscard --;
- }
- return plainText;
- }
-
- /**
- * If possible, determines whether the input is ASCII hex or binary.
- * @param input The array whose content should be tested.
- */
- private void resolveFormat(final byte[] input) {
- byte inputIndex = 0;
- while (this.first4BytesIndex < EEXEC_INITIAL_BYTES
- && inputIndex < input.length) {
- this.first4Bytes[this.first4BytesIndex] = input[inputIndex];
- inputIndex ++;
- this.first4BytesIndex ++;
- }
- if (this.first4BytesIndex < EEXEC_INITIAL_BYTES - 1) {
- return;
- }
- /*
- * Otherwise, we have the first four bytes. Section 7.2 of the Adobe
- * Type 1 Font Format spec says that at least one of the first 4
- * ciphertext bytes must not be one of the ASCII hexadecimal
- * character codes (0-9, A-F, a-f). Since the binary format is one
- * byte per ciphertext byte, all we need to do is find one byte in
- * the first four that is outside the range for ASCII hexadecimal
- * codes. If we find that, then the file is binary. Otherwise it is
- * ASCII hexadecimal.
- */
- for (int i = 0; i < EEXEC_INITIAL_BYTES; i++) {
- if (! StringUtil.isASCIIHex(this.first4Bytes[i])) {
- this.hexFormat = false;
- this.formatResolved = true;
- return;
- }
- }
- this.hexFormat = true;
- this.formatResolved = true;
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-19 00:45:55
|
Revision: 8891
http://svn.sourceforge.net/foray/?rev=8891&view=rev
Author: victormote
Date: 2007-03-16 16:18:15 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
Convert PSFilter to an enum of valid filter types.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFAFile.java
trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java
trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2007-03-16 23:09:06 UTC (rev 8890)
+++ trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java 2007-03-16 23:18:15 UTC (rev 8891)
@@ -72,7 +72,7 @@
public byte[] getRawFontFile(final FOrayFontUse fontUse)
throws IOException {
final Type1File pfb = getType1File();
- return pfb.getByteArray(PSFilter.PSDATA_UNKNOWN);
+ return pfb.getByteArray(PSFilter.UNKNOWN);
}
/**
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2007-03-16 23:09:06 UTC (rev 8890)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java 2007-03-16 23:18:15 UTC (rev 8891)
@@ -285,14 +285,14 @@
/**
* Provides the font contents.
* @param outputFormat One of the following values:
- * Use {@link PSFilter#PSDATA_UNKNOWN} if the contents should be returned
+ * Use {@link PSFilter#UNKNOWN} if the contents should be returned
* with no filtering.
- * Use {@link PSFilter#PSDATA_ASCII_HEX} if the contents should be
+ * Use {@link PSFilter#ASCII_HEX} if the contents should be
* converted to ASCII Hex format.
* @return A byte array with the font contents in the format requested.
* @throws IOException For errors reading font file.
*/
- public byte[] getByteArray(final int outputFormat) throws IOException {
+ public byte[] getByteArray(final PSFilter outputFormat) throws IOException {
parseBasics();
final byte[] encryptedSegment = getEncryptedSegment(outputFormat);
final int newLength = getLength1() + encryptedSegment.length
@@ -404,7 +404,7 @@
* @return A byte array with the font contents in the format requested.
* @throws IOException For errors reading font file.
*/
- protected abstract byte[] getEncryptedSegment(int outputFormat)
+ protected abstract byte[] getEncryptedSegment(PSFilter outputFormat)
throws IOException;
/**
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFAFile.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFAFile.java 2007-03-16 23:09:06 UTC (rev 8890)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFAFile.java 2007-03-16 23:18:15 UTC (rev 8891)
@@ -160,14 +160,14 @@
/**
* {@inheritDoc}
*/
- protected byte[] getEncryptedSegment(final int outputFormat)
+ protected byte[] getEncryptedSegment(final PSFilter outputFormat)
throws IOException {
this.getReader().seek(this.getSegmentOffset(1));
final byte[] unEncoded = new byte[this.getSegmentSize(1)];
this.getReader().readFully(unEncoded, 0, this.getSegmentSize(1));
switch (outputFormat) {
- case PSFilter.PSDATA_UNKNOWN:
- case PSFilter.PSDATA_ASCII_HEX: {
+ case UNKNOWN:
+ case ASCII_HEX: {
return convertLineEndings(unEncoded);
}
default: {
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java 2007-03-16 23:09:06 UTC (rev 8890)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java 2007-03-16 23:18:15 UTC (rev 8891)
@@ -153,16 +153,16 @@
/**
* {@inheritDoc}
*/
- protected byte[] getEncryptedSegment(final int outputFormat)
+ protected byte[] getEncryptedSegment(final PSFilter outputFormat)
throws IOException {
this.getReader().seek(this.getSegmentOffset(1));
final byte[] unEncoded = new byte[this.getSegmentSize(1)];
this.getReader().readFully(unEncoded, 0, this.getSegmentSize(1));
switch (outputFormat) {
- case PSFilter.PSDATA_UNKNOWN: {
+ case UNKNOWN: {
return unEncoded;
}
- case PSFilter.PSDATA_ASCII_HEX: {
+ case ASCII_HEX: {
return AsciiHexEncodeFilter.encodeArray(unEncoded, 0,
unEncoded.length, Type1PFBFile.DEFAULT_LINE_LENGTH);
}
Modified: trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java 2007-03-16 23:09:06 UTC (rev 8890)
+++ trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java 2007-03-16 23:18:15 UTC (rev 8891)
@@ -63,7 +63,7 @@
final FSType1Font type1Font = (FSType1Font) font;
final Type1File pfb = type1Font.getType1File();
try {
- return pfb.getByteArray(PSFilter.PSDATA_ASCII_HEX);
+ return pfb.getByteArray(PSFilter.ASCII_HEX);
} catch (final IOException e) {
this.getLogger().fatal("Failed to get contents for "
+ font.getPostscriptName() + ": " + e.getMessage());
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2007-03-16 23:09:06 UTC (rev 8890)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2007-03-16 23:18:15 UTC (rev 8891)
@@ -26,93 +26,32 @@
* $LastChangedBy$
*/
-/*
- * Known contributors:
- * Eric SCHAEFFER,
- * Kelly A. Campbell
- */
-
package org.foray.ps.filter;
/**
* A PostScript filter object.
*/
-public abstract class PSFilter {
+public enum PSFilter {
- /** Constant indicating an unknown filter type. */
- public static final byte PSDATA_UNKNOWN = 0;
+ /** An unknown filter type. */
+ UNKNOWN,
- /** Constant indicating an ASCII Hex filter. */
- public static final byte PSDATA_ASCII_HEX = 1;
+ /** An ASCII Hex filter. */
+ ASCII_HEX,
- /** Constant indicating an ASCII 85 filter. */
- public static final byte PSDATA_ASCII_85 = 2;
+ /** An ASCII 85 filter. */
+ ASCII_85,
- /** Constant indicating an LZW filter. */
- public static final byte PSDATA_LZW = 3;
+ /** An LZW filter. */
+ LZW,
- /** Constant indicating a Run Length filter. */
- public static final byte PSDATA_RUN_LENGTH = 4;
+ /** A Run Length filter. */
+ RUN_LENGTH,
- /** Constant indicating a CCITT Fax filter. */
- public static final byte PSDATA_CCITT_FAX = 5;
+ /** A CCITT Fax filter. */
+ CCITT_FAX,
- /** Constant indicating a DCT filter. */
- public static final byte PSDATA_DCT = 6;
+ /** A DCT filter. */
+ DCT;
- /** Tracks whether this filter has already been applied to the data. */
- private boolean applied = false;
-
- /**
- * Indicates whether this filter has already been applied to the input.
- * @return True iff this filter has already been applied to the input.
- */
- public boolean isApplied() {
- return this.applied;
- }
-
- /**
- * Set the applied attribute to the given value. This attribute is
- * used to determine if this filter is just a placeholder for the
- * decodeparms and dictionary entries, or if the filter needs to
- * actually encode the data. For example if the raw data is copied
- * out of an image file in it's compressed format, then this
- * should be set to true and the filter options should be set to
- * those which the raw data was encoded with.
- * @param b The new "applied" value.
- */
- public void setApplied(final boolean b) {
- this.applied = b;
- }
-
-
- /**
- * Return a PostScript name representation of the filter, e.g. /FlateDecode.
- * @return A PostScript name representation of the filter.
- */
- public abstract String getName();
-
- /**
- * Return a parameter dictionary for this filter, or null if there is
- * none.
- * @return The parameter dictionary for this filter.
- */
- public abstract String getDecodeParms();
-
- /**
- * Encode the given data with the filter.
- * @param data The unencoded data.
- * @return The encoded data.
- * @throws PSFilterException For errors during encoding.
- */
- public abstract byte[] encode(byte[] data) throws PSFilterException;
-
- /**
- * Decode the input.
- * @param input Byte array containing the encoded input
- * @return Byte array containing the decoded output
- * @throws PSFilterException For errors during decoding.
- */
- public abstract byte[] decode(byte[] input) throws PSFilterException;
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-20 17:33:35
|
Revision: 8920
http://svn.sourceforge.net/foray/?rev=8920&view=rev
Author: victormote
Date: 2007-03-20 10:33:26 -0700 (Tue, 20 Mar 2007)
Log Message:
-----------
Add Eclipse check for shadowed variables.
Modified Paths:
--------------
trunk/foray/foray-app/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-areatree/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-common/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-core/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-font/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-fotree/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-graphic/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-hyphen-r/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-layout/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-mif/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-output/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-pdf/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-pioneer/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-pretty/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-ps/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-render/.settings/org.eclipse.jdt.core.prefs
trunk/foray/foray-text/.settings/org.eclipse.jdt.core.prefs
Modified: trunk/foray/foray-app/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-app/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-app/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-areatree/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-areatree/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-areatree/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-common/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-common/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-common/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-core/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-core/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-font/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-font/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-font/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-fotree/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-fotree/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-fotree/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-graphic/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-graphic/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-graphic/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-hyphen-r/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-hyphen-r/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-hyphen-r/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-layout/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-layout/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-layout/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-mif/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-mif/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-mif/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-output/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-output/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-output/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-pdf/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-pdf/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-pdf/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-pioneer/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-pioneer/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-pioneer/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-pretty/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-pretty/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-pretty/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-ps/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-ps/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-ps/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-render/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-render/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-render/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
Modified: trunk/foray/foray-text/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/foray/foray-text/.settings/org.eclipse.jdt.core.prefs 2007-03-20 00:54:26 UTC (rev 8919)
+++ trunk/foray/foray-text/.settings/org.eclipse.jdt.core.prefs 2007-03-20 17:33:26 UTC (rev 8920)
@@ -1,4 +1,4 @@
-#Fri Mar 09 15:04:34 MST 2007
+#Tue Mar 20 11:12:52 MDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -17,7 +17,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-20 20:02:24
|
Revision: 8922
http://svn.sourceforge.net/foray/?rev=8922&view=rev
Author: victormote
Date: 2007-03-20 13:01:58 -0700 (Tue, 20 Mar 2007)
Log Message:
-----------
Conform to axsl changes limiting which Areas can create block-level children.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-03-20 18:18:16 UTC (rev 8921)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-03-20 20:01:58 UTC (rev 8922)
@@ -32,9 +32,6 @@
import org.axsl.areaW.AreaWException;
import org.axsl.areaW.BlockContainerRA;
-import org.axsl.areaW.ListBlockArea;
-import org.axsl.areaW.NormalBlockArea;
-import org.axsl.areaW.TableArea;
import org.axsl.common.AbsoluteAxis;
import org.axsl.common.AbsoluteDirection;
import org.axsl.common.Baseline;
@@ -45,12 +42,8 @@
import org.axsl.foR.FObj;
import org.axsl.foR.WritingMode;
import org.axsl.foR.fo.BasicLink;
-import org.axsl.foR.fo.Block;
-import org.axsl.foR.fo.BlockContainer;
-import org.axsl.foR.fo.ListBlock;
import org.axsl.foR.fo.Marker;
import org.axsl.foR.fo.RetrieveMarker;
-import org.axsl.foR.fo.Table;
import org.axsl.fontR.Font;
import org.axsl.fontR.FontUse;
import org.axsl.graphicR.Graphic;
@@ -1549,42 +1542,6 @@
}
/**
- * {@inheritDoc}
- */
- public TableArea makeTableArea(final Table table,
- final RetrieveMarker retrieveMarker) {
- return new org.foray.area.TableRA(table, this, retrieveMarker);
- }
-
- /**
- * {@inheritDoc}
- */
- public NormalBlockArea makeNormalBlockArea(final Block block,
- final RetrieveMarker retrieveMarker) {
- return new org.foray.area.NormalBlockArea(block, this, retrieveMarker);
- }
-
- /**
- * {@inheritDoc}
- */
- public BlockContainerRA makeBlockContainerArea(
- final BlockContainer blockContainer,
- final RetrieveMarker retrieveMarker) {
- return new org.foray.area.BlockContainerRA(blockContainer, this,
- retrieveMarker);
- }
-
-
- /**
- * {@inheritDoc}
- */
- public ListBlockArea makeListBlockArea(final ListBlock listBlock,
- final RetrieveMarker retrieveMarker) {
- return new org.foray.area.ListBlockArea(listBlock, this,
- retrieveMarker);
- }
-
- /**
* Returns the top trait for this area.
* @return The top trait for this area.
* @see FObj#traitTop(FOContext, int)
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java 2007-03-20 18:18:16 UTC (rev 8921)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java 2007-03-20 20:01:58 UTC (rev 8922)
@@ -30,8 +30,17 @@
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
+import org.axsl.areaW.BlockContainerRA;
+import org.axsl.areaW.ListBlockArea;
+import org.axsl.areaW.NormalBlockArea;
+import org.axsl.areaW.TableArea;
import org.axsl.common.RelativeAxis;
import org.axsl.foR.FObj;
+import org.axsl.foR.fo.Block;
+import org.axsl.foR.fo.BlockContainer;
+import org.axsl.foR.fo.ListBlock;
+import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.Table;
import java.util.ArrayList;
import java.util.List;
@@ -71,8 +80,9 @@
final Area overflowArea = getParentArea().getOverflowArea(this);
// If parent SpanArea can create another column
if (overflowArea instanceof NormalFlowRA) {
- return new NormalBlockArea(childRequesting.traitGeneratedBy(),
- this, childRequesting.getRetrieveMarker());
+ return new org.foray.area.NormalBlockArea(
+ childRequesting.traitGeneratedBy(), this,
+ childRequesting.getRetrieveMarker());
}
// If a new page was created
if (overflowArea instanceof MainRA) {
@@ -186,4 +196,40 @@
this.children.add(child);
}
+ /**
+ * {@inheritDoc}
+ */
+ public TableArea makeTableArea(final Table table,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.TableRA(table, this, retrieveMarker);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public NormalBlockArea makeNormalBlockArea(final Block block,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.NormalBlockArea(block, this, retrieveMarker);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public BlockContainerRA makeBlockContainerArea(
+ final BlockContainer blockContainer,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.BlockContainerRA(blockContainer, this,
+ retrieveMarker);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public ListBlockArea makeListBlockArea(final ListBlock listBlock,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.ListBlockArea(listBlock, this,
+ retrieveMarker);
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java 2007-03-20 18:18:16 UTC (rev 8921)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java 2007-03-20 20:01:58 UTC (rev 8922)
@@ -30,12 +30,21 @@
import org.axsl.areaR.RegionArea;
import org.axsl.areaR.RenderVisitor;
+import org.axsl.areaW.BlockContainerRA;
+import org.axsl.areaW.ListBlockArea;
+import org.axsl.areaW.NormalBlockArea;
+import org.axsl.areaW.TableArea;
import org.axsl.common.RelativeAxis;
+import org.axsl.foR.fo.Block;
+import org.axsl.foR.fo.BlockContainer;
+import org.axsl.foR.fo.ListBlock;
import org.axsl.foR.fo.Region;
import org.axsl.foR.fo.RegionAfter;
import org.axsl.foR.fo.RegionBefore;
import org.axsl.foR.fo.RegionEnd;
import org.axsl.foR.fo.RegionStart;
+import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.Table;
import org.axsl.graphicR.Graphic;
/**
@@ -165,4 +174,40 @@
return RelativeAxis.BLOCK_PROGRESSION;
}
+ /**
+ * {@inheritDoc}
+ */
+ public TableArea makeTableArea(final Table table,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.TableRA(table, this, retrieveMarker);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public NormalBlockArea makeNormalBlockArea(final Block block,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.NormalBlockArea(block, this, retrieveMarker);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public BlockContainerRA makeBlockContainerArea(
+ final BlockContainer blockContainer,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.BlockContainerRA(blockContainer, this,
+ retrieveMarker);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public ListBlockArea makeListBlockArea(final ListBlock listBlock,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.ListBlockArea(listBlock, this,
+ retrieveMarker);
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-03-20 18:18:16 UTC (rev 8921)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-03-20 20:01:58 UTC (rev 8922)
@@ -31,9 +31,17 @@
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaR.TableCellArea;
import org.axsl.areaW.AreaWException;
+import org.axsl.areaW.BlockContainerRA;
+import org.axsl.areaW.ListBlockArea;
+import org.axsl.areaW.NormalBlockArea;
+import org.axsl.areaW.TableArea;
import org.axsl.common.FoValue;
import org.axsl.common.RelativeAxis;
+import org.axsl.foR.fo.Block;
+import org.axsl.foR.fo.BlockContainer;
+import org.axsl.foR.fo.ListBlock;
import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.Table;
import org.axsl.foR.fo.TableCell;
import org.axsl.graphicR.Graphic;
@@ -383,4 +391,40 @@
this.children.add(child);
}
+ /**
+ * {@inheritDoc}
+ */
+ public TableArea makeTableArea(final Table table,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.TableRA(table, this, retrieveMarker);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public NormalBlockArea makeNormalBlockArea(final Block block,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.NormalBlockArea(block, this, retrieveMarker);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public BlockContainerRA makeBlockContainerArea(
+ final BlockContainer blockContainer,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.BlockContainerRA(blockContainer, this,
+ retrieveMarker);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public ListBlockArea makeListBlockArea(final ListBlock listBlock,
+ final RetrieveMarker retrieveMarker) {
+ return new org.foray.area.ListBlockArea(listBlock, this,
+ retrieveMarker);
+ }
+
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java 2007-03-20 18:18:16 UTC (rev 8921)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java 2007-03-20 20:01:58 UTC (rev 8922)
@@ -31,6 +31,7 @@
import org.axsl.areaW.Area;
import org.axsl.areaW.AreaWException;
import org.axsl.areaW.BlockContainerRA;
+import org.axsl.areaW.BlockContentFactory;
import org.axsl.foR.FONode;
import org.axsl.foR.fo.BlockContainer;
import org.axsl.foR.fo.RetrieveMarker;
@@ -59,11 +60,17 @@
*/
public Status layout(final Area area, final RetrieveMarker retrieveMarker)
throws AreaWException {
+ if (! (area instanceof BlockContentFactory)) {
+ throw new AreaWException("Area \"" + area.getAreaName()
+ + "\" cannot contain a BlockContentArea.");
+ }
+ final BlockContentFactory bcArea = (BlockContentFactory) area;
+
if (getProgress() == FONodePL.START) {
setProgress(0);
}
- final BlockContainerRA blockContainer = area.makeBlockContainerArea(
+ final BlockContainerRA blockContainer = bcArea.makeBlockContainerArea(
this.node, retrieveMarker);
for (int i = this.getProgress(); i < this.node.getChildCount(); i++) {
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java 2007-03-20 18:18:16 UTC (rev 8921)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java 2007-03-20 20:01:58 UTC (rev 8922)
@@ -30,6 +30,7 @@
import org.axsl.areaW.Area;
import org.axsl.areaW.AreaWException;
+import org.axsl.areaW.BlockContentFactory;
import org.axsl.areaW.LineArea;
import org.axsl.areaW.NormalBlockArea;
import org.axsl.foR.FONode;
@@ -89,6 +90,12 @@
*/
public Status layout(final Area area, final RetrieveMarker retrieveMarker)
throws AreaWException {
+ if (! (area instanceof BlockContentFactory)) {
+ throw new AreaWException("Area \"" + area.getAreaName()
+ + "\" cannot contain a NormalBlockArea.");
+ }
+ final BlockContentFactory bcArea = (BlockContentFactory) area;
+
if (! breakStatusBeforeChecked) {
breakStatusBeforeChecked = true;
// no break if first in area tree, or leading in context
@@ -125,7 +132,7 @@
setProgress(0);
}
- blockArea = area.makeNormalBlockArea(node, retrieveMarker);
+ blockArea = bcArea.makeNormalBlockArea(node, retrieveMarker);
for (int i = getProgress(); i < node.getChildCount(); i++) {
final FONode fo = node.getChildAt(i);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java 2007-03-20 18:18:16 UTC (rev 8921)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java 2007-03-20 20:01:58 UTC (rev 8922)
@@ -30,6 +30,7 @@
import org.axsl.areaW.Area;
import org.axsl.areaW.AreaWException;
+import org.axsl.areaW.BlockContentFactory;
import org.axsl.areaW.ListBlockArea;
import org.axsl.areaW.NormalBlockArea;
import org.axsl.foR.fo.ListBlock;
@@ -59,6 +60,12 @@
*/
public Status layout(final Area area, final RetrieveMarker retrieveMarker)
throws AreaWException {
+ if (! (area instanceof BlockContentFactory)) {
+ throw new AreaWException("Area \"" + area.getAreaName()
+ + "\" cannot contain a ListBlockArea.");
+ }
+ final BlockContentFactory bcArea = (BlockContentFactory) area;
+
final ListBlockPL listBlockPL = (ListBlockPL) getLayoutProxy(this.node);
if (listBlockPL.getProgress() == FONodePL.START) {
listBlockPL.setProgress(0);
@@ -68,7 +75,7 @@
}
}
- final ListBlockArea blockArea = area.makeListBlockArea(this.node,
+ final ListBlockArea blockArea = bcArea.makeListBlockArea(this.node,
retrieveMarker);
final int numChildren = this.node.getChildren().size();
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-03-20 18:18:16 UTC (rev 8921)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-03-20 20:01:58 UTC (rev 8922)
@@ -30,6 +30,7 @@
import org.axsl.areaW.Area;
import org.axsl.areaW.AreaWException;
+import org.axsl.areaW.BlockContentFactory;
import org.axsl.areaW.NormalBlockArea;
import org.axsl.areaW.TableArea;
import org.axsl.common.FoValue;
@@ -72,6 +73,12 @@
return Status.OK;
}
+ if (! (area instanceof BlockContentFactory)) {
+ throw new AreaWException("Area \"" + area.getAreaName()
+ + "\" cannot contain a TableArea.");
+ }
+ final BlockContentFactory bcArea = (BlockContentFactory) area;
+
if (getProgress() == FONodePL.START) {
if (node.traitTableLayout() == FoValue.AUTO) {
getLayout().getLogger().warn("table-layout=auto is not "
@@ -96,8 +103,7 @@
}
- // Hack alert!
- final TableArea areaContainer = area.makeTableArea(node,
+ final TableArea areaContainer = bcArea.makeTableArea(node,
retrieveMarker);
boolean addedHeader = false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-21 20:56:32
|
Revision: 8960
http://svn.sourceforge.net/foray/?rev=8960&view=rev
Author: victormote
Date: 2007-03-21 13:56:24 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Conform to axsl changes removing ability of layout systems to actually adjust the size of Areas.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTableBodyPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-03-21 20:43:37 UTC (rev 8959)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-03-21 20:56:24 UTC (rev 8960)
@@ -1236,7 +1236,11 @@
public abstract void setMinimumProgressionDimension(int minimumPD);
/**
- * {@inheritDoc}
+ * Change the progression-dimension used by this Area.
+ * @param incrementAmount The amount by which the progression-dimension
+ * should be changed for this area.
+ * Positive values increase the progression-dimension, negative values
+ * decrease it.
*/
public abstract void incrementProgressionDimension(int incrementAmount);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTableBodyPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTableBodyPL.java 2007-03-21 20:43:37 UTC (rev 8959)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTableBodyPL.java 2007-03-21 20:56:24 UTC (rev 8960)
@@ -89,14 +89,6 @@
if (tableContainer != null) {
area.removeChild(tableContainer);
}
- if (getFONode().traitSpaceBeforeOptimum(area) != 0) {
- final int before = - this.getFONode().traitSpaceBeforeOptimum(area);
- area.incrementProgressionDimension(before);
- }
- if (this.getFONode().traitSpaceAfterOptimum(area) != 0) {
- final int after = - this.getFONode().traitSpaceAfterOptimum(area);
- area.incrementProgressionDimension(after);
- }
resetProgress();
}
@@ -157,12 +149,6 @@
setProgress(0);
}
- if ((node.traitSpaceBeforeOptimum(area) != 0)
- && (getProgress() == 0)) {
- area.incrementProgressionDimension(node
- .traitSpaceBeforeOptimum(area));
- }
-
/*
* Note: the parent FO must be a Table. The parent Area is the Block
* type area created by the Table, which is also a reference area.
@@ -240,13 +226,8 @@
setProgress(i);
// areaContainer.end();
- area.incrementProgressionDimension(areaContainer.crBPD());
if (i == numChildren - 1) {
setProgress(FONodePL.BREAK_AFTER);
- if (node.traitSpaceAfterOptimum(area) != 0) {
- area.incrementProgressionDimension(
- node.traitSpaceAfterOptimum(area));
- }
}
return status;
}
@@ -274,9 +255,6 @@
if ((i != 0) && (status == Status.AREA_FULL_NONE)) {
status = Status.AREA_FULL_SOME;
}
- if (!((i == 0) && (areaContainer.crBPD() <= 0))) {
- area.incrementProgressionDimension(areaContainer.crBPD());
- }
/* Fix for infinite loop bug if spanned rows are too big for
* page */
@@ -292,13 +270,7 @@
}
lastRow = row;
}
- area.incrementProgressionDimension(areaContainer.crBPD());
- if (node.traitSpaceAfterOptimum(area) != 0) {
- area.incrementProgressionDimension(
- node.traitSpaceAfterOptimum(area));
- }
-
return Status.OK;
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java 2007-03-21 20:43:37 UTC (rev 8959)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java 2007-03-21 20:56:24 UTC (rev 8960)
@@ -89,13 +89,10 @@
status = Status.AREA_FULL_SOME;
}
listBlockPL.setProgress(i);
- area.incrementProgressionDimension(blockArea.crBPD());
return status;
}
}
- area.incrementProgressionDimension(blockArea.crBPD());
-
return Status.OK;
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-03-21 20:43:37 UTC (rev 8959)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-03-21 20:56:24 UTC (rev 8960)
@@ -180,6 +180,7 @@
retrieveMarker);
if (status.isIncomplete()) {
setProgress(i);
+ status = Status.AREA_FULL_SOME;
if (this.bodyCount == 0
&& status == Status.AREA_FULL_NONE) {
if (node.getTableHeader() != null) {
@@ -189,14 +190,7 @@
tableFooterPL.removeLayout(areaContainer);
}
resetProgress();
- // status = new Status(Status.AREA_FULL_SOME);
}
- // areaContainer.end();
- if (areaContainer.crBPD() > 0) {
- area.incrementProgressionDimension(
- areaContainer.crBPD());
- status = Status.AREA_FULL_SOME;
- }
return status;
}
this.bodyCount++;
@@ -215,7 +209,6 @@
// the end of the table.
getLayout().getLogger().warn("footer could not fit on page, "
+ "moving last body row to next page");
- area.incrementProgressionDimension(areaContainer.crBPD());
final TableFooterPL tableFooterPL
= (TableFooterPL) this.getLayoutProxy(tf);
tableFooterPL.removeLayout(areaContainer);
@@ -229,9 +222,6 @@
areaContainer.setProgressionDimension(height);
}
- /* should this be combined into above? */
- area.incrementProgressionDimension(areaContainer.crBPD());
-
if (node.traitBreakAfter(area) == FoValue.PAGE) {
setProgress(FONodePL.BREAK_AFTER);
return Status.FORCE_PAGE_BREAK;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-21 21:01:44
|
Revision: 8961
http://svn.sourceforge.net/foray/?rev=8961&view=rev
Author: victormote
Date: 2007-03-21 14:01:45 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Conform to axsl changes removing ability of layout systems to actually adjust the size of Areas.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-03-21 20:56:24 UTC (rev 8960)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-03-21 21:01:45 UTC (rev 8961)
@@ -1223,7 +1223,9 @@
public abstract int getProgressionDimension();
/**
- * {@inheritDoc}
+ * Sets the progression-dimension used by this Area.
+ * @param progressionDimension The new progression-dimension value for this
+ * Area.
*/
public abstract void setProgressionDimension(int progressionDimension);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java 2007-03-21 20:56:24 UTC (rev 8960)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java 2007-03-21 21:01:45 UTC (rev 8961)
@@ -120,13 +120,6 @@
}
bDone = true;
- // Adjust for minimum cell content height
- final int minCellHeight = this.node.traitBPDimensionMin(area,
- area.crBPD());
- if (minCellHeight > cellArea.crBPD()) {
- cellArea.setProgressionDimension(minCellHeight);
- }
-
return Status.OK;
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-03-21 20:56:24 UTC (rev 8960)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-03-21 21:01:45 UTC (rev 8961)
@@ -217,11 +217,6 @@
}
}
- final int height = node.traitBPDimensionOpt(area, area.crBPD());
- if (height != 0) {
- areaContainer.setProgressionDimension(height);
- }
-
if (node.traitBreakAfter(area) == FoValue.PAGE) {
setProgress(FONodePL.BREAK_AFTER);
return Status.FORCE_PAGE_BREAK;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-22 16:21:31
|
Revision: 8968
http://svn.sourceforge.net/foray/?rev=8968&view=rev
Author: victormote
Date: 2007-03-22 09:21:26 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
Move new-line handling further upstream.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java 2007-03-22 16:10:11 UTC (rev 8967)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java 2007-03-22 16:21:26 UTC (rev 8968)
@@ -50,7 +50,7 @@
* {@inheritDoc}
*/
public String getSetterString(final boolean fillNotStroke) {
- return PSColor.toPS(this.color, fillNotStroke, "\n");
+ return PSColor.toPS(this.color, fillNotStroke) + "\n";
}
String toPDF() {
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java 2007-03-22 16:10:11 UTC (rev 8967)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java 2007-03-22 16:21:26 UTC (rev 8968)
@@ -48,21 +48,19 @@
* PostScript.
* @param fillNotStroke Set to true iff the color should be used for the
* fill but not for the stroke.
- * @param eol The end-of-line text.
* @return The PostScript code that represents this color.
*/
- public static String toPS(final Color color, final boolean fillNotStroke,
- final String eol) {
+ public static String toPS(final Color color, final boolean fillNotStroke) {
final int colorSpace = color.getColorSpace().getType();
switch (colorSpace) {
case ColorSpace.TYPE_RGB: {
- return rgbToPS(color, fillNotStroke, eol);
+ return rgbToPS(color, fillNotStroke);
}
case ColorSpace.TYPE_CMYK: {
- return cmykToPS(color, fillNotStroke, eol);
+ return cmykToPS(color, fillNotStroke);
}
default: {
- return grayToPS(color, fillNotStroke, eol);
+ return grayToPS(color, fillNotStroke);
}
}
}
@@ -73,11 +71,10 @@
* PostScript.
* @param fillNotStroke Set to true iff the color should be used for the
* fill but not for the stroke.
- * @param eol The end-of-line text.
* @return The PostScript code that represents this color.
*/
private static String rgbToPS(final Color color,
- final boolean fillNotStroke, final String eol) {
+ final boolean fillNotStroke) {
final StringBuffer buffer = new StringBuffer("");
/* According to pdfspec 12.1 p.399, if the colors are the same then
@@ -92,22 +89,22 @@
// fill
if (fillNotStroke) {
if (isGray) {
- buffer.append(PSReal.doubleOut(rgbColors[0]) + " g" + eol);
+ buffer.append(PSReal.doubleOut(rgbColors[0]) + " g");
} else {
buffer.append(PSReal.doubleOut(rgbColors[0]) + " "
+ PSReal.doubleOut(rgbColors[1]) + " "
+ PSReal.doubleOut(rgbColors[2])
- + " rg" + eol);
+ + " rg");
}
// stroke/border
} else {
if (isGray) {
- buffer.append(PSReal.doubleOut(rgbColors[0]) + " G" + eol);
+ buffer.append(PSReal.doubleOut(rgbColors[0]) + " G");
} else {
buffer.append(PSReal.doubleOut(rgbColors[0]) + " "
+ PSReal.doubleOut(rgbColors[1]) + " "
+ PSReal.doubleOut(rgbColors[2])
- + " RG" + eol);
+ + " RG");
}
}
return buffer.toString();
@@ -119,11 +116,10 @@
* PostScript.
* @param fillNotStroke Set to true iff the color should be used for the
* fill but not for the stroke.
- * @param eol The end-of-line text.
* @return The PostScript code that represents this color.
*/
private static String cmykToPS(final Color color,
- final boolean fillNotStroke, final String eol) {
+ final boolean fillNotStroke) {
final StringBuffer buffer = new StringBuffer("");
final float[] cmykColors = color.getComponents(null);
int index = 0;
@@ -135,7 +131,7 @@
index ++;
buffer.append(PSReal.doubleOut(cmykColors[index]) + " ");
index ++;
- buffer.append(PSReal.doubleOut(cmykColors[index]) + " k" + eol);
+ buffer.append(PSReal.doubleOut(cmykColors[index]) + " k");
} else {
/* Stroke ?? */
buffer.append(PSReal.doubleOut(cmykColors[index]) + " ");
@@ -144,7 +140,7 @@
index ++;
buffer.append(PSReal.doubleOut(cmykColors[index]) + " ");
index ++;
- buffer.append(PSReal.doubleOut(cmykColors[index]) + " K" + eol);
+ buffer.append(PSReal.doubleOut(cmykColors[index]) + " K");
}
return buffer.toString();
}
@@ -155,17 +151,16 @@
* PostScript.
* @param fillNotStroke Set to true iff the color should be used for the
* fill but not for the stroke.
- * @param eol The end-of-line text.
* @return The PostScript code that represents this color.
*/
private static String grayToPS(final Color color,
- final boolean fillNotStroke, final String eol) {
+ final boolean fillNotStroke) {
final StringBuffer buffer = new StringBuffer("");
final float[] grayColors = color.getComponents(null);
if (fillNotStroke) {
- buffer.append(PSReal.doubleOut(grayColors[0]) + " g" + eol);
+ buffer.append(PSReal.doubleOut(grayColors[0]) + " g");
} else {
- buffer.append(PSReal.doubleOut(grayColors[0]) + " G" + eol);
+ buffer.append(PSReal.doubleOut(grayColors[0]) + " G");
}
return buffer.toString();
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java 2007-03-22 16:10:11 UTC (rev 8967)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java 2007-03-22 16:21:26 UTC (rev 8968)
@@ -584,8 +584,10 @@
this.psRenderer.write("BT");
final Shape imclip = getClip();
writeClip(imclip);
- this.psRenderer.write(PSColor.toPS(getColor(), true, "\n"));
- this.psRenderer.write(PSColor.toPS(getBackground(), true, "\n"));
+ this.psRenderer.write(PSColor.toPS(getColor(), true));
+ this.psRenderer.write("\n");
+ this.psRenderer.write(PSColor.toPS(getBackground(), true));
+ this.psRenderer.write("\n");
final AffineTransform trans = getTransform();
trans.translate(x, y);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-22 21:26:12
|
Revision: 8977
http://svn.sourceforge.net/foray/?rev=8977&view=rev
Author: victormote
Date: 2007-03-22 14:25:59 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
1. Conform to axsl change removing unneeded method.
2. Move the Page optimization logic down to LineArea and NormalBlockArea.
3. Change the scheme for removal of empty items so that it is done in a safe manner.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTreeArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/FootnoteRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/MainRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/MarkerContent.java
trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageCollection.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java
trunk/foray/foray-areatree/src/java/org/foray/area/SVGArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
trunk/foray/foray-render/src/java/org/foray/render/Renderer.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -579,15 +579,44 @@
* before the page is rendered. For example, empty areas should be removed.
* Also classes like LineArea can use this to adjust word-spacing and other
* variables.
+ * NOTE: This method is called recursively by each node.
+ * The process starts at {@link PageRA#layoutComplete()}.
+ * @return True iff the Area node thinks it should be removed.
*/
- protected abstract void optimize();
+ protected abstract boolean optimize();
/**
* Optimizes the children of this node.
*/
protected void optimizeChildren() {
- for (AreaNode node : this.getChildren()) {
- node.optimize();
+ /* This convoluted logic is needed to make sure that if an area is
+ * removed, the looping logic still knows where to pick back up and
+ * where to end. */
+ int startingIndex = 0;
+ int endingIndex = this.getChildren().size();
+ boolean done = false;
+ while (! done) {
+ boolean doneWithLoop = false;
+ int currentIndex = startingIndex;
+ while (! doneWithLoop) {
+ if (currentIndex >= endingIndex) {
+ doneWithLoop = true;
+ done = true;
+ } else {
+ final AreaNode child = this.getChildren().get(currentIndex);
+ final boolean shouldRemove = child.optimize();
+ if (shouldRemove) {
+ getLogger().debug("Removing empty "
+ + child.getAreaName());
+ child.remove();
+ startingIndex = currentIndex;
+ endingIndex --;
+ doneWithLoop = true;
+ } else {
+ currentIndex ++;
+ }
+ }
+ }
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -316,8 +316,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BeforeFloatRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -178,8 +178,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -211,8 +211,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -156,8 +156,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -119,8 +119,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTreeArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTreeArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTreeArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -115,8 +115,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -148,8 +148,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/FootnoteRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/FootnoteRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/FootnoteRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -189,8 +189,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -165,8 +165,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -179,8 +179,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -421,8 +421,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -128,13 +128,21 @@
}
/**
+ * {@inheritDoc}
* Resolves and optimizes the line. Specifically, this method resolves any
* page-number citations, and then adjusts leaders, letter-spacing, and
* word-spacing to justify the line if that is neeeded.
*/
- public void optimize() {
+ public boolean optimize() {
+ /* Optimize in post-traversal order. Allow children to optimize
+ * themselves before optimizing the line. */
+ this.optimizeChildren();
+ if (! this.hasChildren()) {
+ return true;
+ }
+
if (this.optimized) {
- return;
+ return false;
}
this.optimized = true;
// Resolve the page-number-citations.
@@ -147,7 +155,7 @@
}
// No need to optimize unless we are justifying the line.
if (traitTextAlign() != FoValue.JUSTIFY) {
- return;
+ return false;
}
/*
* In accordance with standard typographic practice, use up all leader
@@ -177,6 +185,7 @@
* justification ...".
*/
optimizeImpliedWordSpacing();
+ return false;
}
/**
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -181,8 +181,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -174,8 +174,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/MainRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/MainRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/MainRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -362,8 +362,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/MarkerContent.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/MarkerContent.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/MarkerContent.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -130,8 +130,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -300,8 +300,19 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
+ /* Optimize the children first, so that child lines can remove empty
+ * content and then themselves be candidates for removal. */
this.optimizeChildren();
+
+ /* Remove empty block areas only if they are generated by FONodes that
+ * actually have children. If the FONode has no children, then an empty
+ * area is needed in the area tree. */
+ if (! this.hasChildren()
+ && this.traitGeneratedBy().hasChildren()) {
+ return true;
+ }
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/NormalFlowRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -263,8 +263,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageCollection.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageCollection.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageCollection.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -458,8 +458,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -117,8 +117,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -135,8 +135,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -337,7 +337,7 @@
* {@inheritDoc}
*/
public void layoutComplete() throws AreaWException {
- optimize(this);
+ optimize();
final List<Marker> markers = getMarkers();
if (markers != null) {
for (int i = 0; i < markers.size(); i++) {
@@ -351,50 +351,6 @@
}
/**
- * Recursively looks through the AreaTree, removing Areas that are empty
- * and that should not be.
- * @param area The Area instance that is the root of the tree fragment
- * currently being examined.
- */
- private void optimize(final Area area) {
- /*
- * Need post-traversal, so that the child nodes are examined before the
- * parent nodes. For example, we want an empty LineArea to be purged
- * before checking its parent NormalBlockArea, because the
- * NormalBlockArea might also then need to be purged.
- */
- final List<? extends AreaNode> children = area.getChildren();
- for (int i = 0; i < children.size(); i++) {
- final Object object = children.get(i);
- if (object instanceof Area) {
- optimize((Area) object);
- }
- }
-
- if (area instanceof LineArea) {
- if (area.hasChildren()) {
- /* Optimize non-empty lines. */
- final LineArea lineArea = (LineArea) area;
- lineArea.optimize();
- } else {
- /* Remove empty line areas. */
- area.remove();
- getLogger().debug("Removing empty line-area.");
- }
- }
-
- /* Remove empty block areas only if they are generated by FONodes that
- * actually have children. If the FONode has no children, then an empty
- * area is needed in the area tree. */
- if (area instanceof NormalBlockArea
- && ! area.hasChildren()
- && area.traitGeneratedBy().hasChildren()) {
- area.remove();
- getLogger().debug("Removing empty normal block-area.");
- }
- }
-
- /**
* {@inheritDoc}
*/
public org.axsl.areaR.AreaNode firstUnresolvedRefId() {
@@ -733,8 +689,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/RegionRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -262,8 +262,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -381,8 +381,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/SVGArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/SVGArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/SVGArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -108,8 +108,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -492,8 +492,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -107,8 +107,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -294,8 +294,9 @@
/**
* {@inheritDoc}
*/
- public void optimize() {
+ public boolean optimize() {
adjustDisplayAlign();
+ return false;
}
/**
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -107,8 +107,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -107,8 +107,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -528,8 +528,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -242,8 +242,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -729,8 +729,9 @@
/**
* {@inheritDoc}
*/
- protected void optimize() {
+ protected boolean optimize() {
this.optimizeChildren();
+ return false;
}
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/Renderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2007-03-22 20:22:51 UTC (rev 8976)
+++ trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2007-03-22 21:25:59 UTC (rev 8977)
@@ -499,7 +499,6 @@
* {@inheritDoc}
*/
public void render(final TableCellArea area) {
- area.optimize();
markBorder(area);
markBackground(area);
renderChildren(area);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-22 21:58:36
|
Revision: 8979
http://svn.sourceforge.net/foray/?rev=8979&view=rev
Author: victormote
Date: 2007-03-22 14:58:32 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
Fix design flaw allowing the "isApplied" value to be changed after a filter has been created.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthEncodeFilter.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -62,7 +62,7 @@
*/
public EncryptionFilter(final OutputStream outputStream,
final PDFEncryption encryption) {
- super(outputStream);
+ super(outputStream, false);
this.encryption = encryption;
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -162,11 +162,11 @@
return;
}
if (filterType.equals("flate")) {
- addFilter(FlateEncodeFilter.makeFlateDecodeFilter(null));
+ addFilter(FlateEncodeFilter.makeFlateDecodeFilter(null, false));
} else if (filterType.equals("ascii-85")) {
- addFilter(new Ascii85EncodeFilter(null));
+ addFilter(new Ascii85EncodeFilter(null, false));
} else if (filterType.equals("ascii-hex")) {
- addFilter(new AsciiHexEncodeFilter(null));
+ addFilter(new AsciiHexEncodeFilter(null, false));
} else {
throw new PDFException("Unsupported filter type in "
+ "pdf-filters: " + filterType);
@@ -276,7 +276,6 @@
/* Mark the filters as applied. */
for (int i = 0; i < filters.size(); i++) {
final PSEncodeFilter filter = filters.get(i);
- filter.setApplied(true);
// place the names in our local List in reverse order
names.add(0, filter.getDecodeName());
parms.add(0, filter.getDecodeParms());
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -173,8 +173,7 @@
throws GraphicException {
PSEncodeFilter filter = null;
if (graphic.getGraphicType() == Graphic.Type.JPEG) {
- filter = new DctEncodeFilter(outputStream);
- filter.setApplied(true);
+ filter = new DctEncodeFilter(outputStream, true);
return filter;
}
if (graphic.getGraphicType() == Graphic.Type.TIFF) {
@@ -184,20 +183,17 @@
case UNCOMPRESSED:
return null;
case CCITT_GROUP_3:
- filter = new CcittFaxEncodeFilter(outputStream);
- filter.setApplied(true);
+ filter = new CcittFaxEncodeFilter(outputStream, true);
return filter;
case CCITT_GROUP_4:
final CcittFaxEncodeFilter ccf = new CcittFaxEncodeFilter(
- outputStream);
+ outputStream, true);
filter = ccf;
- filter.setApplied(true);
ccf.setDecodeParms("<< /K -1 /Columns "
+ graphic.pixelWidth() + " >>");
return filter;
case JPEG:
- filter = new DctEncodeFilter(outputStream);
- filter.setApplied(true);
+ filter = new DctEncodeFilter(outputStream, true);
return filter;
default:
throw new GraphicException("Error while loading image "
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/Ascii85EncodeFilter.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -100,9 +100,13 @@
* data should be written.
* Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
* needed in a byte array instead of being written to an actual stream.
+ * @param isApplied See
+ * {@link PSEncodeFilter#PSEncodeFilter(OutputStream, boolean)} for a full
+ * explanation of this parameter.
*/
- public Ascii85EncodeFilter(final OutputStream outputStream) {
- super(outputStream);
+ public Ascii85EncodeFilter(final OutputStream outputStream,
+ final boolean isApplied) {
+ super(outputStream, isApplied);
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -57,9 +57,13 @@
* data should be written.
* Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
* needed in a byte array instead of being written to an actual stream.
+ * @param isApplied See
+ * {@link PSEncodeFilter#PSEncodeFilter(OutputStream, boolean)} for a full
+ * explanation of this parameter.
*/
- public AsciiHexEncodeFilter(final OutputStream outputStream) {
- super(outputStream);
+ public AsciiHexEncodeFilter(final OutputStream outputStream,
+ final boolean isApplied) {
+ super(outputStream, isApplied);
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/CcittFaxEncodeFilter.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -51,9 +51,13 @@
* data should be written.
* Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
* needed in a byte array instead of being written to an actual stream.
+ * @param isApplied See
+ * {@link PSEncodeFilter#PSEncodeFilter(OutputStream, boolean)} for a full
+ * explanation of this parameter.
*/
- public CcittFaxEncodeFilter(final OutputStream outputStream) {
- super(outputStream);
+ public CcittFaxEncodeFilter(final OutputStream outputStream,
+ final boolean isApplied) {
+ super(outputStream, isApplied);
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/DctEncodeFilter.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -48,9 +48,13 @@
* data should be written.
* Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
* needed in a byte array instead of being written to an actual stream.
+ * @param isApplied See
+ * {@link PSEncodeFilter#PSEncodeFilter(OutputStream, boolean)} for a full
+ * explanation of this parameter.
*/
- public DctEncodeFilter(final OutputStream outputStream) {
- super(outputStream);
+ public DctEncodeFilter(final OutputStream outputStream,
+ final boolean isApplied) {
+ super(outputStream, isApplied);
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateEncodeFilter.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -44,23 +44,30 @@
* encoded data should be written.
* Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
* needed in a byte array instead of being written to an actual stream.
+ * @param isApplied See
+ * {@link PSEncodeFilter#PSEncodeFilter(OutputStream, boolean)} for a full
+ * explanation of this parameter.
*/
- private FlateEncodeFilter(final DeflaterOutputStream deflaterOutputStream) {
- super(deflaterOutputStream);
+ private FlateEncodeFilter(final DeflaterOutputStream deflaterOutputStream,
+ final boolean isApplied) {
+ super(deflaterOutputStream, isApplied);
}
/**
* Factory method to create a FlateEncodeFilter.
* @param outputStream The underlying output stream.
+ * @param isApplied See
+ * {@link PSEncodeFilter#PSEncodeFilter(OutputStream, boolean)} for a full
+ * explanation of this parameter.
* @return The new FlateEncodeFilter instance.
*/
public static FlateEncodeFilter makeFlateDecodeFilter(
- final OutputStream outputStream) {
+ final OutputStream outputStream, final boolean isApplied) {
DeflaterOutputStream deflaterOutputStream = null;
if (outputStream != null) {
deflaterOutputStream = new DeflaterOutputStream(outputStream);
}
- return new FlateEncodeFilter(deflaterOutputStream);
+ return new FlateEncodeFilter(deflaterOutputStream, isApplied);
}
/**
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSEncodeFilter.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -46,9 +46,20 @@
* data should be written.
* Use {@link ByteArrayOutputStream#toByteArray()} if the encoded data is
* needed in a byte array instead of being written to an actual stream.
+ * @param isApplied Indicates whether this filter has already been applied.
+ * If set to "true" this filter makes no changes to the data, but simply
+ * passes it through.
+ * This is useful in cases where a stack of encoding filters must be
+ * decoded in the opposite order and the stack itself is used to indicate
+ * that decoding.
+ * For example if the raw data is copied out of an image file in its
+ * compressed format, then this should be set to true and the filter options
+ * should be set to those which the raw data was encoded with.
*/
- public PSEncodeFilter(final OutputStream outputStream) {
+ public PSEncodeFilter(final OutputStream outputStream,
+ final boolean isApplied) {
super(outputStream);
+ this.applied = isApplied;
}
/**
@@ -60,20 +71,6 @@
}
/**
- * Set the applied attribute to the given value. This attribute is
- * used to determine if this filter is just a placeholder for the
- * decodeparms and dictionary entries, or if the filter needs to
- * actually encode the data. For example if the raw data is copied
- * out of an image file in it's compressed format, then this
- * should be set to true and the filter options should be set to
- * those which the raw data was encoded with.
- * @param b The new "applied" value.
- */
- public void setApplied(final boolean b) {
- this.applied = b;
- }
-
- /**
* Return a PostScript name representation of the filter, e.g. /FlateEncode.
* @return A PostScript name representation of the filter.
*/
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/RunLengthEncodeFilter.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -79,9 +79,13 @@
* Constructor.
* @param encodeStream The output stream to which the encoded data should
* be written.
+ * @param isApplied See
+ * {@link PSEncodeFilter#PSEncodeFilter(OutputStream, boolean)} for a full
+ * explanation of this parameter.
*/
- public RunLengthEncodeFilter(final OutputStream encodeStream) {
- super(encodeStream);
+ public RunLengthEncodeFilter(final OutputStream encodeStream,
+ final boolean isApplied) {
+ super(encodeStream, isApplied);
}
/**
Modified: trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthEncodeFilter.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthEncodeFilter.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestRunLengthEncodeFilter.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -64,7 +64,8 @@
/* The "I am done" byte. */
(byte) 128};
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
- final RunLengthEncodeFilter filter = new RunLengthEncodeFilter(stream);
+ final RunLengthEncodeFilter filter = new RunLengthEncodeFilter(stream,
+ false);
filter.write(testInput);
filter.flush();
final byte[] output = stream.toByteArray();
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2007-03-22 21:45:11 UTC (rev 8978)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2007-03-22 21:58:32 UTC (rev 8979)
@@ -826,14 +826,15 @@
try {
// imgmap[0] = 1;
OutputStream out = this.out;
- out = new Ascii85EncodeFilter(out);
+ out = new Ascii85EncodeFilter(out, false);
if (img.getGraphicType() == Graphic.Type.JPEG) {
//nop
} else {
if (this.psLevel >= POSTSCRIPT_LEVEL_3) {
- out = FlateEncodeFilter.makeFlateDecodeFilter(out);
+ out = FlateEncodeFilter.makeFlateDecodeFilter(out,
+ false);
} else {
- out = new RunLengthEncodeFilter(out);
+ out = new RunLengthEncodeFilter(out, false);
}
}
out.write(imgmap);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-22 22:56:36
|
Revision: 8980
http://svn.sourceforge.net/foray/?rev=8980&view=rev
Author: victormote
Date: 2007-03-22 15:33:59 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
Convert StringBuffer to StringBuilder.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/Configuration.java
trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java
trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java
trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java
trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java
trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDF.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberGenerator.java
trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/FOrayHyphenBreak.java
trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/FOrayHyphenation.java
trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java
trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java
trunk/foray/foray-mif/src/java/org/foray/mif/MifBook.java
trunk/foray/foray-mif/src/java/org/foray/mif/MifFrame.java
trunk/foray/foray-mif/src/java/org/foray/mif/MifImportObject.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDate.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontDescriptor.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontType0.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFObject.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java
trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayPretty.java
trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java
trunk/foray/foray-ps/src/java/org/foray/ps/filter/AsciiHexEncodeFilter.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/Configuration.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -357,7 +357,7 @@
if (value instanceof String) {
logger.info(" value: " + value);
} else if (value instanceof List) {
- final StringBuffer valueString = new StringBuffer();
+ final StringBuilder valueString = new StringBuilder();
final List<?> list = (List) value;
valueString.append(" value: ");
for (int i = 0; i < list.size(); i++) {
Modified: trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-common/src/java/org/foray/common/StringUtil.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -232,7 +232,7 @@
* spaces to the end of eol.
* @param length The maximum length that a line should contain.
*/
- public static void lineBreakStringBuffer(final StringBuffer buffer,
+ public static void lineBreakStringBuffer(final StringBuilder buffer,
final String eol, final int length) {
int currentLineStarts = 0;
int lastOpportunity = -1;
@@ -336,8 +336,8 @@
* @param newString The substring that should replace oldString.
* @return The number of replacements that were made.
*/
- public static int replace(final StringBuffer buffer, final String oldString,
- final String newString) {
+ public static int replace(final StringBuilder buffer,
+ final String oldString, final String newString) {
int numChanges = 0;
boolean anyChanges = true;
while (anyChanges) {
Modified: trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -43,10 +43,10 @@
* sequences of spaces to one space.
* @param input The String that should be converted.
* @return The converted String.
- * @see #normalizeWhitespace(StringBuffer)
+ * @see #normalizeWhitespace(StringBuilder)
*/
public static String normalizeWhitespace(final String input) {
- final StringBuffer buffer = new StringBuffer(input);
+ final StringBuilder buffer = new StringBuilder(input);
final int changes = normalizeWhitespace(buffer);
if (changes < 1) {
return input;
@@ -61,7 +61,7 @@
* @return The number of changes made to buffer.
* @see #normalizeWhitespace(String)
*/
- public static int normalizeWhitespace(final StringBuffer buffer) {
+ public static int normalizeWhitespace(final StringBuilder buffer) {
int changes = 0;
for (int i = 0; i < buffer.length(); i++) {
final char c = buffer.charAt(i);
Modified: trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -137,7 +137,7 @@
private String stripWhiteSpace(final String s) {
final char[] ch = new char[s.length()];
s.getChars(0, s.length(), ch, 0);
- final StringBuffer stb = new StringBuffer();
+ final StringBuilder stb = new StringBuilder();
for (int i = 0; i < ch.length; i++) {
if (ch[i] != ' ' && ch[i] != '\r' && ch[i] != '\n'
&& ch[i] != '\t') {
Modified: trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -545,7 +545,7 @@
}
if (refID == null || refID.equals("")) {
if (fontID == null || fontID.equals("")) {
- final StringBuffer name = new StringBuffer(
+ final StringBuilder name = new StringBuilder(
this.currentFontFamily.getName());
if (this.currentFontFamilyMember.weight != null) {
name.append(this.currentFontFamilyMember.weight);
@@ -834,7 +834,7 @@
if (input == null) {
return null;
}
- final StringBuffer output = new StringBuffer(input);
+ final StringBuilder output = new StringBuilder(input);
for (String key : this.parameters.keySet()) {
final String value = this.parameters.get(key);
boolean anyChanges = true;
Modified: trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDF.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDF.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDF.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -189,7 +189,7 @@
*/
public String getToUnicodeBF() {
final char[] charArray = getCharsUsed();
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
writeBFCharEntries(buffer, charArray);
writeBFRangeEntries(buffer, charArray);
return buffer.toString();
@@ -200,7 +200,7 @@
* @param p The buffer to which the entries should be written.
* @param charArray The chars which should be written.
*/
- protected void writeBFCharEntries(final StringBuffer p,
+ protected void writeBFCharEntries(final StringBuilder p,
final char[] charArray) {
int completedEntries = 0;
int totalEntries = 0;
@@ -250,7 +250,7 @@
* @param p The buffer to which the entries should be written.
* @param charArray The chars which should be written.
*/
- protected void writeBFRangeEntries(final StringBuffer p,
+ protected void writeBFRangeEntries(final StringBuilder p,
final char[] charArray) {
int completedEntries = 0;
int totalEntries = 0;
@@ -409,7 +409,7 @@
if (length >= numChars) {
return input;
}
- final StringBuffer returnString = new StringBuffer();
+ final StringBuilder returnString = new StringBuilder();
for (int i = 1; i <= numChars - length; i++) {
returnString.append("0");
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjMixed.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -35,7 +35,7 @@
*/
public abstract class FObjMixed extends FObj {
- private StringBuffer textBuffer;
+ private StringBuilder textBuffer;
protected FObjMixed(final FObj parent, final PropertyList propertyList,
final String systemId, final int line, final int column) {
@@ -46,7 +46,7 @@
final int length, final String systemId, final int line,
final int column) {
if (textBuffer == null) {
- textBuffer = new StringBuffer();
+ textBuffer = new StringBuilder();
}
textBuffer.append(data, start, length);
}
@@ -117,7 +117,7 @@
* Returns the text buffer.
* @return Returns the textBuffer.
*/
- public StringBuffer getTextBuffer() {
+ public StringBuilder getTextBuffer() {
return this.textBuffer;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -76,7 +76,7 @@
/**
* Buffer for accumulating text in the element as it is parsed.
*/
- private transient StringBuffer stringBuffer = new StringBuffer();
+ private transient StringBuilder stringBuffer = new StringBuilder();
/**
* Constructor.
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/Namespace.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -93,7 +93,7 @@
return;
}
this.unknownFOs.add(localName);
- final StringBuffer sb = new StringBuffer(128);
+ final StringBuilder sb = new StringBuilder(128);
sb.append("Unsupported element ");
sb.append(this.getTypicalPrefix());
sb.append(":");
@@ -114,7 +114,7 @@
if (locator == null) {
return "";
}
- final StringBuffer sb = new StringBuffer();
+ final StringBuilder sb = new StringBuilder();
if (locator.getSystemId() != null) {
sb.append(locator.getSystemId());
} else if (locator.getPublicId() != null) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberGenerator.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberGenerator.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberGenerator.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -128,7 +128,7 @@
};
int i = 0;
- final StringBuffer romanNumber = new StringBuffer();
+ final StringBuilder romanNumber = new StringBuilder();
while (num > 0) {
while (num >= arabic[i]) {
@@ -143,7 +143,7 @@
private String makeAlpha(final int inputNum) {
int num = inputNum;
final String letters = "abcdefghijklmnopqrstuvwxyz";
- final StringBuffer alphaNumber = new StringBuffer();
+ final StringBuilder alphaNumber = new StringBuilder();
final int base = 26;
int rem = 0;
Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/FOrayHyphenBreak.java
===================================================================
--- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/FOrayHyphenBreak.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/FOrayHyphenBreak.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -90,7 +90,7 @@
&& preBreak.equals("-")) {
return "-";
}
- final StringBuffer res = new StringBuffer("{");
+ final StringBuilder res = new StringBuilder("{");
res.append(preBreak);
res.append("}{");
res.append(postBreak);
Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/FOrayHyphenation.java
===================================================================
--- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/FOrayHyphenation.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/FOrayHyphenation.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -133,7 +133,7 @@
* {@inheritDoc}
*/
public String toString() {
- final StringBuffer str = new StringBuffer();
+ final StringBuilder str = new StringBuilder();
int start = 0;
for (int i = 0; i < hyphenPoints.length; i++) {
str.append(word.substring(start, hyphenPoints[i]) + "-");
Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java
===================================================================
--- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/HyphenationTree.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -231,7 +231,7 @@
/* TODO: I suppose the StringBuffer is used because we don't know how
* long the final array will be. It seems like we can do better than
* that. */
- final StringBuffer buf = new StringBuffer();
+ final StringBuilder buf = new StringBuilder();
int packedIndex = start;
byte packedValue = patternValues.get(packedIndex++);
while (packedValue != 0) {
@@ -604,8 +604,8 @@
* to the map of exceptions. */
final String unhyphenatedWord = FOrayHyphenation.normalizeException(
hyphenatedWord, this.hyphenChar);
-
-
+
+
final FOrayHyphenation exception;
if (qtyMorphExceptions > 0) {
exception = FOrayHyphenation.makeHyphenation(unhyphenatedWord,
@@ -632,7 +632,7 @@
* values. */
final String pattern = getPatternChars(rawPattern);
final String ivalue = getInterletterValues(rawPattern);
-
+
int k = tempInterletterValues.find(ivalue);
if (k <= 0) {
k = packValues(ivalue);
@@ -650,7 +650,7 @@
* return value should be ".abi".
*/
private static String getPatternChars(final String pattern) {
- final StringBuffer pat = new StringBuffer();
+ final StringBuilder pat = new StringBuilder();
final int len = pattern.length();
for (int i = 0; i < len; i++) {
if (!Character.isDigit(pattern.charAt(i))) {
@@ -679,7 +679,7 @@
* <code>values</code> as "00040".
*/
private static String getInterletterValues(final String pattern) {
- final StringBuffer il = new StringBuffer();
+ final StringBuilder il = new StringBuilder();
// add dummy letter to serve as sentinel
final String word = pattern + "a";
final int len = word.length();
Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java
===================================================================
--- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -78,7 +78,7 @@
private PatternConsumer consumer;
/** The current token being parsed. */
- private StringBuffer token;
+ private StringBuilder token;
/** The last error message generated. Used to enhance the messages that
* are returned with exceptions. */
@@ -105,7 +105,7 @@
+ " requires a PatternConsumer instance at construction.");
}
this.logger = logger;
- token = new StringBuffer();
+ token = new StringBuilder();
parser = createParser();
parser.setContentHandler(this);
parser.setErrorHandler(this);
@@ -178,7 +178,7 @@
* @param chars The buffer which is being parsed.
* @return The next token.
*/
- protected String readToken(final StringBuffer chars) {
+ protected String readToken(final StringBuilder chars) {
String word;
boolean space = false;
int i;
@@ -289,7 +289,7 @@
* {@inheritDoc}
*/
public void characters(final char ch[], final int start, final int length) {
- final StringBuffer chars = new StringBuffer(length);
+ final StringBuilder chars = new StringBuilder(length);
chars.append(ch, start, length);
String word = readToken(chars);
while (word != null) {
@@ -340,7 +340,7 @@
* @return The string description of the document location.
*/
private String getLocationString(final SAXParseException ex) {
- final StringBuffer str = new StringBuffer();
+ final StringBuilder str = new StringBuilder();
String systemId = ex.getSystemId();
if (systemId != null) {
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifBook.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifBook.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifBook.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -77,7 +77,7 @@
*/
public static final String mifEncode(final String val) {
final int len = val.length();
- final StringBuffer buf = new StringBuffer(len * 2);
+ final StringBuilder buf = new StringBuilder(len * 2);
char c;
for (int i = 0; i < len; i++) {
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifFrame.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifFrame.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifFrame.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -85,7 +85,7 @@
* {@inheritDoc}
*/
public String mifContent() {
- final StringBuffer mif = new StringBuffer();
+ final StringBuilder mif = new StringBuilder();
mif.append(MifBook.EOL
+ "<Frame" + MifBook.EOL
+ MifBook.TAB + "<ID " + this.id + " >");
Modified: trunk/foray/foray-mif/src/java/org/foray/mif/MifImportObject.java
===================================================================
--- trunk/foray/foray-mif/src/java/org/foray/mif/MifImportObject.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-mif/src/java/org/foray/mif/MifImportObject.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -90,7 +90,7 @@
} while (i != -1);
- final StringBuffer mif = new StringBuffer();
+ final StringBuilder mif = new StringBuilder();
mif.append(MifBook.EOL
+ "<ImportObject" + MifBook.EOL
+ "<ImportObFixedSize Yes>" + MifBook.EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -79,7 +79,7 @@
* @return the PDF string
*/
public String toPDF() {
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(this.pdfID() + EOL);
p.append("[" + EOL);
for (int i = 0; i < annotations.size(); i++) {
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -51,7 +51,7 @@
* {@inheritDoc}
*/
public String toPDF() {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append(this.pdfID() + EOL);
buffer.append("[" + EOL);
buffer.append(addContents());
@@ -61,8 +61,8 @@
return buffer.toString();
}
- private StringBuffer addContents() {
- final StringBuffer buffer = new StringBuffer();
+ private StringBuilder addContents() {
+ final StringBuilder buffer = new StringBuilder();
if (arrayContents instanceof int[]) {
final int[] intValues = (int[]) arrayContents;
for (int i = 0; i < intValues.length; i++) {
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -77,7 +77,7 @@
* @return The text that should be placed in the PDF for this object.
*/
public String toPDF() {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append(this.pdfID() + EOL);
buffer.append("<< /Type /Border" + EOL);
if (this.width >= 0) {
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -95,7 +95,7 @@
*/
public String toPDF() {
final Font font = fsFont.getFont();
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(pdfID() + EOL);
p.append("<< /Type /Font");
p.append(EOL + "/BaseFont /");
@@ -167,7 +167,7 @@
if (widthArray.length == 0) {
return "";
}
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(EOL + "/W [");
int start = 0;
int end = 0;
@@ -203,7 +203,7 @@
return p.toString();
}
- private static void writeWidthArrayUnequalRun(final StringBuffer p,
+ private static void writeWidthArrayUnequalRun(final StringBuilder p,
final short[] widthArray, final int start, final int end) {
p.append(" " + start + " [");
for (int i = start; i <= end; i++) {
@@ -215,7 +215,7 @@
p.append("]");
}
- private static int writeWidthArrayEqualRun(final StringBuffer p,
+ private static int writeWidthArrayEqualRun(final StringBuilder p,
final short[] widthArray, final int start) {
// First, compute the end-point of the run.
int end = -1;
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -57,7 +57,7 @@
this.cidSet = cidSet;
}
- protected void fillInPDF(final StringBuffer p) {
+ protected void fillInPDF(final StringBuilder p) {
p.append(EOL + "/MissingWidth 500" + EOL);
if (lang != null) {
p.append(EOL + "/Lang /");
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -36,7 +36,7 @@
* this small object is used in the CID fonts and in the CMaps.
*/
public class PDFCIDSystemInfo extends PDFObject {
- private static final StringBuffer BUFFER = new StringBuffer();
+ private static final StringBuilder BUFFER = new StringBuilder();
private String registry;
private String ordering;
private int supplement;
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java 2007-03-22 21:58:32 UTC (rev 8979)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java 2007-03-22 22:33:59 UTC (rev 8980)
@@ -200,11 +200,11 @@
}
protected int output(final OutputStream stream) throws IOException {
- fillInPDF(new StringBuffer());
+ fillInPDF(new StringBuilder());
return super.output(stream);
}
- public void fillInPDF(final StringBuffer p) {
+ public void fillInPDF(final StringBuilder p) {
writePreStream(p);
writeStreamComments(p);
writeCIDInit(p);
@@ -219,13 +219,13 @@
add(p.toString());
}
- protected void writePreStream(final StringBuffer p) {
+ protected void writePreStream(final StringBuilder p) {
// p.append("/Type /CMap" + EOL);
// p.append(sysInfo.toPDFString());
// p.append("/CMapName /" + name + EOL);
}
- protected void writeStreamComments(final StringBuffer p) {
+ protected void writeStreamComments(final StringBuilder p) {
p.append("%!PS-Adobe-3.0 Resource-CMap" + EOL);
p.append("%%DocumentNeededResources: ProcSet (CIDInit)" + EOL);
p.append("%%IncludeResource: ProcSet (CIDInit)" + EOL);
@@ -233,13 +233,13 @@
p.append("%%EndComments" + EOL);
}
- protected void writeCIDInit(final StringBuffer p) {
+ protected void writeCIDInit(final StringBuilder p) {
p.append("/CIDInit /ProcSet findresource begin" + EOL);
p.append("12 dict begin" + EOL);
p.append("begincmap" + EOL);
}
- protected void writeCIDSystemInfo(final StringBuffer p) {
+ protected void writeCIDSystemInfo(final StringBuilder p) {
p.append("/CIDSystemInfo 3 dict dup begin" + EOL);
p.append(" /Registry (Adobe) def" + EOL);
p.append(" /Ordering (Identity) def" + EOL);
@@ -247,43 +247,43 @@
p.append("end def" + EOL);
}
- protected void writeVersionTypeName(final StringBuffer p) {
+ protected void writeVersionTypeName(final StringBuilder p) {
p.append("/CMapVersion 1 def" + EOL);
p.append("/CMapType 1 def" + EOL);
p.append("/CMapName /" + name + " def" + EOL);
}
- protected void writeCodeSpaceRange(final StringBuffer p) {
+ protected void writeCodeSpaceRange(final StringBuilder p) {
p.append("1 begincodespacerange" + EOL);
p.append("<0000> <FFFF>" + EOL);
p.append("endcodespacerange" + EOL);
}
- protected void writeCIDRange(final StringBuffer p) {
+ protected void writeCIDRange(final StringBuilder p) {
p.append("1 begincidrange" + EOL);
p.append("<0000> <FFFF> 0" + EOL);
p.append("endcidrange" + EOL);
}
- protected void writeBFEntries(fin...
[truncated message content] |
|
From: <vic...@us...> - 2007-03-23 00:44:45
|
Revision: 8981
http://svn.sourceforge.net/foray/?rev=8981&view=rev
Author: victormote
Date: 2007-03-22 16:00:34 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
Convert StringBuffer to StringBuilder.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java
trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java
trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java
trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFunction.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFGoTo.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFICCStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFInfo.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXPostScript.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTextPainter.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSColor.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSException.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSInterpreter.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSReal.java
trunk/foray/foray-ps/src/java/org/foray/ps/PSSystemDict.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/txt/TXTRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/xml/XMLRenderer.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-common/src/java/org/foray/common/RandomReaderArray.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -213,7 +213,7 @@
* {@inheritDoc}
*/
public final String readLine() throws IOException {
- final StringBuffer input = new StringBuffer();
+ final StringBuilder input = new StringBuilder();
int byteRead = -1;
boolean eol = false;
Modified: trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -679,7 +679,7 @@
if (! changesNeeded) {
return rawText;
}
- final StringBuffer buffer = new StringBuffer(new String(rawText));
+ final StringBuilder buffer = new StringBuilder(new String(rawText));
for (int i = 0; i < buffer.length(); i++) {
final char c = buffer.charAt(i);
if (XMLCharacter.isEntityReference(c)) {
Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -230,7 +230,7 @@
logger.info("Ascender: " + getTTFFunit(getAscender()));
logger.info("Descender: " + getTTFFunit(getDescender()));
final int[] bbox = this.headTable.getBbox();
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append("FontBBox: [");
for (int i = 0; i < bbox.length; i++) {
buffer.append(bbox[i]);
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -117,7 +117,7 @@
*/
private String unexpectedValueMessage(final String reason,
final String value, final PropertyList propertyList) {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
final FObj fobj = propertyList.getFObj();
buffer.append("Unexpected value for ");
buffer.append(getPropertyType().toStringUnparsed());
Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java
===================================================================
--- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/TernaryTree.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -607,7 +607,7 @@
private Stack<Item> ns;
/** Key stack implemented with a StringBuffer. */
- private StringBuffer ks;
+ private StringBuilder ks;
/**
* Constructor.
@@ -615,7 +615,7 @@
public Iterator() {
cur = -1;
ns = new Stack<Item>();
- ks = new StringBuffer();
+ ks = new StringBuilder();
rewind();
}
@@ -747,7 +747,7 @@
}
// The current node should be a data node and
// the key should be in the key stack (at least partially)
- final StringBuffer buf = new StringBuffer(ks.toString());
+ final StringBuilder buf = new StringBuilder(ks.toString());
if (sc[cur] == Character.MAX_VALUE) {
int p = lo[cur];
while (kv.get(p) != 0) {
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFunction.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFunction.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFunction.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -135,7 +135,7 @@
* Required For Type 4: Postscript Calculator function composed of
* arithmetic, boolean, and stack operators + boolean constants.
*/
- private StringBuffer functionDataStream = null;
+ private StringBuilder functionDataStream = null;
/**
* Required (?) For Type 0: A List of Strings for the various filters to be
@@ -252,7 +252,7 @@
final List<Double> theSize,
final int theBitsPerSample, final int theOrder,
final List<Double> theEncode, final List<Double> theDecode,
- final StringBuffer theFunctionDataStream,
+ final StringBuilder theFunctionDataStream,
final List<String> theFilter) {
super(doc);
this.functionType = TYPE_SAMPLED;
@@ -395,7 +395,7 @@
*/
public PDFFunction(final PDFDocument doc, final int theFunctionType,
final List<Double> theDomain, final List<Double> theRange,
- final StringBuffer theFunctionDataStream) {
+ final StringBuilder theFunctionDataStream) {
super(doc);
this.functionType = TYPE_PS_CALCULATOR;
this.functionDataStream = theFunctionDataStream;
@@ -422,7 +422,7 @@
int vectorSize = 0;
int numberOfFunctions = 0;
int tempInt = 0;
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(this.pdfID() + EOL + "<<" + EOL + "/FunctionType "
+ this.functionType + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFGoTo.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFGoTo.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFGoTo.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -55,7 +55,7 @@
* {@inheritDoc}
*/
public String toPDF() {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append(this.pdfID() + EOL);
buffer.append("<<" + EOL);
buffer.append("/S /GoTo" + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFICCStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFICCStream.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFICCStream.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -51,7 +51,7 @@
int length = 0;
setData(cs.getProfile().getData());
final String filterEntry = applyFilters();
- final StringBuffer pb = new StringBuffer();
+ final StringBuilder pb = new StringBuilder();
pb.append(this.pdfID() + EOL);
pb.append("<< ");
pb.append("/N ");
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFInfo.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFInfo.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFInfo.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -125,7 +125,7 @@
// The /Info entry is optional.
return new String();
}
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(this.pdfID() + EOL);
p.append("<< /Type /Info" + EOL);
if (this.title != null && ! this.title.isEmpty()) {
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -97,7 +97,7 @@
* {@inheritDoc}
*/
public String toPDF() {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append(this.pdfID() + EOL);
buffer.append("<< /Type /Annot" + EOL);
buffer.append("/Subtype /Link" + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -49,7 +49,7 @@
* @return The PDF string
*/
public String toPDF() {
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(this.pdfID() + EOL);
p.append("<<" + EOL);
p.append("/Names [" + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -67,7 +67,7 @@
* the referred destination.
*/
protected String toPDF() {
- final StringBuffer result = new StringBuffer();
+ final StringBuilder result = new StringBuilder();
result.append("(" + this.name + ") ");
result.append(this.destination.pdfReference() + EOL);
return result.toString();
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -51,7 +51,7 @@
* {@inheritDoc}
*/
protected String toPDF() {
- final StringBuffer result = new StringBuffer();
+ final StringBuilder result = new StringBuilder();
result.append(this.pdfID() + EOL);
result.append("<<" + EOL);
result.append(" /Type /Outlines" + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -211,7 +211,7 @@
* {@inheritDoc}
*/
protected String toPDF() {
- final StringBuffer result = new StringBuffer();
+ final StringBuilder result = new StringBuilder();
result.append(this.pdfID() + EOL + "<<" + EOL);
final int countDescendants = this.count();
// subentry Outline object
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -123,7 +123,7 @@
* {@inheritDoc}
*/
public String toPDF() {
- final StringBuffer sb = new StringBuffer();
+ final StringBuilder sb = new StringBuilder();
sb.append(this.pdfID() + EOL
+ "<< /Type /Page" + EOL + "/Parent "
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -93,7 +93,7 @@
* {@inheritDoc}
*/
public String toPDF() {
- StringBuffer p = new StringBuffer();
+ StringBuilder p = new StringBuilder();
p.append(this.pdfID() + EOL);
p.append("<< /Type /Pages" + EOL);
p.append("/Count " + this.getCount() + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -86,14 +86,14 @@
* String representing the extended Graphics state.
* Probably will never be used like this.
*/
- private StringBuffer extGState = null;
+ private StringBuilder extGState = null;
/* TODO: Add a PDFExtGSState. */
/** List of Doubles representing the Transformation matrix. */
private List<Double> matrix = null;
/** The stream of a pattern. */
- private StringBuffer patternDataStream = null;
+ private StringBuilder patternDataStream = null;
/**
* Create a tiling pattern (type 1).
@@ -118,7 +118,7 @@
final double theXStep,
final double theYStep, final List<Double> theMatrix,
final List<Integer> theXUID,
- final StringBuffer thePatternDataStream) {
+ final StringBuilder thePatternDataStream) {
super(doc);
this.patternCount = doc.registerPatternResource(this);
this.resources = theResources;
@@ -147,7 +147,7 @@
*/
public PDFPattern(final PDFDocument doc, final int thePatternType,
final PDFShading theShading, final List<Integer> theXUID,
- final StringBuffer theExtGState, final List<Double> theMatrix) {
+ final StringBuilder theExtGState, final List<Double> theMatrix) {
super(doc);
this.patternCount = doc.registerPatternResource(this);
this.patternType = 2; // thePatternType;
@@ -287,7 +287,7 @@
public String toPDF() {
int vectorSize = 0;
int tempInt = 0;
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(this.pdfID() + EOL + "<<" + EOL + "/Type /Pattern" + EOL);
if (this.resources != null) {
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -78,7 +78,7 @@
* {@inheritDoc}
*/
public String toPDF() {
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(this.pdfID() + EOL);
p.append("<<" + EOL);
if (! this.fonts.isEmpty()) {
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -86,7 +86,7 @@
* @return The PDF string
*/
public String toPDF() {
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(this.pdfID() + EOL);
p.append("<<" + EOL);
p.append("/Type /Catalog" + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -367,7 +367,7 @@
public String toPDF() {
int vectorSize;
int tempInt;
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append(this.pdfID() + EOL);
p.append("<<" + EOL);
p.append("/ShadingType " + this.shadingType + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -286,7 +286,7 @@
}
private String buildFilterEntries(final List<String> names) {
- final StringBuffer sb = new StringBuffer();
+ final StringBuilder sb = new StringBuilder();
sb.append("/Filter ");
if (names.size() > 1) {
sb.append("[ ");
@@ -304,7 +304,7 @@
}
private String buildDecodeParms(final List<String> parms) {
- final StringBuffer sb = new StringBuffer();
+ final StringBuilder sb = new StringBuilder();
boolean needParmsEntry = false;
sb.append("/DecodeParms ");
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -59,7 +59,7 @@
}
public String toPDF() {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append("[");
buffer.append(startTextDelimiter());
final FontUse font = this.font.getFontUse();
@@ -86,7 +86,7 @@
* @param buffer The buffer to which the character should be added.
* @param glyphIndex The glyph index to be added.
*/
- private void addCharToBuffer(final StringBuffer buffer,
+ private void addCharToBuffer(final StringBuilder buffer,
final int glyphIndex) {
final Font font = this.font.getFontUse().getFont();
if (font.getFontComplexity() == Font.Complexity.COMPOSITE) {
@@ -127,7 +127,7 @@
* written.
*/
private void addKerning(final Font font, final char char1, final char char2,
- final StringBuffer buf) {
+ final StringBuilder buf) {
final int kernAmount = font.kern(char1, char2);
if (kernAmount == 0) {
return;
@@ -160,7 +160,7 @@
* @return The string representation of the character.
*/
public static String getUnicodeString(final int c) {
- StringBuffer buf = new StringBuffer(UNICODE_STRING_SIZE);
+ StringBuilder buf = new StringBuilder(UNICODE_STRING_SIZE);
byte[] uniBytes = null;
int codePoint = c;
/* TODO: Handle Unicode characters > 0xFFFF better. */
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -69,7 +69,7 @@
if (this.theString == null) {
return new String();
}
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append("(");
// Since it is more readable, try to use the PDFDocEncoding.
final String pdfDoc = unicodeToPDFDocEncoding(this.theString);
@@ -83,7 +83,7 @@
}
private String toPDFUnicode() {
- final StringBuffer result = new StringBuffer();
+ final StringBuilder result = new StringBuilder();
// byte order marker (0xfeff)
result.append("\\376\\377");
for (int i = 0; i < this.theString.length(); i++) {
@@ -105,7 +105,7 @@
* more chars that cannot be converted to PDFDocEncoding.
*/
public static String unicodeToPDFDocEncoding(final String unicodeString) {
- final StringBuffer pdfDocString = new StringBuffer(unicodeString);
+ final StringBuilder pdfDocString = new StringBuilder(unicodeString);
for (int i = 0; i < unicodeString.length(); i++) {
final char unicodeChar = unicodeString.charAt(i);
final char pdfDocChar = unicodeToPDFDocEncoding(unicodeChar);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -83,7 +83,7 @@
p.append(">> def" + EOL);
}
- protected void writeVersionTypeName(final StringBuffer p) {
+ protected void writeVersionTypeName(final StringBuilder p) {
p.append("/CMapName /Adobe-Identity-UCS def" + EOL);
p.append("/CMapType 2 def" + EOL);
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -95,7 +95,7 @@
}
public String toPDFString() {
- final StringBuffer p = new StringBuffer();
+ final StringBuilder p = new StringBuilder();
p.append("[ ");
final int len = entries.size();
for (int i = 0; i < len; i++) {
@@ -125,7 +125,7 @@
metrics = m;
}
- public void fillInPDF(final StringBuffer p) {
+ public void fillInPDF(final StringBuilder p) {
// p.setLength(0);
p.append(start);
p.append(" [");
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -105,7 +105,7 @@
}
protected String xObjectDictionary() {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append("/FormType 1" + EOL);
buffer.append("/BBox [");
/* Use the clip rectangle for the bounding box if we have it.
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -111,7 +111,7 @@
} catch (final GraphicException e) {
getLogger().error("Error in XObject:" + MSG_EOL + e.getMessage());
}
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
// The width, in pixels (aka samples), *not* points.
buffer.append("/Width " + pixelWidth + EOL);
// The width, in pixels (aka samples), *not* points.
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXPostScript.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXPostScript.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXPostScript.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -75,7 +75,7 @@
final int bboxw = FOrayBoundingBox.width(bbox);
final int bboxh = FOrayBoundingBox.height(bbox);
- final StringBuffer preamble = new StringBuffer();
+ final StringBuilder preamble = new StringBuilder();
preamble.append("%%BeginDocument: " + eps.getName()
+ EOL);
@@ -94,7 +94,7 @@
+ bboxh + " rectclip" + EOL);
preamble.append("newpath" + EOL);
- final StringBuffer post = new StringBuffer();
+ final StringBuilder post = new StringBuilder();
post.append("%%EndDocument" + EOL);
post.append("count ops_count sub {pop} repeat" + EOL);
post.append("countdictstack dict_stack sub {end} repeat" + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -70,7 +70,7 @@
}
protected String xObjectDictionary() {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
buffer.append("/BBox [10 10 100 100]" + EOL);
buffer.append("/Resources <</ProcSet [/PDF]>>" + EOL);
buffer.append("/Ref" + EOL);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java 2007-03-22 22:33:59 UTC (rev 8980)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java 2007-03-22 23:00:34 UTC (rev 8981)
@@ -198,7 +198,7 @@
}
public static String octalMatrixToString(final double[] theMatrix) {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
for (int i = 0; i < theMatrix.length; i++) {
buffer.append(PSReal.doubleOut(theMatrix[i],
...
[truncated message content] |
|
From: <vic...@us...> - 2007-03-23 16:26:26
|
Revision: 8985
http://svn.sourceforge.net/foray/?rev=8985&view=rev
Author: victormote
Date: 2007-03-23 09:26:26 -0700 (Fri, 23 Mar 2007)
Log Message:
-----------
Conform to axsl changes making LineArea implement LineOutput.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-03-23 16:03:40 UTC (rev 8984)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-03-23 16:26:26 UTC (rev 8985)
@@ -46,7 +46,6 @@
import org.axsl.foR.fo.PageNumberCitation;
import org.axsl.foR.fo.RetrieveMarker;
import org.axsl.fontR.Font;
-import org.axsl.text.line.LineOutput;
import java.util.ArrayList;
import java.util.List;
@@ -54,8 +53,7 @@
/**
* Area containing a line of content on the page.
*/
-public class LineArea extends BlockArea implements LineOutput,
- org.axsl.areaR.LineArea,
+public class LineArea extends BlockArea implements org.axsl.areaR.LineArea,
org.axsl.areaW.LineArea {
/** The parent of this node. */
@@ -1040,13 +1038,6 @@
/**
* {@inheritDoc}
*/
- public LineOutput asLineOutput() {
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
public int traitSpaceBeforeMinimum() {
/* space-before applies to the parent normal block area, but not to the
* line-area.*/
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2007-03-23 16:03:40 UTC (rev 8984)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2007-03-23 16:26:26 UTC (rev 8985)
@@ -223,8 +223,7 @@
final FOLineText contextAware = lineText.getContextWrapper(
foContext);
try {
- status = lb.processLineContent(contextAware, start, end,
- lineArea.asLineOutput());
+ status = lb.processLineContent(contextAware, start, end, lineArea);
} catch (final TextException e) {
final FObj generatedBy = lineArea.traitGeneratedBy();
throw new AreaWException("Error in text layout:\n"
@@ -259,8 +258,7 @@
final FOLineNonText contextAware = nonText.getContextWrapper(
foContext);
try {
- status = lb.processLineContent(contextAware, -1, -1,
- lineArea.asLineOutput());
+ status = lb.processLineContent(contextAware, -1, -1, lineArea);
} catch (final TextException e) {
final FObj generatedBy = lineArea.traitGeneratedBy();
throw new AreaWException("Error in non-text layout:\n"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-23 16:43:59
|
Revision: 8986
http://svn.sourceforge.net/foray/?rev=8986&view=rev
Author: victormote
Date: 2007-03-23 09:43:57 -0700 (Fri, 23 Mar 2007)
Log Message:
-----------
Conform to axsl change adding convenience method to LineOutput.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java
trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-03-23 16:26:26 UTC (rev 8985)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-03-23 16:43:57 UTC (rev 8986)
@@ -915,6 +915,13 @@
/**
* {@inheritDoc}
*/
+ public int capacityRemaining() {
+ return capacityTotal() - capacityUsed();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public boolean hasAnyContent() {
return getChildren().size() > 0;
}
Modified: trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java
===================================================================
--- trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java 2007-03-23 16:26:26 UTC (rev 8985)
+++ trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java 2007-03-23 16:43:57 UTC (rev 8986)
@@ -134,8 +134,8 @@
protected int processLineNonText(final LineNonText nonTextItem)
throws TextException {
final int lineLength = lineReceivingContent().capacityTotal();
- final int itemSize = nonTextItem.inlineSizeOptimum(lineLength);
- if (itemSize > currentLineWidthRemaining()) {
+ final int itemSize = nonTextItem.inlineSizeMinimum(lineLength);
+ if (itemSize > lineReceivingContent().capacityRemaining()) {
// It doesn't fit on the current line.
if (lineReceivingContent().capacityUsed() == 0) {
// There is nothing on the line. Therefore it won't fit any
@@ -169,15 +169,6 @@
int end) throws TextException;
/**
- * Copmputes the amount of space available on the current line.
- * @return The size, in millipoints, of available space on the current line.
- */
- protected int currentLineWidthRemaining() {
- return lineReceivingContent().capacityTotal()
- - lineReceivingContent().capacityUsed();
- }
-
- /**
* Add new line-content for processing.
* @param content The line-content to be processed.
* @param start The index to the first element in the line-content to be
Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2007-03-23 16:26:26 UTC (rev 8985)
+++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2007-03-23 16:43:57 UTC (rev 8986)
@@ -165,7 +165,7 @@
processTextChar(language, thisCharStarts, charWidth);
if ((this.finalWidth + this.spaceWidth + this.wordWidth)
- <= currentLineWidthRemaining()) {
+ <= lineReceivingContent().capacityRemaining()) {
// Content fits on the current line. We are done with this char.
continue;
}
@@ -210,7 +210,7 @@
* entire word fits. */
if (this.finalWidth + this.spaceWidth + this.wordWidth
+ sizeFirstWordNextText(lineText, startIndex, endIndex)
- <= currentLineWidthRemaining()) {
+ <= lineReceivingContent().capacityRemaining()) {
return remainingContentOnThisLine(startIndex, endIndex);
}
@@ -444,7 +444,8 @@
*/
private int selectDiscretionaryHyphenationPoint(final LineText lineText,
final String word, final Hyphenation hyph) throws TextException {
- final int remainingWidth = this.currentLineWidthRemaining()
+ final int remainingWidth
+ = this.lineReceivingContent().capacityRemaining()
- this.finalWidth
- this.spaceWidth - getHyphenWidth(this.currentLineText);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-23 22:32:28
|
Revision: 8993
http://svn.sourceforge.net/foray/?rev=8993&view=rev
Author: victormote
Date: 2007-03-23 15:32:26 -0700 (Fri, 23 Mar 2007)
Log Message:
-----------
1. Add nominal support for "auto" table layout.
2. Remove warning in Pioneer layout system about "auto" table support. The layout system does not know whether the area tree supports "auto" layout or not.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-03-23 21:10:25 UTC (rev 8992)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-03-23 22:32:26 UTC (rev 8993)
@@ -32,6 +32,7 @@
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaR.TableArea;
import org.axsl.areaW.AreaWException;
+import org.axsl.common.FoValue;
import org.axsl.common.RelativeAxis;
import org.axsl.foR.FOContext;
import org.axsl.foR.fo.RetrieveMarker;
@@ -98,8 +99,7 @@
final int numColumns = generatedBy.numberOfColumns();
newTable.resolvedColumnWidth = new int[numColumns];
newTable.crOriginX = new int[numColumns];
- /* Not sure this is right. */
- newTable.calcFixedColumnWidths(newTable.crIPD());
+ newTable.calcColumnWidths(newTable.crIPD());
newTable.calcColumnOrigins();
return newTable;
}
@@ -220,11 +220,38 @@
}
/**
- * Computes the fixed column widths.
+ * Computes the column widths for this Table Area.
* @param maxAllocationIPD The maximum width of the area into which the
* columns can be placed.
* @return The new width of the table.
*/
+ private int calcColumnWidths(final int maxAllocationIPD) {
+ if (this.traitGeneratedBy().traitTableLayout() == FoValue.AUTO) {
+ /* For "auto" column width, start by just making all of the columns
+ * equal. */
+ final Table table = (Table) this.traitGeneratedBy();
+ final int tableWidth = table.traitIPDimensionOpt(this,
+ this.crIPD());
+ if (this.resolvedColumnWidth.length < 1) {
+ /* TODO: Consider throwing an exception here. */
+ return 0;
+ }
+ final int colWidth = tableWidth / this.resolvedColumnWidth.length;
+ for (int i = 0; i < this.resolvedColumnWidth.length; i++) {
+ this.resolvedColumnWidth[i] = colWidth;
+ }
+ return tableWidth;
+ } else {
+ return calcFixedColumnWidths(maxAllocationIPD);
+ }
+ }
+
+ /**
+ * Computes the column widths for a "fixed" model Table.
+ * @param maxAllocationIPD The maximum width of the area into which the
+ * columns can be placed.
+ * @return The new width of the table.
+ */
private int calcFixedColumnWidths(final int maxAllocationIPD) {
final Table node = (Table) this.traitGeneratedBy();
final int tableWidth = node.traitIPDimensionOpt(this, this.crIPD());
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-03-23 21:10:25 UTC (rev 8992)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-03-23 22:32:26 UTC (rev 8993)
@@ -80,10 +80,6 @@
final BlockContentFactory bcArea = (BlockContentFactory) area;
if (getProgress() == FONodePL.START) {
- if (node.traitTableLayout() == FoValue.AUTO) {
- getLayout().getLogger().warn("table-layout=auto is not "
- + "supported, using fixed!");
- }
if (area instanceof NormalBlockArea) {
getLayout().completeCurrentLineInBlock((NormalBlockArea) area);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-24 23:34:33
|
Revision: 9002
http://svn.sourceforge.net/foray/?rev=9002&view=rev
Author: victormote
Date: 2007-03-24 16:34:32 -0700 (Sat, 24 Mar 2007)
Log Message:
-----------
Conform to axsl changes removing the FONodeResult interface.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkage.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkage.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkage.java 2007-03-24 23:25:15 UTC (rev 9001)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkage.java 2007-03-24 23:34:32 UTC (rev 9002)
@@ -29,14 +29,13 @@
package org.foray.area;
import org.axsl.foR.FONode;
-import org.axsl.foR.FONodeResult;
import org.axsl.foR.fo.RetrieveMarker;
/**
* Abstract superclass for classes that handle the linkage between the FO Tree
* and the Area Tree.
*/
-public abstract class FOLinkage implements FONodeResult {
+public abstract class FOLinkage {
/** The FONode for which this linkage tracks Area generation. */
private FONode foGenerator;
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-03-24 23:25:15 UTC (rev 9001)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-03-24 23:34:32 UTC (rev 9002)
@@ -34,7 +34,6 @@
import org.axsl.foR.FOContext;
import org.axsl.foR.FONodeProxy;
-import org.axsl.foR.FONodeResult;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.fo.RetrieveMarker;
@@ -60,8 +59,6 @@
private FONodeProxy proxy;
- private FONodeResult result;
-
/**
* Constructor.
* @param parent The parent of this node.
@@ -160,23 +157,8 @@
/**
* {@inheritDoc}
*/
- public void setResult(final FONodeResult result) {
- this.result = result;
- }
-
- /**
- * {@inheritDoc}
- */
- public FONodeResult getResult() {
- return this.result;
- }
-
- /**
- * {@inheritDoc}
- */
public void reset() {
this.proxy = null;
- this.result = null;
if (this.getChildren() == null) {
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-03-25 00:51:47
|
Revision: 9003
http://svn.sourceforge.net/foray/?rev=9003&view=rev
Author: victormote
Date: 2007-03-24 17:51:47 -0700 (Sat, 24 Mar 2007)
Log Message:
-----------
Conform to axsl changes removing the FONodeProxy interface.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkageNormal.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiPropertySet.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiSwitch.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiToggle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionAfter.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBefore.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBody.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionEnd.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionStart.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMAlternatives.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMReference.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RetrieveMarker.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Root.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/StaticContent.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableAndCaption.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableBody.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCaption.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableFooter.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableHeader.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableRow.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Wrapper.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/foray/obj/ContinuedLabel.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/svg/obj/SVGElement.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTableBodyPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RowSpanMgr.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkageNormal.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkageNormal.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/FOLinkageNormal.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -35,8 +35,8 @@
import java.util.List;
/**
- * <p>An implementation of {@link org.axsl.foR.FONodeProxy} suitable for use
- * with the FOray AreaTree.</p>
+ * <p>A "normal" linkage manager, that is, one that simply matches an FONode
+ * to the Areas that it has created.</p>
*/
public class FOLinkageNormal extends FOLinkage {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -33,7 +33,6 @@
import org.foray.fotree.fo.obj.Root;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.fo.RetrieveMarker;
@@ -57,8 +56,6 @@
* of this number. */
private int sequentialIndex;
- private FONodeProxy proxy;
-
/**
* Constructor.
* @param parent The parent of this node.
@@ -143,34 +140,6 @@
/**
* {@inheritDoc}
*/
- public void setProxy(final FONodeProxy proxy) {
- this.proxy = proxy;
- }
-
- /**
- * {@inheritDoc}
- */
- public FONodeProxy getProxy() {
- return this.proxy;
- }
-
- /**
- * {@inheritDoc}
- */
- public void reset() {
- this.proxy = null;
- if (this.getChildren() == null) {
- return;
- }
- for (int i = 0; i < this.getChildren().size(); i++) {
- final FONode node = this.getChildren().get(i);
- node.reset();
- }
- }
-
- /**
- * {@inheritDoc}
- */
public FONode getChildAt(final int childIndex) {
return (FONode) super.getChildAt(childIndex);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -35,7 +35,6 @@
import org.axsl.common.FoValue;
import org.axsl.foR.FOContext;
import org.axsl.foR.FOLineText;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.ProxyFactory;
import org.axsl.foR.fo.Block;
import org.axsl.foR.fo.Leader;
@@ -1017,7 +1016,7 @@
return this.getParent().getColumn();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -35,7 +35,6 @@
import org.axsl.common.LinkType;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -158,7 +157,7 @@
return true;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -94,7 +93,7 @@
return true;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -36,7 +36,6 @@
import org.foray.fotree.PropertyList;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -186,7 +185,7 @@
return true;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -103,7 +102,7 @@
return true;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -34,7 +34,6 @@
import org.foray.fotree.PropertyList;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -141,7 +140,7 @@
return traitInternalDestination();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -34,7 +34,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -109,7 +108,7 @@
return false;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -97,7 +96,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -34,7 +34,6 @@
import org.foray.fotree.PropertyList;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -109,7 +108,7 @@
return text.getAreaTreeText(context);
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -90,7 +89,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -33,11 +33,9 @@
import org.foray.fotree.PropertyList;
import org.axsl.common.FoValue;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
-
/**
* A "conditional-page-master-reference" object in XSL-FO.
*/
@@ -214,7 +212,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -90,7 +89,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -36,7 +36,6 @@
import org.axsl.foR.FOContext;
import org.axsl.foR.FOLineNonText;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
import org.axsl.foR.fo.RetrieveMarker;
@@ -172,7 +171,7 @@
}
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -101,7 +100,7 @@
return true;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.PropertyList;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -115,7 +114,7 @@
return this;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -113,7 +112,7 @@
return (FootnoteBody) this.getChildren().get(1);
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -90,7 +89,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -91,7 +90,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -33,7 +33,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -96,7 +95,7 @@
return true;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -99,7 +98,7 @@
return true;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -36,7 +36,6 @@
import org.axsl.foR.FOContext;
import org.axsl.foR.FOLineNonText;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
import org.axsl.foR.fo.RetrieveMarker;
@@ -125,7 +124,7 @@
return ((ForeignXML) getForeignXML()).intrinsicContentHeight();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -33,7 +33,6 @@
import org.foray.fotree.PropertyList;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -201,7 +200,7 @@
regionMap.put(region.traitRegionName(), region.getName());
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -35,7 +35,6 @@
import org.axsl.foR.FOContext;
import org.axsl.foR.FOLineNonText;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
import org.axsl.foR.fo.RetrieveMarker;
@@ -175,7 +174,7 @@
return true;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -99,7 +98,7 @@
return;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -33,7 +33,6 @@
import org.foray.fotree.PropertyList;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -105,7 +104,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -33,7 +33,6 @@
import org.foray.fotree.PropertyList;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -100,7 +99,7 @@
return this;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java 2007-03-24 23:34:32 UTC (rev 9002)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java 2007-03-25 00:51:47 UTC (rev 9003)
@@ -33,7 +33,6 @@
import org.foray.fotree.PropertyList;
import org.axsl.foR.FOContext;
-import org.axsl.foR.FONodeProxy;
import org.axsl.foR.FOTreeException;
import org.axsl.foR.ProxyFactory;
@@ -100,7 +99,7 @@
return this;
}
- public FONodeProxy makeProxy(final ProxyFactory factory) {
+ public Object makeProxy(final ProxyFactory factor...
[truncated message content] |
|
From: <vic...@us...> - 2007-03-26 20:20:43
|
Revision: 9016
http://svn.sourceforge.net/foray/?rev=9016&view=rev
Author: victormote
Date: 2007-03-26 13:20:37 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Conform to axsl change in method name.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiPropertySet.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiSwitch.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiToggle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionAfter.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBefore.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBody.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionEnd.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionStart.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMAlternatives.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMReference.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RetrieveMarker.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Root.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/StaticContent.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableAndCaption.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableBody.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCaption.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableFooter.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableHeader.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableRow.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Title.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Wrapper.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/foray/obj/ContinuedLabel.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/svg/obj/SVGElement.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -1016,7 +1016,7 @@
return this.getParent().getColumn();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BasicLink.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -157,7 +157,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -93,7 +93,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Block.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -185,7 +185,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BlockContainer.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -102,7 +102,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Bookmark.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -140,7 +140,7 @@
return traitInternalDestination();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -108,7 +108,7 @@
return false;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTree.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -96,7 +96,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Character.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -108,7 +108,7 @@
return text.getAreaTreeText(context);
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ColorProfile.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -89,7 +89,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -212,7 +212,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Declarations.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -89,7 +89,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -171,7 +171,7 @@
}
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Float.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -100,7 +100,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -114,7 +114,7 @@
return this;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Footnote.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -112,7 +112,7 @@
return (FootnoteBody) this.getChildren().get(1);
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FootnoteBody.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -89,7 +89,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InitialPropertySet.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -90,7 +90,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Inline.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -95,7 +95,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InlineContainer.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -98,7 +98,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -124,7 +124,7 @@
return ((ForeignXML) getForeignXML()).intrinsicContentHeight();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -200,7 +200,7 @@
regionMap.put(region.traitRegionName(), region.getName());
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -174,7 +174,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListBlock.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -98,7 +98,7 @@
return;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -104,7 +104,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemBody.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -99,7 +99,7 @@
return this;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItemLabel.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -99,7 +99,7 @@
return this;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Marker.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -128,7 +128,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiCase.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -89,7 +89,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiProperties.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -101,7 +101,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiPropertySet.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiPropertySet.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiPropertySet.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -89,7 +89,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiSwitch.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiSwitch.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiSwitch.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -101,7 +101,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiToggle.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiToggle.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/MultiToggle.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -94,7 +94,7 @@
return true;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -158,7 +158,7 @@
return this.getNextSibling() == null;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -168,7 +168,7 @@
return this.getNextSibling() == null;
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -229,7 +229,7 @@
/**
* {@inheritDoc}
*/
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -128,7 +128,7 @@
return this.getFOTreeBuilder().getFONamespace();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionAfter.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionAfter.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionAfter.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -107,7 +107,7 @@
return traitExtent();
}
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBefore.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBefore.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBefore.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -115,7 +115,7 @@
/**
* {@inheritDoc}
*/
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBody.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBody.java 2007-03-26 18:43:31 UTC (rev 9015)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RegionBody.java 2007-03-26 20:20:37 UTC (rev 9016)
@@ -118,7 +118,7 @@
/**
* {@inheritDoc}
*/
- public Object makeProxy(final ProxyFactory factory) {
+ public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
Modified: trunk/fora...
[truncated message content] |
|
From: <vic...@us...> - 2007-03-26 21:02:36
|
Revision: 9017
http://svn.sourceforge.net/foray/?rev=9017&view=rev
Author: victormote
Date: 2007-03-26 14:02:34 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Conform to axsl changes removing accessor methods.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractFlowPL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java 2007-03-26 20:20:37 UTC (rev 9016)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/SpanRA.java 2007-03-26 21:02:34 UTC (rev 9017)
@@ -114,24 +114,6 @@
}
/**
- * {@inheritDoc}
- */
- public int getCurrentColumn() {
- return currentColumn;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setCurrentColumn(final int currentColumn) {
- if (currentColumn <= traitColumnCount()) {
- this.currentColumn = currentColumn;
- } else {
- this.currentColumn = traitColumnCount();
- }
- }
-
- /**
* Returns the current column area.
* @return The current column area.
*/
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractFlowPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractFlowPL.java 2007-03-26 20:20:37 UTC (rev 9016)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractFlowPL.java 2007-03-26 21:02:34 UTC (rev 9017)
@@ -30,9 +30,7 @@
import org.axsl.areaW.Area;
import org.axsl.areaW.AreaWException;
-import org.axsl.areaW.NormalFlowRA;
import org.axsl.areaW.RegionRABody;
-import org.axsl.areaW.SpanRA;
import org.axsl.foR.FObj;
import org.axsl.foR.fo.AbstractFlow;
import org.axsl.foR.fo.Flow;
@@ -161,11 +159,6 @@
setProgress(i);
return getStatus();
}
- // I don't much like exposing this. (AHS 001217)
- final NormalFlowRA column = (NormalFlowRA) currentArea;
- // Cast verified at construction.
- final SpanRA span = (SpanRA) column.getParent();
- span.setCurrentColumn(span.getCurrentColumn() + 1);
i--;
}
if (getStatus() == Status.KEEP_WITH_NEXT) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|