You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2003/03/07 11:09:58 UTC
cvs commit: xml-fop/src/org/apache/fop/viewer PreviewDialog.java PreviewDialogAboutBox.java Translator.java Command.java GoToPageDialog.java
jeremias 2003/03/07 02:09:58
Modified: src/org/apache/fop/viewer PreviewDialog.java
PreviewDialogAboutBox.java Translator.java
Command.java GoToPageDialog.java
Log:
Switched to long licence
Some general checkstyle fixing
Revision Changes Path
1.14 +107 -29 xml-fop/src/org/apache/fop/viewer/PreviewDialog.java
Index: PreviewDialog.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/viewer/PreviewDialog.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- PreviewDialog.java 29 Nov 2002 23:18:58 -0000 1.13
+++ PreviewDialog.java 7 Mar 2003 10:09:58 -0000 1.14
@@ -1,20 +1,80 @@
/*
* $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.
- */
-
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jt...@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */
package org.apache.fop.viewer;
//Java
-import java.awt.*;
-import javax.swing.*;
+import javax.swing.BorderFactory;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JToolBar;
+import javax.swing.SwingUtilities;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Toolkit;
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;
//FOP
import org.apache.fop.apps.AWTStarter;
@@ -29,8 +89,12 @@
* Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
*/
public class PreviewDialog extends JFrame {
+
+ /** The Translator for localization */
protected Translator translator;
+ /** The AWT renderer */
protected AWTRenderer renderer;
+ /** The AWT starter */
protected AWTStarter starter;
private int currentPage = 0;
@@ -102,7 +166,7 @@
//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);
+ setSize(screen.width * 61 / 100, screen.height * 9 / 10);
//Page view stuff
pageLabel = new JLabel();
@@ -123,7 +187,7 @@
scale.setPreferredSize(new Dimension(80, 24));
scale.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- scale_actionPerformed(e);
+ scaleActionPerformed(e);
}
});
scale.setSelectedItem("100%");
@@ -150,10 +214,12 @@
JPanel statusBar = new JPanel();
processStatus = new JLabel();
processStatus.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(0,3,0,0)));
+ BorderFactory.createEtchedBorder(),
+ BorderFactory.createEmptyBorder(0, 3, 0, 0)));
infoStatus = new JLabel();
infoStatus.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(0,3,0,0)));
+ BorderFactory.createEtchedBorder(),
+ BorderFactory.createEmptyBorder(0, 3, 0, 0)));
statusBar.setLayout(new GridBagLayout());
@@ -305,8 +371,9 @@
* Shows the previous page.
*/
private void goToPreviousPage() {
- if (currentPage <= 0)
+ if (currentPage <= 0) {
return;
+ }
currentPage--;
goToPage(currentPage);
}
@@ -316,8 +383,9 @@
* Shows the next page.
*/
private void goToNextPage() {
- if (currentPage >= pageCount - 1)
+ if (currentPage >= pageCount - 1) {
return;
+ }
currentPage++;
goToPage(currentPage);
}
@@ -326,8 +394,9 @@
* Shows the last page.
*/
private void goToLastPage() {
- if (currentPage == pageCount - 1)
+ if (currentPage == pageCount - 1) {
return;
+ }
currentPage = pageCount - 1;
goToPage(currentPage);
}
@@ -372,8 +441,9 @@
(int)getLocation().getY() + 50);
d.setVisible(true);
currentPage = d.getPageNumber();
- if (currentPage < 1 || currentPage > pageCount)
+ if (currentPage < 1 || currentPage > pageCount) {
return;
+ }
currentPage--;
goToPage(currentPage);
}
@@ -382,8 +452,9 @@
* Shows the first page.
*/
private void goToFirstPage() {
- if (currentPage == 0)
+ if (currentPage == 0) {
return;
+ }
currentPage = 0;
goToPage(currentPage);
}
@@ -407,29 +478,31 @@
* Scales page image
*/
private void setScale(double scaleFactor) {
- if (scaleFactor == 25.0)
+ if (scaleFactor == 25.0) {
scale.setSelectedIndex(0);
- else if (scaleFactor == 50.0)
+ } else if (scaleFactor == 50.0) {
scale.setSelectedIndex(1);
- else if (scaleFactor == 75.0)
+ } else if (scaleFactor == 75.0) {
scale.setSelectedIndex(2);
- else if (scaleFactor == 100.0)
+ } else if (scaleFactor == 100.0) {
scale.setSelectedIndex(3);
- else if (scaleFactor == 150.0)
+ } else if (scaleFactor == 150.0) {
scale.setSelectedIndex(4);
- else if (scaleFactor == 200.0)
+ } else if (scaleFactor == 200.0) {
scale.setSelectedIndex(5);
+ }
renderer.setScaleFactor(scaleFactor);
showPage();
}
- private void scale_actionPerformed(ActionEvent e) {
+ private void scaleActionPerformed(ActionEvent e) {
String item = (String)scale.getSelectedItem();
setScale(Double.parseDouble(item.substring(0, item.indexOf('%'))));
}
/**
* Sets message to be shown in the status bar in a thread safe way.
+ * @param message the message
*/
public void setStatus(String message) {
SwingUtilities.invokeLater(new ShowStatus(message));
@@ -442,7 +515,7 @@
/**
* The message to display
*/
- String message;
+ private String message;
/**
* Constructs ShowStatus thread
* @param message message to display
@@ -450,6 +523,7 @@
public ShowStatus(String message) {
this.message = message;
}
+
public void run() {
processStatus.setText(message.toString());
}
@@ -462,8 +536,9 @@
ShowPageImage viewer = new ShowPageImage();
if (SwingUtilities.isEventDispatchThread()) {
viewer.run();
- } else
+ } else {
SwingUtilities.invokeLater(viewer);
+ }
}
@@ -494,6 +569,7 @@
/**
* Opens standard Swing error dialog box and reports given exception details.
+ * @param e the Exception
*/
public void reportException(Exception e) {
String msg = translator.getString("Exception.Occured");
@@ -501,8 +577,10 @@
JOptionPane.showMessageDialog(
getContentPane(),
"<html><b>" + msg + ":</b><br>"
- + e.getClass().getName() + "<br>" + e.getMessage() + "</html>", translator.getString("Exception.Error"),
- JOptionPane.ERROR_MESSAGE
+ + e.getClass().getName() + "<br>"
+ + e.getMessage() + "</html>",
+ translator.getString("Exception.Error"),
+ JOptionPane.ERROR_MESSAGE
);
}
}
1.5 +71 -10 xml-fop/src/org/apache/fop/viewer/PreviewDialogAboutBox.java
Index: PreviewDialogAboutBox.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/viewer/PreviewDialogAboutBox.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PreviewDialogAboutBox.java 6 Nov 2002 14:30:15 -0000 1.4
+++ PreviewDialogAboutBox.java 7 Mar 2003 10:09:58 -0000 1.5
@@ -1,15 +1,67 @@
/*
* $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.
- */
-
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jt...@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */
package org.apache.fop.viewer;
//Java
-import java.awt.*;
-import javax.swing.*;
+import java.awt.AWTEvent;
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridLayout;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
@@ -30,6 +82,8 @@
/**
* Creates modal "About" dialog, attached to a given parent frame.
+ * @param parent parent frame
+ * @param translator Translator for localization
*/
public PreviewDialogAboutBox(Frame parent, Translator translator) {
super(parent, true);
@@ -45,7 +99,8 @@
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 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());
@@ -69,6 +124,9 @@
pack();
}
+ /**
+ * @see java.awt.Window#processWindowEvent(WindowEvent)
+ */
protected void processWindowEvent(WindowEvent e) {
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
cancel();
@@ -76,10 +134,13 @@
super.processWindowEvent(e);
}
- void cancel() {
+ private void cancel() {
dispose();
}
+ /**
+ * @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
+ */
public void actionPerformed(ActionEvent e) {
if (e.getSource() == okButton) {
cancel();
1.6 +53 -7 xml-fop/src/org/apache/fop/viewer/Translator.java
Index: Translator.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/viewer/Translator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Translator.java 29 Nov 2002 23:18:59 -0000 1.5
+++ Translator.java 7 Mar 2003 10:09:58 -0000 1.6
@@ -1,16 +1,58 @@
/*
* $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.
- */
-
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jt...@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */
package org.apache.fop.viewer;
//Java
import java.util.ResourceBundle;
import java.util.Locale;
-import java.util.MissingResourceException;
/**
* AWT Viewer's localization class, backed up by <code>java.util.ResourceBundle</code>.
@@ -18,6 +60,7 @@
* Stanislav.Gorkhover@jCatalog.com
*/
public class Translator {
+
private ResourceBundle bundle;
private static String bundleBaseName = "org/apache/fop/viewer/resources/Viewer";
@@ -30,6 +73,7 @@
/**
* Constructor for a given <code>Locale</code>.
+ * @param locale Locale to use
*/
public Translator(Locale locale) {
bundle = ResourceBundle.getBundle(bundleBaseName, locale);
@@ -37,6 +81,8 @@
/**
* Returns localized <code>String</code> for a given key.
+ * @param key the key
+ * @return the localized String
*/
public String getString(String key) {
return bundle.getString(key);
1.9 +56 -7 xml-fop/src/org/apache/fop/viewer/Command.java
Index: Command.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/viewer/Command.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Command.java 6 Nov 2002 14:30:15 -0000 1.8
+++ Command.java 7 Mar 2003 10:09:58 -0000 1.9
@@ -1,10 +1,53 @@
/*
* $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.
- */
-
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jt...@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */
package org.apache.fop.viewer;
//Java
@@ -27,11 +70,12 @@
*/
public class Command extends AbstractAction {
- private static String IMAGE_DIR = "Images/";
+ private static final 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.
+ * @param name of the command
*/
public Command(String name) {
super(name);
@@ -41,6 +85,8 @@
/**
* Creates <code>Command</code> object with a given name, the same
* tooltip text and icon image if appropriate image file is found.
+ * @param name name of the command
+ * @param iconName name of the icon
*/
public Command(String name, String iconName) {
super(name);
@@ -51,6 +97,9 @@
}
}
+ /**
+ * @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
+ */
public void actionPerformed(ActionEvent e) {
doit();
}
1.6 +70 -12 xml-fop/src/org/apache/fop/viewer/GoToPageDialog.java
Index: GoToPageDialog.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/viewer/GoToPageDialog.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GoToPageDialog.java 29 Nov 2002 23:18:58 -0000 1.5
+++ GoToPageDialog.java 7 Mar 2003 10:09:58 -0000 1.6
@@ -1,14 +1,67 @@
/*
* $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.
- */
-
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jt...@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */
package org.apache.fop.viewer;
-import java.awt.*;
-import javax.swing.*;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -20,11 +73,15 @@
* Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
*/
public class GoToPageDialog extends JDialog {
+
private JTextField pgNbField;
private int pageNumber = -1;
/**
* Creates modal dialog with a given title, attached to a given frame.
+ * @param frame Frame to attach to
+ * @param title dialog title
+ * @param translator translator for localization
*/
public GoToPageDialog(Frame frame, String title, Translator translator) {
super(frame, title, true);
@@ -44,13 +101,13 @@
okButton.setText(translator.getString("Button.Ok"));
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- okButton_actionPerformed(e);
+ okButtonActionPerformed(e);
}
});
cancelButton.setText(translator.getString("Button.Cancel"));
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
- cancelButton_actionPerformed(e);
+ cancelButtonActionPerformed(e);
}
});
panel1.setMinimumSize(new Dimension(250, 78));
@@ -77,7 +134,7 @@
new Insets(0, 10, 10, 10), 0, 0));
}
- private void okButton_actionPerformed(ActionEvent e) {
+ private void okButtonActionPerformed(ActionEvent e) {
try {
pageNumber = Integer.parseInt(pgNbField.getText());
dispose();
@@ -87,13 +144,14 @@
}
- private void cancelButton_actionPerformed(ActionEvent e) {
+ private void cancelButtonActionPerformed(ActionEvent e) {
pageNumber = -1;
dispose();
}
/**
* Returns page number, entered by user.
+ * @return the page number
*/
public int getPageNumber() {
return pageNumber;
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org