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

📄 abstracttierexportdialog.java

📁 编辑视频文件
💻 JAVA
字号:
/* * File:     AbstractTierExportDialog.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.eudico.client.annotator.export;import mpi.eudico.client.annotator.ElanLocale;import mpi.eudico.client.annotator.Selection;import mpi.eudico.client.annotator.tier.TierExportTableModel;import mpi.eudico.server.corpora.clom.Transcription;import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.Frame;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.util.ArrayList;import java.util.List;import javax.swing.JCheckBox;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTable;import javax.swing.SwingConstants;import javax.swing.WindowConstants;import javax.swing.border.TitledBorder;import javax.swing.table.DefaultTableModel;/** * $Id: AbstractTierExportDialog.java,v 1.9 2007/02/06 14:31:40 klasal Exp $  Abstract dialog class for tier export. * * @author $author$ * @version $Revision: 1.9 $ */public abstract class AbstractTierExportDialog extends AbstractBasicExportDialog    implements ActionListener {    /** table for tiers */    protected final DefaultTableModel model = new TierExportTableModel();    /** restrict export to selection ? */    protected final JCheckBox restrictCheckBox = new JCheckBox();    /** panel for a tier table */    protected final JPanel tierSelectionPanel = new JPanel();    /** table ui */    protected final JTable tierTable = new JTable(model);    /** selection */    protected final Selection selection;    /** column id for the include in export checkbox column, invisible */    protected final String EXPORT_COLUMN = "export";    /** column id for the tier name column, invisible */    protected final String TIER_NAME_COLUMN = "tier";    /**     * Creates a new AbstractTierExportDialog instance.     *     * @param parent the parent frame     * @param modal whether this dialog should be modal     * @param transcription DOCUMENT ME!     * @param selection DOCUMENT ME!     */    public AbstractTierExportDialog(Frame parent, boolean modal,        Transcription transcription, Selection selection) {        super(parent, modal, transcription);        this.selection = selection;    }    /**     * DOCUMENT ME!     *     * @return DOCUMENT ME!     */    protected List getSelectedTiers() {        int includeCol = model.findColumn(EXPORT_COLUMN);        int nameCol = model.findColumn(TIER_NAME_COLUMN);        ArrayList selectedTiers = new ArrayList();        // add selected tiers in the right order        for (int i = 0; i < model.getRowCount(); i++) {            Boolean include = (Boolean) model.getValueAt(i, includeCol);            if (include.booleanValue()) {                selectedTiers.add(model.getValueAt(i, nameCol));            }        }        return selectedTiers;    }    /**     * Initializes UI elements.     */    protected void makeLayout() {        super.makeLayout();        getContentPane().setLayout(new GridBagLayout());        GridBagConstraints gridBagConstraints;        gridBagConstraints = new GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;        gridBagConstraints.anchor = GridBagConstraints.NORTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.insets = insets;        getContentPane().add(titleLabel, gridBagConstraints);        tierSelectionPanel.setLayout(new GridBagLayout());        Dimension tableDim = new Dimension(50, 100);        JScrollPane tierScrollPane = new JScrollPane(tierTable);        tierScrollPane.setPreferredSize(tableDim);        gridBagConstraints = new GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;        gridBagConstraints.insets = insets;        gridBagConstraints.fill = GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 1.0;        tierSelectionPanel.add(tierScrollPane, gridBagConstraints);        // add more elements to this panel        gridBagConstraints = new GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.fill = GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 1.0;        gridBagConstraints.insets = insets;        getContentPane().add(tierSelectionPanel, gridBagConstraints);        optionsPanel.setLayout(new GridBagLayout());        // add elements to the optionspanel        gridBagConstraints = new GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        gridBagConstraints.anchor = GridBagConstraints.WEST;        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.insets = insets;        getContentPane().add(optionsPanel, gridBagConstraints);        gridBagConstraints = new GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 3;        gridBagConstraints.insets = insets;        getContentPane().add(buttonPanel, gridBagConstraints);    }    /**     * Set the localized text on ui elements     */    protected void updateLocale() {        super.updateLocale();        tierSelectionPanel.setBorder(new TitledBorder(ElanLocale.getString(                    "ExportDialog.Label.SelectTiers")));        optionsPanel.setBorder(new TitledBorder(ElanLocale.getString(                    "ExportDialog.Label.Options")));        restrictCheckBox.setText(ElanLocale.getString("ExportDialog.Restrict"));    }}

⌨️ 快捷键说明

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