*/
package org.apache.fop.apps;
-/*
- * originally contributed by
- * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
- * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
- * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
- * Modified to use streaming API by Mark Lillywhite, mark-fop@inomial.com
- */
-import org.apache.fop.viewer.*;
-import org.apache.fop.render.awt.*;
+//FOP
+import org.apache.fop.render.awt.AWTRenderer;
+import org.apache.fop.viewer.PreviewDialog;
+import org.apache.fop.viewer.Translator;
+//Java
import javax.swing.UIManager;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import java.util.Locale;
// SAX
import org.xml.sax.XMLReader;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-
-
-// Java
-import java.io.FileReader;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.io.IOException;
-import java.io.FileNotFoundException;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.*;
-
/**
- * initialize AWT previewer
+ * AWT Viewer starter.
+ * Originally contributed by:
+ * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
+ * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
+ * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
+ * Modified to use streaming API by Mark Lillywhite, mark-fop@inomial.com
*/
public class AWTStarter extends CommandLineStarter {
+ private PreviewDialog frame;
+ private Translator translator;
+ private Driver driver;
+ private XMLReader parser;
- PreviewDialog frame;
- AWTRenderer renderer;
- public static String TRANSLATION_PATH =
- "/org/apache/fop/viewer/resources/";
-
- private Translator resource;
-
- public AWTStarter(CommandLineOptions commandLineOptions)
- throws FOPException {
+ public AWTStarter(CommandLineOptions commandLineOptions) throws FOPException {
super(commandLineOptions);
init();
}
- private void init() {
- try {
- UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
- } catch (Exception e) {
- e.printStackTrace();
- }
-
+ private void init() throws FOPException {
+ //Creates Translator according to the language
String language = commandLineOptions.getLanguage();
-
- if (language == null) {
- try {
- language = System.getProperty("user.language");
- } catch(SecurityException se) {
- // if this is running in a secure place
- }
- }
- resource = getResourceBundle(TRANSLATION_PATH + "resources."
- + language);
-
- UserMessage.setTranslator(getResourceBundle(TRANSLATION_PATH
- + "messages."
- + language));
-
- resource.setMissingEmphasized(false);
- renderer = new AWTRenderer(resource);
- frame = createPreviewDialog(renderer, resource);
- //renderer.setProgressListener(frame);
+ if (language == null)
+ translator = new Translator(Locale.getDefault());
+ else
+ translator = new Translator(new Locale(language, ""));
+ AWTRenderer renderer = new AWTRenderer(translator);
+ frame = createPreviewDialog(renderer, translator);
renderer.setComponent(frame);
- }
-
-
- public void run() throws FOPException {
- Driver driver = new Driver();
- setupLogger(driver);
-
- // init parser
- frame.progress(resource.getString("Init parser") + " ...");
- XMLReader parser = inputHandler.getParser();
-
+ driver = new Driver();
+ driver.setRenderer(renderer);
+ parser = inputHandler.getParser();
if (parser == null) {
throw new FOPException("Unable to create SAX parser");
}
+ }
- setParserFeatures(parser);
-
+ /**
+ * Runs formatting.
+ */
+ public void run() throws FOPException {
+ driver.reset();
try {
- driver.setRenderer(renderer);
-
- // build FO tree: time
- frame.progress(resource.getString("Build FO tree") + " ...");
+ frame.setStatus(translator.getString("Status.Build.FO.tree"));
driver.render(parser, inputHandler.getInputSource());
-
- frame.progress(resource.getString("Show"));
+ frame.setStatus(translator.getString("Status.Show"));
frame.showPage();
-
} catch (Exception e) {
- if (e instanceof FOPException) {
- throw (FOPException)e;
- }
- throw new FOPException(e);
+ frame.reportException(e);
}
-
}
- protected PreviewDialog createPreviewDialog(AWTRenderer renderer,
+ private PreviewDialog createPreviewDialog(AWTRenderer renderer,
Translator res) {
- PreviewDialog frame = new PreviewDialog(renderer, res);
- frame.validate();
+ PreviewDialog frame = new PreviewDialog(this, renderer, res);
frame.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent we) {
System.exit(0);
}
});
- // center window
+ //Centers the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frame.setVisible(true);
return frame;
}
-
-
-
- private SecureResourceBundle getResourceBundle(String path) {
- InputStream in = null;
-
- try {
- URL url = getClass().getResource(path);
- in = url.openStream();
- } catch (Exception ex) {
- getLogger().error("Can't find URL to: <" + path + "> "
- + ex.getMessage(), ex);
- }
- return new SecureResourceBundle(in);
- }
-
}
protected double scaleFactor = 100.0;
protected int pageNumber = 0;
protected Vector pageList = new Vector();
- protected ProgressListener progressListener = null;
+ //protected ProgressListener progressListener = null;
protected Translator res = null;
protected Hashtable fontNames = new Hashtable();
*/
package org.apache.fop.viewer;
-/*
- * Juergen Verwohlt: Juergen.Verwohlt@jcatalog.com,
- * Rainer Steinkuhle: Rainer.Steinkuhle@jcatalog.com,
- * Stanislav Gorkhover: Stanislav.Gorkhover@jcatalog.com
- */
+//Java
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
-import java.net.*;
-
+import java.net.URL;
/**
- * Klasse für UI-Kommandos. Die Kommandos können in das Menüsystem oder
- * in eine Toolbar eingefügt werden.<br>
- * <code>Commands</code> unterstützen mehrsprachigkeit.<br>
- * Durch überschreiben der Methode <code>doit<code> kann die Klasse customisiert werden.
- * Über die Methode <code>undoit</code> kann Undo-Funktionalität unterstützt werden.<br>
- *
- * @author Juergen.Verwohlt@jcatalog.com
- * @version 1.0 18.03.99
+ * This class represents UI-commands, which can be used as menu or toolbar
+ * items<br>.
+ * When the <code>Command</code> object receives action event, that object's
+ * <code>doit</code> method is invoked. <code>doit</code> method by default
+ * does nothing and the class customer have to override it to implement
+ * any action handling logic.
+ * Originally contributed by:
+ * Juergen Verwohlt: Juergen.Verwohlt@jcatalog.com,
+ * Rainer Steinkuhle: Rainer.Steinkuhle@jcatalog.com,
+ * Stanislav Gorkhover: Stanislav.Gorkhover@jcatalog.com
*/
public class Command extends AbstractAction {
- public static String IMAGE_DIR = "/org/apache/fop/viewer/Images/";
+ private static String IMAGE_DIR = "Images/";
+ /**
+ * Creates <code>Command</code> object with a given name and
+ * sets the name as a tooltip text. No associated icon image.
+ */
public Command(String name) {
- this(name, (ImageIcon)null);
- }
-
- public Command(String name, ImageIcon anIcon) {
- super(name, anIcon);
+ super(name);
+ putValue(SHORT_DESCRIPTION, name);
}
+ /**
+ * Creates <code>Command</code> object with a given name, the same
+ * tooltip text and icon image if appropriate image file is found.
+ */
public Command(String name, String iconName) {
super(name);
- String path = IMAGE_DIR + iconName + ".gif";
- URL url = getClass().getResource(path);
- if (url == null) {
- //log.error("Icon not found: " + path);
- } else
+ putValue(SHORT_DESCRIPTION, name);
+ URL url = getClass().getResource(IMAGE_DIR + iconName + ".gif");
+ if (url != null) {
putValue(SMALL_ICON, new ImageIcon(url));
+ }
}
public void actionPerformed(ActionEvent e) {
doit();
}
+ /**
+ * Action handler, have to be overrided by subclasses.
+ */
public void doit() {
- //log.error("Not implemented.");
+ //Do nothing
}
-
- public void undoit() {
- //log.error("Not implemented.");
- }
-
}
+
* LICENSE file included with these sources.
*/
-/*
- * originally contributed by
- * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
- * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
- * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
- */
-
package org.apache.fop.viewer;
import java.awt.*;
import javax.swing.*;
-import java.awt.event.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+/**
+ * Go to Page Dialog.
+ * Originally contributed by:
+ * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
+ * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
+ * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
+ */
public class GoToPageDialog extends JDialog {
- JPanel panel1 = new JPanel();
- GridBagLayout gridBagLayout1 = new GridBagLayout();
- JLabel pgNbLabel = new JLabel();
- JTextField pgNbField = new JTextField();
- JButton okButton = new JButton();
- JButton cancelButton = new JButton();
-
- int pageNumber = -1;
-
- public GoToPageDialog(Frame frame, String title, boolean modal) {
- super(frame, title, modal);
- try {
- jbInit();
- pack();
- } catch (Exception ex) {
- //log.error("GoToPageDialog: Konstruktor: "
- // + ex.getMessage(), ex);
- }
+ private JTextField pgNbField;
+ private int pageNumber = -1;
+
+ /**
+ * Creates modal dialog with a given title, attached to a given frame.
+ */
+ public GoToPageDialog(Frame frame, String title, Translator translator) {
+ super(frame, title, true);
+ jbInit(translator);
+ pack();
}
- public GoToPageDialog() {
- this(null, "", false);
- }
-
- void jbInit() throws Exception {
+ private void jbInit(Translator translator) {
+ JPanel panel1 = new JPanel();
+ GridBagLayout gridBagLayout1 = new GridBagLayout();
+ JLabel pgNbLabel = new JLabel();
+ pgNbField = new JTextField();
+ JButton okButton = new JButton();
+ JButton cancelButton = new JButton();
panel1.setLayout(gridBagLayout1);
- pgNbLabel.setText("Page number");
- okButton.setText("Ok");
- okButton.addActionListener(new java.awt.event.ActionListener() {
-
+ pgNbLabel.setText(translator.getString("Label.Page.number"));
+ okButton.setText(translator.getString("Button.Ok"));
+ okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
okButton_actionPerformed(e);
}
-
});
- cancelButton.setText("Cancel");
+ cancelButton.setText(translator.getString("Button.Cancel"));
cancelButton.addActionListener(new java.awt.event.ActionListener() {
-
public void actionPerformed(ActionEvent e) {
cancelButton_actionPerformed(e);
}
-
});
panel1.setMinimumSize(new Dimension(250, 78));
getContentPane().add(panel1);
new Insets(0, 10, 10, 10), 0, 0));
}
- void okButton_actionPerformed(ActionEvent e) {
+ private void okButton_actionPerformed(ActionEvent e) {
try {
pageNumber = Integer.parseInt(pgNbField.getText());
dispose();
- } catch (Exception ex) {
+ } catch (NumberFormatException nfe) {
pgNbField.setText("???");
}
}
- void cancelButton_actionPerformed(ActionEvent e) {
+ private void cancelButton_actionPerformed(ActionEvent e) {
pageNumber = -1;
dispose();
}
+ /**
+ * Returns page number, entered by user.
+ */
public int getPageNumber() {
return pageNumber;
}
-
}
+
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.viewer;
-
-/*
- * originally contributed by
- * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
- * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
- * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
- */
-
-
-import javax.swing.*;
-import java.beans.PropertyChangeListener;
-
-public class IconToolBar extends JToolBar {
-
- public JButton add(Action a) {
- String name = (String)a.getValue(Action.NAME);
- Icon icon = (Icon)a.getValue(Action.SMALL_ICON);
- return add(a, name, icon);
- }
-
- public JButton add(Action a, String name, Icon icon) {
- JButton b = new JButton(icon);
- b.setToolTipText(name);
- b.setEnabled(a.isEnabled());
- b.addActionListener(a);
- add(b);
- PropertyChangeListener actionPropertyChangeListener =
- createActionChangeListener(b);
- a.addPropertyChangeListener(actionPropertyChangeListener);
- return b;
- }
-
-}
-
-
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.viewer;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Erweitert Hashtable um die Methode load.
- * Die Zeilen der Textdatei, die mit # oder ! anfangen sind Kommentarzeilen.
- * Eine gültige Zeile ist entweder eine Kommentarzeile oder eine Zeile mit dem
- * Gleichheitszeichen "in der Mitte".
- * Die Klasse LoadableProperties lässt im Gegensatz zu der Klasse Properties die
- * Schlüsselwerte mit Leerzeichen zu.
- *
- * @version 02.12.99
- * @author Stanislav.Gorkhover@jCatalog.com
- *
- */
-public class LoadableProperties extends Hashtable {
-
- public LoadableProperties() {
- super();
- }
-
-
- public void load(InputStream inStream) throws IOException {
-
- BufferedReader in = new BufferedReader(new InputStreamReader(inStream,
- "8859_1"));
-
- String aKey;
- String aValue;
- int index;
- String line = getNextLine(in);
- while (line != null) {
- line = line.trim();
- if (isValid(line)) {
- index = line.indexOf("=");
- aKey = line.substring(0, index);
- aValue = line.substring(index + 1);
- put(aKey, aValue);
- }
- line = getNextLine(in);
- }
- }
-
-
- private boolean isValid(String str) {
- if (str == null)
- return false;
- if (str.length() > 0) {
- if (str.startsWith("#") || str.startsWith("!")) {
- return false;
- }
- } else {
- return false;
- }
-
- int index = str.indexOf("=");
- if (index > 0 && str.length() > index) {
- return true;
- } else {
- //log.debug(getClass().getName()
- // + ": load(): invalid line " + str + "."
- // + " Character '=' missed.");
- return false;
- }
- }
-
- private String getNextLine(BufferedReader br) {
- try {
- return br.readLine();
- } catch (Exception e) {
- return null;
- }
-
- }
-
-
-}
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.viewer;
-
-import java.lang.Exception;
-
-/**
- * Die Klasse <code>MessageException</code> ist eine Exception, die
- * mit einer Meldung und deren Parametern versehen werden kann.
- * Dadurch kann die Meldung über den Exception-Mechanismus an die
- * Aufrufer hochgereicht werden, bis schliesslich ein Aufrufer die
- * Meldung zur Anzeige bringt.
- *
- * @author Juergen.Verwohlt@jCatalog.com
- * @version 1.0 28.05.99
- *
- */
-public class MessageException extends Exception {
-
- /**
- * Angabe der auslösenden Exception, wie z.B. NullPointerException.
- * Dieses Feld ist optional.
- */
- protected Exception exception;
-
- /**
- * ID der Meldung, die für diese Exception ausgegeben werden soll
- */
- protected String messageId;
-
- /**
- * Parameterliste zur Meldung
- */
- protected String[] parameterList;
-
-
- // Konstruktoren
-
- public MessageException() {
- this("UNKNOWN_EXCEPTION");
- }
-
- public MessageException(String aMessageId) {
- this(aMessageId, null);
- }
-
- public MessageException(String aMessageId, String[] aParameterList) {
- this(aMessageId, aParameterList, null);
- }
-
- public MessageException(String aMessageId, String[] aParameterList,
- Exception anException) {
- super(aMessageId);
- messageId = aMessageId;
- parameterList = aParameterList;
- exception = anException;
- }
-
- // Zugriffsmethoden
-
- public String getMessageId() {
- return messageId;
- }
-
- public String[] getParameterList() {
- return parameterList;
- }
-
- public Exception getException() {
- return exception;
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.viewer;
-
-import javax.swing.*;
-
-import java.beans.*;
-import java.io.*;
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-
-
-import org.apache.fop.apps.*;
-
-
-/**
- * Die Klasse <code>MessagesDialog</code> dient der Anzeige von Meldungen.
- * Die Klasse erweitert <code>JOptionPane</code> um die Möglichkeit, auf Knopfdruck
- * eine Detailanzeige einzublenden, in der z.B. bei Fehlern der StackTrace ausgegeben
- * werden kann.
- *
- * @author Juergen.Verwohlt@jCatalog.com
- * @version 1.0 09.06.99
- */
-public class MessagesDialog extends JOptionPane {
-
- static Translator res;
-
- public static void setTranslator(Translator aRes) {
- res = aRes;
- iniConstants();
- }
-
-
- static String DETAIL_OPTION;
- static String YES_OPTION;
- static String NO_OPTION;
- static String CANCEL_OPTION;
- static String OK_OPTION;
-
- static String[] defaultDetailOption;
- static String[] yesNoDetailOption;
- static String[] yesNoCancelDetailOption;
- static String[] okCancelDetailOption;
-
- static String[] defaultOption;
- static String[] yesNoOption;
- static String[] yesNoCancelOption;
- static String[] okCancelOption;
-
-
-
- private static void iniConstants() {
- DETAIL_OPTION = res.getString("Details");
- YES_OPTION = res.getString("Yes");
- NO_OPTION = res.getString("No");
- CANCEL_OPTION = res.getString("Cancel");
- OK_OPTION = res.getString("Ok");
-
- defaultDetailOption = new String[] {
- OK_OPTION, DETAIL_OPTION
- };
- yesNoDetailOption = new String[] {
- YES_OPTION, NO_OPTION, DETAIL_OPTION
- };
- yesNoCancelDetailOption = new String[] {
- YES_OPTION, NO_OPTION, CANCEL_OPTION, DETAIL_OPTION
- };
- okCancelDetailOption = new String[] {
- OK_OPTION, CANCEL_OPTION, DETAIL_OPTION
- };
-
- defaultOption = new String[] {
- OK_OPTION
- };
- yesNoOption = new String[] {
- YES_OPTION, NO_OPTION
- };
- yesNoCancelOption = new String[] {
- YES_OPTION, NO_OPTION, CANCEL_OPTION
- };
- okCancelOption = new String[] {
- OK_OPTION, CANCEL_OPTION
- };
- }
-
-
- protected String detailInformation = null;
- protected JDialog dialog = null;
- protected boolean showsDetails = false;
-
- // MessagesDialog.showConfirmDialog(null,preparedMes,title,
- // optionTypeIndex,messageTypeIndex);
-
- public MessagesDialog(Object message, int messageType, int optionType,
- Icon icon, Object[] options, Object initialValue) {
- super(message, messageType, optionType, icon, options, initialValue);
- setMinimumSize(new Dimension(240, 96));
- }
-
- public static int showConfirmDialog(Component parentComponent,
- Object message, String title,
- int optionType, int messageType) {
- Object[] options;
-
- switch (optionType) {
- case JOptionPane.YES_NO_OPTION:
- options = yesNoOption;
- break;
- case JOptionPane.YES_NO_CANCEL_OPTION:
- options = yesNoCancelOption;
- break;
- case JOptionPane.OK_CANCEL_OPTION:
- options = okCancelOption;
- break;
- default:
- options = defaultOption;
- }
-
- MessagesDialog pane = new MessagesDialog(message, messageType,
- JOptionPane.DEFAULT_OPTION,
- null, options, options[0]);
-
- pane.setInitialValue(options[0]);
-
- JDialog dialog = pane.createDialog(parentComponent, title);
-
- pane.setDialog(dialog);
- pane.selectInitialValue();
-
- dialog.show();
-
- Object selectedValue = pane.getValue();
-
- if (selectedValue == null)
- return CLOSED_OPTION;
-
- if (selectedValue.equals(OK_OPTION))
- return JOptionPane.OK_OPTION;
- if (selectedValue.equals(CANCEL_OPTION))
- return JOptionPane.CANCEL_OPTION;
- if (selectedValue.equals(YES_OPTION))
- return JOptionPane.YES_OPTION;
- if (selectedValue.equals(NO_OPTION))
- return JOptionPane.NO_OPTION;
-
- return CLOSED_OPTION;
- }
-
- /**
- * Öffnet ein Dialogfenster, bei dem zusätzlich zu den spez. Buttons noch ein
- * 'Detail'-Button erscheint. Wird dieser Knopf vom Benutzer betätigt, erscheint
- * die übergebene Detailinformation in einem scrollbaren Bereich des Dialogs.
- */
- public static int showDetailDialog(Component parentComponent,
- Object message, String title,
- int optionType, int messageType,
- Icon icon,
- String newDetailInformation) {
- Object[] options;
-
- switch (optionType) {
- case JOptionPane.YES_NO_OPTION:
- options = yesNoDetailOption;
- break;
- case JOptionPane.YES_NO_CANCEL_OPTION:
- options = yesNoCancelDetailOption;
- break;
- case JOptionPane.OK_CANCEL_OPTION:
- options = okCancelDetailOption;
- break;
- default:
- options = defaultDetailOption;
- }
-
- MessagesDialog pane = new MessagesDialog(message, messageType,
- JOptionPane.DEFAULT_OPTION,
- icon, options, options[0]);
-
- pane.setDetailInformation(newDetailInformation);
- pane.setInitialValue(options[0]);
-
- JDialog dialog = pane.createDialog(parentComponent, title);
-
- pane.setDialog(dialog);
- pane.selectInitialValue();
-
- dialog.show();
-
- Object selectedValue = pane.getValue();
-
- if (selectedValue == null)
- return CLOSED_OPTION;
-
- if (((String)selectedValue).equals(DETAIL_OPTION))
- return CLOSED_OPTION;
-
- if (selectedValue.equals(OK_OPTION))
- return JOptionPane.OK_OPTION;
- if (selectedValue.equals(CANCEL_OPTION))
- return JOptionPane.CANCEL_OPTION;
- if (selectedValue.equals(YES_OPTION))
- return JOptionPane.YES_OPTION;
- if (selectedValue.equals(NO_OPTION))
- return JOptionPane.NO_OPTION;
-
- return CLOSED_OPTION;
- }
-
- /**
- * Die Methode fügt in den übergebenen Dialog eine scrollbare Textkomponente ein,
- * in der die Detailinformation angezeigt wird.
- *
- * @param JDialog dialog Der Dialog, in den die Textkomponente eingefügt werden soll
- */
- protected void displayDetails(JDialog dialog) {
- if (getDetailInformation() != null && dialog != null
- && showsDetails == false) {
- showsDetails = true;
- JScrollPane aScrollPane = new JScrollPane();
- JTextArea aTextArea = new JTextArea();
- StringWriter aStringWriter = new StringWriter();
-
- aTextArea.setText(getDetailInformation());
- aTextArea.setEditable(false);
-
- aScrollPane.getViewport().add(aTextArea, null);
- dialog.getContentPane().add(aScrollPane, BorderLayout.SOUTH);
- aScrollPane.setPreferredSize(new Dimension(320, 240));
- dialog.pack();
- }
- }
-
- // Zugriff
-
- public void setValue(Object aValue) {
- if (aValue != null && DETAIL_OPTION.equals(aValue))
- displayDetails(getDialog());
- else
- super.setValue(aValue);
- }
-
- public String getDetailInformation() {
- return detailInformation;
- }
-
- public void setDetailInformation(String aValue) {
- detailInformation = aValue;
- }
-
- public JDialog getDialog() {
- return dialog;
- }
-
- public void setDialog(JDialog aValue) {
- dialog = aValue;
- }
-
-}
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
-
+
package org.apache.fop.viewer;
-
-/*
- * originally contributed by
- * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
- * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
- * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
- * Doro Wiarda (wiarda@dwiarda.com:
- * added MessageListener support and made
- * the showing of the progress and error
- * messages Swing thread safe.
- * This is needed as xml parse errors do not
- * necessarily occur in the
- * EventDispatchThread.
- */
-
+
+//Java
import java.awt.*;
-import java.awt.print.*;
-import java.awt.event.*;
-import java.awt.image.BufferedImage;
-import java.util.StringTokenizer;
-import java.util.ArrayList;
-
import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.print.PrinterJob;
+import java.awt.print.PrinterException;
+import java.awt.image.BufferedImage;
-import org.apache.fop.layout.*;
-import org.apache.fop.render.awt.*;
+//FOP
+import org.apache.fop.apps.AWTStarter;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.render.awt.AWTRenderer;
/**
- * Frame and User Interface for Preview
+ * AWT Viewer main window.
+ * Originally contributed by:
+ * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
+ * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
+ * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
*/
-public class PreviewDialog extends JFrame implements ProgressListener {
-
- protected Translator res;
-
- protected int currentPage = 0;
- protected int pageCount = 0;
-
+public class PreviewDialog extends JFrame {
+ protected Translator translator;
protected AWTRenderer renderer;
+ protected AWTStarter starter;
- protected IconToolBar toolBar = new IconToolBar();
-
- protected Command printAction;
- protected Command firstPageAction;
- protected Command previousPageAction;
- protected Command nextPageAction;
- protected Command lastPageAction;
-
- protected JLabel zoomLabel =
- new JLabel(); // {public float getAlignmentY() { return 0.0f; }};
- protected JComboBox scale = new JComboBox() {
- public float getAlignmentY() {
- return 0.5f;
- }
-
- };
-
- protected JScrollPane previewArea = new JScrollPane();
- // protected JLabel statusBar = new JLabel();
- protected JPanel statusBar = new JPanel();
- protected GridBagLayout statusBarLayout = new GridBagLayout();
+ private int currentPage = 0;
+ private int pageCount = 0;
+ private Reloader reloader;
+ private JComboBox scale;
+ private JLabel processStatus;
+ private JLabel pageLabel;
+ private JLabel infoStatus;
- protected JLabel statisticsStatus = new JLabel();
- protected JLabel processStatus = new JLabel();
- protected JLabel infoStatus = new JLabel();
- protected JLabel previewImageLabel = new JLabel();
+ /**
+ * Creates a new PreviewDialog that uses the given starter, renderer and translator.
+ * @param aStarter the to use starter
+ * @param aRenderer the to use renderer
+ * @param aRes the to use translator
+ */
+ public PreviewDialog(AWTStarter aStarter, AWTRenderer aRenderer, Translator aRes) {
+ this(aRenderer, aRes);
+ starter = aStarter;
+ }
/**
- * Create a new PreviewDialog that uses the given renderer and translator.
- *
+ * Creates a new PreviewDialog that uses the given renderer and translator.
* @param aRenderer the to use renderer
* @param aRes the to use translator
*/
public PreviewDialog(AWTRenderer aRenderer, Translator aRes) {
- res = aRes;
+ translator = aRes;
renderer = aRenderer;
- printAction = new Command(res.getString("Print"), "Print") {
+ //Commands aka Actions
+ Command printAction = new Command(translator.getString("Menu.Print"), "Print") {
public void doit() {
print();
}
-
};
- firstPageAction = new Command(res.getString("First page"),
+ Command firstPageAction = new Command(translator.getString("Menu.First.page"),
"firstpg") {
public void doit() {
- goToFirstPage(null);
+ goToFirstPage();
}
-
};
- previousPageAction = new Command(res.getString("Previous page"),
+ Command previousPageAction = new Command(translator.getString("Menu.Prev.page"),
"prevpg") {
public void doit() {
- goToPreviousPage(null);
+ goToPreviousPage();
}
-
};
- nextPageAction = new Command(res.getString("Next page"), "nextpg") {
+ Command nextPageAction = new Command(translator.getString("Menu.Next.page"), "nextpg") {
public void doit() {
- goToNextPage(null);
+ goToNextPage();
}
};
- lastPageAction = new Command(res.getString("Last page"), "lastpg") {
+ Command lastPageAction = new Command(translator.getString("Menu.Last.page"), "lastpg") {
public void doit() {
- goToLastPage(null);
+ goToLastPage();
+ }
+ };
+ Command reloadAction = new Command(translator.getString("Menu.Reload"), "reload") {
+ public void doit() {
+ reload();
}
-
};
+ setTitle("FOP: AWT-" + translator.getString("Title.Preview"));
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
- this.setSize(new Dimension(379, 476));
- previewArea.setMinimumSize(new Dimension(50, 50));
-
- this.setTitle("FOP: AWT-" + res.getString("Preview"));
- scale.addItem("25");
- scale.addItem("50");
- scale.addItem("75");
- scale.addItem("100");
- scale.addItem("150");
- scale.addItem("200");
+ //Sets size to be 61%x90% of the screen size
+ Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
+ //Rather frivolous size - fits A4 page width in 1024x768 screen on my desktop
+ setSize(screen.width*61/100, screen.height*9/10);
+ //Page view stuff
+ pageLabel = new JLabel();
+ JScrollPane previewArea = new JScrollPane(pageLabel);
+ previewArea.getViewport().setBackground(Color.gray);
+ previewArea.setMinimumSize(new Dimension(50, 50));
+ getContentPane().add(previewArea, BorderLayout.CENTER);
+
+ //Scaling combobox
+ scale = new JComboBox();
+ scale.addItem("25%");
+ scale.addItem("50%");
+ scale.addItem("75%");
+ scale.addItem("100%");
+ scale.addItem("150%");
+ scale.addItem("200%");
scale.setMaximumSize(new Dimension(80, 24));
scale.setPreferredSize(new Dimension(80, 24));
-
- scale.addActionListener(new java.awt.event.ActionListener() {
+ scale.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
scale_actionPerformed(e);
}
-
});
-
- scale.setSelectedItem("100");
+ scale.setSelectedItem("100%");
renderer.setScaleFactor(100.0);
- zoomLabel.setText(res.getString("Zoom"));
-
- this.setJMenuBar(setupMenue());
-
- this.getContentPane().add(toolBar, BorderLayout.NORTH);
+ //Menu
+ setJMenuBar(setupMenu());
+ //Toolbar
+ JToolBar toolBar = new JToolBar();
toolBar.add(printAction);
+ toolBar.add(reloadAction);
toolBar.addSeparator();
toolBar.add(firstPageAction);
toolBar.add(previousPageAction);
toolBar.add(nextPageAction);
toolBar.add(lastPageAction);
toolBar.addSeparator();
- toolBar.add(zoomLabel, null);
+ toolBar.add(new JLabel(translator.getString("Menu.Zoom")));
toolBar.addSeparator();
- toolBar.add(scale, null);
-
- this.getContentPane().add(previewArea, BorderLayout.CENTER);
- this.getContentPane().add(statusBar, BorderLayout.SOUTH);
-
- statisticsStatus.setBorder(BorderFactory.createEtchedBorder());
- processStatus.setBorder(BorderFactory.createEtchedBorder());
- infoStatus.setBorder(BorderFactory.createEtchedBorder());
-
- statusBar.setLayout(statusBarLayout);
+ toolBar.add(scale);
+ getContentPane().add(toolBar, BorderLayout.NORTH);
+ //Status bar
+ JPanel statusBar = new JPanel();
+ processStatus = new JLabel();
+ processStatus.setBorder(BorderFactory.createCompoundBorder(
+ BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(0,3,0,0)));
+ infoStatus = new JLabel();
+ infoStatus.setBorder(BorderFactory.createCompoundBorder(
+ BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(0,3,0,0)));
+
+ statusBar.setLayout(new GridBagLayout());
processStatus.setPreferredSize(new Dimension(200, 21));
- statisticsStatus.setPreferredSize(new Dimension(100, 21));
- infoStatus.setPreferredSize(new Dimension(100, 21));
processStatus.setMinimumSize(new Dimension(200, 21));
- statisticsStatus.setMinimumSize(new Dimension(100, 21));
+
+ infoStatus.setPreferredSize(new Dimension(100, 21));
infoStatus.setMinimumSize(new Dimension(100, 21));
statusBar.add(processStatus,
- new GridBagConstraints(0, 0, 2, 1, 2.0, 0.0,
- GridBagConstraints.CENTER,
- GridBagConstraints.HORIZONTAL,
- new Insets(0, 0, 0, 5), 0, 0));
- statusBar.add(statisticsStatus,
- new GridBagConstraints(2, 0, 1, 2, 1.0, 0.0,
+ new GridBagConstraints(0, 0, 1, 0, 2.0, 0.0,
GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL,
- new Insets(0, 0, 0, 5), 0, 0));
+ new Insets(0, 0, 0, 3), 0, 0));
statusBar.add(infoStatus,
- new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0,
+ new GridBagConstraints(1, 0, 1, 0, 1.0, 0.0,
GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0));
-
- previewArea.getViewport().add(previewImageLabel);
- showPage();
+ getContentPane().add(statusBar, BorderLayout.SOUTH);
}
/**
- * Create a new menubar to be shown in this window.
- *
+ * Creates a new menubar to be shown in this window.
* @return the newly created menubar
*/
- private JMenuBar setupMenue() {
- JMenuBar menuBar;
- JMenuItem menuItem;
- JMenu menu;
- JMenu subMenu;
-
- menuBar = new JMenuBar();
- menu = new JMenu(res.getString("File"));
- subMenu = new JMenu("OutputFormat");
- subMenu.add(new Command("mHTML"));
- subMenu.add(new Command("mPDF"));
- subMenu.add(new Command("mRTF"));
- subMenu.add(new Command("mTEXT"));
- // menu.add(subMenu);
- // menu.addSeparator();
- menu.add(new Command(res.getString("Print")) {
+ private JMenuBar setupMenu() {
+ JMenuBar menuBar = new JMenuBar();
+ JMenu menu = new JMenu(translator.getString("Menu.File"));
+
+ //Adds mostly the same actions, but without icons
+ menu.add(new Command(translator.getString("Menu.Print")) {
public void doit() {
print();
}
-
+ });
+ menu.add(new Command(translator.getString("Menu.Reload")) {
+ public void doit() {
+ reload();
+ }
});
menu.addSeparator();
- menu.add(new Command(res.getString("Exit")) {
+ menu.add(new Command(translator.getString("Menu.Exit")) {
public void doit() {
dispose();
}
-
});
menuBar.add(menu);
- menu = new JMenu(res.getString("View"));
- menu.add(new Command(res.getString("First page")) {
+ menu = new JMenu(translator.getString("Menu.View"));
+ menu.add(new Command(translator.getString("Menu.First.page")) {
public void doit() {
- goToFirstPage(null);
+ goToFirstPage();
}
-
});
- menu.add(new Command(res.getString("Previous page")) {
+ menu.add(new Command(translator.getString("Menu.Prev.page")) {
public void doit() {
- goToPreviousPage(null);
+ goToPreviousPage();
}
-
});
- menu.add(new Command(res.getString("Next page")) {
+ menu.add(new Command(translator.getString("Menu.Next.page")) {
public void doit() {
- goToNextPage(null);
+ goToNextPage();
}
-
});
- menu.add(new Command(res.getString("Last page")) {
+ menu.add(new Command(translator.getString("Menu.Last.page")) {
public void doit() {
- goToLastPage(null);
+ goToLastPage();
}
-
});
- menu.add(new Command(res.getString("Go to Page") + " ...") {
+ menu.add(new Command(translator.getString("Menu.Go.to.Page") + " ...") {
public void doit() {
- goToPage(null);
+ showGoToPageDialog();
}
-
});
menu.addSeparator();
- subMenu = new JMenu(res.getString("Zoom"));
+ JMenu subMenu = new JMenu(translator.getString("Menu.Zoom"));
subMenu.add(new Command("25%") {
public void doit() {
setScale(25.0);
}
-
});
subMenu.add(new Command("50%") {
public void doit() {
setScale(50.0);
}
-
});
subMenu.add(new Command("75%") {
public void doit() {
setScale(75.0);
}
-
});
subMenu.add(new Command("100%") {
public void doit() {
setScale(100.0);
}
-
});
subMenu.add(new Command("150%") {
public void doit() {
setScale(150.0);
}
-
});
subMenu.add(new Command("200%") {
public void doit() {
setScale(200.0);
}
-
});
menu.add(subMenu);
menu.addSeparator();
- menu.add(new Command(res.getString("Default zoom")) {
+ menu.add(new Command(translator.getString("Menu.Default.zoom")) {
public void doit() {
setScale(100.0);
}
-
});
menuBar.add(menu);
- menu = new JMenu(res.getString("Help"));
- menu.add(new Command(res.getString("Index")));
- menu.addSeparator();
- menu.add(new Command(res.getString("Introduction")));
- menu.addSeparator();
- menu.add(new Command(res.getString("About")) {
+ menu = new JMenu(translator.getString("Menu.Help"));
+ menu.add(new Command(translator.getString("Menu.About")) {
public void doit() {
- startHelpAbout(null);
+ startHelpAbout();
}
-
});
menuBar.add(menu);
return menuBar;
}
- // Aktion Hilfe | Info durchgeführt
-
/**
- * Show the About box
- *
- * @param e a value of type 'ActionEvent'
+ * Shows the About box
*/
- public void startHelpAbout(ActionEvent e) {
- PreviewDialogAboutBox dlg = new PreviewDialogAboutBox(this);
+ private void startHelpAbout() {
+ PreviewDialogAboutBox dlg = new PreviewDialogAboutBox(this, translator);
+ //Centers the box
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
- dlg.setModal(true);
- dlg.show();
+ dlg.setVisible(true);
}
/**
- * Change the current visible page
- *
+ * Changes the current visible page
* @param number the page number to go to
*/
- private void goToPage(int number) {
+ private void goToPage(int number) {
currentPage = number;
renderer.setPageNumber(number);
showPage();
/**
* Shows the previous page.
*/
- private void goToPreviousPage(ActionEvent e) {
+ private void goToPreviousPage() {
if (currentPage <= 0)
return;
currentPage--;
/**
* Shows the next page.
*/
- private void goToNextPage(ActionEvent e) {
+ private void goToNextPage() {
if (currentPage >= pageCount - 1)
return;
currentPage++;
/**
* Shows the last page.
*/
- private void goToLastPage(ActionEvent e) {
-
+ private void goToLastPage() {
if (currentPage == pageCount - 1)
return;
currentPage = pageCount - 1;
-
goToPage(currentPage);
}
/**
- * Shows a page by number.
+ * Reloads and reformats document.
+ */
+ private synchronized void reload() {
+ if (reloader == null || !reloader.isAlive()) {
+ reloader = new Reloader();
+ reloader.start();
+ }
+ }
+
+ /**
+ * This class is used to reload document in
+ * a thread safe way.
*/
- private void goToPage(ActionEvent e) {
+ private class Reloader extends Thread {
+ public void run() {
+ pageLabel.setIcon(null);
+ infoStatus.setText("");
+ currentPage = 0;
+ //Cleans up renderer - to be done
+ //while (renderer.getPageCount() != 0)
+ // renderer.removePage(0);
+ try {
+ starter.run();
+ } catch (FOPException e) {
+ reportException(e);
+ }
+ }
+ }
+ /**
+ * Shows "go to page" dialog and then goes to the selected page
+ */
+ private void showGoToPageDialog() {
GoToPageDialog d = new GoToPageDialog(this,
- res.getString("Go to Page"),
- true);
+ translator.getString("Menu.Go.to.Page"), translator);
d.setLocation((int)getLocation().getX() + 50,
(int)getLocation().getY() + 50);
- d.show();
+ d.setVisible(true);
currentPage = d.getPageNumber();
-
if (currentPage < 1 || currentPage > pageCount)
return;
-
currentPage--;
-
goToPage(currentPage);
}
/**
* Shows the first page.
*/
- private void goToFirstPage(ActionEvent e) {
+ private void goToFirstPage() {
if (currentPage == 0)
return;
currentPage = 0;
goToPage(currentPage);
}
+ /**
+ * Prints the document
+ */
private void print() {
PrinterJob pj = PrinterJob.getPrinterJob();
- // Nicht nötig, Pageable get a Printable.
- // pj.setPrintable(renderer);
pj.setPageable(renderer);
-
if (pj.printDialog()) {
try {
pj.print();
}
}
- public void setScale(double scaleFactor) {
-
+ /**
+ * Scales page image
+ */
+ private void setScale(double scaleFactor) {
if (scaleFactor == 25.0)
scale.setSelectedIndex(0);
else if (scaleFactor == 50.0)
scale.setSelectedIndex(4);
else if (scaleFactor == 200.0)
scale.setSelectedIndex(5);
-
renderer.setScaleFactor(scaleFactor);
showPage();
}
- void scale_actionPerformed(ActionEvent e) {
- setScale(new Double((String)scale.getSelectedItem()).doubleValue());
- }
-
- public void progress(int percentage) {
- progress(new String(percentage + "%"));
- }
-
- public void progress(int percentage, String message) {
- progress(new String(message + " " + percentage + "%"));
+ private void scale_actionPerformed(ActionEvent e) {
+ String item = (String)scale.getSelectedItem();
+ setScale(Double.parseDouble(item.substring(0, item.indexOf('%'))));
}
-
/**
- * Setting the text of a JLabel is not thread save, it
- * needs to be done in the EventThread. Here we make sure
- * it is done.
+ * Sets message to be shown in the status bar in a thread safe way.
*/
- public void progress(String message) {
- SwingUtilities.invokeLater(new showProgress(message, false));
+ public void setStatus(String message) {
+ SwingUtilities.invokeLater(new ShowStatus(message));
}
-
/**
- * This class is used to show status and error messages in
- * a thread safe way.
+ * This class is used to show status in a thread safe way.
*/
- class showProgress implements Runnable {
-
+ private class ShowStatus implements Runnable {
/**
* The message to display
*/
- Object message;
-
- /**
- * Is this an errorMessage, i.e. should it be shown in
- * an JOptionPane or in the status bar.
- */
- boolean isErrorMessage = false;
-
+ String message;
/**
- * Constructs showProgress thread
+ * Constructs ShowStatus thread
* @param message message to display
- * @param isErrorMessage show in status bar or in JOptionPane
*/
- public showProgress(Object message, boolean isErrorMessage) {
+ public ShowStatus(String message) {
this.message = message;
- this.isErrorMessage = isErrorMessage;
}
-
public void run() {
- if (isErrorMessage) {
- JOptionPane.showMessageDialog(null, message, "Error",
- JOptionPane.ERROR_MESSAGE);
- } else
- processStatus.setText(message.toString());
+ processStatus.setText(message.toString());
}
-
}
+ /**
+ * Starts rendering process and shows the current page.
+ */
public void showPage() {
- showPageImage viewer = new showPageImage();
-
+ ShowPageImage viewer = new ShowPageImage();
if (SwingUtilities.isEventDispatchThread()) {
viewer.run();
} else
* This class is used to update the page image
* in a thread safe way.
*/
- class showPageImage implements Runnable {
-
+ private class ShowPageImage implements Runnable {
/**
- * The run method that does the actuall updating
+ * The run method that does the actual updating
*/
public void run() {
- BufferedImage pageImage = null;
- Graphics graphics = null;
-
- //renderer.render(currentPage);
- pageImage = renderer.getLastRenderedPage();
+ //Rendering a page - to be done
+ /*
+ renderer.render(currentPage);
+ BufferedImage pageImage = renderer.getLastRenderedPage();
if (pageImage == null)
return;
- graphics = pageImage.getGraphics();
- graphics.setColor(Color.black);
- graphics.drawRect(0, 0, pageImage.getWidth() - 1,
- pageImage.getHeight() - 1);
-
- previewImageLabel.setIcon(new ImageIcon(pageImage));
-
+ pageLabel.setIcon(new ImageIcon(pageImage));
pageCount = renderer.getPageCount();
-
- statisticsStatus.setText(res.getString("Page") + " "
- + (currentPage + 1) + " "
- + res.getString("of") + " " + pageCount);
+ //Updates status bar
+ infoStatus.setText(translator.getString("Status.Page") + " "
+ + (currentPage + 1) + " "
+ + translator.getString("Status.of") + " " + pageCount);
+ */
}
-
}
-
/**
- * Called by logger if an error message or a
- * log message is received.
+ * Opens standard Swing error dialog box and reports given exception details.
*/
- public void processMessage() {
-/* String error = event.getMessage();
- String text = processStatus.getText();
- FontMetrics fmt =
- processStatus.getFontMetrics(processStatus.getFont());
- int width = processStatus.getWidth() - fmt.stringWidth("...");
- showProgress showIt;
-
- if (event.getMessageType() == event.LOG) {
- if (!text.endsWith("\n")) {
- text = text + error;
- while (fmt.stringWidth(text) > width) {
- text = text.substring(1);
- width = processStatus.getWidth() - fmt.stringWidth("...");
- }
- } else
- text = error;
- progress(text);
- } else {
- error = error.trim();
- if (error.equals(">")) {
- text = text + error;
- while (fmt.stringWidth(text) > width) {
- text = text.substring(1);
- width = processStatus.getWidth() - fmt.stringWidth("...");
- }
- progress(processStatus.getText() + error);
- return;
- }
- if (error.equals(""))
- return;
- if (error.length() < 60) {
- showIt = new showProgress(error, true);
- } else {
- StringTokenizer tok = new StringTokenizer(error, " ");
- ArrayList labels = new ArrayList();
- StringBuffer buffer = new StringBuffer();
- String tmp, list[];
-
- while (tok.hasMoreTokens()) {
- tmp = tok.nextToken();
- if ((buffer.length() + tmp.length() + 1) < 60) {
- buffer.append(" ").append(tmp);
- } else {
- labels.add(buffer.toString());
- buffer = new StringBuffer();
- buffer.append(tmp);
- }
- }
- labels.add(buffer.toString());
- list = new String[labels.size()];
- for (int i = 0; i < labels.size(); i++) {
- list[i] = labels.get(i).toString();
- }
- showIt = new showProgress(list, true);
- }
- if (SwingUtilities.isEventDispatchThread()) {
- showIt.run();
- } else {
- try {
- SwingUtilities.invokeAndWait(showIt);
- } catch (Exception e) {
- e.printStackTrace();
- progress(event.getMessage());
- }
- }
- }*/
+ public void reportException(Exception e) {
+ String msg = translator.getString("Exception.Occured");
+ setStatus(msg);
+ JOptionPane.showMessageDialog(
+ getContentPane(),
+ "<html><b>" + msg + ":</b><br>"
+ + e.getClass().getName() + "<br>" + e.getMessage() + "</html>", translator.getString("Exception.Error"),
+ JOptionPane.ERROR_MESSAGE
+ );
}
-
-} // class PreviewDialog
+}
package org.apache.fop.viewer;
-/*
- * originally contributed by
- * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
- * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
- * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
- */
-
-
+//Java
import java.awt.*;
-import java.awt.event.*;
import javax.swing.*;
-import javax.swing.border.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowEvent;
+import java.awt.event.ActionEvent;
+//FOP
import org.apache.fop.apps.Version;
-
-
+/**
+ * AWT Viewer's "About" dialog.
+ * Originally contributed by:
+ * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
+ * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
+ * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
+ */
public class PreviewDialogAboutBox extends Dialog implements ActionListener {
+ private JButton okButton;
- JPanel panel1 = new JPanel();
- JPanel panel2 = new JPanel();
- JPanel insetsPanel1 = new JPanel();
- JPanel insetsPanel2 = new JPanel();
- JPanel insetsPanel3 = new JPanel();
- JButton button1 = new JButton();
- JLabel imageControl1 = new JLabel();
- ImageIcon imageIcon;
- JLabel label1 = new JLabel();
- JLabel label2 = new JLabel();
- JLabel label3 = new JLabel();
- JLabel label4 = new JLabel();
- BorderLayout borderLayout1 = new BorderLayout();
- BorderLayout borderLayout2 = new BorderLayout();
- FlowLayout flowLayout1 = new FlowLayout();
- FlowLayout flowLayout2 = new FlowLayout();
- GridLayout gridLayout1 = new GridLayout();
- String product = "FOP AWT-Preview";
- String version = "Version: " + Version.getVersion();
- String copyright = "See xml.apache.org";
- String comments = ""; // "Print Preview";
-
- public PreviewDialogAboutBox(Frame parent) {
- super(parent);
+ /**
+ * Creates modal "About" dialog, attached to a given parent frame.
+ */
+ public PreviewDialogAboutBox(Frame parent, Translator translator) {
+ super(parent, true);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
-
- // imageIcon = new ImageIcon(getClass().getResource("Hier der Grafikname"));
- this.setTitle("Info");
+ setTitle(translator.getString("About.Title"));
setResizable(false);
- panel1.setLayout(borderLayout1);
- panel2.setLayout(borderLayout2);
- insetsPanel1.setLayout(flowLayout1);
- insetsPanel2.setLayout(flowLayout1);
+ JPanel panel1 = new JPanel();
+ JPanel panel2 = new JPanel();
+ JPanel insetsPanel1 = new JPanel();
+ JPanel insetsPanel2 = new JPanel();
+ JPanel insetsPanel3 = new JPanel();
+ okButton = new JButton();
+ JLabel imageControl1 = new JLabel();
+ imageControl1.setIcon(new ImageIcon(getClass().getResource("Images/fop.gif")));
+ JLabel label1 = new JLabel(translator.getString("About.Product"));
+ JLabel label2 = new JLabel(translator.getString("About.Version") + " " + Version.getVersion());
+ JLabel label3 = new JLabel(translator.getString("About.Copyright"));
+ panel1.setLayout(new BorderLayout());
+ panel2.setLayout(new BorderLayout());
+ insetsPanel1.setLayout(new FlowLayout());
+ insetsPanel2.setLayout(new FlowLayout());
insetsPanel2.setBorder(new EmptyBorder(10, 10, 10, 10));
- gridLayout1.setRows(4);
- gridLayout1.setColumns(1);
- label1.setText(product);
- label2.setText(version);
- label3.setText(copyright);
- label4.setText(comments);
- insetsPanel3.setLayout(gridLayout1);
- insetsPanel3.setBorder(new EmptyBorder(10, 60, 10, 10));
- button1.setText("OK");
- button1.addActionListener(this);
+ insetsPanel3.setLayout(new GridLayout(3, 1));
+ insetsPanel3.setBorder(new EmptyBorder(10, 10, 10, 10));
+ okButton.setText(translator.getString("Button.Ok"));
+ okButton.addActionListener(this);
insetsPanel2.add(imageControl1, null);
panel2.add(insetsPanel2, BorderLayout.WEST);
- this.add(panel1, null);
- insetsPanel3.add(label1, null);
- insetsPanel3.add(label2, null);
- insetsPanel3.add(label3, null);
- insetsPanel3.add(label4, null);
+ insetsPanel3.add(label1);
+ insetsPanel3.add(label2);
+ insetsPanel3.add(label3);
panel2.add(insetsPanel3, BorderLayout.CENTER);
- insetsPanel1.add(button1, null);
+ insetsPanel1.add(okButton);
panel1.add(insetsPanel1, BorderLayout.SOUTH);
panel1.add(panel2, BorderLayout.NORTH);
+ add(panel1);
pack();
}
}
public void actionPerformed(ActionEvent e) {
- if (e.getSource() == button1) {
+ if (e.getSource() == okButton) {
cancel();
}
}
-
}
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.viewer;
-
-/*
- * originally contributed by
- * Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
- * Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
- * Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
- */
-
-
-public interface ProgressListener {
- public void progress(int percentage);
- public void progress(String message);
- public void progress(int percentage, String message);
-}
-
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.viewer;
-
-import java.util.*;
-import java.io.*;
-
-
-/**
- * Die Klasse <code>SecureResourceBundle</code> ist ein Resourceundle, das im Falle eines fehlenden
- * Eintrages keinen Absturz verursacht, sondern die Meldung
- * <strong>Key <i>key</i> not found</strong> zurückgibt.
- *
- * @author Stanislav.Gorkhover@jCatalog.com
- * @version 1.0 18.03.1999
- */
-public class SecureResourceBundle extends ResourceBundle
- implements Translator {
-
- // Fehlende keys mit einer Meldung zurückgeben.
- private boolean isMissingEmphasized = false;
-
- // private Properties lookup = new Properties();
- private LoadableProperties lookup = new LoadableProperties();
-
- private boolean isSourceFound = true;
-
- public void setMissingEmphasized(boolean flag) {
- isMissingEmphasized = flag;
- }
-
- /**
- * Kreiert ein ResourceBundle mit der Quelle in <strong>in</strong>.
- */
-
- public SecureResourceBundle(InputStream in) {
- try {
- lookup.load(in);
- } catch (Exception ex) {
- //log.error("Abgefangene Exception: " + ex.getMessage());
- isSourceFound = false;
- }
- }
-
- public Enumeration getKeys() {
- return lookup.keys();
- }
-
- /**
- * Händelt den abgefragten Key, liefert entweder den zugehörigen Wert oder eine Meldung.
- * Die <strong>null</strong> wird nie zurückgegeben.
- * Schreibt die fehlenden Suchschlüssel in die Protokoll-Datei.
- * @return <code>Object</code><UL>
- * <LI>den zu dem Suchschlüssel <strong>key</strong> gefundenen Wert, falls vorhanden, <br>
- * <LI>Meldung <strong>Key <i>key</i> not found</strong>, falls der Suchschlüssel fehlt
- * und die Eigenschaft "jCatalog.DevelopmentStartModus" in der ini-Datei aus true gesetzt ist.
- * <LI>Meldung <strong>Key is null</strong>, falls der Suchschlüssel <code>null</code> ist.
- * </UL>
- *
- */
- public Object handleGetObject(String key) {
-
- if (key == null)
- return "Key is null";
-
- Object obj = lookup.get(key);
- if (obj != null)
- return obj;
- else {
- if (isMissingEmphasized) {
- //log.debug(getClass().getName() + ": missing key: "
- // + key);
- return getMissedRepresentation(key.toString());
- } else
- return key.toString();
- }
- }
-
- /**
- * Stellt fest, ob es den Key gibt.
- */
- public boolean contains(String key) {
- return (key == null || lookup.get(key) == null) ? false : true;
- }
-
-
- private String getMissedRepresentation(String str) {
- return "<!" + str + "!>";
- }
-
- public boolean isSourceFound() {
- return isSourceFound;
- }
-}
-
* LICENSE file included with these sources.
*/
-package org.apache.fop.viewer;
+package org.apache.fop.viewer;
+//Java
+import java.util.ResourceBundle;
+import java.util.Locale;
+import java.util.MissingResourceException;
-/**
- * Definition für die Übersetzer-Klassen.
- *
- * @version 03.12.99
- * @author Stanislav.Gorkhover@jCatalog.com
- *
+/**
+ * AWT Viewer's localization class, backed up by <code>java.util.ResourceBundle</code>.
+ * Originally contributed by:
+ * Stanislav.Gorkhover@jCatalog.com
*/
-public interface Translator {
+public class Translator {
+ private ResourceBundle bundle;
+ private static String bundleBaseName = "org/apache/fop/viewer/resources/Viewer";
/**
- * Übersetzt ein Wort.
+ * Default constructor, default <code>Locale</code> is used.
*/
- public String getString(String key);
-
- /**
- * Ein Translator soll die fehlenden keys hervorheben können.
- */
- public void setMissingEmphasized(boolean b);
-
- /**
- * Gibt an ob die Übersetzungsquelle gefunden ist.
+ public Translator() {
+ this(Locale.getDefault());
+ }
+
+ /**
+ * Constructor for a given <code>Locale</code>.
*/
- public boolean isSourceFound();
+ public Translator(Locale locale) {
+ bundle = ResourceBundle.getBundle(bundleBaseName, locale);
+ }
/**
- * Gibt an ob ein Key in der Übersetzungsquelle vorhanden ist.
+ * Returns localized <code>String</code> for a given key.
*/
- public boolean contains(String key);
+ public String getString(String key) {
+ return bundle.getString(key);
+ }
}
+
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.viewer;
-
-import java.awt.*;
-import java.io.*;
-import java.awt.event.*;
-import java.util.*;
-import javax.swing.*;
-import javax.swing.JComponent.*;
-
-
-
-/**
- * Klasse <code>UserMessage</code> ist ein utility zum Abfragen oder zum Informieren des Benutzers.<br>
- * Eine Meldung besteht aus dem Identifikator (Suchschlüssel im Meldungspool), einem Dialogtitel, einem Buttonset und
- * dem Meldungstext mit eventuellen Platzhaltern für die Parameter.
- *
- * @author S. Gorkhover
- * @version 18.03.1999
- *
- * @changed 23.04.99 Juergen.Verwohlt@jCatalog.com
- * @subject Weitere Ausgabemethoden: show(String, String) und show(String,String,Frame)
- *
- * @changed 28.05.99 Juergen.Verwohlt@jCatalog.com
- * @subject MessageException unterstützen
- *
- * @changed 09.06.99 Juergen.Verwohlt@jCatalog.com
- * @subject Neue Klasse MessagesException zur Anzeige verwenden
- *
- * @changed 10.12.00 gears@apache.org
- * @subject Unicode
- */
-public class UserMessage {
-
- private static Translator res = null;
-
- public static void setTranslator(Translator aRes) {
- res = aRes;
- if (res == null) {
- //log.debug("UserMessage: setTranslator(null) !");
- res = new SecureResourceBundle(null);
- }
-
- MessagesDialog.setTranslator(res);
- }
-
-
- // Zulässige Werte für Dialogart:
-
- /**
- * Möglicher Wert des Meldungstypes. Fenster-Title "Info" (de).
- */
- private static final int INFO = JOptionPane.PLAIN_MESSAGE;
-
- /**
- * Möglicher Wert des Meldungstypes. Fenster-Title "Warnung" (de).
- */
- private static final int WARNING = JOptionPane.WARNING_MESSAGE;
-
- /**
- * Möglicher Wert des Meldungstypes. Fenster-Title "Frage" (de).
- */
- private static final int QUESTION = JOptionPane.QUESTION_MESSAGE;
-
- /**
- * Möglicher Wert des Meldungstypes. Fenster-Title "Fehler" (de).
- */
- private static final int ERROR = JOptionPane.ERROR_MESSAGE;
-
- /**
- * Möglicher Wert des Meldungstypes. Fenster-Title "Systemfehler" (de).
- */
- private static final int SYS_ERROR = JOptionPane.ERROR_MESSAGE;
-
-
-
- /*
- * Style Constanten orientieren sich auf die
- * Constanten der ButtonDialog-Klasse und legen das Dialog-ButtonSet fest.
- */
-
- /**
- * Wert für Setzten keines Buttons
- */
- public static final int STYLE_NOBUTTON = -2;
-
- /**
- * Wert für Setzten von nur Ja-Button.
- */
- public 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;
- // 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;
- // ButtonDialog.YES_NO_CANCEL; // = 3;
-
-
- // Platzhalter für Parameter in der Properties-Datei
- private static final String PARAMETER_TAG = "&&&";
-
-
- /**
- * Benutzer-Antwort-Constanten orientieren sich auf die
- * 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 int buttonType = STYLE_Y;
- private static int iconType = WARNING;
- private static String currentIconName = "";
- private static String actMessId = null;
- // private static MessagesDialog nobuttonDialog = null;
-
-
- /**
- * Ersetzt die eventuellen Platzhalter durch die übergebenen Parameter
- */
- static String prepareMessage(String rawText, String[] par) {
- //log.debug("prepareMessage(): " + rawText + ", parameter: "
- // + par);
- int index = rawText.indexOf(PARAMETER_TAG);
- String composedMess = "";
- if ((index == -1) && (par == null))
- return rawText;
- if ((index != -1) && (par == null)) {
- //log.debug("Message " + actMessId
- // + " erwartet Parameter. Aufgerufen ohne Parameter");
- return rawText;
- }
- if ((index == -1) && (par != null)) {
- //log.debug("Message " + actMessId
- // + " erwartet keine Parameter. Aufgerufen mit folgenden Parametern:");
- for (int i = 0; i < par.length; ++i) {
- //log.debug(par[i].toString());
- }
- return rawText;
- }
- int tagCount = 0;
- while (rawText.indexOf(PARAMETER_TAG) != -1) {
- index = rawText.indexOf(PARAMETER_TAG);
- try {
- composedMess += rawText.substring(0, index) + par[tagCount];
- } catch (ArrayIndexOutOfBoundsException ex) {
- //log.error("Anzahl der übergebenen Parameter zu der Meldung "
- // + actMessId
- // + " ist weniger als erwartet.", ex);
- return composedMess + rawText;
- }
- rawText = rawText.substring(index + PARAMETER_TAG.length());
- tagCount++;
- }
- composedMess += rawText;
- if (tagCount != par.length) {
- //log.debug("Die zu der Meldung " + actMessId
- // + " übergebenen Parameter sind mehr als die Meldung vorsieht.");
- }
- return composedMess;
- }
-
- /**
- * Gibt den Title fürs Dialogfenster.
- * Dieser wird durch die Dialogart festgelegt
- * (erster Teil in der MeldungsDefinition in der Properties-Datei).
- */
- static String getTitle(String strVal) {
- String title = null;
- int choice = getValue(strVal);
- switch (choice) {
- case INFO:
- title = "Info";
- currentIconName = "info.gif";
- break;
- case WARNING:
- title = "Warning";
- currentIconName = "warn.gif";
- break;
- case QUESTION:
- title = "Question";
- currentIconName = "quest.gif";
- break;
- case ERROR:
- title = "Error";
- currentIconName = "error.gif";
- break;
- default:
- title =
- "Ungültiger IonType für diese Meldung. Prüfen in Übersetzungsdatei.";
- }
- return title;
- }
-
- /**
- * Liefert den Wert der über den Nemen übergebenen Klassenvariablen.
- */
- static int getValue(String fieldName) {
-
- int val = -1;
- if (fieldName.equals("INFO"))
- return INFO;
- else if (fieldName.equals("WARNING"))
- return WARNING;
- else if (fieldName.equals("ERROR"))
- return ERROR;
- else if (fieldName.equals("SYS_ERROR"))
- return SYS_ERROR;
- else if (fieldName.equals("QUESTION"))
- return QUESTION;
- else if (fieldName.equals("STYLE_NOBUTTON"))
- return STYLE_NOBUTTON;
- else if (fieldName.equals("STYLE_Y"))
- return STYLE_Y;
- else if (fieldName.equals("STYLE_Y_N"))
- return STYLE_Y_N;
- else if (fieldName.equals("STYLE_Y_N_C"))
- return STYLE_Y_N_C;
- return val;
- }
-
- private static String getStackTrace(Exception exception) {
-
- if (exception == null)
- return "null";
-
- String stack = "";
-
- StringWriter strWriter = new StringWriter();
- exception.printStackTrace(new PrintWriter(strWriter));
- stack = strWriter.toString();
- stack = stack.replace('\r', ' ');
- stack = stack.replace('\t', ' ');
- return stack;
- }
-
- private static int display(String textID, String[] param,
- Exception exception, Frame frame) {
-
- String translatedMes = "";
- String preparedMes = "";
- String messageType = "";
- String optionType = "";
- String title = "";
- MessagesDialog dialog = null;
- actMessId = textID;
-
- boolean messageFound = res.contains(textID);
- translatedMes = res.getString(textID);
-
- if (messageFound) {
- try {
- messageType =
- translatedMes.substring(0, translatedMes.indexOf(':'));
- translatedMes =
- translatedMes.substring(translatedMes.indexOf(':') + 1);
-
- optionType =
- translatedMes.substring(0, translatedMes.indexOf(':'));
- translatedMes =
- translatedMes.substring(translatedMes.indexOf(':') + 1);
-
- } catch (Exception ex) {
- //log.debug("FALSCHES FORMAT: MESSAGE: " + textID);
- }
- } else { // Message not found
- //log.debug("UserMessage: textID '" + textID
- // + "' not found. Return "
- // + "value 'CANCEL' = " + CANCEL);
-
- // return CANCEL;
-
- messageType = "ERROR";
- optionType = "STYLE_Y";
- translatedMes = "textID '" + textID + "' not found."
- + "\nIt is possible the message file not found.";
- }
-
- preparedMes = prepareMessage(translatedMes, param);
- // Exception exception = getException(param);
-
- // WARNING -> nach Warnung übersetzen
- title = res.getString(getTitle(messageType));
-
- // WARNING -> JOptionPane.WARNING_MESSAGE
- int messageTypeIndex = getValue(messageType);
-
- // Button Set idetifizieren
- int optionTypeIndex = getValue(optionType);
-
- int result = CANCEL;
-
- if (exception != null) {
- String str = getStackTrace(exception);
- if (exception instanceof MessageException) {
- MessageException ex = (MessageException)exception;
- if (ex.getException() != null)
- str += "\n" + getStackTrace(ex.getException());
- }
- result = MessagesDialog.showDetailDialog(null, preparedMes,
- title, optionTypeIndex,
- messageTypeIndex, null,
- str);
- } else {
- if (optionTypeIndex == STYLE_NOBUTTON) {
- // Wird nicht mehr unterstützt
- //log.debug("UserMessage: STYLE_NOBUTTON wird nicht unterstützt");
- return result;
- } else {
- result = MessagesDialog.showConfirmDialog(null, preparedMes,
- title,
- optionTypeIndex,
- messageTypeIndex);
- }
- }
- return result;
- }
-
- /**
- * Öffnet das Dialogfenster mit der Übersetzung der per Suchschlüssel übergebenen Meldung
- * mit eingesetzten Parametern. Für die Übersetzung der Parameter trägt die aufrufende Stelle die Sorge.
- * Der Dialog ist modal zum Frame <code>frame</code>.
- * @param <UL>
- * <LI> textID - Suchschlüssel der Meldung im Meldungspool,
- * <LI> param - Array der in die Meldung einzusetztenden Parameter,
- * <LI> frame - das Fenster, zu dem der Dialog modal ist.
- * </UL>
- * @return <UL>
- * <LI> -1 wenn keine Rückgabe möglich ist oder Dialog NICHT MODAL ist.
- * <LI> ButtonDialog.YES = 2
- * <LI> ButtonDialog.NO = 4
- * <LI> ButtonDialog.CANCEL = 8
- * <LI> Wird das Dialog-Fenster ohne Buttonklick geschlossen (Kreuzchen oben rechts), so ist die Rückgabe gleich ButtonDialog.CANCEL.
- * </UL>
- */
- public static int show(String messageId, String[] parameterList,
- Exception anException, Frame parentFrame) {
- return display(messageId, parameterList, anException, parentFrame);
- }
-
- public static int show(String messageId, String[] parameterList,
- Exception anException) {
- return display(messageId, parameterList, anException, (Frame)null);
- }
-
- public static int show(String messageId, String[] parameterList,
- Frame parentFrame) {
- return display(messageId, parameterList, (Exception)null,
- parentFrame);
- }
-
- public static int show(String messageId, String[] parameterList) {
- return display(messageId, parameterList, (Exception)null,
- (Frame)null);
- }
-
- public static int show(String messageId, String parameter,
- Frame parentFrame) {
- return display(messageId, new String[] {
- parameter
- }, (Exception)null, parentFrame);
- }
-
- public static int show(String messageId, String parameter) {
- return display(messageId, new String[] {
- parameter
- }, (Exception)null, (Frame)null);
- }
-
- public static int show(String messageId, Frame parentFrame) {
- return display(messageId, (String[])null, (Exception)null,
- parentFrame);
- }
-
- public static int show(String messageId) {
- return display(messageId, (String[])null, (Exception)null,
- (Frame)null);
- }
-
- public static int show(String messageId, Exception anException,
- Frame aFrame) {
- return display(messageId, (String[])null, anException, aFrame);
- }
-
- public static int show(String messageId, Exception anException) {
- return display(messageId, (String[])null, anException, (Frame)null);
- }
-
- public static int show(Exception anException, Frame aFrame) {
- if (anException instanceof MessageException) {
- MessageException ex = (MessageException)anException;
- return show(ex.getMessageId(), ex.getParameterList(), ex, aFrame);
- } else
- return show("UNHANDLED_EXCEPTION", (String[])null, anException,
- aFrame);
- }
-
-}
-
--- /dev/null
+#############################################################################
+# Copyright (C) The Apache Software Foundation. All rights reserved. #
+# ------------------------------------------------------------------------- #
+# This software is published under the terms of the Apache Software License #
+# version 1.1, a copy of which has been included with this distribution in #
+# the LICENSE file. #
+#############################################################################
+#
+# AWT viewer's GUI resources. Default bundle.
+#
+Menu.File=File
+Menu.Exit=Exit
+Menu.View=View
+Menu.First.page=First page
+Menu.Prev.page=Previous page
+Menu.Next.page=Next page
+Menu.Last.page=Last page
+Menu.Go.to.Page=Go to Page
+Menu.Help=Help
+Menu.Default.zoom=Default zoom
+Menu.About=About
+Menu.Print=Print
+Menu.Zoom=Zoom
+Menu.Reload=Reload
+
+Title.Preview=Preview
+
+Status.Show=Show
+Status.Page=Page
+Status.of=of
+Status.Build.FO.tree=Build FO tree...
+
+Exception.Occured=An exception has occured
+Exception.Error=Fatal error
+
+Label.Page.number=Page number
+Button.Ok=Ok
+Button.Cancel=Cancel
+
+About.Product=FOP AWT Viewer
+About.Version=Version:
+About.Copyright=See http://xml.apache.org/fop
+About.Title=About
\ No newline at end of file
--- /dev/null
+#############################################################################
+# Copyright (C) The Apache Software Foundation. All rights reserved. #
+# ------------------------------------------------------------------------- #
+# This software is published under the terms of the Apache Software License #
+# version 1.1, a copy of which has been included with this distribution in #
+# the LICENSE file. #
+#############################################################################
+#
+# AWT viewer's GUI resources. Czech bundle.
+#
+Menu.File=Soubor
+Menu.Print=Tisk
+Menu.Exit=Konec
+Menu.View=Zobrazit
+Menu.First.page=Prvn\u00ed strana
+Menu.Prev.page=P\u0159edchoz\u00ed strana
+Menu.Next.page=Dal\u0161\u00ed strana
+Menu.Last.page=Posledn\u00ed strana
+Menu.Zoom=Lupa
+Menu.Default.zoom=Standardn\u00ed lupa
+Menu.Help=N\u00e1pov\u011bda
+Menu.About=O aplikaci
+Menu.Reload=Obnovit
+Menu.Go.to.Page=Jdi na stranu
+
+Title.Preview=N\u00e1hled
+
+Status.Show=Zobrazen\u00ed
+Status.Page=Strana
+Status.of=z
+Status.Build.FO.tree=Vytv\u00e1\u0159\u00edm strom FO...
+
+Label.Page.number=Strana \u010d\u00edslo
+Button.Cancel=Zru\u0161it
--- /dev/null
+#############################################################################
+# Copyright (C) The Apache Software Foundation. All rights reserved. #
+# ------------------------------------------------------------------------- #
+# This software is published under the terms of the Apache Software License #
+# version 1.1, a copy of which has been included with this distribution in #
+# the LICENSE file. #
+#############################################################################
+#
+# AWT viewer's GUI resources. German bundle.
+#
+Menu.File=Datei
+Menu.Exit=Beenden
+Menu.View=Anzeige
+Menu.First.page=Erste Seite
+Menu.Prev.page=Vorherige Seite
+Menu.Next.page=N\u00e4chste Seite
+Menu.Last.page=Letzte Seite
+Menu.Help=Hilfe
+Menu.Default.zoom=Standardzoom
+Menu.About=\u00dcber
+Menu.Print=Drucken
+Menu.Go.to.Page=Gehe zur Seite
+
+Title.Preview=Vorschau
+
+Status.Show=Anzeigen
+Status.Page=Seite
+Status.of=von
+Status.Build.FO.tree=Baue FO-Baum
+
+Button.Cancel=Abbrechen
+Label.Page.number=Seitennummer
\ No newline at end of file
--- /dev/null
+#############################################################################
+# Copyright (C) The Apache Software Foundation. All rights reserved. #
+# ------------------------------------------------------------------------- #
+# This software is published under the terms of the Apache Software License #
+# version 1.1, a copy of which has been included with this distribution in #
+# the LICENSE file. #
+#############################################################################
+#
+# AWT viewer's GUI resources. Finnish bundle.
+#
+Menu.File=Tiedosto
+Menu.Print=Tulosta
+Menu.Exit=Poistu
+Menu.View=N\u00e4yt\u00e4
+Menu.First.page=Ensimm\u00e4inen sivu
+Menu.Prev.page=Edellinen sivu
+Menu.Next.page=Seuraava sivu
+Menu.Last.page=Viimeinen sivu
+Menu.Default.zoom=Normaali zoom
+Menu.Help=Ohje
+Menu.About=Tietoja
+
+Status.Page=Sivu
--- /dev/null
+#############################################################################
+# Copyright (C) The Apache Software Foundation. All rights reserved. #
+# ------------------------------------------------------------------------- #
+# This software is published under the terms of the Apache Software License #
+# version 1.1, a copy of which has been included with this distribution in #
+# the LICENSE file. #
+#############################################################################
+#
+# AWT viewer's GUI resources. French bundle.
+#
+Menu.File=Fichier
+Menu.Print=Imprimer
+Menu.Exit=Quitter
+Menu.View=Affichage
+Menu.First.page=Premi\u00e8re page
+Menu.Prev.page=Page pr\u00e9c\u00e9dente
+Menu.Next.page=Page suivante
+Menu.Last.page=Derni\u00e8re page
+Menu.Help=Aide
+Menu.Default.zoom=Zoom par d\u00e9faut
+Menu.About=A propos
--- /dev/null
+#############################################################################
+# Copyright (C) The Apache Software Foundation. All rights reserved. #
+# ------------------------------------------------------------------------- #
+# This software is published under the terms of the Apache Software License #
+# version 1.1, a copy of which has been included with this distribution in #
+# the LICENSE file. #
+#############################################################################
+#
+# AWT viewer's GUI resources. Italian bundle.
+#
+Menu.File=File
+Menu.Exit=Esci
+Menu.View=Vista
+Menu.First.page=Prima pagina
+Menu.Prev.page=Pagina precedente
+Menu.Next.page=Pagina seguente
+Menu.Last.page=Ultima pagina
+Menu.Help=Aiuto
+Menu.Default.zoom=Zoom di default
+Menu.About=Riguardo a...
+Menu.Print=Stampa
--- /dev/null
+#############################################################################
+# Copyright (C) The Apache Software Foundation. All rights reserved. #
+# ------------------------------------------------------------------------- #
+# This software is published under the terms of the Apache Software License #
+# version 1.1, a copy of which has been included with this distribution in #
+# the LICENSE file. #
+#############################################################################
+#
+# AWT viewer's GUI resources. Japanese bundle.
+#
+Menu.File=\u30d5\u30a1\u30a4\u30eb
+Menu.Print=\u5370\u5237
+Menu.Exit=\u7d42\u4e86
+Menu.View=\u8868\u793a
+Menu.First.page=\u958b\u59cb\u30da\u30fc\u30b8
+Menu.Prev.page=\u524d\u30da\u30fc\u30b8
+Menu.Next.page=\u6b21\u30da\u30fc\u30b8
+Menu.Last.page=\u6700\u7d42\u30da\u30fc\u30b8
+Menu.Go.to.Page=\u30da\u30fc\u30b8\u6307\u5b9a
+Menu.Zoom=\u30ba\u30fc\u30e0
+Menu.Default.zoom=\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30ba\u30fc\u30e0
+Menu.Help=\u30d8\u30eb\u30d7
+Menu.About=\u30d0\u30fc\u30b8\u30e7\u30f3\u60c5\u5831
+
+Status.Page=\u30da\u30fc\u30b8
+Status.of=/
+Status.Build.FO.tree=FO\u30c4\u30ea\u30fc\u69cb\u7bc9\u4e2d
+Status.Show=\u5b8c\u4e86
--- /dev/null
+#############################################################################
+# Copyright (C) The Apache Software Foundation. All rights reserved. #
+# ------------------------------------------------------------------------- #
+# This software is published under the terms of the Apache Software License #
+# version 1.1, a copy of which has been included with this distribution in #
+# the LICENSE file. #
+#############################################################################
+#
+# AWT viewer's GUI resources. Polish bundle.
+#
+Menu.File=Plik
+Menu.Print=Drukuj
+Menu.Exit=Zako\u00f1cz
+Menu.View=Widok
+Menu.First.page=Pierwsza strona
+Menu.Prev.page=Poprzednia strona
+Menu.Next.page=Nast\u00eapna strona
+Menu.Last.page=Ostatnia strona
+Menu.Zoom=Powi\u00eakszenie
+Menu.Default.zoom=Domy\u00b6lne powiekszenie
+Menu.Help=Pomoc
+Menu.About=O programie
+
+Status.Page=Strona
--- /dev/null
+#############################################################################
+# Copyright (C) The Apache Software Foundation. All rights reserved. #
+# ------------------------------------------------------------------------- #
+# This software is published under the terms of the Apache Software License #
+# version 1.1, a copy of which has been included with this distribution in #
+# the LICENSE file. #
+#############################################################################
+#
+# AWT viewer's GUI resources. Russain bundle.
+#
+Menu.File=\u0424\u0430\u0439\u043b
+Menu.Exit=\u0412\u044b\u0445\u043e\u0434
+Menu.View=\u0412\u0438\u0434
+Menu.First.page=\u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430
+Menu.Prev.page=\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430
+Menu.Next.page=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430
+Menu.Last.page=\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430
+Menu.Go.to.Page=\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435
+Menu.Help=\u041f\u043e\u043c\u043e\u0449\u044c
+Menu.Default.zoom=\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440
+Menu.About=\u041e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0435
+Menu.Print=\u041f\u0435\u0447\u0430\u0442\u044c
+Menu.Zoom=\u0420\u0430\u0437\u043c\u0435\u0440
+Menu.Reload=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c
+
+Title.Preview=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440
+
+Status.Show=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435
+Status.Page=\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430
+Status.of=\u0438\u0437
+Status.Build.FO.tree=\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 FO \u0434\u0435\u0440\u0435\u0432\u0430...
+
+Exception.Occured=\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430
+Exception.Error=\u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430
+
+Label.Page.number=\u041d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b
+Button.Ok=Ok
+Button.Cancel=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c
+
+About.Product=FOP AWT Viewer
+About.Version=\u0412\u0435\u0440\u0441\u0438\u044f:
+About.Copyright=\u0421\u043c\u043e\u0442\u0440\u0438 http://xml.apache.org/fop
+About.Title=\u041e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0435
+++ /dev/null
-###############################################################################
-#
-# In dieser Datei werden im Abschnitt "Messages" Meldungen auf deutsch
-# definiert.
-# Zu beachten: Beim Definieren einer neuen neuen Meldung, diese soweit möglich
-# in allen Sprachen anlegen.
-#
-#
-#
-# MELDUNG DEFINIEREN
-# ==================
-#
-# Eine Meldung hat eine eindeutige textuelle ID. Diese steht links vom Gleichheitszeichen.
-# Zu jeder Meldung wird angegeben:
-# - iconType (Typen siehe unten)
-# - buttonType (Typen siehe unten)
-# - Meldungstext mit evtl. Platzhaltern für Parameter.
-#
-# Ein Parameterplatzhalter ist ein dreifaches kaumänisches "und". Siehe Beispielmeldung
-# "No_Records_found".
-#
-# Die Angaben erfolgen in einer Zeile, jeweils durch einen Doppelpunkt getrennt.
-#
-# Format:
-# <MESSAGE_ID>=<iconType>:<buttonType>:<Meldungstext>
-#
-# Zulässige Werte für:
-# iconType:
-# INFO
-# WARNING
-# ERROR
-# QUESTION
-#
-# buttonType:
-# STYLE_Y ("yes" Button)
-# STYLE_Y_N ("yes" and "no" Buttons)
-# STYLE_Y_N_C ("yes", "no" and "cancel" Buttons)
-#
-#
-# Beispiel mit einem String-Array:
-# ================================
-# Messagedefinition:
-# No_Records_found=WARNING:STYLE_Y:Die Tabelle &&& enthält keinen Eintrag. Erwartet mind. &&&. Weitermachen?
-# Aufruf:
-# answer = UserMessage.show("No_Records_found", new String[] {"Mitarbeiter", "" + minNumber}, aShowFrame);
-# if (answer == UserMessage.NO)
-# return;
-#
-# Beispiel mit einer Exception:
-# =============================
-# Messagedefinition:
-# UNEXPECTED_EXCEPTION=ERROR:STYLE_Y:Wow! An exception!
-#
-# Aufruf:
-# try {
-# String str = null;
-# int index = str.indexOf("abc");
-# } catch (Exception ex) {
-# UserMessage.show("UNEXPECTED_EXCEPTION", ex);
-# }
-#
-#
-#
-#
-#################################################################################################
-
-
-# Titles
-Info=Info
-Warning=Warnung
-Question=Frage
-Error=Fehler
-
-# Messages
-TRANSLATION_SOURCE_NOT_FOUND=WARNING:STYLE_Y:Die Übersetzungsdatei &&& ist nicht gefunden.
-UNKNOWN_EXCEPTION=ERROR:STYLE_Y:Unbekannter Fehler
-UNHANDLED_EXCEPTION=ERROR:STYLE_Y:Interner Fehler
-
+++ /dev/null
-###############################################################################
-#
-# This file contains the english messages.
-#
-# NOTICE: When defining a new message it has to be created in message files for each language.
-#
-#
-#
-#
-# DEFINING A MESSAGE
-# ==================
-#
-# A message has a uinique CHARACTER ID. It is placed on the left hand side of the equation.
-# For each message there are additional switches:
-# - iconType (see below)
-# - buttonType (see below)
-# - messageText may contain placeholders for parameters.
-
-# A placeholder pattern is a "&&&" . See Examplemessage "No_Records_found".
-#
-# A messsage definition is placed within a single row, its switches are seperated by a colon ":".
-#
-# Format:
-# =======
-# <MESSAGE_ID>=<iconType>:<buttonType>:<message text>
-#
-#
-# Allowed values for:
-# ===================
-# iconType:
-# INFO
-# WARNING
-# ERROR
-# QUESTION
-#
-# buttonType:
-# STYLE_Y ("yes" Button)
-# STYLE_Y_N ("yes" and "no" Buttons)
-# STYLE_Y_N_C ("yes", "no" and "cancel" Buttons)
-#
-#
-# Example with a parameter array:
-# ================================
-# Message definition:
-# No_Records_found=WARNING:STYLE_Y:The Table &&& has no records. Expected at least &&&. Continue?
-# Aufruf:
-# answer = UserMessage.show("No_Records_found", new String[] {"Employee", "" + minNumber}, aShowFrame);
-# if (answer == UserMessage.NO)
-# return;
-#
-# Example with an Exception:
-# =============================
-# Message definition:
-# UNEXPECTED_EXCEPTION=ERROR:STYLE_Y:Wow! An exception!
-#
-# Aufruf:
-# try {
-# String str = null;
-# int index = str.indexOf("abc");
-# } catch (Exception ex) {
-# UserMessage.show("UNEXPECTED_EXCEPTION", ex);
-# }
-#
-#
-#
-#
-#################################################################################################
-
-
-# Titles
-Info=Info
-Warning=Warning
-Question=Question
-Error=Error
-
-# Messages
-TRANSLATION_SOURCE_NOT_FOUND=WARNING:STYLE_Y:The translation file &&& is not found.
-UNKNOWN_EXCEPTION=ERROR:STYLE_Y:Unknown error.
-UNHANDLED_EXCEPTION=ERROR:STYLE_Y:Internal error.
-
+++ /dev/null
-File=Datei
-
-Exit=Beenden
-
-View=Anzeige
-
-Previous page=Vorherige Seite
-
-Next page=Nächste Seite
-
-Last page=Letzte Seite
-
-Help=Hilfe
-
-Default zoom=Standardzoom
-
-Introduction=Einleitung
-
-About=Über
-
-Show=Anzeigen
-
-Preview=Vorschau
-
-First page=Erste Seite
-
-Print=Drucken
-
-Page=Seite
-
-of=von
-
-Init parser=Initializiere Parser
-
-Init mappings=Initializiere Abbildung
-
-Build FO tree=Baue FO-Baum
-
-Layout FO tree=Formatiere FO-Baum
-
-Render=Gebe aus
-
-Close=Schließen
-
-Go to Page=Gehe zur Seite
+++ /dev/null
-# Diese Datei ist nur dafür da, daß die Warnung
-# "Übersetzungsdatei nicht gefunden" nicht hochkommt.
-# Die Suchschlüssel für die zu übersetzenden Begriffe sind
-# englisch. Daher wäre eine Übersetzung redundant.
+++ /dev/null
-File=Tiedosto
-Print=Tulosta
-Exit=Poistu
-View=Näytä
-First page=Ensimmäinen sivu
-Previous page=Edellinen sivu
-Next page=Seuraava sivu
-Last page=Viimeinen sivu
-Default zoom=Normaali zoom
-Help=Ohje
-Index=Sisällys
-Introduction=Esittely
-About=Tietoja
-Page=Sivu
-
-
+++ /dev/null
-File=Fichier
-Print=Imprimer
-Exit=Quitter
-View=Affichage
-First page=Première page
-Previous page=Page précédente
-Next page=Page suivante
-Last page=Dernière page
-Help=Aide
-Default zoom=Zoom par défaut
-Introduction=Introduction
-About=A propos
-
+++ /dev/null
-File=File
-Exit=Esci
-View=Vista
-First page=Prima pagina
-Previous page=Pagina precedente
-Next page=Pagina seguente
-Last page=Ultima pagina
-Help=Aiuto
-Default zoom=Zoom di default
-Introduction=Introduzione
-About=Riguardo a...
-Index=Indice
-Print=Stampa
-
+++ /dev/null
-File=Plik
-Print=Drukuj
-Exit=Zakoñcz
-View=Widok
-First page=Pierwsza strona
-Previous page=Poprzednia strona
-Next page=Nastêpna strona
-Last page=Ostatnia strona
-Zoom=Powiêkszenie
-Default zoom=Domy¶lne powiekszenie
-Help=Pomoc
-Index=Indeks
-Introduction=Wstêp
-About=O programie
-Page=Strona
-
-
+++ /dev/null
-File=Ôàéë
-
-Exit=Çàêîí÷èòü
-
-View=Âèä
-
-First page=Ïåðâàÿ ñòðàíèöà
-
-Previous page=Ïðåäûäóùàÿ ñòðàíèöà
-
-Next page=Ñëåäóþùàÿ ñòðàíèöà
-
-Last page=Ïîñëåäíÿÿ ñòðàíèöà
-
-Go to Page=Èäòè ê ñòðàíèöå
-
-Help=Ïîìîùü
-
-Default zoom=Ñòàíäàðòíûé ìàñøòàá
-
-Introduction=Ââåäåíèå
-
-About=Î ïðîãðàììå
-
-Show=Ïîêàç
-
-Preview=Ïðîñìîòð
-
-Print=Ïå÷àòàòü
-
-Page=Ñòðàíèöà
-
-of=èç
-
-Zoom=Ìàñøòàá
-
-Close=Çàêðûòü
-