001 /* BEE - Book Editing Environment for PAVLOV 002 * Copyright (C) 2004 T.J. Willis 003 * 004 * This program is free software; you can redistribute it and/or 005 * modify it under the terms of the GNU General Public License 006 * as published by the Free Software Foundation; either version 2 007 * of the License, or (at your option) any later version. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU General Public License for more details. 013 * 014 * You should have received a copy of the GNU General Public License 015 * along with this program; if not, write to the Free Software 016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. 017 * 018 * $Header: /cvsroot/pavlov/net/sourceforge/bee/TableQuestionHandler.java,v 1.4 2004/05/10 14:46:07 tj_willis Exp $ 019 */ 020 package net.sourceforge.bee; 021 022 import javax.swing.*; 023 import java.awt.datatransfer.*; 024 import net.sourceforge.pavlov.library.*; 025 026 /** 027 * FIXME: This doesn't appear to be used anywhere. 028 * @deprecated 029 */ 030 @Deprecated public class TableQuestionHandler 031 extends TransferHandler 032 { 033 private ChapterTableModel tmod; 034 035 public TableQuestionHandler(ChapterTableModel tMod) 036 { 037 super("text"); 038 tmod = tMod; 039 } 040 041 042 public boolean canImport(JComponent comp, DataFlavor[] transferFlavors ) 043 { 044 return true; // TOFIX: change this to Data???.Text 045 } 046 047 048 public boolean importData(JComponent comp, Transferable t) 049 { 050 try { 051 //JTable tab = (JTable)comp; 052 Question q = new Question(); 053 Object o = t.getTransferData(DataFlavor.plainTextFlavor); 054 q.setText(o.toString() ); 055 tmod.insertQuestion(0,q); 056 } catch (Exception e) { 057 System.out.println(e); 058 return false; 059 } 060 return true; 061 } 062 063 }