2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.text.DateFormat;
41 import java.util.ArrayList;
42 import java.util.Collection;
43 import java.util.Date;
44 import java.util.List;
46 import javax.swing.DefaultListModel;
47 import javax.swing.DefaultListSelectionModel;
48 import javax.swing.Icon;
49 import javax.swing.JButton;
50 import javax.swing.JFrame;
51 import javax.swing.JLabel;
52 import javax.swing.JList;
53 import javax.swing.JOptionPane;
54 import javax.swing.JPanel;
55 import javax.swing.JScrollPane;
56 import javax.swing.JSplitPane;
57 import javax.swing.JTextField;
58 import javax.swing.ListModel;
59 import javax.swing.ListSelectionModel;
60 import javax.swing.UIManager;
61 import javax.swing.UnsupportedLookAndFeelException;
62 import javax.swing.event.ListSelectionEvent;
63 import javax.swing.event.ListSelectionListener;
65 import fr.orsay.lri.varna.VARNAPanel;
66 import fr.orsay.lri.varna.components.ReorderableJList;
67 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
68 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
69 import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
70 import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
71 import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
72 import fr.orsay.lri.varna.models.FullBackup;
73 import fr.orsay.lri.varna.models.VARNAConfig;
74 import fr.orsay.lri.varna.models.rna.Mapping;
75 import fr.orsay.lri.varna.models.rna.RNA;
77 public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
78 implements DropTargetListener, InterfaceVARNAListener,
85 // private static final long serialVersionUID = -790155708306987257L;
87 private String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA";
89 private String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...)))))..";
91 private String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...)))))..";
95 protected JPanel _tools = new JPanel();
97 private JPanel _input = new JPanel();
99 private JPanel _seqPanel = new JPanel();
101 private JPanel _strPanel = new JPanel();
103 private JLabel _info = new JLabel();
105 private JTextField _str = new JTextField();
107 private JTextField _seq = new JTextField();
109 private JLabel _strLabel = new JLabel(" Str:");
111 private JLabel _seqLabel = new JLabel(" Seq:");
113 private JButton _createButton = new JButton("Create");
115 private JButton _updateButton = new JButton("Update");
117 private JButton _deleteButton = new JButton("Delete");
119 private JButton _duplicateButton = new JButton("Snapshot");
121 protected JPanel _listPanel = new JPanel();
123 private ReorderableJList _sideList = null;
125 private static String errorOpt = "error";
127 @SuppressWarnings("unused")
128 private boolean _error;
130 private Color _backgroundColor = Color.white;
132 private static int _nextID = 1;
134 @SuppressWarnings("unused")
135 private int _algoCode;
137 private BackupHolder _rnaList;
140 * public AppVarnaBinding() { //super("VARNA in Jalview");
141 * //this.set_seq("ATGC"); //this.set_str(".()."); //RNAPanelDemoInit();
143 * //initVarna("ATGCATGATATATATATAT","....((((...))))....");
144 * initVarna(this.DEFAULT_SEQUENCE,this.DEFAULT_STRUCTURE1); }
147 public AppVarnaBinding(String seq, String struc)
149 // super("VARNA in Jalview");
150 initVarna(seq, struc);
154 public AppVarnaBinding(ArrayList<RNA> rnaList)
157 // super("VARNA in Jalview");
158 initVarnaEdit(rnaList);
161 private void initVarna(String seq, String str)
164 DefaultListModel dlm = new DefaultListModel();
166 DefaultListSelectionModel m = new DefaultListSelectionModel();
167 m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
168 m.setLeadAnchorNotificationEnabled(false);
170 _sideList = new ReorderableJList();
171 _sideList.setModel(dlm);
172 _sideList.addMouseListener(this);
173 _sideList.setSelectionModel(m);
174 _sideList.setPreferredSize(new Dimension(100, 0));
175 _sideList.addListSelectionListener(new ListSelectionListener()
177 public void valueChanged(ListSelectionEvent arg0)
179 if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
181 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
182 Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
183 .getSize(), sel.rna.getSize());
184 vp.showRNAInterpolated(sel.rna, sel.config, map);
185 _seq.setText(sel.rna.getSeq());
186 _str.setText(sel.rna.getStructDBN());
191 _rnaList = new BackupHolder(dlm, _sideList);
192 RNA _RNA1 = new RNA("User defined 1");
197 vp = new VARNAPanel("0", ".");
198 _RNA1.setRNA(seq, str);
199 _RNA1.drawRNARadiate(vp.getConfig());
200 } catch (ExceptionNonEqualLength e)
203 } catch (ExceptionUnmatchedClosingParentheses e2)
205 e2.printStackTrace();
206 } catch (ExceptionFileFormatOrSyntax e3)
208 e3.printStackTrace();
210 vp.setPreferredSize(new Dimension(400, 400));
211 _rnaList.add(vp.getConfig().clone(), _RNA1, generateDefaultName(), true);
213 // TODO setBackground(_backgroundColor);
214 vp.setBackground(_backgroundColor);
216 // TODO getContentPane().setLayout(new BorderLayout());
217 // TODO getContentPane().add(vp, BorderLayout.CENTER);
220 vp.addVARNAListener(this);
223 private void initVarnaEdit(ArrayList<RNA> rnaInList)
226 DefaultListModel dlm = new DefaultListModel();
228 int marginTools = 40;
230 DefaultListSelectionModel m = new DefaultListSelectionModel();
231 m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
232 m.setLeadAnchorNotificationEnabled(false);
234 _sideList = new ReorderableJList();
235 _sideList.setModel(dlm);
236 _sideList.addMouseListener(this);
237 _sideList.setSelectionModel(m);
238 _sideList.setPreferredSize(new Dimension(100, 0));
239 _sideList.addListSelectionListener(new ListSelectionListener()
241 public void valueChanged(ListSelectionEvent arg0)
243 // System.out.println(arg0);
244 if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
246 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
247 Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
248 .getSize(), sel.rna.getSize());
249 //vp.showRNAInterpolated(sel.rna, sel.config, map);
250 vp.showRNA(sel.rna, sel.config);
251 // _seq.setText(sel.rna.getSeq());
252 _str.setText(sel.rna.getStructDBN());
256 _rnaList = new BackupHolder(dlm, _sideList);
261 vp = new VARNAPanel("0", ".");
262 for (int i = 0; i < rnaInList.size(); i++)
264 rnaInList.get(i).drawRNARadiate(vp.getConfig());
267 } catch (ExceptionNonEqualLength e)
271 vp.setPreferredSize(new Dimension(400, 400));
272 for (int i = 0; i < rnaInList.size(); i++)
274 if (i < rnaInList.size() - 1)
276 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
281 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
282 .get(i).getName(), true);
287 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
288 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
291 JScrollPane listScroller = new JScrollPane(_sideList);
292 listScroller.setPreferredSize(new Dimension(150, 0));
294 vp.setBackground(_backgroundColor);
296 Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
298 // _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
299 // _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
300 _seq.setFont(textFieldsFont);
301 _seq.setText(rnaInList.get(0).getSeq());
303 _updateButton.addActionListener(new ActionListener()
305 public void actionPerformed(ActionEvent e)
307 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
308 sel.rna.setSequence("A");
312 // _seqPanel.setLayout(new BorderLayout());
313 // _seqPanel.add(_seqLabel, BorderLayout.WEST);
314 // _seqPanel.add(_seq, BorderLayout.CENTER);
316 _strLabel.setPreferredSize(new Dimension(marginTools, 15));
317 _strLabel.setHorizontalTextPosition(JLabel.LEFT);
318 _str.setFont(textFieldsFont);
319 _strPanel.setLayout(new BorderLayout());
320 _strPanel.add(_strLabel, BorderLayout.WEST);
321 _strPanel.add(_str, BorderLayout.CENTER);
323 _input.setLayout(new GridLayout(1, 0));
324 // _input.add(_seqPanel);
325 _input.add(_strPanel);
327 JPanel goPanel = new JPanel();
328 goPanel.setLayout(new BorderLayout());
330 _tools.setLayout(new BorderLayout());
331 _tools.add(_input, BorderLayout.CENTER);
332 // _tools.add(_info, BorderLayout.SOUTH);
333 _tools.add(goPanel, BorderLayout.EAST);
336 * _deleteButton.addActionListener(new ActionListener() { public void
337 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
338 * _duplicateButton.addActionListener(new ActionListener() { public void
339 * actionPerformed(ActionEvent e) {
340 * _rnaList.add((VARNAConfig)vp.getConfig().
341 * clone(),vp.getRNA().clone(),vp.getRNA
342 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
343 * Date()),true); }});
345 goPanel.add(_updateButton, BorderLayout.CENTER);
347 JPanel ops = new JPanel();
348 ops.setLayout(new GridLayout(1, 2));
349 ops.add(_deleteButton);
350 ops.add(_duplicateButton);
352 JLabel j = new JLabel("Structures Manager", JLabel.CENTER);
353 _listPanel.setLayout(new BorderLayout());
355 //_listPanel.add(ops, BorderLayout.SOUTH);
356 _listPanel.add(j, BorderLayout.NORTH);
357 _listPanel.add(listScroller, BorderLayout.CENTER);
359 // JSplitPane split = new
360 // JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
362 * TODO getContentPane().setLayout(new BorderLayout());
363 * getContentPane().add(split, BorderLayout.CENTER);
364 * getContentPane().add(_tools, BorderLayout.NORTH);
367 // TODO setVisible(true);
368 DropTarget dt = new DropTarget(vp, this);
370 vp.addVARNAListener(this);
373 public JPanel getTools()
378 public JPanel getListPanel()
384 * TODO: Is it effective to transfer the whole RNA?
386 * @return Currently selected RNA
388 public RNA getSelectedRNA()
390 return _rnaList.getElementAt(_sideList.getSelectedIndex()).rna;
394 * Substitute currently selected RNA with the edited one
398 public void updateSelectedRNA(RNA rnaEdit)
405 * private void RNAPanelDemoInit() { DefaultListModel dlm = new
406 * DefaultListModel();
409 * int marginTools = 40;
411 * DefaultListSelectionModel m = new DefaultListSelectionModel();
412 * m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
413 * m.setLeadAnchorNotificationEnabled(false);
416 * _sideList = new ReorderableJList(); _sideList.setModel(dlm);
417 * _sideList.addMouseListener(this); _sideList.setSelectionModel(m);
418 * _sideList.setPreferredSize(new Dimension(100, 0));
419 * _sideList.addListSelectionListener( new ListSelectionListener(){ public
420 * void valueChanged(ListSelectionEvent arg0) { //System.out.println(arg0); if
421 * (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) { FullBackup
422 * sel = (FullBackup) _sideList.getSelectedValue(); Mapping map =
423 * Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize());
424 * vp.showRNAInterpolated(sel.rna,sel.config,map);
425 * _seq.setText(sel.rna.getSeq()); _str.setText(sel.rna.getStructDBN()); } }
428 * _rnaList = new BackupHolder(dlm,_sideList); RNA _RNA1 = new
429 * RNA("User defined 1"); RNA _RNA2 = new RNA("User defined 2"); try { vp =
430 * new VARNAPanel("0","."); _RNA1.setRNA(DEFAULT_SEQUENCE,
431 * DEFAULT_STRUCTURE1); _RNA1.drawRNARadiate(vp.getConfig());
432 * _RNA2.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE2);
433 * _RNA2.drawRNARadiate(vp.getConfig()); } catch (ExceptionNonEqualLength e) {
434 * vp.errorDialog(e); } catch (ExceptionUnmatchedClosingParentheses e2) {
435 * e2.printStackTrace(); } catch (ExceptionFileFormatOrSyntax e3) {
436 * e3.printStackTrace(); } vp.setPreferredSize(new Dimension(400, 400));
437 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
438 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
440 * JScrollPane listScroller = new JScrollPane(_sideList);
441 * listScroller.setPreferredSize(new Dimension(150, 0));
443 * setBackground(_backgroundColor); vp.setBackground(_backgroundColor);
446 * Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
448 * _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
449 * _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
450 * _seq.setFont(textFieldsFont); _seq.setText(DEFAULT_SEQUENCE);
452 * _createButton.addActionListener(new ActionListener() { public void
453 * actionPerformed(ActionEvent e) { try { RNA nRNA = new
454 * RNA(generateDefaultName()); nRNA.setRNA(_seq.getText(), _str.getText());
455 * nRNA.drawRNARadiate(vp.getConfig()); _rnaList.add(new
456 * VARNAConfig(),nRNA,true); } catch (ExceptionUnmatchedClosingParentheses e1)
457 * { JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
458 * JOptionPane.ERROR_MESSAGE); } catch (ExceptionFileFormatOrSyntax e1) {
459 * JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
460 * JOptionPane.ERROR_MESSAGE); } } });
463 * _seqPanel.setLayout(new BorderLayout()); _seqPanel.add(_seqLabel,
464 * BorderLayout.WEST); _seqPanel.add(_seq, BorderLayout.CENTER);
466 * _strLabel.setPreferredSize(new Dimension(marginTools, 15));
467 * _strLabel.setHorizontalTextPosition(JLabel.LEFT);
468 * _str.setFont(textFieldsFont); _strPanel.setLayout(new BorderLayout());
469 * _strPanel.add(_strLabel, BorderLayout.WEST); _strPanel.add(_str,
470 * BorderLayout.CENTER);
472 * _input.setLayout(new GridLayout(2, 0)); _input.add(_seqPanel);
473 * _input.add(_strPanel);
475 * JPanel goPanel = new JPanel(); goPanel.setLayout(new BorderLayout());
477 * _tools.setLayout(new BorderLayout()); _tools.add(_input,
478 * BorderLayout.CENTER); _tools.add(_info, BorderLayout.SOUTH);
479 * _tools.add(goPanel, BorderLayout.EAST);
481 * _deleteButton.addActionListener(new ActionListener() { public void
482 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
483 * _duplicateButton.addActionListener(new ActionListener() { public void
484 * actionPerformed(ActionEvent e) {
485 * _rnaList.add((VARNAConfig)vp.getConfig().clone
486 * (),vp.getRNA().clone(),vp.getRNA
487 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
488 * Date()),true); }});
490 * JPanel ops = new JPanel(); ops.setLayout(new GridLayout(1,2));
491 * ops.add(_deleteButton); ops.add(_duplicateButton);
493 * JLabel j = new JLabel("Structures Manager",JLabel.CENTER);
494 * _listPanel.setLayout(new BorderLayout());
496 * _listPanel.add(ops,BorderLayout.SOUTH);
497 * _listPanel.add(j,BorderLayout.NORTH);
498 * _listPanel.add(listScroller,BorderLayout.CENTER);
500 * goPanel.add(_createButton, BorderLayout.CENTER);
502 * JSplitPane split = new
503 * JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
504 * getContentPane().setLayout(new BorderLayout()); getContentPane().add(split,
505 * BorderLayout.CENTER); getContentPane().add(_tools, BorderLayout.NORTH);
507 * setVisible(true); DropTarget dt = new DropTarget(vp, this);
509 * vp.addVARNAListener(this); }
511 public static String generateDefaultName()
513 return "User file #" + _nextID++;
518 return (RNA) _sideList.getSelectedValue();
521 public String[][] getParameterInfo()
525 // Parameter Name Kind of Value Description,
526 { "sequenceDBN", "String", "A raw RNA sequence" },
527 { "structureDBN", "String",
528 "An RNA structure in dot bracket notation (DBN)" },
529 { errorOpt, "boolean", "To show errors" }, };
535 vp.setBackground(_backgroundColor);
539 @SuppressWarnings("unused")
540 private Color getSafeColor(String col, Color def)
545 result = Color.decode(col);
546 } catch (Exception e)
550 result = Color.getColor(col, def);
551 } catch (Exception e2)
559 public VARNAPanel get_varnaPanel()
564 public void set_varnaPanel(VARNAPanel surface)
569 public String get_seq()
571 return _seq.getText();
574 public void set_seq(String _seq)
576 this._seq.setText(_seq);
579 public String get_str()
581 return _str.getText();
584 public void set_str(String _str)
586 this._str.setText(_str);
589 public JLabel get_info()
594 public void set_info(JLabel _info)
600 * public static void main(String[] args) { AppVarnaBinding d = new
601 * AppVarnaBinding(); d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
602 * d.pack(); d.setVisible(true); }
605 public void dragEnter(DropTargetDragEvent arg0)
607 // TODO Auto-generated method stub
611 public void dragExit(DropTargetEvent arg0)
613 // TODO Auto-generated method stub
617 public void dragOver(DropTargetDragEvent arg0)
619 // TODO Auto-generated method stub
623 public void drop(DropTargetDropEvent dtde)
627 Transferable tr = dtde.getTransferable();
628 DataFlavor[] flavors = tr.getTransferDataFlavors();
629 for (int i = 0; i < flavors.length; i++)
631 if (flavors[i].isFlavorJavaFileListType())
633 dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
634 Object ob = tr.getTransferData(flavors[i]);
635 if (ob instanceof List)
637 List list = (List) ob;
638 for (int j = 0; j < list.size(); j++)
640 Object o = list.get(j);
642 if (dtde.getSource() instanceof DropTarget)
644 DropTarget dt = (DropTarget) dtde.getSource();
645 Component c = dt.getComponent();
646 if (c instanceof VARNAPanel)
648 String path = o.toString();
649 VARNAPanel vp = (VARNAPanel) c;
652 FullBackup bck = VARNAPanel.importSession(path);
653 _rnaList.add(bck.config, bck.rna, bck.name, true);
654 } catch (ExceptionLoadingFailed e3)
657 Collection<RNA> mdls=fr.orsay.lri.varna.factories.RNAFactory.loadSecStr(path);
660 r.drawRNA(vp.getConfig());
661 String name = r.getName();
664 name = path.substring(path
665 .lastIndexOf(File.separatorChar) + 1);
669 name += " (Model "+mn+++")";
671 _rnaList.add(vp.getConfig().clone(), r, name, true);
678 // If we made it this far, everything worked.
679 dtde.dropComplete(true);
683 // Hmm, the user must not have dropped a file list
685 } catch (Exception e)
693 public void dropActionChanged(DropTargetDragEvent arg0)
697 private class BackupHolder
699 private DefaultListModel _rnaList;
701 private ArrayList<RNA> _rnas = new ArrayList<RNA>();
705 public BackupHolder(DefaultListModel rnaList, JList l)
711 public void add(VARNAConfig c, RNA r)
713 add(c, r, r.getName(), false);
716 public void add(VARNAConfig c, RNA r, boolean select)
718 add(c, r, r.getName(), select);
721 public void add(VARNAConfig c, RNA r, String name)
723 add(c, r, name, false);
726 public void add(VARNAConfig c, RNA r, String name, boolean select)
730 _l.removeSelectionInterval(0, _rnaList.size());
734 name = generateDefaultName();
736 FullBackup bck = new FullBackup(c, r, name);
738 _rnaList.add(0, bck);
741 _l.setSelectedIndex(0);
745 public void remove(int i)
752 public DefaultListModel getModel()
757 public boolean contains(RNA r)
759 return _rnas.contains(r);
763 * public int getSize() { return _rnaList.getSize(); }
765 public FullBackup getElementAt(int i)
767 return (FullBackup) _rnaList.getElementAt(i);
770 public void removeSelected()
772 int i = _l.getSelectedIndex();
775 if (_rnaList.getSize() == 1)
781 } catch (ExceptionUnmatchedClosingParentheses e1)
783 } catch (ExceptionFileFormatOrSyntax e1)
792 if (newi == _rnaList.getSize())
794 newi = _rnaList.getSize() - 2;
796 FullBackup bck = (FullBackup) _rnaList.getElementAt(newi);
797 _l.setSelectedValue(bck, true);
805 public void onLayoutChanged()
807 // TODO Auto-generated method stub
811 public void onUINewStructure(VARNAConfig v, RNA r)
813 //_rnaList.add(v, r, "", true);
816 public void onWarningEmitted(String s)
818 // TODO Auto-generated method stub
822 public void mouseClicked(MouseEvent e)
824 if (e.getClickCount() == 2)
826 int index = _sideList.locationToIndex(e.getPoint());
827 ListModel dlm = _sideList.getModel();
828 FullBackup item = (FullBackup) dlm.getElementAt(index);
830 _sideList.ensureIndexIsVisible(index);
832 * TODO Object newName = JOptionPane.showInputDialog( this,
833 * "Specify a new name for this RNA", "Rename RNA",
834 * JOptionPane.QUESTION_MESSAGE, (Icon)null, null, item.toString()); if
835 * (newName!=null) { item.name = newName.toString();
836 * this._sideList.repaint(); }
841 public void mouseEntered(MouseEvent arg0)
843 // TODO Auto-generated method stub
847 public void mouseExited(MouseEvent arg0)
849 // TODO Auto-generated method stub
853 public void mousePressed(MouseEvent arg0)
855 // TODO Auto-generated method stub
859 public void mouseReleased(MouseEvent arg0)
861 // TODO Auto-generated method stub
866 public Color getColour(int atomIndex, int pdbResNum, String chain,
869 // TODO Auto-generated method stub
874 public String[] getPdbFile()
876 // TODO Auto-generated method stub
881 public void highlightAtom(int atomIndex, int pdbResNum, String chain,
884 // TODO Auto-generated method stub
889 public void mouseOverStructure(int atomIndex, String strInfo)
891 // TODO Auto-generated method stub
896 public void releaseReferences(Object svl)
898 // TODO Auto-generated method stub
903 public void updateColours(Object source)
905 // TODO Auto-generated method stub
910 public void componentHidden(ComponentEvent e)
912 // TODO Auto-generated method stub
917 public void componentMoved(ComponentEvent e)
919 // TODO Auto-generated method stub
924 public void componentResized(ComponentEvent e)
926 // TODO Auto-generated method stub
931 public void componentShown(ComponentEvent e)
933 // TODO Auto-generated method stub
938 public void onStructureRedrawn()
940 // TODO Auto-generated method stub
946 * public static void main(String[] args) { JTextField str = new
947 * JTextField("ATGC");
949 * AppVarnaBinding vab = new AppVarnaBinding(); vab.varnagui.set_seq(str);
950 * vab.varnagui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
951 * vab.varnagui.pack(); vab.varnagui.setVisible(true); } }