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

📄 abstractcomplexsearchpanel.java

📁 编辑视频文件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * File:     AbstractComplexSearchPanel.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 */package mpi.search.content.viewer;import mpi.search.SearchLocale;import mpi.search.content.query.model.ContentQuery;import mpi.search.content.query.viewer.QueryPanel;import mpi.search.content.result.model.ContentResult;import mpi.search.content.result.viewer.ContentMatchCounter;import mpi.search.query.model.Query;import mpi.search.query.model.QueryManager;import mpi.search.query.viewer.AbstractSimpleSearchPanel;import mpi.search.query.viewer.StartStopPanel;import mpi.util.gui.TriptychLayout;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dimension;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.GridLayout;import java.awt.Window;import java.awt.event.ActionEvent;import java.awt.event.KeyEvent;import javax.swing.AbstractAction;import javax.swing.Action;import javax.swing.Icon;import javax.swing.ImageIcon;import javax.swing.JComponent;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JSplitPane;import javax.swing.JToolBar;import javax.swing.KeyStroke;import javax.swing.border.CompoundBorder;import javax.swing.border.EmptyBorder;import javax.swing.border.LineBorder;/** * Created on Jul 21, 2004 * * @author Alexander Klassmann * @version November 2004 */public abstract class AbstractComplexSearchPanel    extends AbstractSimpleSearchPanel {    /** action to read query/results from file */    protected Action readAction;    /** action to save query/results to file */    protected Action saveAction;    /** action to specify (sub)query on existing result */    protected Action zoomAction;    /** holds name of corpus */    protected JLabel corpusLabel;    /** Holds counter, start/StopButtons and progressViewer */    protected final JPanel bottomPanel = new JPanel();    /** stores queries */    protected final QueryManager queryManager = new QueryManager();    /** Holds panel for query formulation */    protected QueryPanel queryPanel;    /** Holds value of property DOCUMENT ME! */    private final JLabel resultCounterLabel = new JLabel();    /** Panel to contain toolbar and queryPanel */    private final JPanel toolAndQueryPanel = new JPanel(new BorderLayout());    /** Holds value of property DOCUMENT ME! */    private final JToolBar toolBar = new JToolBar();    /** action to go to last result */    private Action backAction;    /** action to go to next result */    private Action forwardAction;    /** Holds action to open empty query panel */    private Action newAction;    /**     * Constructor that has a ViewerManager as an argument. <b>Note: </b>the     * viewer manager is currently needed to be able to connect and disconnect     * as a listener. The SearchDialog is not an AbstractViewer and is     * (currently) not created by the viewer manager, so it has to be     * connected seperately.     */    public AbstractComplexSearchPanel() {        matchCounter = new ContentMatchCounter();        createActions();    }    /**     * DOCUMENT ME!     *     * @return DOCUMENT ME!     */    protected Query getQuery() {        ContentQuery query = queryPanel.getQuery();        if (!query.equals(queryManager.getCurrentQuery())) {            queryManager.addQuery(query);            return query;        } else if (queryManager.getCurrentQuery().getResult().getStatus() != ContentResult.COMPLETE) {            return queryManager.getCurrentQuery(); // is equal but not the same object        }        return null;    }    /**     * DOCUMENT ME!     *     * @param query DOCUMENT ME!     */    protected void addQuery(ContentQuery query) {        queryPanel.setQuery(query);        clearResult();    }    /**     * DOCUMENT ME!     */    protected void clearResult() {        resultViewer.reset();        matchCounter.setVisible(false);        progressViewer.setVisible(false);        queryManager.setCurrentQueryNumber(queryManager.size() + 1);        updateActions();    }    /**     * DOCUMENT ME!     *     * @param nr DOCUMENT ME!     */    protected void gotoQuery(int nr) {        queryManager.setCurrentQueryNumber(nr);        ContentQuery query = (ContentQuery) queryManager.getCurrentQuery();        if (query.getResult() != null) {            queryPanel.setQuery(query);            if (query.getResult().getStatus() == ContentResult.MODIFIED) {                startSearch();            } else {                matchCounter.setResult(query.getResult());                matchCounter.setVisible(true);                progressViewer.setStatus(query.getResult().getStatus());                progressViewer.setVisible(true);                updateActions();                resultViewer.showResult(query.getResult());            }        }    }    /**     * DOCUMENT ME!     */    protected void makeLayout() {        // toolBar.add(corpusLabel);        toolBar.addSeparator();        toolBar.add(startAction);        toolBar.add(stopAction);        toolBar.add(newAction);        toolBar.add(zoomAction);        toolBar.addSeparator();        toolBar.add(saveAction);        toolBar.add(readAction);        toolBar.add(exportAction);        toolBar.addSeparator();        toolBar.add(backAction);        toolBar.add(resultCounterLabel);        toolBar.add(forwardAction);        toolBar.addSeparator();        toolBar.setBorderPainted(true);        toolBar.setBorder(new LineBorder(Color.gray));        toolBar.putClientProperty("JToolBar.isRollover", new Boolean(true));        toolAndQueryPanel.setLayout(new GridBagLayout());        GridBagConstraints c = new GridBagConstraints();        c.gridx = 0;        c.gridy = 0;        c.anchor = GridBagConstraints.NORTHWEST;        c.fill = GridBagConstraints.HORIZONTAL;        c.weightx = 1.0;        toolAndQueryPanel.add(toolBar, c);        //        JPanel queryCont = new JPanel(new GridBagLayout());        c.gridx = 0;        c.gridy = 0;        c.anchor = GridBagConstraints.NORTHWEST;        c.fill = GridBagConstraints.BOTH;        c.weightx = 1.0;        c.weighty = 1.0;        queryCont.add(queryPanel, c);

⌨️ 快捷键说明

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