📄 retrievaltoolkit.java
字号:
/* * This file is part of Caliph & Emir. * * Caliph & Emir is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Caliph & Emir is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Caliph & Emir; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Copyright statement: * -------------------- * (c) 2002-2004 by Mathias Lux (mathias@juggle.at) * http://www.juggle.at *//* * * @author Mathias Lux, mathias@juggle.at * Date: Sep 23, 2002 * Time: 10:24:32 PM * To change template for new class use * */package at.lux.fotoretrieval;import org.jaxen.XPath;import org.jaxen.jdom.JDOMXPath;import org.jdom.Namespace;import javax.swing.*;import java.awt.event.ActionListener;import java.awt.event.KeyEvent;import java.util.List;import java.util.StringTokenizer;import java.util.Vector;public class RetrievalToolkit { public static String PROGRAM_NAME = "Emir"; public static String PROGRAM_VERSION = "v 0.8.5"; public static List xpathQuery(org.jdom.Element document, String xpathQuery1, Namespace xNs) { List returnValue = new Vector(); String xpathQuery = xpathQuery1; XPath xPath; try { Namespace ns = document.getNamespace(); if (ns.getPrefix().length() == 0) { StringTokenizer tokens = new StringTokenizer(xpathQuery, "/", true); xpathQuery = ""; while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); if (!token.equalsIgnoreCase("/")) { token = "x:" + token; } xpathQuery += token; } xPath = new JDOMXPath(xpathQuery); xPath.addNamespace("x", ns.getURI()); } else { xPath = new JDOMXPath(xpathQuery); } if (xNs != null) { xPath.addNamespace(xNs.getPrefix(), xNs.getURI()); } Object jdomNode = document; returnValue = xPath.selectNodes(jdomNode); } catch (Exception e) { e.printStackTrace(); } return returnValue; } public static JMenuBar createRetrievalMenuBar(ActionListener al) { JMenu file, help, view; file = new JMenu("File"); help = new JMenu("Help"); view = new JMenu("View"); file.setMnemonic(KeyEvent.VK_F); help.setMnemonic(KeyEvent.VK_H); view.setMnemonic(KeyEvent.VK_V);// file.add(createMenuItem("Create index", "index", "alt F12", al, KeyEvent.VK_I));// file.addSeparator(); file.add(createMenuItem("Exit", "exit", "alt F4", al, KeyEvent.VK_E)); view.add(createMenuItem("Close active Tab", "closeTab", "alt X", al, KeyEvent.VK_C)); help.add(createMenuItem("Help", "help", "F1", al, KeyEvent.VK_H)); help.add(createMenuItem("About", "about", "alt A", al, KeyEvent.VK_A)); JMenuBar bar = new JMenuBar(); bar.add(file); bar.add(view); bar.add(help); return bar; } public static JMenuItem createMenuItem(String label, String command, String Mnemonic, ActionListener al, int mnem) { JMenuItem i = new JMenuItem(label); if (Mnemonic != null) { i.setAccelerator(KeyStroke.getKeyStroke(Mnemonic)); } i.setMnemonic(mnem); i.setActionCommand(command); i.addActionListener(al); return i; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -