From 2419dd357be41f6c64c52ad35c7691743cf8303c Mon Sep 17 00:00:00 2001 From: tushkanchik Date: Fri, 8 Feb 2008 02:34:59 +0000 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D1=8B=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20?= =?UTF-8?q?=D0=BA=20=D1=80=D0=B5=D1=81=D1=83=D1=80=D1=81=D0=B0=D0=BC;=20FB?= =?UTF-8?q?FileHandler;=20=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@536 6a642e6f-84f6-412e-ac94-c4a38d5a04b0 --- .../swing/dialogs/ZLSwingDialogManager.java | 2 +- .../swing/dialogs/ZLSwingSelectionDialog.java | 117 +++++- src/org/fbreader/fbreader/AddBookAction.java | 2 +- src/org/fbreader/fbreader/FBFileHandler.java | 156 ++++++++ src/org/fbreader/formats/FormatPlugin.java | 2 +- src/org/fbreader/formats/fb2/FB2Plugin.java | 2 +- .../zlibrary/core/filesystem/ZLFSManager.java | 4 + .../zlibrary/core/resources/ZLResource.java | 16 +- .../core/resources/ZLTreeResource.java | 4 +- test/data/resources/application/en.xml | 337 +++++++++++++++++ test/data/resources/application/fi.xml | 337 +++++++++++++++++ test/data/resources/application/fr.xml | 338 ++++++++++++++++++ test/data/resources/application/it.xml | 337 +++++++++++++++++ test/data/resources/application/ru.xml | 337 +++++++++++++++++ test/data/resources/application/sv.xml | 337 +++++++++++++++++ test/data/resources/application/uk.xml | 337 +++++++++++++++++ test/data/resources/zlibrary/en.xml | 60 ++++ test/data/resources/zlibrary/fi.xml | 60 ++++ test/data/resources/zlibrary/fr.xml | 61 ++++ test/data/resources/zlibrary/it.xml | 60 ++++ test/data/resources/zlibrary/ru.xml | 60 ++++ test/data/resources/zlibrary/sv.xml | 60 ++++ test/data/resources/zlibrary/uk.xml | 60 ++++ .../core/resources/TestResources.java | 4 +- 24 files changed, 3081 insertions(+), 9 deletions(-) create mode 100644 src/org/fbreader/fbreader/FBFileHandler.java create mode 100644 test/data/resources/application/en.xml create mode 100644 test/data/resources/application/fi.xml create mode 100644 test/data/resources/application/fr.xml create mode 100644 test/data/resources/application/it.xml create mode 100644 test/data/resources/application/ru.xml create mode 100644 test/data/resources/application/sv.xml create mode 100644 test/data/resources/application/uk.xml create mode 100644 test/data/resources/zlibrary/en.xml create mode 100644 test/data/resources/zlibrary/fi.xml create mode 100644 test/data/resources/zlibrary/fr.xml create mode 100644 test/data/resources/zlibrary/it.xml create mode 100644 test/data/resources/zlibrary/ru.xml create mode 100644 test/data/resources/zlibrary/sv.xml create mode 100644 test/data/resources/zlibrary/uk.xml diff --git a/platform/swing/src/org/zlibrary/ui/swing/dialogs/ZLSwingDialogManager.java b/platform/swing/src/org/zlibrary/ui/swing/dialogs/ZLSwingDialogManager.java index df39fb14d..4b3d89012 100644 --- a/platform/swing/src/org/zlibrary/ui/swing/dialogs/ZLSwingDialogManager.java +++ b/platform/swing/src/org/zlibrary/ui/swing/dialogs/ZLSwingDialogManager.java @@ -14,7 +14,7 @@ public class ZLSwingDialogManager extends ZLDialogManager { } public boolean runSelectionDialog(String key, ZLTreeHandler handler) { - new ZLSwingSelectionDialog(myApplicationWindow.getFrame()).run(); + new ZLSwingSelectionDialog(myApplicationWindow.getFrame(), getDialogTitle(key), handler).run(); return false; } diff --git a/platform/swing/src/org/zlibrary/ui/swing/dialogs/ZLSwingSelectionDialog.java b/platform/swing/src/org/zlibrary/ui/swing/dialogs/ZLSwingSelectionDialog.java index 10a138c7c..e2daf8133 100644 --- a/platform/swing/src/org/zlibrary/ui/swing/dialogs/ZLSwingSelectionDialog.java +++ b/platform/swing/src/org/zlibrary/ui/swing/dialogs/ZLSwingSelectionDialog.java @@ -3,9 +3,123 @@ package org.zlibrary.ui.swing.dialogs; import javax.swing.*; import java.awt.*; +import org.zlibrary.core.dialogs.ZLSelectionDialog; +import org.zlibrary.core.dialogs.ZLTreeHandler; import org.zlibrary.ui.swing.util.ZLSwingIconUtil; -class ZLSwingSelectionDialog { +class ZLSwingSelectionDialog extends ZLSelectionDialog{ + private JDialog myJDialog; + private final String myCaption; + private JTextField myStateLine = new JTextField(); + + protected ZLSwingSelectionDialog(JFrame frame, String caption, ZLTreeHandler myHandler) { + super(myHandler); + myJDialog = new JDialog(frame); + myCaption = caption; + update(); + } + + @Override + protected void exitDialog() { + // TODO Auto-generated method stub + + } + + @Override + public boolean run() { + myJDialog.setLayout(new BorderLayout()); + myJDialog.setTitle(myCaption); + myStateLine.setEditable(false); + myJDialog.add(myStateLine, BorderLayout.NORTH); + + String[] books = new String[] { "..", "Book 0", "Book 1", "Book 2", "Book 3", "Book 4", "Book 5" }; + JList list = new JList(books); + list.setCellRenderer(new CellRenderer()); + JScrollPane scrollPane = new JScrollPane(list); + scrollPane.setBorder(BorderFactory.createLoweredBevelBorder()); + myJDialog.add(scrollPane, BorderLayout.CENTER); + + JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); + JButton button1 = ZLSwingDialogManager.createButton(ZLSwingDialogManager.OK_BUTTON); + buttonPanel.add(button1); + JButton button2 = ZLSwingDialogManager.createButton(ZLSwingDialogManager.CANCEL_BUTTON); + buttonPanel.add(button2); + myJDialog.add(buttonPanel, BorderLayout.SOUTH); + myJDialog.pack(); + myJDialog.setSize(600, 400); + myJDialog.setLocationRelativeTo(myJDialog.getParent()); + myJDialog.setVisible(true); + + + + // TODO Auto-generated method stub + return false; + } + + @Override + protected void selectItem(int index) { + // TODO Auto-generated method stub + + } + + @Override + protected void updateList() { + // TODO Auto-generated method stub + + } + + @Override + protected void updateStateLine() { + // TODO Auto-generated method stub + myStateLine.setText(handler().stateDisplayName()); + } + + + + private static class CellRenderer extends JLabel implements ListCellRenderer { + final static ImageIcon icon = ZLSwingIconUtil.getIcon("icons/filetree/unknown.png"); + final static ImageIcon upicon = ZLSwingIconUtil.getIcon("icons/filetree/upfolder.png"); + + public Component getListCellRendererComponent( + JList list, + Object value, // value to display + int index, // cell index + boolean isSelected, // is the cell selected + boolean cellHasFocus) // the list and the cell have the focus + { + String s = value.toString(); + setText(s); + setIcon(s.equals("..") ? upicon : icon); + if (isSelected) { + setBackground(list.getSelectionBackground()); + setForeground(list.getSelectionForeground()); + } else { + setBackground(list.getBackground()); + setForeground(list.getForeground()); + } + setEnabled(list.isEnabled()); + setFont(list.getFont()); + setOpaque(true); + return this; + } + } + + + + + + + + + + + + + + + + /* private JDialog myJDialog; ZLSwingSelectionDialog(JFrame frame) { @@ -67,4 +181,5 @@ class ZLSwingSelectionDialog { myJDialog.setLocationRelativeTo(myJDialog.getParent()); myJDialog.setVisible(true); } + */ } diff --git a/src/org/fbreader/fbreader/AddBookAction.java b/src/org/fbreader/fbreader/AddBookAction.java index 64bc8e0f2..f9df7c75c 100644 --- a/src/org/fbreader/fbreader/AddBookAction.java +++ b/src/org/fbreader/fbreader/AddBookAction.java @@ -12,7 +12,7 @@ class AddBookAction extends FBAction { } public void run() { - ZLDialogManager.getInstance().runSelectionDialog("addFileDialog", null); + ZLDialogManager.getInstance().runSelectionDialog("addFileDialog", new FBFileHandler()); /* FBFileHandler handler; if (ZLDialogManager::instance().selectionDialog(ZLResourceKey("addFileDialog"), handler)) { diff --git a/src/org/fbreader/fbreader/FBFileHandler.java b/src/org/fbreader/fbreader/FBFileHandler.java new file mode 100644 index 000000000..a2fe7a0f1 --- /dev/null +++ b/src/org/fbreader/fbreader/FBFileHandler.java @@ -0,0 +1,156 @@ +package org.fbreader.fbreader; + +import java.util.*; + +import org.fbreader.description.BookDescription; +import org.fbreader.formats.FormatPlugin; +import org.fbreader.formats.FormatPlugin.PluginCollection; +import org.zlibrary.core.options.ZLOption; +import org.zlibrary.core.options.ZLStringOption; +import org.zlibrary.core.util.*; + +import org.zlibrary.core.dialogs.UpdateType; +import org.zlibrary.core.dialogs.ZLDialogManager; +import org.zlibrary.core.dialogs.ZLTreeNode; +import org.zlibrary.core.dialogs.ZLTreeOpenHandler; +import org.zlibrary.core.filesystem.ZLDir; +import org.zlibrary.core.filesystem.ZLFile; + +public class FBFileHandler extends ZLTreeOpenHandler { + + public ZLStringOption DirectoryOption; //?public + + private ZLDir myDir; + private boolean myIsUpToDate; + private final ArrayList mySubnodes = new ArrayList(); + private BookDescription myDescription; + private int mySelectedIndex; + + private final static String FOLDER_ICON = "folder"; + private final static String ZIP_FOLDER_ICON = "zipfolder"; + private static HashMap pluginIcons; // ?static + + public FBFileHandler() { + DirectoryOption = new ZLStringOption(ZLOption.LOOK_AND_FEEL_CATEGORY, "OpenFileDialog", "Directory", System.getProperty("user.home")); + myIsUpToDate = false; + mySelectedIndex = 0; + myDir = (new ZLFile(DirectoryOption.getValue())).getDirectory(); + if (myDir == null) { + myDir = (new ZLFile(System.getProperty("user.home"))).getDirectory(); + } + if (myDir == null) { + myDir = ZLDir.getRoot(); + } + } + + public BookDescription description() { + return myDescription; + } + +// override private + + @Override + public boolean accept(ZLTreeNode node) { + final String name = myDir.getItemPath(node.id()); + FormatPlugin plugin = PluginCollection.instance().getPlugin(new ZLFile(name), false); + final String message = (plugin == null) ? "Unknown File Format" : plugin.tryOpen(name); + if ("".equals(message)) { + final String boxKey = "openBookErrorBox"; + ZLDialogManager.getInstance().showErrorBox(boxKey, + ZLDialogManager.getDialogMessage(boxKey) + " " + message); + return false; + } + myDescription = BookDescription.getDescription(name); + return true; + } + + @Override + public void changeFolder(ZLTreeNode node) { + // TODO Auto-generated method stub + // id != null + ZLDir dir = new ZLFile(myDir.getItemPath(node.id())).getDirectory(); + if (dir != null) { + final String selectedId = myDir.getName(); + myDir = dir; + myIsUpToDate = false; + mySubnodes.clear(); + mySelectedIndex = 0; + if ("..".equals(node.id())) { + final ArrayList subnodes = this.subnodes(); + final int size = subnodes.size(); + for (int index = 0; index < size; index++) { + if (((ZLTreeNode) subnodes.get(index)).id().equals(selectedId)) { + mySelectedIndex = index; + break; + } + } + } + addUpdateInfo(UpdateType.UPDATE_ALL); + } + } + + @Override + public int selectedIndex() { + return mySelectedIndex; + } + + @Override + public String stateDisplayName() { + return ZLFile.fileNameToUtf8(myDir.getPath()); + } + + @Override + public ArrayList subnodes() { + // TODO Auto-generated method stub + + if (!myIsUpToDate) { + if (!myDir.isRoot()) { + mySubnodes.add(new ZLTreeNode("..", "..", FOLDER_ICON, true)); + } + + HashMap folderNodes = new HashMap(); // + HashMap fileNodes = new HashMap(); + + ArrayList/**/ names = myDir.collectSubDirs(); + int size = names.size(); + for (int i = 0; i < size; i++) { + final String subDir = (String) names.get(i); + final String displayName = ZLFile.fileNameToUtf8(new ZLFile(subDir).getName(false)); + folderNodes.put(displayName, new ZLTreeNode(subDir, displayName, FOLDER_ICON, true)); + } + names.clear(); + + names = myDir.collectFiles(); + size = names.size(); + for (int i = 0; i < size; i++) { + final String fileName = (String) names.get(i); + if ("".equals(fileName)) { + continue; + } + ZLFile file = new ZLFile(myDir.getItemPath(fileName)); + final String displayName = ZLFile.fileNameToUtf8(file.getName(false)); + if ("".equals(displayName)) { + continue; + } + FormatPlugin plugin = PluginCollection.instance().getPlugin(file, false); + if (plugin != null) { + String icon = (String) pluginIcons.get(plugin); + if ("".equals(icon)) { + icon = plugin.getIconName(); + pluginIcons.put(plugin, icon); + } + fileNodes.put(displayName, new ZLTreeNode(fileName, displayName, icon, false)); + } else if (file.isArchive()) { + folderNodes.put(displayName, new ZLTreeNode(fileName, displayName, ZIP_FOLDER_ICON, true)); + } + } + + mySubnodes.add(folderNodes.values()); + mySubnodes.add(fileNodes.values()); + myIsUpToDate = true; + } + + return mySubnodes; + } + +} diff --git a/src/org/fbreader/formats/FormatPlugin.java b/src/org/fbreader/formats/FormatPlugin.java index 213040156..c4c3e6391 100644 --- a/src/org/fbreader/formats/FormatPlugin.java +++ b/src/org/fbreader/formats/FormatPlugin.java @@ -74,7 +74,7 @@ public abstract class FormatPlugin { public static class PluginCollection { private static PluginCollection ourInstance; - private ArrayList myPlugins; + private final ArrayList myPlugins = new ArrayList(); public ZLIntegerOption DefaultLanguageOption; public static PluginCollection instance() { diff --git a/src/org/fbreader/formats/fb2/FB2Plugin.java b/src/org/fbreader/formats/fb2/FB2Plugin.java index dcfc83459..62e0edd8d 100644 --- a/src/org/fbreader/formats/fb2/FB2Plugin.java +++ b/src/org/fbreader/formats/fb2/FB2Plugin.java @@ -15,7 +15,7 @@ public class FB2Plugin extends FormatPlugin { } public boolean acceptsFile(ZLFile file) { - return file.getExtension().equals("fb2"); + return "fb2".equals(file.getExtension()); } public boolean readDescription(String path, BookDescription description) { diff --git a/src/org/zlibrary/core/filesystem/ZLFSManager.java b/src/org/zlibrary/core/filesystem/ZLFSManager.java index c30c9e00b..fa6ee3609 100644 --- a/src/org/zlibrary/core/filesystem/ZLFSManager.java +++ b/src/org/zlibrary/core/filesystem/ZLFSManager.java @@ -76,6 +76,10 @@ public class ZLFSManager { } public int findArchiveFileNameDelimiter(String path) { + if (System.getProperty("os.name").startsWith("Windows")) { + int index = path.lastIndexOf(':'); + return (index == 1) ? -1 : index; + } return path.lastIndexOf(':'); } diff --git a/src/org/zlibrary/core/resources/ZLResource.java b/src/org/zlibrary/core/resources/ZLResource.java index d6f59c683..4d4cde76b 100644 --- a/src/org/zlibrary/core/resources/ZLResource.java +++ b/src/org/zlibrary/core/resources/ZLResource.java @@ -1,8 +1,22 @@ package org.zlibrary.core.resources; +import org.zlibrary.core.library.ZLibrary; + abstract public class ZLResource { public final String Name; - + + // this static fields and set-methods were created so as to run tests + protected static String ourApplicationDirectory = ZLibrary.JAR_DATA_PREFIX + "data/resources/application/"; + protected static String ourZLibraryDirectory = ZLibrary.JAR_DATA_PREFIX + "data/resources/zlibrary/"; + + public static void setApplicationDirectory(String dir) { + ourApplicationDirectory = dir; + } + + public static void setZLibraryDirectory(String dir) { + ourZLibraryDirectory = dir; + } + public static ZLResource resource(String key) { ZLTreeResource.buildTree(); if (ZLTreeResource.ourRoot == null) { diff --git a/src/org/zlibrary/core/resources/ZLTreeResource.java b/src/org/zlibrary/core/resources/ZLTreeResource.java index 31652120e..95e9ba10d 100644 --- a/src/org/zlibrary/core/resources/ZLTreeResource.java +++ b/src/org/zlibrary/core/resources/ZLTreeResource.java @@ -29,8 +29,8 @@ final class ZLTreeResource extends ZLResource { public static void loadData(String language) { final String fileName = language + ".xml"; ResourceTreeReader reader = new ResourceTreeReader(); - reader.readDocument(ourRoot, ZLibrary.JAR_DATA_PREFIX + "data/resources/zlibrary/" + fileName); - reader.readDocument(ourRoot, ZLibrary.JAR_DATA_PREFIX + "data/resources/application/" + fileName); + reader.readDocument(ourRoot, ourZLibraryDirectory + fileName); + reader.readDocument(ourRoot, ourApplicationDirectory + fileName); } private ZLTreeResource(String name, String value) { diff --git a/test/data/resources/application/en.xml b/test/data/resources/application/en.xml new file mode 100644 index 000000000..16113ef78 --- /dev/null +++ b/test/data/resources/application/en.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/application/fi.xml b/test/data/resources/application/fi.xml new file mode 100644 index 000000000..ade02d21a --- /dev/null +++ b/test/data/resources/application/fi.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/application/fr.xml b/test/data/resources/application/fr.xml new file mode 100644 index 000000000..7f8bd8ceb --- /dev/null +++ b/test/data/resources/application/fr.xml @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/application/it.xml b/test/data/resources/application/it.xml new file mode 100644 index 000000000..de91c2681 --- /dev/null +++ b/test/data/resources/application/it.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/application/ru.xml b/test/data/resources/application/ru.xml new file mode 100644 index 000000000..61f959ec3 --- /dev/null +++ b/test/data/resources/application/ru.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/application/sv.xml b/test/data/resources/application/sv.xml new file mode 100644 index 000000000..92e7ca4f8 --- /dev/null +++ b/test/data/resources/application/sv.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/application/uk.xml b/test/data/resources/application/uk.xml new file mode 100644 index 000000000..56dc8554d --- /dev/null +++ b/test/data/resources/application/uk.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/zlibrary/en.xml b/test/data/resources/zlibrary/en.xml new file mode 100644 index 000000000..607485083 --- /dev/null +++ b/test/data/resources/zlibrary/en.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/zlibrary/fi.xml b/test/data/resources/zlibrary/fi.xml new file mode 100644 index 000000000..387a16d3a --- /dev/null +++ b/test/data/resources/zlibrary/fi.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/zlibrary/fr.xml b/test/data/resources/zlibrary/fr.xml new file mode 100644 index 000000000..1454f6509 --- /dev/null +++ b/test/data/resources/zlibrary/fr.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/zlibrary/it.xml b/test/data/resources/zlibrary/it.xml new file mode 100644 index 000000000..7abc09c97 --- /dev/null +++ b/test/data/resources/zlibrary/it.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/zlibrary/ru.xml b/test/data/resources/zlibrary/ru.xml new file mode 100644 index 000000000..4a3478c7b --- /dev/null +++ b/test/data/resources/zlibrary/ru.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/zlibrary/sv.xml b/test/data/resources/zlibrary/sv.xml new file mode 100644 index 000000000..1d4d1a55e --- /dev/null +++ b/test/data/resources/zlibrary/sv.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/data/resources/zlibrary/uk.xml b/test/data/resources/zlibrary/uk.xml new file mode 100644 index 000000000..2416e06cf --- /dev/null +++ b/test/data/resources/zlibrary/uk.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/org/test/zlibrary/core/resources/TestResources.java b/test/org/test/zlibrary/core/resources/TestResources.java index b5654c062..75478aaa2 100644 --- a/test/org/test/zlibrary/core/resources/TestResources.java +++ b/test/org/test/zlibrary/core/resources/TestResources.java @@ -14,6 +14,8 @@ public class TestResources extends TestCase { new ZLSwingLibrary(); new ZLOwnXMLProcessorFactory(); Locale.setDefault(Locale.ENGLISH); + ZLResource.setApplicationDirectory("test/data/resources/application/"); + ZLResource.setZLibraryDirectory("test/data/resources/zlibrary/"); } public void testMissingResource() { @@ -57,7 +59,7 @@ public class TestResources extends TestCase { } public void testValue2() { - ZLResource res = ZLResource.resource("menu").getResource("search").getResource("find"); + ZLResource res = ZLResource.resource("menu").getResource("search").getResource("search"); assertEquals(res.getValue(), "Find Text..."); } }