2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
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.
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.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
20 import java.awt.BorderLayout;
21 import java.awt.Color;
22 import java.awt.Component;
23 import java.awt.Dimension;
25 import java.awt.GridLayout;
26 import java.awt.datatransfer.DataFlavor;
27 import java.awt.datatransfer.Transferable;
28 import java.awt.dnd.DnDConstants;
29 import java.awt.dnd.DropTarget;
30 import java.awt.dnd.DropTargetDragEvent;
31 import java.awt.dnd.DropTargetDropEvent;
32 import java.awt.dnd.DropTargetEvent;
33 import java.awt.dnd.DropTargetListener;
34 import java.awt.event.ActionEvent;
35 import java.awt.event.ActionListener;
36 import java.awt.event.ComponentEvent;
37 import java.awt.event.MouseEvent;
38 import java.awt.event.MouseListener;
40 import java.util.ArrayList;
41 import java.util.Collection;
42 import java.util.List;
44 import javax.swing.DefaultListModel;
45 import javax.swing.DefaultListSelectionModel;
46 import javax.swing.Icon;
47 import javax.swing.JButton;
48 import javax.swing.JFrame;
49 import javax.swing.JLabel;
50 import javax.swing.JList;
51 import javax.swing.JOptionPane;
52 import javax.swing.JPanel;
53 import javax.swing.JScrollPane;
54 import javax.swing.JSplitPane;
55 import javax.swing.JTextField;
56 import javax.swing.ListModel;
57 import javax.swing.ListSelectionModel;
58 import javax.swing.UIManager;
59 import javax.swing.UnsupportedLookAndFeelException;
60 import javax.swing.event.ListSelectionEvent;
61 import javax.swing.event.ListSelectionListener;
63 import fr.orsay.lri.varna.VARNAPanel;
64 import fr.orsay.lri.varna.components.ReorderableJList;
65 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
66 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
67 import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
68 import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
69 import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
70 import fr.orsay.lri.varna.models.FullBackup;
71 import fr.orsay.lri.varna.models.VARNAConfig;
72 import fr.orsay.lri.varna.models.rna.Mapping;
73 import fr.orsay.lri.varna.models.rna.RNA;
75 public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
76 implements DropTargetListener, InterfaceVARNAListener,
83 // private static final long serialVersionUID = -790155708306987257L;
85 private String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA";
87 private String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...)))))..";
89 private String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...)))))..";
93 protected JPanel _tools = new JPanel();
95 private JPanel _input = new JPanel();
97 private JPanel _seqPanel = new JPanel();
99 private JPanel _strPanel = new JPanel();
101 private JLabel _info = new JLabel();
103 private JTextField _str = new JTextField();
105 private JTextField _seq = new JTextField();
107 private JLabel _strLabel = new JLabel(" Str:");
109 private JLabel _seqLabel = new JLabel(" Seq:");
111 private JButton _createButton = new JButton("Create");
113 private JButton _updateButton = new JButton("Update");
115 private JButton _deleteButton = new JButton("Delete");
117 private JButton _duplicateButton = new JButton("Snapshot");
119 protected JPanel _listPanel = new JPanel();
121 private ReorderableJList _sideList = null;
123 private static String errorOpt = "error";
125 @SuppressWarnings("unused")
126 private boolean _error;
128 private Color _backgroundColor = Color.white;
130 private static int _nextID = 1;
132 @SuppressWarnings("unused")
133 private int _algoCode;
135 private BackupHolder _rnaList;
138 * public AppVarnaBinding() { //super("VARNA in Jalview");
139 * //this.set_seq("ATGC"); //this.set_str(".()."); //RNAPanelDemoInit();
141 * //initVarna("ATGCATGATATATATATAT","....((((...))))....");
142 * initVarna(this.DEFAULT_SEQUENCE,this.DEFAULT_STRUCTURE1); }
145 public AppVarnaBinding(String seq, String struc)
147 // super("VARNA in Jalview");
148 initVarna(seq, struc);
151 public AppVarnaBinding(ArrayList<RNA> rnaList)
153 // super("VARNA in Jalview");
154 initVarnaEdit(rnaList);
157 private void initVarna(String seq, String str)
159 DefaultListModel dlm = new DefaultListModel();
161 DefaultListSelectionModel m = new DefaultListSelectionModel();
162 m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
163 m.setLeadAnchorNotificationEnabled(false);
165 _sideList = new ReorderableJList();
166 _sideList.setModel(dlm);
167 _sideList.addMouseListener(this);
168 _sideList.setSelectionModel(m);
169 _sideList.setPreferredSize(new Dimension(100, 0));
170 _sideList.addListSelectionListener(new ListSelectionListener()
172 public void valueChanged(ListSelectionEvent arg0)
174 if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
176 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
177 Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
178 .getSize(), sel.rna.getSize());
179 vp.showRNAInterpolated(sel.rna, sel.config, map);
180 _seq.setText(sel.rna.getSeq());
181 _str.setText(sel.rna.getStructDBN());
186 _rnaList = new BackupHolder(dlm, _sideList);
187 RNA _RNA1 = new RNA("User defined 1");
191 vp = new VARNAPanel("0", ".");
192 _RNA1.setRNA(seq, str);
193 _RNA1.drawRNARadiate(vp.getConfig());
194 } catch (ExceptionNonEqualLength e)
197 } catch (ExceptionUnmatchedClosingParentheses e2)
199 e2.printStackTrace();
200 } catch (ExceptionFileFormatOrSyntax e3)
202 e3.printStackTrace();
204 vp.setPreferredSize(new Dimension(400, 400));
205 _rnaList.add(vp.getConfig().clone(), _RNA1, generateDefaultName(), true);
207 // TODO setBackground(_backgroundColor);
208 vp.setBackground(_backgroundColor);
210 // TODO getContentPane().setLayout(new BorderLayout());
211 // TODO getContentPane().add(vp, BorderLayout.CENTER);
214 vp.addVARNAListener(this);
217 private void initVarnaEdit(ArrayList<RNA> rnaInList)
219 DefaultListModel dlm = new DefaultListModel();
221 int marginTools = 40;
223 DefaultListSelectionModel m = new DefaultListSelectionModel();
224 m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
225 m.setLeadAnchorNotificationEnabled(false);
227 _sideList = new ReorderableJList();
228 _sideList.setModel(dlm);
229 _sideList.addMouseListener(this);
230 _sideList.setSelectionModel(m);
231 _sideList.setPreferredSize(new Dimension(100, 0));
232 _sideList.addListSelectionListener(new ListSelectionListener()
234 public void valueChanged(ListSelectionEvent arg0)
236 // System.out.println(arg0);
237 if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
239 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
240 Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
241 .getSize(), sel.rna.getSize());
242 vp.showRNAInterpolated(sel.rna, sel.config, map);
243 // _seq.setText(sel.rna.getSeq());
244 _str.setText(sel.rna.getStructDBN());
248 _rnaList = new BackupHolder(dlm, _sideList);
252 vp = new VARNAPanel("0", ".");
253 for (int i = 0; i < rnaInList.size(); i++)
255 rnaInList.get(i).drawRNARadiate(vp.getConfig());
257 } catch (ExceptionNonEqualLength e)
261 vp.setPreferredSize(new Dimension(400, 400));
262 for (int i = 0; i < rnaInList.size(); i++)
264 if (i < rnaInList.size() - 1)
266 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
271 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
272 .get(i).getName(), true);
277 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
278 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
281 JScrollPane listScroller = new JScrollPane(_sideList);
282 listScroller.setPreferredSize(new Dimension(150, 0));
284 vp.setBackground(_backgroundColor);
286 Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
288 // _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
289 // _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
290 _seq.setFont(textFieldsFont);
291 _seq.setText(rnaInList.get(0).getSeq());
293 _updateButton.addActionListener(new ActionListener()
295 public void actionPerformed(ActionEvent e)
297 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
298 sel.rna.setSequence("A");
302 // _seqPanel.setLayout(new BorderLayout());
303 // _seqPanel.add(_seqLabel, BorderLayout.WEST);
304 // _seqPanel.add(_seq, BorderLayout.CENTER);
306 _strLabel.setPreferredSize(new Dimension(marginTools, 15));
307 _strLabel.setHorizontalTextPosition(JLabel.LEFT);
308 _str.setFont(textFieldsFont);
309 _strPanel.setLayout(new BorderLayout());
310 _strPanel.add(_strLabel, BorderLayout.WEST);
311 _strPanel.add(_str, BorderLayout.CENTER);
313 _input.setLayout(new GridLayout(1, 0));
314 // _input.add(_seqPanel);
315 _input.add(_strPanel);
317 JPanel goPanel = new JPanel();
318 goPanel.setLayout(new BorderLayout());
320 _tools.setLayout(new BorderLayout());
321 _tools.add(_input, BorderLayout.CENTER);
322 // _tools.add(_info, BorderLayout.SOUTH);
323 _tools.add(goPanel, BorderLayout.EAST);
326 * _deleteButton.addActionListener(new ActionListener() { public void
327 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
328 * _duplicateButton.addActionListener(new ActionListener() { public void
329 * actionPerformed(ActionEvent e) {
330 * _rnaList.add((VARNAConfig)vp.getConfig().
331 * clone(),vp.getRNA().clone(),vp.getRNA
332 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
333 * Date()),true); }});
335 goPanel.add(_updateButton, BorderLayout.CENTER);
337 JPanel ops = new JPanel();
338 ops.setLayout(new GridLayout(1, 2));
339 ops.add(_deleteButton);
340 ops.add(_duplicateButton);
342 JLabel j = new JLabel("Structures Manager", JLabel.CENTER);
343 _listPanel.setLayout(new BorderLayout());
345 // _listPanel.add(ops, BorderLayout.SOUTH);
346 _listPanel.add(j, BorderLayout.NORTH);
347 _listPanel.add(listScroller, BorderLayout.CENTER);
349 // JSplitPane split = new
350 // JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
352 * TODO getContentPane().setLayout(new BorderLayout());
353 * getContentPane().add(split, BorderLayout.CENTER);
354 * getContentPane().add(_tools, BorderLayout.NORTH);
357 // TODO setVisible(true);
358 DropTarget dt = new DropTarget(vp, this);
360 vp.addVARNAListener(this);
363 public JPanel getTools()
368 public JPanel getListPanel()
374 * TODO: Is it effective to transfer the whole RNA?
376 * @return Currently selected RNA
378 public RNA getSelectedRNA()
380 return _rnaList.getElementAt(_sideList.getSelectedIndex()).rna;
384 * Substitute currently selected RNA with the edited one
388 public void updateSelectedRNA(RNA rnaEdit)
395 * private void RNAPanelDemoInit() { DefaultListModel dlm = new
396 * DefaultListModel();
399 * int marginTools = 40;
401 * DefaultListSelectionModel m = new DefaultListSelectionModel();
402 * m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
403 * m.setLeadAnchorNotificationEnabled(false);
406 * _sideList = new ReorderableJList(); _sideList.setModel(dlm);
407 * _sideList.addMouseListener(this); _sideList.setSelectionModel(m);
408 * _sideList.setPreferredSize(new Dimension(100, 0));
409 * _sideList.addListSelectionListener( new ListSelectionListener(){ public
410 * void valueChanged(ListSelectionEvent arg0) { //System.out.println(arg0); if
411 * (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) { FullBackup
412 * sel = (FullBackup) _sideList.getSelectedValue(); Mapping map =
413 * Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize());
414 * vp.showRNAInterpolated(sel.rna,sel.config,map);
415 * _seq.setText(sel.rna.getSeq()); _str.setText(sel.rna.getStructDBN()); } }
418 * _rnaList = new BackupHolder(dlm,_sideList); RNA _RNA1 = new
419 * RNA("User defined 1"); RNA _RNA2 = new RNA("User defined 2"); try { vp =
420 * new VARNAPanel("0","."); _RNA1.setRNA(DEFAULT_SEQUENCE,
421 * DEFAULT_STRUCTURE1); _RNA1.drawRNARadiate(vp.getConfig());
422 * _RNA2.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE2);
423 * _RNA2.drawRNARadiate(vp.getConfig()); } catch (ExceptionNonEqualLength e) {
424 * vp.errorDialog(e); } catch (ExceptionUnmatchedClosingParentheses e2) {
425 * e2.printStackTrace(); } catch (ExceptionFileFormatOrSyntax e3) {
426 * e3.printStackTrace(); } vp.setPreferredSize(new Dimension(400, 400));
427 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
428 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
430 * JScrollPane listScroller = new JScrollPane(_sideList);
431 * listScroller.setPreferredSize(new Dimension(150, 0));
433 * setBackground(_backgroundColor); vp.setBackground(_backgroundColor);
436 * Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
438 * _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
439 * _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
440 * _seq.setFont(textFieldsFont); _seq.setText(DEFAULT_SEQUENCE);
442 * _createButton.addActionListener(new ActionListener() { public void
443 * actionPerformed(ActionEvent e) { try { RNA nRNA = new
444 * RNA(generateDefaultName()); nRNA.setRNA(_seq.getText(), _str.getText());
445 * nRNA.drawRNARadiate(vp.getConfig()); _rnaList.add(new
446 * VARNAConfig(),nRNA,true); } catch (ExceptionUnmatchedClosingParentheses e1)
447 * { JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
448 * JOptionPane.ERROR_MESSAGE); } catch (ExceptionFileFormatOrSyntax e1) {
449 * JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
450 * JOptionPane.ERROR_MESSAGE); } } });
453 * _seqPanel.setLayout(new BorderLayout()); _seqPanel.add(_seqLabel,
454 * BorderLayout.WEST); _seqPanel.add(_seq, BorderLayout.CENTER);
456 * _strLabel.setPreferredSize(new Dimension(marginTools, 15));
457 * _strLabel.setHorizontalTextPosition(JLabel.LEFT);
458 * _str.setFont(textFieldsFont); _strPanel.setLayout(new BorderLayout());
459 * _strPanel.add(_strLabel, BorderLayout.WEST); _strPanel.add(_str,
460 * BorderLayout.CENTER);
462 * _input.setLayout(new GridLayout(2, 0)); _input.add(_seqPanel);
463 * _input.add(_strPanel);
465 * JPanel goPanel = new JPanel(); goPanel.setLayout(new BorderLayout());
467 * _tools.setLayout(new BorderLayout()); _tools.add(_input,
468 * BorderLayout.CENTER); _tools.add(_info, BorderLayout.SOUTH);
469 * _tools.add(goPanel, BorderLayout.EAST);
471 * _deleteButton.addActionListener(new ActionListener() { public void
472 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
473 * _duplicateButton.addActionListener(new ActionListener() { public void
474 * actionPerformed(ActionEvent e) {
475 * _rnaList.add((VARNAConfig)vp.getConfig().clone
476 * (),vp.getRNA().clone(),vp.getRNA
477 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
478 * Date()),true); }});
480 * JPanel ops = new JPanel(); ops.setLayout(new GridLayout(1,2));
481 * ops.add(_deleteButton); ops.add(_duplicateButton);
483 * JLabel j = new JLabel("Structures Manager",JLabel.CENTER);
484 * _listPanel.setLayout(new BorderLayout());
486 * _listPanel.add(ops,BorderLayout.SOUTH);
487 * _listPanel.add(j,BorderLayout.NORTH);
488 * _listPanel.add(listScroller,BorderLayout.CENTER);
490 * goPanel.add(_createButton, BorderLayout.CENTER);
492 * JSplitPane split = new
493 * JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
494 * getContentPane().setLayout(new BorderLayout()); getContentPane().add(split,
495 * BorderLayout.CENTER); getContentPane().add(_tools, BorderLayout.NORTH);
497 * setVisible(true); DropTarget dt = new DropTarget(vp, this);
499 * vp.addVARNAListener(this); }
501 public static String generateDefaultName()
503 return "User file #" + _nextID++;
508 return (RNA) _sideList.getSelectedValue();
511 public String[][] getParameterInfo()
515 // Parameter Name Kind of Value Description,
516 { "sequenceDBN", "String", "A raw RNA sequence" },
517 { "structureDBN", "String",
518 "An RNA structure in dot bracket notation (DBN)" },
519 { errorOpt, "boolean", "To show errors" }, };
525 vp.setBackground(_backgroundColor);
529 @SuppressWarnings("unused")
530 private Color getSafeColor(String col, Color def)
535 result = Color.decode(col);
536 } catch (Exception e)
540 result = Color.getColor(col, def);
541 } catch (Exception e2)
549 public VARNAPanel get_varnaPanel()
554 public void set_varnaPanel(VARNAPanel surface)
559 public String get_seq()
561 return _seq.getText();
564 public void set_seq(String _seq)
566 this._seq.setText(_seq);
569 public String get_str()
571 return _str.getText();
574 public void set_str(String _str)
576 this._str.setText(_str);
579 public JLabel get_info()
584 public void set_info(JLabel _info)
590 * public static void main(String[] args) { AppVarnaBinding d = new
591 * AppVarnaBinding(); d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
592 * d.pack(); d.setVisible(true); }
595 public void dragEnter(DropTargetDragEvent arg0)
597 // TODO Auto-generated method stub
601 public void dragExit(DropTargetEvent arg0)
603 // TODO Auto-generated method stub
607 public void dragOver(DropTargetDragEvent arg0)
609 // TODO Auto-generated method stub
613 public void drop(DropTargetDropEvent dtde)
617 Transferable tr = dtde.getTransferable();
618 DataFlavor[] flavors = tr.getTransferDataFlavors();
619 for (int i = 0; i < flavors.length; i++)
621 if (flavors[i].isFlavorJavaFileListType())
623 dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
624 Object ob = tr.getTransferData(flavors[i]);
625 if (ob instanceof List)
627 List list = (List) ob;
628 for (int j = 0; j < list.size(); j++)
630 Object o = list.get(j);
632 if (dtde.getSource() instanceof DropTarget)
634 DropTarget dt = (DropTarget) dtde.getSource();
635 Component c = dt.getComponent();
636 if (c instanceof VARNAPanel)
638 String path = o.toString();
639 VARNAPanel vp = (VARNAPanel) c;
642 FullBackup bck = VARNAPanel.importSession(path);
643 _rnaList.add(bck.config, bck.rna, bck.name, true);
644 } catch (ExceptionLoadingFailed e3)
647 Collection<RNA> mdls = fr.orsay.lri.varna.factories.RNAFactory
651 r.drawRNA(vp.getConfig());
652 String name = r.getName();
655 name = path.substring(path
656 .lastIndexOf(File.separatorChar) + 1);
660 name += " (Model " + mn++ + ")";
662 _rnaList.add(vp.getConfig().clone(), r, name, true);
669 // If we made it this far, everything worked.
670 dtde.dropComplete(true);
674 // Hmm, the user must not have dropped a file list
676 } catch (Exception e)
684 public void dropActionChanged(DropTargetDragEvent arg0)
688 private class BackupHolder
690 private DefaultListModel _rnaList;
692 private ArrayList<RNA> _rnas = new ArrayList<RNA>();
696 public BackupHolder(DefaultListModel rnaList, JList l)
702 public void add(VARNAConfig c, RNA r)
704 add(c, r, r.getName(), false);
707 public void add(VARNAConfig c, RNA r, boolean select)
709 add(c, r, r.getName(), select);
712 public void add(VARNAConfig c, RNA r, String name)
714 add(c, r, name, false);
717 public void add(VARNAConfig c, RNA r, String name, boolean select)
721 _l.removeSelectionInterval(0, _rnaList.size());
725 name = generateDefaultName();
727 FullBackup bck = new FullBackup(c, r, name);
729 _rnaList.add(0, bck);
732 _l.setSelectedIndex(0);
736 public void remove(int i)
743 public DefaultListModel getModel()
748 public boolean contains(RNA r)
750 return _rnas.contains(r);
754 * public int getSize() { return _rnaList.getSize(); }
756 public FullBackup getElementAt(int i)
758 return (FullBackup) _rnaList.getElementAt(i);
761 public void removeSelected()
763 int i = _l.getSelectedIndex();
766 if (_rnaList.getSize() == 1)
772 } catch (ExceptionUnmatchedClosingParentheses e1)
774 } catch (ExceptionFileFormatOrSyntax e1)
783 if (newi == _rnaList.getSize())
785 newi = _rnaList.getSize() - 2;
787 FullBackup bck = (FullBackup) _rnaList.getElementAt(newi);
788 _l.setSelectedValue(bck, true);
796 public void onLayoutChanged()
798 // TODO Auto-generated method stub
802 public void onUINewStructure(VARNAConfig v, RNA r)
804 _rnaList.add(v, r, "", true);
807 public void onWarningEmitted(String s)
809 // TODO Auto-generated method stub
813 public void mouseClicked(MouseEvent e)
815 if (e.getClickCount() == 2)
817 int index = _sideList.locationToIndex(e.getPoint());
818 ListModel dlm = _sideList.getModel();
819 FullBackup item = (FullBackup) dlm.getElementAt(index);
821 _sideList.ensureIndexIsVisible(index);
823 * TODO Object newName = JOptionPane.showInputDialog( this,
824 * "Specify a new name for this RNA", "Rename RNA",
825 * JOptionPane.QUESTION_MESSAGE, (Icon)null, null, item.toString()); if
826 * (newName!=null) { item.name = newName.toString();
827 * this._sideList.repaint(); }
832 public void mouseEntered(MouseEvent arg0)
834 // TODO Auto-generated method stub
838 public void mouseExited(MouseEvent arg0)
840 // TODO Auto-generated method stub
844 public void mousePressed(MouseEvent arg0)
846 // TODO Auto-generated method stub
850 public void mouseReleased(MouseEvent arg0)
852 // TODO Auto-generated method stub
857 public Color getColour(int atomIndex, int pdbResNum, String chain,
860 // TODO Auto-generated method stub
865 public String[] getPdbFile()
867 // TODO Auto-generated method stub
872 public void highlightAtom(int atomIndex, int pdbResNum, String chain,
875 // TODO Auto-generated method stub
880 public void mouseOverStructure(int atomIndex, String strInfo)
882 // TODO Auto-generated method stub
887 public void releaseReferences(Object svl)
889 // TODO Auto-generated method stub
894 public void updateColours(Object source)
896 // TODO Auto-generated method stub
901 public void componentHidden(ComponentEvent e)
903 // TODO Auto-generated method stub
908 public void componentMoved(ComponentEvent e)
910 // TODO Auto-generated method stub
915 public void componentResized(ComponentEvent e)
917 // TODO Auto-generated method stub
922 public void componentShown(ComponentEvent e)
924 // TODO Auto-generated method stub
929 public void onStructureRedrawn()
931 // TODO Auto-generated method stub
937 * public static void main(String[] args) { JTextField str = new
938 * JTextField("ATGC");
940 * AppVarnaBinding vab = new AppVarnaBinding(); vab.varnagui.set_seq(str);
941 * vab.varnagui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
942 * vab.varnagui.pack(); vab.varnagui.setVisible(true); } }