Browse Source

Fix: various, by the AWT Viewer team


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193324 13f79535-47bb-0310-9956-ffa450edef68
tags/pre-columns
arved 24 years ago
parent
commit
3b1fe35125

+ 21
- 39
src/org/apache/fop/apps/AWTCommandLine.java View File

@@ -2,9 +2,9 @@
package org.apache.fop.apps;
/*
originally contributed by
Juergen Verwohlt: Juergen.Verwohlt@af-software.de,
Rainer Steinkuhle: Rainer.Steinkuhle@af-software.de,
Stanislav Gorkhover: Stanislav.Gorkhover@af-software.de
Juergen Verwohlt: Juergen.Verwohlt@jcatalog.com,
Rainer Steinkuhle: Rainer.Steinkuhle@jcatalog.com,
Stanislav Gorkhover: Stanislav.Gorkhover@jcatalog.com
*/


@@ -30,6 +30,7 @@ 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.*;

@@ -42,31 +43,23 @@ import java.util.*;
public class AWTCommandLine {


public static String DEFAULT_TRANSLATION_PATH
= "../viewer/resources/resources." +
System.getProperty("user.language");
public static String TRANSLATION_PATH = "/org/apache/fop/viewer/resources/";


private Translator resource;



public AWTCommandLine(String srcFile, String translationPath) {
public AWTCommandLine(String srcFile, String language) {

resource = getResourceBundle(translationPath);
if (language == null)
language = System.getProperty("user.language");

String messPath = new File(translationPath).getAbsoluteFile().getParent();
if (!messPath.endsWith(System.getProperty("file.separator")))
messPath += System.getProperty("file.separator");
messPath += "messages." + System.getProperty("user.language");
System.out.println("Set messages resource: " + messPath);
UserMessage.setTranslator(getResourceBundle(messPath));
resource = getResourceBundle(TRANSLATION_PATH + "resources." + language);

resource.setMissingEmphasized(false);
UserMessage.setTranslator(getResourceBundle(TRANSLATION_PATH + "messages." + language));

if (!resource.isSourceFound())
UserMessage.show("TRANSLATION_SOURCE_NOT_FOUND",
new File(translationPath).getAbsolutePath());
resource.setMissingEmphasized(false);

AWTRenderer renderer = new AWTRenderer(resource);
PreviewDialog frame = createPreviewDialog(renderer, resource);
@@ -105,7 +98,7 @@ public class AWTCommandLine {
// render: time
frame.progress(resource.getString("Render") + " ...");
driver.render();
frame.progress(resource.getString("Show"));

} catch (Exception e) {
@@ -187,17 +180,18 @@ public class AWTCommandLine {


private SecureResourceBundle getResourceBundle(String path) {
FileInputStream in = null;
InputStream in = null;

try {
in = new FileInputStream(path);
URL url = getClass().getResource(path);
in = url.openStream();
} catch(Exception ex) {
System.out.println("Abgefangene Exception: " + ex.getMessage());
System.out.println("Can't find URL to: <" + path + "> " + ex.getMessage());
}
return new SecureResourceBundle(in);
}



/* main
*/
public static void main(String[] args) {
@@ -208,34 +202,22 @@ public class AWTCommandLine {
}

String srcPath = null;
String translationFile = null;
String language = null;
String imageDir = null;

System.err.println(Version.getVersion());
if (args.length < 1 || args.length > 3) {
System.err.println("usage: java AWTCommandLine " +
"formatting-object-file [translation-file] " +
"[image-dir]");
"formatting-object-file [language] ");
System.exit(1);
}

srcPath = args[0];
if (args.length > 1) {
translationFile = args[1];
}
if (args.length > 2) {
imageDir = args[2];
if (!imageDir.endsWith(System.getProperty("file.separator")))
imageDir += System.getProperty("file.separator");
Command.IMAGE_DIR = imageDir;
language = args[1];
}

if (translationFile == null)
translationFile = DEFAULT_TRANSLATION_PATH;


new AWTCommandLine(srcPath, translationFile);
new AWTCommandLine(srcPath, language);

} // main
} // AWTCommandLine

+ 14
- 16
src/org/apache/fop/viewer/Command.java View File

@@ -1,15 +1,14 @@
package org.apache.fop.viewer;
/*
originally contributed by
Juergen Verwohlt: Juergen.Verwohlt@af-software.de,
Rainer Steinkuhle: Rainer.Steinkuhle@af-software.de,
Stanislav Gorkhover: Stanislav.Gorkhover@af-software.de
Juergen Verwohlt: Juergen.Verwohlt@jcatalog.com,
Rainer Steinkuhle: Rainer.Steinkuhle@jcatalog.com,
Stanislav Gorkhover: Stanislav.Gorkhover@jcatalog.com
*/

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import java.io.File;
import java.net.*;


/**
@@ -19,12 +18,12 @@ import java.io.File;
* 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@af-software.de
* @author Juergen.Verwohlt@jcatalog.com
* @version 1.0 18.03.99
*/
public class Command extends AbstractAction {

public static String IMAGE_DIR = "../viewer/images/";
public static String IMAGE_DIR = "/org/apache/fop/viewer/Images/";

public Command(String name) {
this(name, (ImageIcon)null);
@@ -35,18 +34,17 @@ public class Command extends AbstractAction {
}


public Command(String name, ImageIcon anIcon, String path) {
this(name, anIcon);
File f = new File (IMAGE_DIR + path + ".gif");
if (!f.exists()) {
System.err.println("Icon not found: " + f.getAbsolutePath());
public Command(String name, String iconName) {
super(name);
String path = IMAGE_DIR + iconName + ".gif";
URL url = getClass().getResource(path);
if (url == null) {
System.err.println("Icon not found: " + path);
}

else
putValue(SMALL_ICON, new ImageIcon(url));
}

public Command(String name, String iconName) {
this(name, new ImageIcon(IMAGE_DIR + iconName + ".gif"), iconName);
}

public void actionPerformed(ActionEvent e) {
doit();

+ 3
- 5
src/org/apache/fop/viewer/PreviewDialog.java View File

@@ -163,7 +163,9 @@ public class PreviewDialog extends JFrame implements ProgressListener {
// menu.addSeparator();
menu.add(new Command(res.getString("Print")) {public void doit(){print();}});
menu.addSeparator();
menu.add(new Command(res.getString("Exit")){ public void doit() {dispose();}} );
menu.add(new Command(res.getString("Close")){ public void doit() {dispose();}} );
menu.addSeparator();
menu.add(new Command(res.getString("Exit")){ public void doit() {System.exit(0);}} );
menuBar.add(menu);
menu = new JMenu(res.getString("View"));
menu.add(new Command(res.getString("First page")) { public void doit() {goToFirstPage(null);}} );
@@ -192,10 +194,6 @@ public class PreviewDialog extends JFrame implements ProgressListener {
return menuBar;
}

public void dispose() {
System.exit(0);
}

//Aktion Hilfe | Info durchgeführt

public void startHelpAbout(ActionEvent e) {

+ 2
- 0
src/org/apache/fop/viewer/resources/resources.de View File

@@ -19,3 +19,5 @@ Init mappings=Initializiere Abbildung
Build FO tree=Baue FO-Baum
Layout FO tree=Formatiere FO-Baum
Render=Gebe aus
Close=Schließen


+ 4
- 3
src/org/apache/fop/viewer/resources/resources.ru View File

@@ -2,16 +2,17 @@ File=
Exit=Закончить
View=Вид
First page=Первая страница
Previous page=Прелылущая страница
Previous page=Предыдущая страница
Next page=Следующая страница
Last page=Последняя страница
Help=Помощь
Default zoom=Стандаотный масштаб
Default zoom=Стандартный масштаб
Introduction=Введение
About=О программе
Show=Показ
Preview=Просмотр
Print=Печатать
Page=Стоаница
Page=Страница
of=из
Zoom=Масштаб
Close=Закрыть

Loading…
Cancel
Save