⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eafmultiplefilesearchpanel.java

📁 编辑视频文件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * File:     EAFMultipleFileSearchPanel.java * Project:  MPI Linguistic Application * Date:     02 May 2007 * * Copyright (C) 2001-2007  Max Planck Institute for Psycholinguistics * * This program 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. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *//* This program 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. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */package mpi.eudico.client.annotator.search.viewer;import mpi.eudico.client.annotator.ElanFrame2;import mpi.eudico.client.annotator.Preferences;import mpi.eudico.client.annotator.search.model.EAFMultipleFileSearchEngine;import mpi.eudico.client.annotator.search.model.EAFType;import mpi.eudico.client.annotator.search.result.viewer.EAFMultipleFileResultViewer;import mpi.eudico.client.annotator.search.result.viewer.EAFResultViewerTableModel;import mpi.eudico.client.util.LinkButton;import mpi.search.SearchLocale;import mpi.search.content.query.model.AnchorConstraint;import mpi.search.content.query.model.ContentQuery;import mpi.search.content.result.model.ContentResult;import mpi.search.content.result.viewer.ContentMatch2TabDelimitedText;import mpi.search.content.result.viewer.ContentMatchCounter;import mpi.search.model.DefaultSearchController;import mpi.search.query.model.Query;import mpi.search.query.viewer.AbstractSimpleSearchPanel;import mpi.search.query.viewer.StartStopPanel;import org.xml.sax.SAXException;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Font;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.KeyEvent;import java.io.File;import java.io.IOException;import java.util.ArrayList;import java.util.List;import java.util.regex.PatternSyntaxException;import javax.swing.AbstractAction;import javax.swing.Action;import javax.swing.Box;import javax.swing.BoxLayout;import javax.swing.JCheckBox;import javax.swing.JComponent;import javax.swing.JFileChooser;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JSeparator;import javax.swing.JTextField;import javax.swing.KeyStroke;import javax.swing.border.CompoundBorder;import javax.swing.border.EmptyBorder;/** * Created on Aug 24, 2004 * * @author Alexander Klassmann * @version November, 2004 */public class EAFMultipleFileSearchPanel extends AbstractSimpleSearchPanel {    /**DOCUMENT ME! */    protected static final String LAST_DIR_KEY = "MultipleFileSearchLastDir";    /**DOCUMENT ME! */    protected static final String PREFERENCES_DIRS_KEY = "MultipleFileSearchDirs";    /**DOCUMENT ME! */    protected static final String PREFERENCES_PATHS_KEY = "MultipleFileSearchPaths";    /** Holds value of property DOCUMENT ME! */    private final Action defineDomainAction;    /** Holds value of property DOCUMENT ME! */    private final ArrayList searchDirs;    /** Holds value of property DOCUMENT ME! */    private final ArrayList searchPaths;    /** Holds value of property DOCUMENT ME! */    private final Box optionBox = new Box(BoxLayout.Y_AXIS);    /** Holds value of property DOCUMENT ME! */    private final Box searchCategoryBox = new Box(BoxLayout.X_AXIS);    /** Holds value of property DOCUMENT ME! */    private final JCheckBox caseSensitiveCheckBox;    /** Holds value of property DOCUMENT ME! */    private final JCheckBox regexCheckBox;    /** Holds value of property DOCUMENT ME! */    private final JLabel copyrightLabel = new JLabel("\u00A9 MPI Nijmegen 2004");    /** Holds value of property DOCUMENT ME! */    private final JLabel googleLabel = new JLabel(SearchLocale.getString(                "Action.Search"));    /** Holds value of property DOCUMENT ME! */    private final JLabel infoLabel = new JLabel();    /** Holds value of property DOCUMENT ME! */    private final JPanel centralPanel;    /** Holds value of property DOCUMENT ME! */    private final JTextField googleField = new JTextField(18);    /** Holds value of property DOCUMENT ME! */    private final LinkButton exportButton;    private File[] searchFiles;    /**     * Creates a new EAFMultipleFileSearchPanel object.     */    public EAFMultipleFileSearchPanel() {        this(null);    }    /**     * Creates a new EAFMultipleFileSearchPanel object.     *     * @param elanFrame DOCUMENT ME!     */    public EAFMultipleFileSearchPanel(ElanFrame2 elanFrame) {        matchCounter = new ContentMatchCounter();        defineDomainAction = new AbstractAction(SearchLocale.getString(                    "Action.DefineDomain")) {                    public void actionPerformed(ActionEvent e) {                        EAFMultipleFileUtilities.specifyDomain(EAFMultipleFileSearchPanel.this,                            searchDirs, searchPaths);                        searchFiles = EAFMultipleFileUtilities.getUniqueEAFFilesIn(searchDirs,                                searchPaths);                    }                };        defineDomainAction.putValue(Action.SHORT_DESCRIPTION,            SearchLocale.getString("Action.Tooltip.DefineDomain"));        KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_D,                ActionEvent.CTRL_MASK);        defineDomainAction.putValue(Action.ACCELERATOR_KEY, ks);        regexCheckBox = new JCheckBox(SearchLocale.getString(                    "Search.Constraint.RegularExpression"));        caseSensitiveCheckBox = new JCheckBox(SearchLocale.getString(                    "Search.Constraint.CaseSensitive"));        startStopPanel = new StartStopPanel(startAction, stopAction);        resultViewer = new EAFMultipleFileResultViewer(elanFrame);        exportButton = new LinkButton(exportAction);        matchCounter.setHorizontalAlignment(JLabel.RIGHT);        centralPanel = new JPanel(new BorderLayout());        setComponents();        makeStartPanel();        setVisible(true);        googleField.addActionListener(startAction);        // get defaults from preferences        searchDirs = (Preferences.get(PREFERENCES_DIRS_KEY, null) != null)            ? (ArrayList) Preferences.get(PREFERENCES_DIRS_KEY, null)            : new ArrayList();        searchPaths = (Preferences.get(PREFERENCES_PATHS_KEY, null) != null)            ? (ArrayList) Preferences.get(PREFERENCES_PATHS_KEY, null)            : new ArrayList();        searchEngine = new DefaultSearchController(this,                new EAFMultipleFileSearchEngine(progressViewer));        searchEngine.setProgressListener(progressViewer);        // construct the unique list of searchable files        searchFiles = EAFMultipleFileUtilities.getUniqueEAFFilesIn(searchDirs,                searchPaths);    }    /**     * DOCUMENT ME!     *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -