public interface PlanHints {
/** Border attribute */
- public static final String PLAN_BORDER = "border";
+ String PLAN_BORDER = "border";
/** Legend attribute */
- public static final String PLAN_LEGEND = "legend";
+ String PLAN_LEGEND = "legend";
/** Font family attribute */
- public static final String FONT_FAMILY = "font-family";
+ String FONT_FAMILY = "font-family";
/** Font size attribute */
- public static final String FONT_SIZE = "font-size";
+ String FONT_SIZE = "font-size";
/** Legent type attribute */
- public static final String LEGEND_TYPE = "legendType";
+ String LEGEND_TYPE = "legendType";
/** Locale attribute */
- public static final String LOCALE = "locale";
+ String LOCALE = "locale";
/** Label type attribute */
- public static final String LABEL_TYPE = "labelType";
+ String LABEL_TYPE = "labelType";
/** Label font size attribute */
- public static final String LABEL_FONT_SIZE = "labelFontSize";
+ String LABEL_FONT_SIZE = "labelFontSize";
/** Label font attribute */
- public static final String LABEL_FONT = "labelFont";
+ String LABEL_FONT = "labelFont";
}
hints.put(PlanHints.FONT_FAMILY, fontFamily);
hints.put(PlanHints.FONT_SIZE, new Float(fontSize));
hints.put(PlanHints.LOCALE, locale);
- Document doc =
- planDrawer.createDocument(data, width, height, hints);
+ Document doc
+ = planDrawer.createDocument(data, width, height, hints);
return doc;
}
} else if (t.equals("grouping")) {
data.setType(ActionInfo.GROUPING);
} else {
+ throw new IllegalArgumentException("Unknown action type: " + t);
}
for (int i = 0; i < childs.getLength(); i++) {
- lastWeek.getTime() + 43200000) / 86400000);
int days = (int)((end.getTime() - start.getTime()
+ 43200000) / 86400000);
- int daysFromEnd =
- (int)((future.getTime() - end.getTime()
+ int daysFromEnd
+ = (int)((future.getTime() - end.getTime()
+ 43200000) / 86400000);
Element taskGraphic;
switch (type) {
topEdge = lastTop;
}
}
- int currentDays =
- (int)((currentDate.getTime() - lastWeek.getTime()
+ int currentDays
+ = (int)((currentDate.getTime() - lastWeek.getTime()
+ 43200000) / 86400000);
text = SVGUtilities.createText(doc,
package org.apache.fop.afp;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.afp.modca.Registry;
import org.apache.fop.afp.modca.triplets.MappingOptionTriplet;
* A list of parameters associated with an AFP data objects
*/
public class AFPDataObjectInfo {
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog("org.apache.xmlgraphics.afp");
/** the object area info */
private AFPObjectAreaInfo objectAreaInfo;
*/
public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHandler {
- private static final Log log = LogFactory.getLog(AFPGraphics2D.class); // CSOK: ConstantName
+ private static final Log LOG = LogFactory.getLog(AFPGraphics2D.class);
private static final int X = 0;
graphicsObj.setLineType(type);
}
} else {
- log.warn("Unsupported Stroke: " + stroke.getClass().getName());
+ LOG.warn("Unsupported Stroke: " + stroke.getClass().getName());
}
}
if (paint instanceof Color) {
return true;
}
- log.debug("NYI: applyPaint() " + paint + " fill=" + fill);
+ LOG.debug("NYI: applyPaint() " + paint + " fill=" + fill);
if (paint instanceof TexturePaint) {
// TexturePaint texturePaint = (TexturePaint)paint;
// BufferedImage bufferedImage = texturePaint.getImage();
currentPosition = new double[]{openingCoords[0], openingCoords[1]};
break;
default:
- log.debug("Unrecognised path iterator type");
+ LOG.debug("Unrecognised path iterator type");
break;
}
}
/** {@inheritDoc} */
public void draw(Shape shape) {
- log.debug("draw() shape=" + shape);
+ LOG.debug("draw() shape=" + shape);
doDrawing(shape, false);
}
/** {@inheritDoc} */
public void fill(Shape shape) {
- log.debug("fill() shape=" + shape);
+ LOG.debug("fill() shape=" + shape);
doDrawing(shape, true);
}
*/
public void handleIOException(IOException ioe) {
// TODO Surely, there's a better way to do this.
- log.error(ioe.getMessage());
+ LOG.error(ioe.getMessage());
ioe.printStackTrace();
}
/** {@inheritDoc} */
public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
- log.debug("drawRenderableImage() NYI: img=" + img + ", xform=" + xform);
+ LOG.debug("drawRenderableImage() NYI: img=" + img + ", xform=" + xform);
}
/** {@inheritDoc} */
public FontMetrics getFontMetrics(Font f) {
- log.debug("getFontMetrics() NYI: f=" + f);
+ LOG.debug("getFontMetrics() NYI: f=" + f);
return null;
}
/** {@inheritDoc} */
public void setXORMode(Color col) {
- log.debug("setXORMode() NYI: col=" + col);
+ LOG.debug("setXORMode() NYI: col=" + col);
}
/** {@inheritDoc} */
public void addNativeImage(org.apache.xmlgraphics.image.loader.Image image,
float x, float y, float width, float height) {
- log.debug("NYI: addNativeImage() " + "image=" + image
+ LOG.debug("NYI: addNativeImage() " + "image=" + image
+ ",x=" + x + ",y=" + y + ",width=" + width + ",height=" + height);
}
/** {@inheritDoc} */
public void copyArea(int x, int y, int width, int height, int dx, int dy) {
- log.debug("copyArea() NYI: ");
+ LOG.debug("copyArea() NYI: ");
}
}
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.afp.modca.ResourceGroup;
import org.apache.fop.afp.modca.StreamedResourceGroup;
*/
public class AFPStreamer implements Streamable {
/** Static logging instance */
- private static final Log log = LogFactory.getLog(AFPStreamer.class); // CSOK: ConstantName
+ private static final Log LOG = LogFactory.getLog(AFPStreamer.class);
private static final String AFPDATASTREAM_TEMP_FILE_PREFIX = "AFPDataStream_";
if (level.isExternal()) {
String filePath = level.getExternalFilePath();
if (filePath == null) {
- log.warn("No file path provided for external resource, using default.");
+ LOG.warn("No file path provided for external resource, using default.");
filePath = defaultResourceGroupFilePath;
}
resourceGroup = (ResourceGroup)pathResourceGroupMap.get(filePath);
try {
os = new BufferedOutputStream(new FileOutputStream(filePath));
} catch (FileNotFoundException fnfe) {
- log.error("Failed to create/open external resource group file '"
+ LOG.error("Failed to create/open external resource group file '"
+ filePath + "'");
} finally {
if (os != null) {
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.fop.afp.fonts.AFPFontAttributes;
import org.apache.fop.afp.fonts.AFPFont;
+import org.apache.fop.afp.fonts.AFPFontAttributes;
import org.apache.fop.afp.fonts.CharacterSet;
import org.apache.fop.afp.modca.AbstractPageObject;
import org.apache.fop.afp.modca.Document;
import org.apache.fop.afp.modca.ResourceGroup;
import org.apache.fop.afp.modca.TagLogicalElementBean;
import org.apache.fop.afp.modca.triplets.FullyQualifiedNameTriplet;
-import org.apache.fop.afp.ptoca.PtocaProducer;
import org.apache.fop.afp.ptoca.PtocaBuilder;
-import org.apache.fop.util.CharUtilities;
+import org.apache.fop.afp.ptoca.PtocaProducer;
import org.apache.fop.fonts.Font;
+import org.apache.fop.util.CharUtilities;
/**
* A data stream is a continuous ordered stream of data elements and objects
public class DataStream {
/** Static logging instance */
- protected static final Log log // CSOK: ConstantName
- = LogFactory.getLog("org.apache.xmlgraphics.afp");
+ protected static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp");
/** Boolean completion indicator */
private boolean complete = false;
public void endDocument() throws IOException {
if (complete) {
String msg = "Invalid state - document already ended.";
- log.warn("endDocument():: " + msg);
+ LOG.warn("endDocument():: " + msg);
throw new IllegalStateException(msg);
}
* @param letterSpacing letter spacing to draw text with
* @param wordSpacing word Spacing to draw text with
* @param font is the font to draw text with
- * @param charSet is the AFP Character Set to use with the text
+ * @param charSet is the AFP Character Set to use with the text
* @throws UnsupportedEncodingException thrown if character encoding is not supported
*/
public void createText
import java.io.OutputStream;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.fop.afp.goca.GraphicsData;
import org.apache.fop.afp.ioca.ImageContent;
import org.apache.fop.afp.ioca.ImageRasterData;
*/
public class Factory {
- /** Static logging instance */
- private static final Log log = LogFactory.getLog(Factory.class); // CSOK: ConstantName
-
private static final String OBJECT_ENVIRONMENT_GROUP_NAME_PREFIX = "OEG";
private static final String ACTIVE_ENVIRONMENT_GROUP_NAME_PREFIX = "AEG";
import java.io.File;
import java.io.UnsupportedEncodingException;
-import java.net.URI;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
public class RasterFont extends AFPFont {
/** Static logging instance */
- protected static final Log log // CSOK: ConstantName
- = LogFactory.getLog("org.apache.fop.afp.fonts");
+ protected static final Log LOG = LogFactory.getLog("org.apache.fop.afp.fonts");
private final SortedMap/*<Integer,CharacterSet>*/ charSets
= new java.util.TreeMap/*<Integer,CharacterSet>*/();
substitutionCharSets.put(requestedSize, csm);
String msg = "No " + (size / 1000f) + "pt font " + getFontName()
+ " found, substituted with " + fontSize.intValue() / 1000f + "pt font";
- log.warn(msg);
+ LOG.warn(msg);
}
}
// Still no match -> error
String msg = "No font found for font " + getFontName()
+ " with point size " + size / 1000f;
- log.error(msg);
+ LOG.error(msg);
throw new FontRuntimeException(msg);
}
return csm.getFirstChar();
} else {
String msg = "getFirstChar() - No character set found for font:" + getFontName();
- log.error(msg);
+ LOG.error(msg);
throw new FontRuntimeException(msg);
}
}
return csm.getLastChar();
} else {
String msg = "getLastChar() - No character set found for font:" + getFontName();
- log.error(msg);
+ LOG.error(msg);
throw new FontRuntimeException(msg);
}
} else if (colSpaceType == ColorSpace.TYPE_RGB) {
colspace = RGB;
} else {
- log.error("unsupported colorspace " + colSpaceType);
+ LOG.error("unsupported colorspace " + colSpaceType);
colspace = RGB;
}
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.afp.Streamable;
import org.apache.fop.afp.util.BinaryUtils;
public abstract class AbstractAFPObject implements Streamable {
/** Static logging instance */
- protected static final Log log // CSOK: ConstantName
- = LogFactory.getLog("org.apache.xmlgraphics.afp.modca");
+ protected static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp.modca");
/** the structured field class id */
protected static final byte SF_CLASS = (byte)0xD3;
protected String truncate(String str, int maxLength) {
if (str.length() > maxLength) {
str = str.substring(0, maxLength);
- log.warn("truncated character string '"
+ LOG.warn("truncated character string '"
+ str + "', longer than " + maxLength + " chars");
}
return str;
mpo.addOverlay(name);
} catch (MaximumSizeExceededException ex) {
// Should never happen (but log just in case)
- log.error("createOverlay():: resulted in a MaximumSizeExceededException");
+ LOG.error("createOverlay():: resulted in a MaximumSizeExceededException");
}
}
}
name = (name + " ").substring(0, afpNameLen);
} else if (name.length() > afpNameLen) {
String truncatedName = name.substring(nameLen - afpNameLen, nameLen);
- log.warn("Constructor:: name '" + name + "'"
+ LOG.warn("Constructor:: name '" + name + "'"
+ " truncated to " + afpNameLen + " chars"
+ " ('" + truncatedName + "')");
name = truncatedName;
nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
} catch (UnsupportedEncodingException usee) {
nameBytes = name.getBytes();
- log.warn(
+ LOG.warn(
"Constructor:: UnsupportedEncodingException translating the name "
+ name);
}
import org.apache.fop.afp.modca.Registry.ObjectType;
import org.apache.fop.afp.modca.triplets.AbstractTriplet;
-import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet;
-import org.apache.fop.afp.modca.triplets.AttributeValueTriplet;
import org.apache.fop.afp.modca.triplets.CommentTriplet;
import org.apache.fop.afp.modca.triplets.FullyQualifiedNameTriplet;
import org.apache.fop.afp.modca.triplets.ObjectClassificationTriplet;
if (fqNameTriplet != null) {
return fqNameTriplet.getFullyQualifiedName();
}
- log.warn(this + " has no fully qualified name");
+ LOG.warn(this + " has no fully qualified name");
return null;
}
mapCodedFont.addFont(fontRef, font, size, orientation);
} catch (MaximumSizeExceededException ex) {
// Should never happen (but log just in case)
- log.error("createFont():: resulted in a MaximumSizeExceededException");
+ LOG.error("createFont():: resulted in a MaximumSizeExceededException");
}
}
}
if (cs == null) {
String msg = "Character set not found for font "
+ font.getFontName() + " with point size " + size;
- log.error(msg);
+ LOG.error(msg);
throw new FontRuntimeException(msg);
}
} else {
String msg = "Font of type " + font.getClass().getName()
+ " not recognized.";
- log.error(msg);
+ LOG.error(msg);
throw new FontRuntimeException(msg);
}
throw new IllegalArgumentException("The name of overlay " + name
+ " must be 8 characters");
}
- if (log.isDebugEnabled()) {
- log.debug("addOverlay():: adding overlay " + name);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("addOverlay():: adding overlay " + name);
}
try {
byte[] data = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
getOverlays().add(data);
} catch (UnsupportedEncodingException usee) {
- log.error("addOverlay():: UnsupportedEncodingException translating the name "
+ LOG.error("addOverlay():: UnsupportedEncodingException translating the name "
+ name);
}
}
throw new IllegalArgumentException("The name of page segment " + name
+ " must not be longer than 8 characters");
}
- if (log.isDebugEnabled()) {
- log.debug("addPageSegment():: adding page segment " + name);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("addPageSegment():: adding page segment " + name);
}
getPageSegments().add(name);
}
byte[] nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
System.arraycopy(nameBytes, 0, data, pos, nameBytes.length);
} catch (UnsupportedEncodingException usee) {
- log.error("UnsupportedEncodingException translating the name "
+ LOG.error("UnsupportedEncodingException translating the name "
+ name);
}
pos += 8;
public class LineDataInfoProducer implements PtocaProducer, PtocaConstants {
/** Static logging instance */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(LineDataInfoProducer.class);
+ private static final Log LOG = LogFactory.getLog(LineDataInfoProducer.class);
private AFPLineDataInfo lineDataInfo;
} else if (x1 == x2) {
builder.drawBaxisRule(y2 - y1, thickness);
} else {
- log.error("Invalid axis rule: unable to draw line");
+ LOG.error("Invalid axis rule: unable to draw line");
return;
}
}
}
}
- private static final Log log // CSOK: ConstantName
+ private static final Log LOG
= LogFactory.getLog(AFPGraphicsConfiguration.class);
private AffineTransform defaultTransform = null;
* @return the default transform for the configuration
*/
public AffineTransform getDefaultTransform() {
- log.debug("getDefaultTransform()");
+ LOG.debug("getDefaultTransform()");
if (defaultTransform == null) {
defaultTransform = new AffineTransform();
}
* @return the normalizing transform for the configuration
*/
public AffineTransform getNormalizingTransform() {
- log.debug("getNormalizingTransform()");
+ LOG.debug("getNormalizingTransform()");
if (normalizingTransform == null) {
normalizingTransform = new AffineTransform(2, 0, 0, 2, 0, 0);
}
/** {@inheritDoc} */
public GraphicsDevice getDevice() {
- log.debug("getDevice()");
+ LOG.debug("getDevice()");
return graphicsDevice;
}
}
*/
public class IDTracker {
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(IDTracker.class);
+ private static final Log LOG = LogFactory.getLog(IDTracker.class);
// HashMap of ID's whose area is located on one or more consecutive
// PageViewports. Each ID has an arraylist of PageViewports that
* @param pv a page viewport that contains the area with this ID
*/
public void associateIDWithPageViewport(String id, PageViewport pv) {
- if (log.isDebugEnabled()) {
- log.debug("associateIDWithPageViewport(" + id + ", " + pv + ")");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("associateIDWithPageViewport(" + id + ", " + pv + ")");
}
List pvList = (List) idLocations.get(id);
if (pvList == null) { // first time ID located
* @param id the id of the object being processed
*/
public void signalPendingID(String id) {
- if (log.isDebugEnabled()) {
- log.debug("signalPendingID(" + id + ")");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("signalPendingID(" + id + ")");
}
unfinishedIDs.add(id);
}
* @param id the id of the formatting object which was just finished
*/
public void signalIDProcessed(String id) {
- if (log.isDebugEnabled()) {
- log.debug("signalIDProcessed(" + id + ")");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("signalIDProcessed(" + id + ")");
}
alreadyResolvedIDs.add(id);
}
/** Logger instance */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(EventModelParser.class);
+ private static final Log LOG = LogFactory.getLog(EventModelParser.class);
private static SAXTransformerFactory tFactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
public static EventModel parse(Source src)
throws TransformerException {
Transformer transformer = tFactory.newTransformer();
- transformer.setErrorListener(new DefaultErrorListener(log));
+ transformer.setErrorListener(new DefaultErrorListener(LOG));
EventModel model = new EventModel();
SAXResult res = new SAXResult(getContentHandler(model));
import org.apache.fop.fo.flow.PageNumberCitationLast;
import org.apache.fop.fo.flow.table.Table;
import org.apache.fop.fo.flow.table.TableBody;
-import org.apache.fop.fo.flow.table.TableFooter;
-import org.apache.fop.fo.flow.table.TableHeader;
-import org.apache.fop.fo.flow.table.TablePart;
import org.apache.fop.fo.flow.table.TableCell;
import org.apache.fop.fo.flow.table.TableColumn;
+import org.apache.fop.fo.flow.table.TableFooter;
+import org.apache.fop.fo.flow.table.TableHeader;
import org.apache.fop.fo.flow.table.TableRow;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.PageSequence;
public abstract class FObj extends FONode implements Constants {
/** the list of property makers */
- private static final PropertyMaker[] propertyListTable // CSOK: ConstantName
+ private static final PropertyMaker[] PROPERTY_LIST_TABLE
= FOPropertyMapping.getGenericMappings();
/**
* @return the requested Property Maker
*/
public static PropertyMaker getPropertyMakerFor(int propId) {
- return propertyListTable[propId];
+ return PROPERTY_LIST_TABLE[propId];
}
/** {@inheritDoc} */
/** The FOP extension namespace URI */
public static final String URI = "http://xmlgraphics.apache.org/fop/extensions";
- private static final Set propertyAttributes // CSOK: ConstantName
+ private static final Set PROPERTY_ATTRIBUTES
= new java.util.HashSet();
static {
//These are FOP's standard extension properties (fox:*)
- propertyAttributes.add("block-progression-unit");
- propertyAttributes.add("widow-content-limit");
- propertyAttributes.add("orphan-content-limit");
- propertyAttributes.add("internal-destination");
- propertyAttributes.add("disable-column-balancing");
+ PROPERTY_ATTRIBUTES.add("block-progression-unit");
+ PROPERTY_ATTRIBUTES.add("widow-content-limit");
+ PROPERTY_ATTRIBUTES.add("orphan-content-limit");
+ PROPERTY_ATTRIBUTES.add("internal-destination");
+ PROPERTY_ATTRIBUTES.add("disable-column-balancing");
//These are FOP's extension properties for accessibility
- propertyAttributes.add("alt-text");
+ PROPERTY_ATTRIBUTES.add("alt-text");
}
/**
if (!URI.equals(attributeName.getNamespaceURI())) {
throw new IllegalArgumentException("The namespace URIs don't match");
}
- return propertyAttributes.contains(attributeName.getLocalName());
+ return PROPERTY_ATTRIBUTES.contains(attributeName.getLocalName());
}
}
package org.apache.fop.fo.flow;
-import java.util.Collections;
import java.util.Map;
import org.xml.sax.Attributes;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
}
/** cache containing all canonical CharacterProperty instances */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(CharacterProperty.class);
private final char character;
* @return the character property instance
*/
public static CharacterProperty getInstance(char character) {
- return (CharacterProperty) cache.fetch(
+ return (CharacterProperty) CACHE.fetch(
new CharacterProperty(character));
}
public final class ColorProperty extends Property {
/** cache holding canonical ColorProperty instances */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(ColorProperty.class);
/**
ColorProperty instance = new ColorProperty(
ColorUtil.parseColorString(
foUserAgent, value));
- return (ColorProperty)cache.fetch(instance);
+ return (ColorProperty)CACHE.fetch(instance);
}
/**
* cache holding all canonical instances
* (w/ absolute background-position-* and padding-*)
*/
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(CommonBorderPaddingBackground.class);
private int hash = -1;
public static final class BorderInfo {
/** cache holding all canonical instances */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(BorderInfo.class);
private int mStyle; // Enum for border style
* @return a cached BorderInfo instance
*/
public static BorderInfo getInstance(int style, CondLengthProperty width, Color color) {
- return cache.fetch(new BorderInfo(style, width, color));
+ return CACHE.fetch(new BorderInfo(style, width, color));
}
/**
* A border info with style "none". Used as a singleton, in the collapsing-border model,
* for elements which don't specify any border on some of their sides.
*/
- private static final BorderInfo defaultBorderInfo // CSOK: ConstantName
+ private static final BorderInfo DEFAULT_BORDER_INFO
= BorderInfo.getInstance(Constants.EN_NONE, new ConditionalNullLength(), null);
/**
* @return a BorderInfo instance with style set to {@link Constants#EN_NONE}
*/
public static BorderInfo getDefaultBorderInfo() {
- return defaultBorderInfo;
+ return DEFAULT_BORDER_INFO;
}
private BorderInfo[] borderInfo = new BorderInfo[4];
|| newInstance.backgroundPositionHorizontal.isAbsolute())
&& (newInstance.backgroundPositionVertical == null
|| newInstance.backgroundPositionVertical.isAbsolute())) {
- cachedInstance = cache.fetch(newInstance);
+ cachedInstance = CACHE.fetch(newInstance);
}
/* for non-cached, or not-yet-cached instances, preload the image */
/** cache holding canonical CommonFont instances (only those with
* absolute font-size and font-size-adjust) */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(CommonFont.class);
/** hashcode of this instance */
fontSize,
fontSizeAdjust);
- return cache.fetch(commonFont);
+ return CACHE.fetch(commonFont);
}
/** @return an array with the font-family names */
public final class CommonHyphenation {
/** Logger */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(CommonHyphenation.class);
+ private static final Log LOG = LogFactory.getLog(CommonHyphenation.class);
- private static final PropertyCache cache // CSOK: ConstantName
- = new PropertyCache(CommonHyphenation.class);
+ private static final PropertyCache CACHE = new PropertyCache(CommonHyphenation.class);
private int hash = 0;
hyphenationPushCharacterCount,
hyphenationRemainCharacterCount);
- return cache.fetch(instance);
+ return CACHE.fetch(instance);
}
}
}
if (warn) {
- log.warn("Substituted specified hyphenation character (0x"
+ LOG.warn("Substituted specified hyphenation character (0x"
+ Integer.toHexString(hyphChar)
+ ") with 0x" + Integer.toHexString(effHyphChar)
+ " because the font doesn't have the specified hyphenation character: "
public class CondLengthProperty extends Property implements CompoundDatatype {
/** cache holding canonical instances (for absolute conditional lengths) */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(CondLengthProperty.class);
/** components */
*/
public CondLengthProperty getCondLength() {
if (this.length.getLength().isAbsolute()) {
- CondLengthProperty clp = (CondLengthProperty) cache.fetch(this);
+ CondLengthProperty clp = (CondLengthProperty) CACHE.fetch(this);
if (clp == this) {
isCached = true;
}
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
/**
+ * Maker class for handling corresponding properties.
*/
public class CorrespondingPropertyMaker {
/** base property maker */
public final class EnumNumber extends Property implements Numeric {
/** cache holding all canonical EnumNumber instances */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(EnumNumber.class);
private final EnumProperty enumProperty;
* @return the canonical instance
*/
public static EnumNumber getInstance(Property enumProperty) {
- return (EnumNumber)cache.fetch(
+ return (EnumNumber)CACHE.fetch(
new EnumNumber((EnumProperty) enumProperty));
}
public final class EnumProperty extends Property {
/** cache holding all canonical EnumProperty instances */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(EnumProperty.class);
/**
* @return an enumeration property
*/
public static EnumProperty getInstance(int explicitValue, String text) {
- return (EnumProperty) cache.fetch(
+ return (EnumProperty) CACHE.fetch(
new EnumProperty(explicitValue, text));
}
public static final String MPT = "mpt";
/** cache holding all canonical FixedLength instances */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(FixedLength.class);
/** canonical zero-length instance */
if (numUnits == 0.0) {
return ZERO_FIXED_LENGTH;
} else {
- return (FixedLength)cache.fetch(
+ return (FixedLength)CACHE.fetch(
new FixedLength(numUnits, units, sourceResolution));
}
public final class FontFamilyProperty extends ListProperty {
/** cache holding all canonical FontFamilyProperty instances */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(FontFamilyProperty.class);
private int hash = 0;
prop.addProperty(StringProperty.getInstance(tmpVal));
}
}
- return cache.fetch(prop);
+ return CACHE.fetch(prop);
}
}
public final class KeepProperty extends Property implements CompoundDatatype {
/** class holding all canonical KeepProperty instances*/
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(KeepProperty.class);
private boolean isCachedValue = false;
* this property
*/
public KeepProperty getKeep() {
- KeepProperty keep = (KeepProperty) cache.fetch(this);
+ KeepProperty keep = (KeepProperty) CACHE.fetch(this);
/* make sure setComponent() can never alter cached values */
keep.isCachedValue = true;
return keep;
}
/** cache holding all canonical NumberProperty instances */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(NumberProperty.class);
private final Number number;
* @return the canonical NumberProperty
*/
public static NumberProperty getInstance(Double num) {
- return (NumberProperty)cache.fetch(
+ return (NumberProperty)CACHE.fetch(
new NumberProperty(num.doubleValue()));
}
* @return the canonical NumberProperty
*/
public static NumberProperty getInstance(Integer num) {
- return (NumberProperty)cache.fetch(
+ return (NumberProperty)CACHE.fetch(
new NumberProperty(num.intValue()));
}
* @return the canonical NumberProperty
*/
public static NumberProperty getInstance(double num) {
- return (NumberProperty)cache.fetch(
+ return (NumberProperty)CACHE.fetch(
new NumberProperty(num));
}
* @return the canonical NumberProperty
*/
public static NumberProperty getInstance(int num) {
- return (NumberProperty)cache.fetch(
+ return (NumberProperty)CACHE.fetch(
new NumberProperty(num));
}
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.FOValidationEventProducer;
-import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.expr.PropertyException;
-
-import java.util.Set;
/**
* Exists primarily as a container for its Maker inner class, which is
}
/** cache containing all canonical StringProperty instances */
- private static final PropertyCache cache // CSOK: ConstantName
+ private static final PropertyCache CACHE
= new PropertyCache(StringProperty.class);
/** canonical instance for empty strings */
if ("".equals(str) || str == null) {
return EMPTY_STRING_PROPERTY;
} else {
- return (StringProperty)cache.fetch(
+ return (StringProperty)CACHE.fetch(
new StringProperty(str));
}
}
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.fop.fonts.base14.Courier;
import org.apache.fop.fonts.base14.CourierBold;
import org.apache.fop.fonts.base14.CourierBoldOblique;
private FontSetup() {
}
- /**
- * logging instance
- */
- private static Log log // CSOK: ConstantName
- = LogFactory.getLog(FontSetup.class);
-
/**
* Sets up a font info
* @param fontInfo font info
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.fo.Constants;
import org.apache.fop.traits.MinOptMax;
*/
public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class);
+ private static final Log LOG = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class);
private int columnCount;
private int fullLen;
protected double computeDemerits(KnuthNode activeNode,
KnuthElement element, int fitnessClass, double r) {
double dem = super.computeDemerits(activeNode, element, fitnessClass, r);
- if (log.isTraceEnabled()) {
- log.trace("original demerit=" + dem + " " + totalWidth
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("original demerit=" + dem + " " + totalWidth
+ " line=" + activeNode.line + "/" + columnCount
+ " pos=" + activeNode.position + "/" + (par.size() - 1));
}
if (remParts > 0) {
avgRestLen = restLen / remParts;
}
- if (log.isTraceEnabled()) {
- log.trace("remaining parts: " + remParts + " rest len: " + restLen
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("remaining parts: " + remParts + " rest len: " + restLen
+ " avg=" + avgRestLen);
}
double balance = (idealPartLen - partLen) / 1000f;
- if (log.isTraceEnabled()) {
- log.trace("balance=" + balance);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("balance=" + balance);
}
double absBalance = Math.abs(balance);
dem = absBalance;
//We don't want more columns than available
dem = Double.MAX_VALUE;
}
- if (log.isTraceEnabled()) {
- log.trace("effective dem=" + dem + " " + totalWidth);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("effective dem=" + dem + " " + totalWidth);
}
return dem;
}
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.pagination.Title;
import org.apache.fop.layoutmgr.inline.BasicLinkLayoutManager;
-import org.apache.fop.layoutmgr.inline.BidiLayoutManager;
import org.apache.fop.layoutmgr.inline.CharacterLayoutManager;
import org.apache.fop.layoutmgr.inline.ContentLayoutManager;
import org.apache.fop.layoutmgr.inline.ExternalGraphicLayoutManager;
import org.apache.fop.layoutmgr.inline.FootnoteLayoutManager;
import org.apache.fop.layoutmgr.inline.ICLayoutManager;
import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
-import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
import org.apache.fop.layoutmgr.inline.InstreamForeignObjectLM;
import org.apache.fop.layoutmgr.inline.LeaderLayoutManager;
import org.apache.fop.layoutmgr.inline.PageNumberCitationLastLayoutManager;
public class LayoutManagerMapping implements LayoutManagerMaker {
/** logging instance */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(LayoutManagerMapping.class);
+ private static final Log LOG = LogFactory.getLog(LayoutManagerMapping.class);
/** The map of LayoutManagerMakers */
private Map makers = new HashMap();
Maker maker = (Maker) makers.get(node.getClass());
if (maker == null) {
if (FOElementMapping.URI.equals(node.getNamespaceURI())) {
- log.error("No LayoutManager maker for class " + node.getClass());
+ LOG.error("No LayoutManager maker for class " + node.getClass());
} else {
- if (log.isDebugEnabled()) {
- log.debug("Skipping the creation of a layout manager for " + node.getClass());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Skipping the creation of a layout manager for " + node.getClass());
}
}
} else {
public final class SpaceResolver {
/** Logger instance */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(SpaceResolver.class);
+ private static final Log LOG = LogFactory.getLog(SpaceResolver.class);
private UnresolvedListElementWithLength[] firstPart;
private BreakElement breakPoss;
//Add pending elements from higher level FOs
if (breakPoss != null) {
if (breakPoss.getPendingAfterMarks() != null) {
- if (log.isTraceEnabled()) {
- log.trace(" adding pending before break: "
+ if (LOG.isTraceEnabled()) {
+ LOG.trace(" adding pending before break: "
+ breakPoss.getPendingAfterMarks());
}
first.addAll(0, breakPoss.getPendingAfterMarks());
}
if (breakPoss.getPendingBeforeMarks() != null) {
- if (log.isTraceEnabled()) {
- log.trace(" adding pending after break: "
+ if (LOG.isTraceEnabled()) {
+ LOG.trace(" adding pending after break: "
+ breakPoss.getPendingBeforeMarks());
}
second.addAll(0, breakPoss.getPendingBeforeMarks());
}
}
- if (log.isTraceEnabled()) {
- log.trace("before: " + first);
- log.trace(" break: " + breakPoss);
- log.trace("after: " + second);
- log.trace("NO-BREAK: " + toString(noBreak, noBreakLengths));
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("before: " + first);
+ LOG.trace(" break: " + breakPoss);
+ LOG.trace("after: " + second);
+ LOG.trace("NO-BREAK: " + toString(noBreak, noBreakLengths));
}
if (first != null) {
if (elems[effIndex] instanceof BorderOrPaddingElement) {
BorderOrPaddingElement bop = (BorderOrPaddingElement)elems[effIndex];
if (bop.isConditional() && !(bop.isFirst() || bop.isLast())) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling conditional element: " + bop);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling conditional element: " + bop);
}
lengths[effIndex] = null;
}
}
}
- if (log.isTraceEnabled() && elems.length > 0) {
- log.trace("-->Resulting list: " + toString(elems, lengths));
+ if (LOG.isTraceEnabled() && elems.length > 0) {
+ LOG.trace("-->Resulting list: " + toString(elems, lengths));
}
}
} else if (!elems[effIndex].isConditional()) {
break;
}
- if (log.isDebugEnabled()) {
- log.debug("Nulling conditional element using 4.3.1, rule 1: " + elems[effIndex]);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling conditional element using 4.3.1, rule 1: " + elems[effIndex]);
}
lengths[effIndex] = null;
}
- if (log.isTraceEnabled() && elems.length > 0) {
- log.trace("-->Resulting list: " + toString(elems, lengths));
+ if (LOG.isTraceEnabled() && elems.length > 0) {
+ LOG.trace("-->Resulting list: " + toString(elems, lengths));
}
}
private void performSpaceResolutionRules2to3(UnresolvedListElement[] elems,
MinOptMax[] lengths, int start, int end) {
- if (log.isTraceEnabled()) {
- log.trace("rule 2-3: " + start + "-" + end);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("rule 2-3: " + start + "-" + end);
}
SpaceElement space;
int remaining;
}
space = (SpaceElement)elems[i];
if (!space.isForcing()) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling non-forcing space-specifier using 4.3.1, rule 2: "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling non-forcing space-specifier using 4.3.1, rule 2: "
+ elems[i]);
}
lengths[i] = null;
space = (SpaceElement)elems[i];
highestPrecedence = Math.max(highestPrecedence, space.getPrecedence());
}
- if (highestPrecedence != 0 && log.isDebugEnabled()) {
- log.debug("Highest precedence is " + highestPrecedence);
+ if (highestPrecedence != 0 && LOG.isDebugEnabled()) {
+ LOG.debug("Highest precedence is " + highestPrecedence);
}
//Suppress space-specifiers with lower precedence
remaining = 0;
}
space = (SpaceElement)elems[i];
if (space.getPrecedence() != highestPrecedence) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling space-specifier with precedence "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling space-specifier with precedence "
+ space.getPrecedence() + " using 4.3.1, rule 3: "
+ elems[i]);
}
remaining++;
}
}
- if (log.isDebugEnabled()) {
- log.debug("Greatest optimum: " + greatestOptimum);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Greatest optimum: " + greatestOptimum);
}
if (remaining <= 1) {
return;
}
space = (SpaceElement)elems[i];
if (space.getLength().getOpt() < greatestOptimum) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling space-specifier with smaller optimum length "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling space-specifier with smaller optimum length "
+ "using 4.3.1, rule 3: "
+ elems[i]);
}
min = Math.max(min, space.getLength().getMin());
max = Math.min(max, space.getLength().getMax());
if (remaining > 1) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling non-last space-specifier using 4.3.1, rule 3, second part: "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling non-last space-specifier using 4.3.1, rule 3, second part: "
+ elems[i]);
}
lengths[i] = null;
}
}
- if (log.isTraceEnabled() && elems.length > 0) {
- log.trace("Remaining spaces: " + remaining);
- log.trace("-->Resulting list: " + toString(elems, lengths));
+ if (LOG.isTraceEnabled() && elems.length > 0) {
+ LOG.trace("Remaining spaces: " + remaining);
+ LOG.trace("-->Resulting list: " + toString(elems, lengths));
}
}
if (hasFirstPart()) {
//Now that we've handled isFirst/isLast conditions, we need to look at the
//active part in its normal order so swap it back.
- log.trace("Swapping first and second parts.");
+ LOG.trace("Swapping first and second parts.");
UnresolvedListElementWithLength[] tempList;
MinOptMax[] tempLengths;
tempList = secondPart;
* @param elems the element list
*/
public static void resolveElementList(List elems) {
- if (log.isTraceEnabled()) {
- log.trace(elems);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace(elems);
}
boolean first = true;
boolean last = false;
while (iter.hasNext()) {
ListElement el = (ListElement)iter.next();
if (el.isUnresolvedElement()) {
- if (log.isTraceEnabled()) {
- log.trace("unresolved found: " + el + " " + first + "/" + last);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("unresolved found: " + el + " " + first + "/" + last);
}
BreakElement breakPoss = null;
//Clear temp lists
}
//last = !iter.hasNext();
if (breakPoss == null && unresolvedSecond.size() == 0 && !last) {
- log.trace("Swap first and second parts in no-break condition,"
+ LOG.trace("Swap first and second parts in no-break condition,"
+ " second part is empty.");
//The first list is reversed, so swap if this shouldn't happen
List swapList = unresolvedSecond;
unresolvedFirst = swapList;
}
- log.debug("----start space resolution (first=" + first + ", last=" + last + ")...");
+ LOG.debug("----start space resolution (first=" + first + ", last=" + last + ")...");
SpaceResolver resolver = new SpaceResolver(
unresolvedFirst, breakPoss, unresolvedSecond, first, last);
if (!last) {
if (!last && skipNextElement) {
iter.next();
}
- log.debug("----end space resolution.");
+ LOG.debug("----end space resolution.");
}
first = false;
}
}
/** logger */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(TraitSetter.class);
+ private static final Log LOG = LogFactory.getLog(TraitSetter.class);
/**
* Sets border and padding traits on areas.
+ backProps.backgroundPositionHorizontal.getValue(refContext));
} else {
// TODO Area IPD has to be set for this to work
- log.warn("Horizontal background image positioning ignored"
+ LOG.warn("Horizontal background image positioning ignored"
+ " because the IPD was not set on the area."
+ " (Yes, it's a bug in FOP)");
}
+ backProps.backgroundPositionVertical.getValue(refContext));
} else {
// TODO Area BPD has to be set for this to work
- log.warn("Vertical background image positioning ignored"
+ LOG.warn("Vertical background image positioning ignored"
+ " because the BPD was not set on the area."
+ " (Yes, it's a bug in FOP)");
}
back.setHoriz(horizontal);
} else {
//TODO Area IPD has to be set for this to work
- log.warn("Horizontal background image positioning ignored"
+ LOG.warn("Horizontal background image positioning ignored"
+ " because the IPD was not set on the area."
+ " (Yes, it's a bug in FOP)");
}
back.setVertical(vertical);
} else {
//TODO Area BPD has to be set for this to work
- log.warn("Vertical background image positioning ignored"
+ LOG.warn("Vertical background image positioning ignored"
+ " because the BPD was not set on the area."
+ " (Yes, it's a bug in FOP)");
}
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.fop.datatypes.Length;
-import org.apache.fop.datatypes.LengthBase;
-import org.apache.fop.datatypes.SimplePercentBaseContext;
+
import org.apache.fop.fo.Constants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.layoutmgr.Position;
/**
public class LineLayoutPossibilities {
/** logger instance */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(LineLayoutPossibilities.class);
+ private static final Log LOG = LogFactory.getLog(LineLayoutPossibilities.class);
private final class Possibility {
private int lineCount;
possibilitiesList.set(index, restoredPossibility);
} else {
// this should not happen
- log.error("LineLayoutPossibilities restorePossibilities(),"
+ LOG.error("LineLayoutPossibilities restorePossibilities(),"
+ " min= " + getMinLineCount()
+ " max= " + getMaxLineCount()
+ " restored= " + restoredPossibility.getLineCount());
&& adj <= (getMaxLineCount() - getChosenLineCount())
&& getLineCount(chosenIndex + adj) == getChosenLineCount() + adj) {
chosenIndex += adj;
- log.debug("chosenLineCount= " + (getChosenLineCount() - adj) + " adjustment= " + adj
+ LOG.debug("chosenLineCount= " + (getChosenLineCount() - adj) + " adjustment= " + adj
+ " => chosenLineCount= " + getLineCount(chosenIndex));
return adj;
} else {
// this should not happen!
- log.warn("Cannot apply the desired line count adjustment.");
+ LOG.warn("Cannot apply the desired line count adjustment.");
return 0;
}
}
import org.apache.fop.area.inline.UnresolvedPageNumber;
import org.apache.fop.fo.flow.PageNumberCitation;
import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.LayoutManager;
/**
* LayoutManager for the fo:page-number-citation formatting object
package org.apache.fop.layoutmgr.inline;
-import org.apache.fop.datatypes.Length;
-
/**
* The FOP specific incarnation of the XSL-FO scaled baseline table.
* All baseline tables are scaled to the font size of the font they
public class TableContentLayoutManager implements PercentBaseContext {
/** Logger **/
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(TableContentLayoutManager.class);
+ private static final Log LOG = LogFactory.getLog(TableContentLayoutManager.class);
private TableLayoutManager tableLM;
private TableRowIterator bodyIter;
* @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int)
*/
public List getNextKnuthElements(LayoutContext context, int alignment) {
- if (log.isDebugEnabled()) {
- log.debug("==> Columns: " + getTableLM().getColumns());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("==> Columns: " + getTableLM().getColumns());
}
KnuthBox headerAsFirst = null;
KnuthBox headerAsSecondToLast = null;
headerIter, context, alignment, TableRowIterator.HEADER);
this.headerNetHeight
= ElementListUtils.calcContentLength(this.headerList);
- if (log.isDebugEnabled()) {
- log.debug("==> Header: "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("==> Header: "
+ headerNetHeight + " - " + this.headerList);
}
TableHeaderFooterPosition pos = new TableHeaderFooterPosition(
footerIter, context, alignment, TableRowIterator.FOOTER);
this.footerNetHeight
= ElementListUtils.calcContentLength(this.footerList);
- if (log.isDebugEnabled()) {
- log.debug("==> Footer: "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("==> Footer: "
+ footerNetHeight + " - " + this.footerList);
}
//We can simply add the table footer at the end of the whole list
} else if (pos instanceof TableContentPosition) {
tablePositions.add(pos);
} else {
- if (log.isDebugEnabled()) {
- log.debug("Ignoring position: " + pos);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Ignoring position: " + pos);
}
}
}
if (lastPos instanceof TableHFPenaltyPosition) {
TableHFPenaltyPosition penaltyPos = (TableHFPenaltyPosition)lastPos;
- log.debug("Break at penalty!");
+ LOG.debug("Break at penalty!");
if (penaltyPos.headerElements != null) {
//Header positions for the penalty position are in the last element and need to
//be handled first before all other TableContentPositions
if (tablePositions.isEmpty()) {
// TODO make sure this actually never happens
- log.error("tablePositions empty."
+ LOG.error("tablePositions empty."
+ " Please send your FO file to fop-users@xmlgraphics.apache.org");
} else {
// Here we are sure that posIter iterates only over TableContentPosition instances
import org.apache.fop.fo.flow.table.EffRow;
import org.apache.fop.fo.flow.table.Table;
import org.apache.fop.fo.flow.table.TableBody;
-import org.apache.fop.fo.flow.table.TablePart;
-
/**
* Iterator that lets the table layout manager step over all the rows of a part of the
import java.util.Date;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* This class represents an embedded file stream.
*/
public class PDFEmbeddedFile extends PDFStream {
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(PDFEmbeddedFile.class.getName());
-
/**
* Creates a new embedded file stream.
*/
// Java
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
}
/** logging instance */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(PDFEncryptionManager.class);
+ private static final Log LOG = LogFactory.getLog(PDFEncryptionManager.class);
/**
* Indicates whether JCE is available.
Provider[] providers;
providers = Security.getProviders("Cipher.RC4");
if (providers == null) {
- log.warn("Cipher provider for RC4 not available.");
+ LOG.warn("Cipher provider for RC4 not available.");
return false;
}
providers = Security.getProviders("MessageDigest.MD5");
if (providers == null) {
- log.warn("MessageDigest provider for MD5 not available.");
+ LOG.warn("MessageDigest provider for MD5 not available.");
return false;
}
return true;
if (params != null) {
if (!checkAvailableAlgorithms()) {
if (isJCEAvailable()) {
- log.warn("PDF encryption has been requested, JCE is "
+ LOG.warn("PDF encryption has been requested, JCE is "
+ "available but there's no "
+ "JCE provider available that provides the "
+ "necessary algorithms. The PDF won't be "
+ "encrypted.");
} else {
- log.warn("PDF encryption has been requested but JCE is "
+ LOG.warn("PDF encryption has been requested but JCE is "
+ "unavailable! The PDF won't be encrypted.");
}
}
return (PDFEncryption)obj;
} catch (ClassNotFoundException e) {
if (checkAvailableAlgorithms()) {
- log.warn("JCE and algorithms available, but the "
+ LOG.warn("JCE and algorithms available, but the "
+ "implementation class unavailable. Please do a full "
+ "rebuild.");
}
return null;
} catch (NoSuchMethodException e) {
- log.error(e);
+ LOG.error(e);
return null;
} catch (IllegalAccessException e) {
- log.error(e);
+ LOG.error(e);
return null;
} catch (InvocationTargetException e) {
- log.error(e);
+ LOG.error(e);
return null;
}
}
* Parses any AFP foreign attributes
*/
public class AFPForeignAttributeReader {
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog("org.apache.xmlgraphics.afp");
+ private static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp");
/** the resource-name attribute */
public static final QName RESOURCE_NAME = new QName(
= (String)foreignAttributes.get(RESOURCE_GROUP_FILE);
if (resourceGroupFile == null) {
String msg = RESOURCE_GROUP_FILE + " not specified";
- log.error(msg);
+ LOG.error(msg);
throw new UnsupportedOperationException(msg);
}
File resourceExternalGroupFile = new File(resourceGroupFile);
} catch (SecurityException ex) {
String msg = "unable to gain write access to external resource file: "
+ resourceGroupFile;
- log.error(msg);
+ LOG.error(msg);
}
try {
boolean exists = resourceExternalGroupFile.exists();
if (exists) {
- log.warn("overwriting external resource file: "
+ LOG.warn("overwriting external resource file: "
+ resourceGroupFile);
}
resourceLevel.setExternalFilePath(resourceGroupFile);
} catch (SecurityException ex) {
String msg = "unable to gain read access to external resource file: "
+ resourceGroupFile;
- log.error(msg);
+ LOG.error(msg);
}
}
}
package org.apache.fop.render.afp.extensions;
-import java.net.URI;
-
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
package org.apache.fop.render.intermediate;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.apps.FOUserAgent;
/**
*/
public abstract class AbstractIFDocumentHandler implements IFDocumentHandler {
- /** logging instance */
- private static Log log = LogFactory.getLog(AbstractIFDocumentHandler.class);
-
private IFContext ifContext;
/**
import org.w3c.dom.Document;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontTriplet;
*/
public class Java2DPainter extends AbstractIFPainter {
- /** logging instance */
- private static Log log = LogFactory.getLog(Java2DPainter.class);
-
/** the IF context */
protected IFContext ifContext;
}
/** logging instance */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(HardcodedFonts.class);
+ private static final Log LOG = LogFactory.getLog(HardcodedFonts.class);
/**
* Sets the current font (NOTE: Hard-coded font mappings ATM!)
try {
fontcode = Integer.parseInt(name.substring(1));
} catch (Exception e) {
- log.error(e);
+ LOG.error(e);
}
}
//Note "(ON" selects ISO 8859-1 symbol set as used by PCLGenerator
import org.w3c.dom.Document;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.apache.xmlgraphics.image.loader.ImageException;
import org.apache.xmlgraphics.image.loader.ImageInfo;
import org.apache.xmlgraphics.image.loader.ImageProcessingHints;
*/
public class PCLPainter extends AbstractIFPainter implements PCLConstants {
- /** logging instance */
- private static Log log = LogFactory.getLog(PCLPainter.class);
-
private static final boolean DEBUG = false;
private PCLDocumentHandler parent;
package org.apache.fop.render.pcl;
-import org.apache.xmlgraphics.util.QName;
-
-import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.render.ImageHandlerUtil;
import org.apache.fop.render.RendererContext;
public class PDFBorderPainter extends BorderPainter {
/** logging instance */
- private static final Log log // CSOK: ConstantName
- = LogFactory.getLog(PDFBorderPainter.class);
+ private static final Log LOG = LogFactory.getLog(PDFBorderPainter.class);
private PDFContentGenerator generator;
float w = x2 - x1;
float h = y2 - y1;
if ((w < 0) || (h < 0)) {
- log.error("Negative extent received (w=" + w + ", h=" + h
+ LOG.error("Negative extent received (w=" + w + ", h=" + h
+ "). Border won't be painted.");
return;
}
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.gvt.GraphicsNode;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
import org.apache.xmlgraphics.ps.PSGenerator;
public class PSSVGHandler extends AbstractGenericSVGHandler
implements PSRendererContextConstants {
- /** logging instance */
- private static Log log = LogFactory.getLog(PSSVGHandler.class);
-
/**
* Create a new PostScript XML handler for use by the PostScript renderer.
*/
* the FOP project.
*/
-import java.io.Writer;
import java.io.IOException;
-import java.util.Date;
+import java.io.Writer;
import java.util.Random;
/**
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.apache.xmlgraphics.image.loader.ImageException;
import org.apache.xmlgraphics.image.loader.ImageInfo;
import org.apache.xmlgraphics.image.loader.ImageManager;
import org.apache.xmlgraphics.image.loader.ImageSessionContext;
import org.apache.xmlgraphics.xmp.Metadata;
-import org.apache.fop.apps.MimeConstants;
import org.apache.fop.ResourceEventProducer;
+import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.ImageHandlerUtil;
import org.apache.fop.render.RenderingContext;
import org.apache.fop.render.intermediate.AbstractIFPainter;
*/
public class SVGPainter extends AbstractIFPainter implements SVGConstants {
- /** logging instance */
- private static Log log = LogFactory.getLog(SVGPainter.class);
-
private AbstractSVGDocumentHandler parent;
/** The SAX content handler that receives the generated XML events. */
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.fop.apps.Fop;
+import org.xml.sax.InputSource;
+
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.util.DigestFilter;
-import org.xml.sax.InputSource;
/**
* Framework for simple regression testing.
public void testSimple() throws Exception {
final String digestIn = "17bf13298796065f7775db8707133aeb";
final String digestOut = "e2761f51152f6663911e567901596707";
- final String fo =
- "<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>"
+ final String fo
+ = "<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>"
+ " <fo:layout-master-set>"
+ " <fo:simple-page-master master-name='simple'"
+ " page-height='25cm' page-width='20cm'>"
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
foUserAgent.setCreationDate(new Date(10000));
MessageDigest outDigest = MessageDigest.getInstance("MD5");
- DigestOutputStream out =
- new DigestOutputStream(new ByteArrayOutputStream(), outDigest);
+ DigestOutputStream out
+ = new DigestOutputStream(new ByteArrayOutputStream(), outDigest);
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
InputSource source = new InputSource(new StringReader(fo));
DigestFilter filter = new DigestFilter("MD5");
/**
* @return user config File
*/
- abstract protected String getUserConfigFilename();
+ protected abstract String getUserConfigFilename();
/*
* @see junit.framework.TestCase#getName()
if (event.getEventID().equals(expectedEventID)) {
eventReceived = true;
} else {
- fail("Unexpected event: id = " + event.getEventID() + ": "+ msg);
+ fail("Unexpected event: id = " + event.getEventID() + ": " + msg);
}
}
public void dumpFinalStats() {
long duration = System.currentTimeMillis() - startTime;
System.out.println("Final statistics");
- System.out.println("Pages produced: " +totalPagesProduced);
+ System.out.println("Pages produced: " + totalPagesProduced);
long ppm = 60000 * totalPagesProduced / duration;
System.out.println("Average speed: " + ppm + "ppm");
}
/** Simple sanity test of the PDFCmap class */
public class PDFCMapTestCase extends TestCase {
+ private static final String EOL = "\n";
public void testPDFCMapFillInPDF() throws Exception {
- final String EOL = "\n";
- final String expected =
- "%!PS-Adobe-3.0 Resource-CMap" + EOL
- +"%%DocumentNeededResources: ProcSet (CIDInit)" + EOL
- +"%%IncludeResource: ProcSet (CIDInit)" + EOL
- +"%%BeginResource: CMap (test)" + EOL
- +"%%EndComments" + EOL
- +"/CIDInit /ProcSet findresource begin" + EOL
- +"12 dict begin" + EOL
- +"begincmap" + EOL
- +"/CIDSystemInfo 3 dict dup begin" + EOL
- +" /Registry (Adobe) def" + EOL
- +" /Ordering (Identity) def" + EOL
- +" /Supplement 0 def" + EOL
- +"end def" + EOL
- +"/CMapVersion 1 def" + EOL
- +"/CMapType 1 def" + EOL
- +"/CMapName /test def" + EOL
- +"1 begincodespacerange" + EOL
- +"<0000> <FFFF>" + EOL
- +"endcodespacerange" + EOL
- +"1 begincidrange" + EOL
- +"<0000> <FFFF> 0" + EOL
- +"endcidrange" + EOL
- +"endcmap" + EOL
- +"CMapName currentdict /CMap defineresource pop" + EOL
- +"end" + EOL
- +"end" + EOL
- +"%%EndResource" + EOL
- +"%%EOF" + EOL
+ final String expected
+ = "%!PS-Adobe-3.0 Resource-CMap" + EOL
+ + "%%DocumentNeededResources: ProcSet (CIDInit)" + EOL
+ + "%%IncludeResource: ProcSet (CIDInit)" + EOL
+ + "%%BeginResource: CMap (test)" + EOL
+ + "%%EndComments" + EOL
+ + "/CIDInit /ProcSet findresource begin" + EOL
+ + "12 dict begin" + EOL
+ + "begincmap" + EOL
+ + "/CIDSystemInfo 3 dict dup begin" + EOL
+ + " /Registry (Adobe) def" + EOL
+ + " /Ordering (Identity) def" + EOL
+ + " /Supplement 0 def" + EOL
+ + "end def" + EOL
+ + "/CMapVersion 1 def" + EOL
+ + "/CMapType 1 def" + EOL
+ + "/CMapName /test def" + EOL
+ + "1 begincodespacerange" + EOL
+ + "<0000> <FFFF>" + EOL
+ + "endcodespacerange" + EOL
+ + "1 begincidrange" + EOL
+ + "<0000> <FFFF> 0" + EOL
+ + "endcidrange" + EOL
+ + "endcmap" + EOL
+ + "CMapName currentdict /CMap defineresource pop" + EOL
+ + "end" + EOL
+ + "end" + EOL
+ + "%%EndResource" + EOL
+ + "%%EOF" + EOL
;
final StringWriter w = new StringWriter();
public class DigestFilter extends XMLFilterImpl {
private MessageDigest digest;
- private byte value[];
+ private byte[] value;
private boolean isNamespaceAware;
public DigestFilter(String algorithm) throws NoSuchAlgorithmException {
*/
public void setFeature(String feature, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException {
- if(feature.equals("http://xml.org/sax/features/namespaces")) {
+ if (feature.equals("http://xml.org/sax/features/namespaces")) {
isNamespaceAware = value;
}
super.setFeature(feature, value);