JAL-1432 updated copyright notices
[jalview.git] / src / jalview / jbgui / GCutAndPasteHtmlTransfer.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  * The Jalview Authors are detailed in the 'AUTHORS' file.
18  */
19 package jalview.jbgui;
20
21 import jalview.gui.JvSwingUtils;
22
23 import java.awt.*;
24 import java.awt.event.*;
25
26 import javax.swing.*;
27
28 /**
29  * DOCUMENT ME!
30  * 
31  * @author $author$
32  * @version $Revision$
33  */
34 public class GCutAndPasteHtmlTransfer extends JInternalFrame
35 {
36   protected JEditorPane textarea = new JEditorPane("text/html", "");
37
38   protected JScrollPane scrollPane = new JScrollPane();
39
40   BorderLayout borderLayout1 = new BorderLayout();
41
42   JMenuBar editMenubar = new JMenuBar();
43
44   JMenu editMenu = new JMenu();
45
46   JMenuItem copyItem = new JMenuItem();
47
48   protected JCheckBoxMenuItem displaySource = new JCheckBoxMenuItem();
49
50   BorderLayout borderLayout2 = new BorderLayout();
51
52   protected JPanel inputButtonPanel = new JPanel();
53
54   protected JButton ok = new JButton();
55
56   JButton cancel = new JButton();
57
58   JMenuItem close = new JMenuItem();
59
60   JMenuItem selectAll = new JMenuItem();
61
62   JMenu jMenu1 = new JMenu();
63
64   JMenuItem save = new JMenuItem();
65
66   /**
67    * Creates a new GCutAndPasteTransfer object.
68    */
69   public GCutAndPasteHtmlTransfer()
70   {
71     try
72     {
73       setJMenuBar(editMenubar);
74       jbInit();
75     } catch (Exception e)
76     {
77       e.printStackTrace();
78     }
79   }
80
81   /**
82    * DOCUMENT ME!
83    * 
84    * @throws Exception
85    *           DOCUMENT ME!
86    */
87   private void jbInit() throws Exception
88   {
89     scrollPane.setBorder(null);
90     ok.setFont(JvSwingUtils.getLabelFont());
91     ok.setText("New Window");
92     ok.addActionListener(new ActionListener()
93     {
94       public void actionPerformed(ActionEvent e)
95       {
96         ok_actionPerformed(e);
97       }
98     });
99     cancel.setText("Close");
100     cancel.addActionListener(new ActionListener()
101     {
102       public void actionPerformed(ActionEvent e)
103       {
104         cancel_actionPerformed(e);
105       }
106     });
107     textarea.setBorder(null);
108     close.setText("Close");
109     close.addActionListener(new ActionListener()
110     {
111       public void actionPerformed(ActionEvent e)
112       {
113         cancel_actionPerformed(e);
114       }
115     });
116     close.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
117             java.awt.event.KeyEvent.VK_W, Toolkit.getDefaultToolkit()
118                     .getMenuShortcutKeyMask(), false));
119     selectAll.setText("Select All");
120     selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
121             java.awt.event.KeyEvent.VK_A, Toolkit.getDefaultToolkit()
122                     .getMenuShortcutKeyMask(), false));
123     selectAll.addActionListener(new ActionListener()
124     {
125       public void actionPerformed(ActionEvent e)
126       {
127         selectAll_actionPerformed(e);
128       }
129     });
130     jMenu1.setText("File");
131     save.setText("Save");
132     save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
133             java.awt.event.KeyEvent.VK_S, Toolkit.getDefaultToolkit()
134                     .getMenuShortcutKeyMask(), false));
135     save.addActionListener(new ActionListener()
136     {
137       public void actionPerformed(ActionEvent e)
138       {
139         save_actionPerformed(e);
140       }
141     });
142     copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
143             java.awt.event.KeyEvent.VK_C, Toolkit.getDefaultToolkit()
144                     .getMenuShortcutKeyMask(), false));
145
146     editMenubar.add(jMenu1);
147     editMenubar.add(editMenu);
148     textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
149     textarea.addMouseListener(new java.awt.event.MouseAdapter()
150     {
151       public void mousePressed(MouseEvent e)
152       {
153         textarea_mousePressed(e);
154       }
155     });
156     editMenu.setText("Edit");
157     copyItem.setText("Copy");
158     copyItem.addActionListener(new ActionListener()
159     {
160       public void actionPerformed(ActionEvent e)
161       {
162         copyItem_actionPerformed(e);
163       }
164     });
165     displaySource.setText("Show HTML Source");
166     displaySource
167             .setToolTipText("Select this if you want to copy raw html");
168     displaySource.addActionListener(new ActionListener()
169     {
170
171       @Override
172       public void actionPerformed(ActionEvent arg0)
173       {
174         toggleHtml_actionPerformed(arg0);
175       }
176     });
177     editMenu.add(displaySource);
178     this.getContentPane().setLayout(borderLayout2);
179     scrollPane.setBorder(null);
180     scrollPane.getViewport().add(textarea, null);
181     editMenu.add(selectAll);
182     editMenu.add(copyItem);
183     this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
184     inputButtonPanel.add(ok);
185     inputButtonPanel.add(cancel);
186     jMenu1.add(save);
187     jMenu1.add(close);
188   }
189
190   protected void toggleHtml_actionPerformed(ActionEvent arg0)
191   {
192     // TODO Auto-generated method stub
193
194   }
195
196   /**
197    * DOCUMENT ME!
198    * 
199    * @param e
200    *          DOCUMENT ME!
201    */
202   public void textarea_mousePressed(MouseEvent e)
203   {
204
205   }
206
207   /**
208    * DOCUMENT ME!
209    * 
210    * @param e
211    *          DOCUMENT ME!
212    */
213   public void copyItem_actionPerformed(ActionEvent e)
214   {
215   }
216
217   /**
218    * DOCUMENT ME!
219    * 
220    * @param e
221    *          DOCUMENT ME!
222    */
223   public void ok_actionPerformed(ActionEvent e)
224   {
225   }
226
227   /**
228    * DOCUMENT ME!
229    * 
230    * @param e
231    *          DOCUMENT ME!
232    */
233   public void cancel_actionPerformed(ActionEvent e)
234   {
235   }
236
237   public void selectAll_actionPerformed(ActionEvent e)
238   {
239     textarea.selectAll();
240   }
241
242   public void save_actionPerformed(ActionEvent e)
243   {
244
245   }
246 }