[FOray-commit] SF.net SVN: foray: [7910] trunk/foray/foray-render/src/java/org/foray/ render
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-09-05 03:06:10
|
Revision: 7910
http://svn.sourceforge.net/foray/?rev=7910&view=rev
Author: victormote
Date: 2006-09-04 20:06:00 -0700 (Mon, 04 Sep 2006)
Log Message:
-----------
1. Conform to standard class-ordering scheme, as reported by checkstyle.
2. Removed some unused instance variables.
Modified Paths:
--------------
trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Command.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/GoToPageDialog.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessagesDialog.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.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/svg/SVGRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/txt/TXTRenderer.java
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -114,39 +114,26 @@
* object that is contained withing the Image Object.
*/
private BufferedImage pageImage = null;
- protected Graphics2D graphics = null;
+ private Graphics2D graphics = null;
/**
* The current Font instance
*/
- protected FontUse currentFont;
+ private FontUse currentFont;
/**
* The current font size in millipoints
*/
- protected int currentFontSize;
+ private int currentFontSize;
/**
* The current colour's red, green and blue component
*/
- protected float currentRed = 0;
- protected float currentGreen = 0;
- protected float currentBlue = 0;
+ private float currentRed = 0;
+ private float currentGreen = 0;
+ private float currentBlue = 0;
- /**
- * Used to make the last font and color available to
- * renderInlineSpace() to render text decorations.
- */
- protected java.awt.Font lastFont = null;
- protected Color lastColor = null;
- /**
- * The parent component, used to set up the font.
- * This is needed as FontSetup needs a live AWT component
- * in order to generate valid font measures.
- */
- protected Component parent;
-
public AWTRenderer(final Log logger, final OutputConfig renderConfig) {
super(logger, renderConfig);
}
@@ -158,7 +145,6 @@
* @param parent the live AWT component reference
*/
public void setComponent(final Component parent) {
- this.parent = parent;
}
public int getPageNumber() {
@@ -630,11 +616,6 @@
area.traitOverlineScore(),
area.traitThroughScore());
- // remember last font and color for possible inline spaces
- // (especially for text decorations)
- this.lastFont = graphics.getFont();
- this.lastColor = graphics.getColor();
-
graphics.setFont(oldFont);
graphics.setColor(oldColor);
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Command.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Command.java 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Command.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -53,7 +53,7 @@
public class Command extends AbstractAction {
static final long serialVersionUID = 369419499522888726L;
- public static final String IMAGE_DIR =
+ private static final String IMAGE_DIR =
"/org/foray/render/awt/viewer/images/";
PreviewDialog parent;
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/GoToPageDialog.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/GoToPageDialog.java 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/GoToPageDialog.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -55,14 +55,14 @@
private Translator res;
- JPanel panel1 = new JPanel();
- GridBagLayout gridBagLayout1 = new GridBagLayout();
- JLabel pgNbLabel = new JLabel();
- JTextField pgNbField = new JTextField();
- JButton okButton = new JButton();
- JButton cancelButton = new JButton();
+ private JPanel panel1 = new JPanel();
+ private GridBagLayout gridBagLayout1 = new GridBagLayout();
+ private JLabel pgNbLabel = new JLabel();
+ private JTextField pgNbField = new JTextField();
+ private JButton okButton = new JButton();
+ private JButton cancelButton = new JButton();
- int pageNumber = -1;
+ private int pageNumber = -1;
public GoToPageDialog(final Frame frame, final String title,
final boolean modal, final Translator resource, final Log logger) {
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessagesDialog.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessagesDialog.java 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/MessagesDialog.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -50,12 +50,6 @@
static Translator res;
- public static void setTranslator(final Translator aRes) {
- res = aRes;
- iniConstants();
- }
-
-
static String DETAIL_OPTION;
static String YES_STRING;
static String NO_STRING;
@@ -72,8 +66,22 @@
static String[] yesNoCancelOption;
static String[] okCancelOption;
+ protected String detailInformation = null;
+ protected JDialog dialog = null;
+ protected boolean showsDetails = false;
+ public MessagesDialog(final Object message, final int messageType,
+ final int optionType, final Icon icon, final Object[] options,
+ final Object initialValue) {
+ super(message, messageType, optionType, icon, options, initialValue);
+ setMinimumSize(new Dimension(240, 96));
+ }
+ public static void setTranslator(final Translator aRes) {
+ res = aRes;
+ iniConstants();
+ }
+
private static void iniConstants() {
DETAIL_OPTION = res.getString("Details");
YES_STRING = res.getString("Yes");
@@ -108,21 +116,6 @@
};
}
-
- protected String detailInformation = null;
- protected JDialog dialog = null;
- protected boolean showsDetails = false;
-
- // MessagesDialog.showConfirmDialog(null,preparedMes,title,
- // optionTypeIndex,messageTypeIndex);
-
- public MessagesDialog(final Object message, final int messageType,
- final int optionType, final Icon icon, final Object[] options,
- final Object initialValue) {
- super(message, messageType, optionType, icon, options, initialValue);
- setMinimumSize(new Dimension(240, 96));
- }
-
public static int showConfirmDialog(final Component parentComponent,
final Object message, final String title, final int optionType,
final int messageType) {
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -51,9 +51,6 @@
private boolean isSourceFound = true;
- public void setMissingEmphasized(final boolean flag) {
- isMissingEmphasized = flag;
- }
private Log logger;
/**
@@ -70,8 +67,10 @@
}
}
+ public void setMissingEmphasized(final boolean flag) {
+ isMissingEmphasized = flag;
+ }
-
public Enumeration getKeys() {
return lookup.keys();
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/UserMessage.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -37,24 +37,6 @@
*/
public class UserMessage {
- private Translator res = null;
- private Log logger;
-
- public UserMessage(final Log logger) {
- this.logger = logger;
- }
-
- public void setTranslator(final Translator aRes) {
- res = aRes;
- if (res == null) {
- logger.info("UserMessage: setTranslator(null) !");
- res = new SecureResourceBundle(null, this.logger);
- }
-
- MessagesDialog.setTranslator(res);
- }
-
-
// Zulässige Werte für Dialogart:
/**
@@ -92,24 +74,24 @@
/**
* Wert für Setzten keines Buttons
*/
- public static final int STYLE_NOBUTTON = -2;
+ private static final int STYLE_NOBUTTON = -2;
/**
* Wert für Setzten von nur Ja-Button.
*/
- public static final int STYLE_Y = JOptionPane.DEFAULT_OPTION;
+ private static final int STYLE_Y = JOptionPane.DEFAULT_OPTION;
// ButtonDialog.YES; // = 1
/**
* Wert für Setzten von Ja- und Nein-Buttons.
*/
- public static final int STYLE_Y_N = JOptionPane.YES_NO_OPTION;
+ private static final int STYLE_Y_N = JOptionPane.YES_NO_OPTION;
// ButtonDialog.YES_NO; // = 2;
/**
* Wert für Setzten von Ja-, Nein-und Abbruch Buttons.
*/
- public static final int STYLE_Y_N_C = JOptionPane.YES_NO_CANCEL_OPTION;
+ private static final int STYLE_Y_N_C = JOptionPane.YES_NO_CANCEL_OPTION;
// ButtonDialog.YES_NO_CANCEL; // = 3;
@@ -122,30 +104,27 @@
* Constanten der ButtonDialog-Klasse
*/
- /**
- * Möglicher Rückgabewert @see ButtonDialog
- */
- public static final int YES = JOptionPane.YES_OPTION;
- // ButtonDialog.YES; // = 2
-
- /**
- * Möglicher Rückgabewert @see ButtonDialog
- */
- public static final int NO = JOptionPane.NO_OPTION;
- // ButtonDialog.NO; // = 4;
-
- /**
- * Möglicher Rückgabewert @see ButtonDialog
- */
- public static final int CANCEL = JOptionPane.CANCEL_OPTION;
- // ButtonDialog.CANCEL; // = 8;
-
-
// Default-Values
private static String actMessId = null;
// private static MessagesDialog nobuttonDialog = null;
+ private Translator res = null;
+ private Log logger;
+ public UserMessage(final Log logger) {
+ this.logger = logger;
+ }
+
+ public void setTranslator(final Translator aRes) {
+ res = aRes;
+ if (res == null) {
+ logger.info("UserMessage: setTranslator(null) !");
+ res = new SecureResourceBundle(null, this.logger);
+ }
+
+ MessagesDialog.setTranslator(res);
+ }
+
/**
* Ersetzt die eventuellen Platzhalter durch die übergebenen Parameter
*/
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 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -28,7 +28,6 @@
import org.foray.ps.PSReal;
import org.foray.render.TempImage;
-import org.axsl.fontR.FontServer;
import org.axsl.graphicR.Graphic;
import org.apache.batik.ext.awt.g2d.AbstractGraphics2D;
@@ -78,36 +77,23 @@
* @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
*/
public class PSGraphics2D extends AbstractGraphics2D {
- boolean standalone = false;
/**
* the PDF Document being created
*/
- protected PSRenderer psRenderer;
+ private PSRenderer psRenderer;
/**
- * the current (internal) font name
+ * Used to create proper font metrics
*/
- protected String currentFontName;
+ private Graphics2D fmg;
+ {
+ final BufferedImage bi = new BufferedImage(1, 1,
+ BufferedImage.TYPE_INT_ARGB);
+ fmg = bi.createGraphics();
+ }
/**
- * the current font size in millipoints
- */
- protected int currentFontSize;
-
- /**
- * the current vertical position in millipoints from bottom
- */
- protected int currentYPosition = 0;
-
- /**
- * the current horizontal position in millipoints from left
- */
- protected int currentXPosition = 0;
-
- FontServer fontInfo;
-
- /**
* Create a new PDFGraphics2D with the given pdf document info.
* This is used to create a Graphics object for use inside an already
* existing document.
@@ -116,20 +102,12 @@
final String font, final int size, final int xpos, final int ypos) {
super(textAsShapes);
psRenderer = ren;
- currentFontName = font;
- currentFontSize = size;
- currentYPosition = ypos;
- currentXPosition = xpos;
}
public PSGraphics2D(final boolean textAsShapes) {
super(textAsShapes);
}
- public void setGraphicContext(final GraphicContext c) {
- gc = c;
- }
-
/**
* This constructor supports the create method
*/
@@ -137,6 +115,10 @@
super(g);
}
+ public void setGraphicContext(final GraphicContext c) {
+ gc = c;
+ }
+
/**
* Creates a new <code>Graphics</code> object that is
* a copy of this <code>Graphics</code> object.
@@ -318,8 +300,6 @@
*/
public void dispose() {
psRenderer = null;
- currentFontName = null;
- fontInfo = null;
}
/**
@@ -787,17 +767,6 @@
}
/**
- * Used to create proper font metrics
- */
- private Graphics2D fmg;
-
- {
- final BufferedImage bi = new BufferedImage(1, 1,
- BufferedImage.TYPE_INT_ARGB);
- fmg = bi.createGraphics();
- }
-
- /**
* Gets the font metrics for the specified font.
* @return the font metrics for the specified font.
* @param f the specified font
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 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSRenderer.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -111,21 +111,13 @@
*/
public class PSRenderer extends PrintRenderer {
- /**
- * the application producing the PostScript
- */
-// protected String producer;
+ private int pagecount = 0;
- int imagecount = 0; // DEBUG
- int pagecount = 0;
-
private boolean enableComments = true;
private boolean autoRotateLandscape = false;
- /**
- * the stream used to output the PostScript
- */
- protected PSStream out;
+ /** The stream used to output the PostScript. */
+ private PSStream out;
private boolean ioTrouble = false;
private PSFont currentPSFont;
Modified: trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -65,8 +65,6 @@
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.OutputStreamWriter;
-import java.util.HashMap;
-import java.util.Map;
/**
* A {@link Renderer} implementation that writes the document as SVG.
@@ -81,31 +79,10 @@
float totalWidth = 0;
float totalHeight = 0;
- protected int pageWidth = 0;
- protected int pageHeight = 0;
- protected int pageNumber = 0;
+ private int pageWidth = 0;
+ private int pageHeight = 0;
+ private int pageNumber = 0;
- protected Map fontNames = new HashMap();
- protected Map fontStyles = new HashMap();
- protected Color saveColor = null;
-
- /**
- * The current (internal) font name
- */
- protected String currentFontName;
-
- /**
- * The current font size in millipoints
- */
- protected int currentFontSize;
-
- /**
- * The current colour's red, green and blue component
- */
- protected float currentRed = 0;
- protected float currentGreen = 0;
- protected float currentBlue = 0;
-
public SVGRenderer(final Log logger, final OutputConfig renderConfig) {
super(logger, renderConfig);
}
@@ -256,8 +233,6 @@
drawFrame();
- this.currentFontName = "";
- this.currentFontSize = 0;
renderRegions(page);
currentPageG.setAttributeNS(null, "transform", "translate(0,"
Modified: trunk/foray/foray-render/src/java/org/foray/render/txt/TXTRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/txt/TXTRenderer.java 2006-09-05 02:58:22 UTC (rev 7909)
+++ trunk/foray/foray-render/src/java/org/foray/render/txt/TXTRenderer.java 2006-09-05 03:06:00 UTC (rev 7910)
@@ -58,12 +58,11 @@
*/
public class TXTRenderer extends PrintRenderer {
- /**
- * the current stream to add Text commands to
- */
- TXTStream currentStream;
private static final String DEFAULT_ENCODING = "UTF-8";
+ /** Tthe current stream to add Text commands to. */
+ private TXTStream currentStream;
+
private int pageHeight = 7920;
// These variables control the virtual paggination functionality.
@@ -71,17 +70,17 @@
/** Paper height in decipoints? */
private int paperheight = -1;
- final boolean debug = false;
+ private final boolean debug = false;
// Variables for rendering text.
- StringBuffer charData[];
- StringBuffer decoData[];
+ private StringBuffer charData[];
+ private StringBuffer decoData[];
private float textCPI = 16.67f;
private float textLPI = 8;
- int maxX = (int)(8.5f * textCPI + 1);
- int maxY = (int)(11f * textLPI + 1);
- float xFactor;
- float yFactor;
+ private int maxX = (int)(8.5f * textCPI + 1);
+ private int maxY = (int)(11f * textLPI + 1);
+ private float xFactor;
+ private float yFactor;
/** Every line except the last line on a page (which will end with
* pageEnding) will be terminated with this string.*/
@@ -92,7 +91,7 @@
/** If true then graphics/decorations will not be rendered - text only. */
private boolean suppressGraphics = false;
- boolean firstPage = false;
+ private boolean firstPage = false;
public TXTRenderer(final Log logger, final OutputConfig renderConfig) {
super(logger, renderConfig);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|