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);
151 System.out.println("here(1)");
154 public AppVarnaBinding(ArrayList<RNA> rnaList)
156 System.out.println("here(2)");
157 // super("VARNA in Jalview");
158 initVarnaEdit(rnaList);
161 private void initVarna(String seq, String str)
163 System.out.println("initialisation VARNA (appvarnabinding");
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");
196 System.out.println("here");
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)
225 System.out.println("initialisation VARNA(2) (appvarnabinding");
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 // _seq.setText(sel.rna.getSeq());
251 _str.setText(sel.rna.getStructDBN());
255 _rnaList = new BackupHolder(dlm, _sideList);
259 System.out.println("here(plop)");
260 vp = new VARNAPanel("0", ".");
261 for (int i = 0; i < rnaInList.size(); i++)
263 rnaInList.get(i).drawRNARadiate(vp.getConfig());
264 System.out.println(i);
266 } catch (ExceptionNonEqualLength e)
270 vp.setPreferredSize(new Dimension(400, 400));
271 for (int i = 0; i < rnaInList.size(); i++)
273 if (i < rnaInList.size() - 1)
275 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
280 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
281 .get(i).getName(), true);
286 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
287 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
290 JScrollPane listScroller = new JScrollPane(_sideList);
291 listScroller.setPreferredSize(new Dimension(150, 0));
293 vp.setBackground(_backgroundColor);
295 Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
297 // _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
298 // _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
299 _seq.setFont(textFieldsFont);
300 _seq.setText(rnaInList.get(0).getSeq());
302 _updateButton.addActionListener(new ActionListener()
304 public void actionPerformed(ActionEvent e)
306 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
307 sel.rna.setSequence("A");
311 // _seqPanel.setLayout(new BorderLayout());
312 // _seqPanel.add(_seqLabel, BorderLayout.WEST);
313 // _seqPanel.add(_seq, BorderLayout.CENTER);
315 _strLabel.setPreferredSize(new Dimension(marginTools, 15));
316 _strLabel.setHorizontalTextPosition(JLabel.LEFT);
317 _str.setFont(textFieldsFont);
318 _strPanel.setLayout(new BorderLayout());
319 _strPanel.add(_strLabel, BorderLayout.WEST);
320 _strPanel.add(_str, BorderLayout.CENTER);
322 _input.setLayout(new GridLayout(1, 0));
323 // _input.add(_seqPanel);
324 _input.add(_strPanel);
326 JPanel goPanel = new JPanel();
327 goPanel.setLayout(new BorderLayout());
329 _tools.setLayout(new BorderLayout());
330 _tools.add(_input, BorderLayout.CENTER);
331 // _tools.add(_info, BorderLayout.SOUTH);
332 _tools.add(goPanel, BorderLayout.EAST);
335 * _deleteButton.addActionListener(new ActionListener() { public void
336 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
337 * _duplicateButton.addActionListener(new ActionListener() { public void
338 * actionPerformed(ActionEvent e) {
339 * _rnaList.add((VARNAConfig)vp.getConfig().
340 * clone(),vp.getRNA().clone(),vp.getRNA
341 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
342 * Date()),true); }});
344 goPanel.add(_updateButton, BorderLayout.CENTER);
346 JPanel ops = new JPanel();
347 ops.setLayout(new GridLayout(1, 2));
348 ops.add(_deleteButton);
349 ops.add(_duplicateButton);
351 JLabel j = new JLabel("Structures Manager", JLabel.CENTER);
352 _listPanel.setLayout(new BorderLayout());
354 //_listPanel.add(ops, BorderLayout.SOUTH);
355 _listPanel.add(j, BorderLayout.NORTH);
356 _listPanel.add(listScroller, BorderLayout.CENTER);
358 // JSplitPane split = new
359 // JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
361 * TODO getContentPane().setLayout(new BorderLayout());
362 * getContentPane().add(split, BorderLayout.CENTER);
363 * getContentPane().add(_tools, BorderLayout.NORTH);
366 // TODO setVisible(true);
367 DropTarget dt = new DropTarget(vp, this);
369 vp.addVARNAListener(this);
372 public JPanel getTools()
377 public JPanel getListPanel()
383 * TODO: Is it effective to transfer the whole RNA?
385 * @return Currently selected RNA
387 public RNA getSelectedRNA()
389 return _rnaList.getElementAt(_sideList.getSelectedIndex()).rna;
393 * Substitute currently selected RNA with the edited one
397 public void updateSelectedRNA(RNA rnaEdit)
404 * private void RNAPanelDemoInit() { DefaultListModel dlm = new
405 * DefaultListModel();
408 * int marginTools = 40;
410 * DefaultListSelectionModel m = new DefaultListSelectionModel();
411 * m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
412 * m.setLeadAnchorNotificationEnabled(false);
415 * _sideList = new ReorderableJList(); _sideList.setModel(dlm);
416 * _sideList.addMouseListener(this); _sideList.setSelectionModel(m);
417 * _sideList.setPreferredSize(new Dimension(100, 0));
418 * _sideList.addListSelectionListener( new ListSelectionListener(){ public
419 * void valueChanged(ListSelectionEvent arg0) { //System.out.println(arg0); if
420 * (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) { FullBackup
421 * sel = (FullBackup) _sideList.getSelectedValue(); Mapping map =
422 * Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize());
423 * vp.showRNAInterpolated(sel.rna,sel.config,map);
424 * _seq.setText(sel.rna.getSeq()); _str.setText(sel.rna.getStructDBN()); } }
427 * _rnaList = new BackupHolder(dlm,_sideList); RNA _RNA1 = new
428 * RNA("User defined 1"); RNA _RNA2 = new RNA("User defined 2"); try { vp =
429 * new VARNAPanel("0","."); _RNA1.setRNA(DEFAULT_SEQUENCE,
430 * DEFAULT_STRUCTURE1); _RNA1.drawRNARadiate(vp.getConfig());
431 * _RNA2.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE2);
432 * _RNA2.drawRNARadiate(vp.getConfig()); } catch (ExceptionNonEqualLength e) {
433 * vp.errorDialog(e); } catch (ExceptionUnmatchedClosingParentheses e2) {
434 * e2.printStackTrace(); } catch (ExceptionFileFormatOrSyntax e3) {
435 * e3.printStackTrace(); } vp.setPreferredSize(new Dimension(400, 400));
436 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
437 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
439 * JScrollPane listScroller = new JScrollPane(_sideList);
440 * listScroller.setPreferredSize(new Dimension(150, 0));
442 * setBackground(_backgroundColor); vp.setBackground(_backgroundColor);
445 * Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
447 * _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
448 * _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
449 * _seq.setFont(textFieldsFont); _seq.setText(DEFAULT_SEQUENCE);
451 * _createButton.addActionListener(new ActionListener() { public void
452 * actionPerformed(ActionEvent e) { try { RNA nRNA = new
453 * RNA(generateDefaultName()); nRNA.setRNA(_seq.getText(), _str.getText());
454 * nRNA.drawRNARadiate(vp.getConfig()); _rnaList.add(new
455 * VARNAConfig(),nRNA,true); } catch (ExceptionUnmatchedClosingParentheses e1)
456 * { JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
457 * JOptionPane.ERROR_MESSAGE); } catch (ExceptionFileFormatOrSyntax e1) {
458 * JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
459 * JOptionPane.ERROR_MESSAGE); } } });
462 * _seqPanel.setLayout(new BorderLayout()); _seqPanel.add(_seqLabel,
463 * BorderLayout.WEST); _seqPanel.add(_seq, BorderLayout.CENTER);
465 * _strLabel.setPreferredSize(new Dimension(marginTools, 15));
466 * _strLabel.setHorizontalTextPosition(JLabel.LEFT);
467 * _str.setFont(textFieldsFont); _strPanel.setLayout(new BorderLayout());
468 * _strPanel.add(_strLabel, BorderLayout.WEST); _strPanel.add(_str,
469 * BorderLayout.CENTER);
471 * _input.setLayout(new GridLayout(2, 0)); _input.add(_seqPanel);
472 * _input.add(_strPanel);
474 * JPanel goPanel = new JPanel(); goPanel.setLayout(new BorderLayout());
476 * _tools.setLayout(new BorderLayout()); _tools.add(_input,
477 * BorderLayout.CENTER); _tools.add(_info, BorderLayout.SOUTH);
478 * _tools.add(goPanel, BorderLayout.EAST);
480 * _deleteButton.addActionListener(new ActionListener() { public void
481 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
482 * _duplicateButton.addActionListener(new ActionListener() { public void
483 * actionPerformed(ActionEvent e) {
484 * _rnaList.add((VARNAConfig)vp.getConfig().clone
485 * (),vp.getRNA().clone(),vp.getRNA
486 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
487 * Date()),true); }});
489 * JPanel ops = new JPanel(); ops.setLayout(new GridLayout(1,2));
490 * ops.add(_deleteButton); ops.add(_duplicateButton);
492 * JLabel j = new JLabel("Structures Manager",JLabel.CENTER);
493 * _listPanel.setLayout(new BorderLayout());
495 * _listPanel.add(ops,BorderLayout.SOUTH);
496 * _listPanel.add(j,BorderLayout.NORTH);
497 * _listPanel.add(listScroller,BorderLayout.CENTER);
499 * goPanel.add(_createButton, BorderLayout.CENTER);
501 * JSplitPane split = new
502 * JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
503 * getContentPane().setLayout(new BorderLayout()); getContentPane().add(split,
504 * BorderLayout.CENTER); getContentPane().add(_tools, BorderLayout.NORTH);
506 * setVisible(true); DropTarget dt = new DropTarget(vp, this);
508 * vp.addVARNAListener(this); }
510 public static String generateDefaultName()
512 return "User file #" + _nextID++;
517 return (RNA) _sideList.getSelectedValue();
520 public String[][] getParameterInfo()
524 // Parameter Name Kind of Value Description,
525 { "sequenceDBN", "String", "A raw RNA sequence" },
526 { "structureDBN", "String",
527 "An RNA structure in dot bracket notation (DBN)" },
528 { errorOpt, "boolean", "To show errors" }, };
534 vp.setBackground(_backgroundColor);
538 @SuppressWarnings("unused")
539 private Color getSafeColor(String col, Color def)
544 result = Color.decode(col);
545 } catch (Exception e)
549 result = Color.getColor(col, def);
550 } catch (Exception e2)
558 public VARNAPanel get_varnaPanel()
563 public void set_varnaPanel(VARNAPanel surface)
568 public String get_seq()
570 return _seq.getText();
573 public void set_seq(String _seq)
575 this._seq.setText(_seq);
578 public String get_str()
580 return _str.getText();
583 public void set_str(String _str)
585 this._str.setText(_str);
588 public JLabel get_info()
593 public void set_info(JLabel _info)
599 * public static void main(String[] args) { AppVarnaBinding d = new
600 * AppVarnaBinding(); d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
601 * d.pack(); d.setVisible(true); }
604 public void dragEnter(DropTargetDragEvent arg0)
606 // TODO Auto-generated method stub
610 public void dragExit(DropTargetEvent arg0)
612 // TODO Auto-generated method stub
616 public void dragOver(DropTargetDragEvent arg0)
618 // TODO Auto-generated method stub
622 public void drop(DropTargetDropEvent dtde)
626 Transferable tr = dtde.getTransferable();
627 DataFlavor[] flavors = tr.getTransferDataFlavors();
628 for (int i = 0; i < flavors.length; i++)
630 if (flavors[i].isFlavorJavaFileListType())
632 dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
633 Object ob = tr.getTransferData(flavors[i]);
634 if (ob instanceof List)
636 List list = (List) ob;
637 for (int j = 0; j < list.size(); j++)
639 Object o = list.get(j);
641 if (dtde.getSource() instanceof DropTarget)
643 DropTarget dt = (DropTarget) dtde.getSource();
644 Component c = dt.getComponent();
645 if (c instanceof VARNAPanel)
647 String path = o.toString();
648 VARNAPanel vp = (VARNAPanel) c;
651 FullBackup bck = VARNAPanel.importSession(path);
652 _rnaList.add(bck.config, bck.rna, bck.name, true);
653 } catch (ExceptionLoadingFailed e3)
656 Collection<RNA> mdls=fr.orsay.lri.varna.factories.RNAFactory.loadSecStr(path);
659 r.drawRNA(vp.getConfig());
660 String name = r.getName();
663 name = path.substring(path
664 .lastIndexOf(File.separatorChar) + 1);
668 name += " (Model "+mn+++")";
670 _rnaList.add(vp.getConfig().clone(), r, name, true);
677 // If we made it this far, everything worked.
678 dtde.dropComplete(true);
682 // Hmm, the user must not have dropped a file list
684 } catch (Exception e)
692 public void dropActionChanged(DropTargetDragEvent arg0)
696 private class BackupHolder
698 private DefaultListModel _rnaList;
700 private ArrayList<RNA> _rnas = new ArrayList<RNA>();
704 public BackupHolder(DefaultListModel rnaList, JList l)
710 public void add(VARNAConfig c, RNA r)
712 add(c, r, r.getName(), false);
715 public void add(VARNAConfig c, RNA r, boolean select)
717 add(c, r, r.getName(), select);
720 public void add(VARNAConfig c, RNA r, String name)
722 add(c, r, name, false);
725 public void add(VARNAConfig c, RNA r, String name, boolean select)
729 _l.removeSelectionInterval(0, _rnaList.size());
733 name = generateDefaultName();
735 FullBackup bck = new FullBackup(c, r, name);
737 _rnaList.add(0, bck);
740 _l.setSelectedIndex(0);
744 public void remove(int i)
751 public DefaultListModel getModel()
756 public boolean contains(RNA r)
758 return _rnas.contains(r);
762 * public int getSize() { return _rnaList.getSize(); }
764 public FullBackup getElementAt(int i)
766 return (FullBackup) _rnaList.getElementAt(i);
769 public void removeSelected()
771 int i = _l.getSelectedIndex();
774 if (_rnaList.getSize() == 1)
780 } catch (ExceptionUnmatchedClosingParentheses e1)
782 } catch (ExceptionFileFormatOrSyntax e1)
791 if (newi == _rnaList.getSize())
793 newi = _rnaList.getSize() - 2;
795 FullBackup bck = (FullBackup) _rnaList.getElementAt(newi);
796 _l.setSelectedValue(bck, true);
804 public void onLayoutChanged()
806 // TODO Auto-generated method stub
810 public void onUINewStructure(VARNAConfig v, RNA r)
812 _rnaList.add(v, r, "", true);
815 public void onWarningEmitted(String s)
817 // TODO Auto-generated method stub
821 public void mouseClicked(MouseEvent e)
823 if (e.getClickCount() == 2)
825 int index = _sideList.locationToIndex(e.getPoint());
826 ListModel dlm = _sideList.getModel();
827 FullBackup item = (FullBackup) dlm.getElementAt(index);
829 _sideList.ensureIndexIsVisible(index);
831 * TODO Object newName = JOptionPane.showInputDialog( this,
832 * "Specify a new name for this RNA", "Rename RNA",
833 * JOptionPane.QUESTION_MESSAGE, (Icon)null, null, item.toString()); if
834 * (newName!=null) { item.name = newName.toString();
835 * this._sideList.repaint(); }
840 public void mouseEntered(MouseEvent arg0)
842 // TODO Auto-generated method stub
846 public void mouseExited(MouseEvent arg0)
848 // TODO Auto-generated method stub
852 public void mousePressed(MouseEvent arg0)
854 // TODO Auto-generated method stub
858 public void mouseReleased(MouseEvent arg0)
860 // TODO Auto-generated method stub
865 public Color getColour(int atomIndex, int pdbResNum, String chain,
868 // TODO Auto-generated method stub
873 public String[] getPdbFile()
875 // TODO Auto-generated method stub
880 public void highlightAtom(int atomIndex, int pdbResNum, String chain,
883 // TODO Auto-generated method stub
888 public void mouseOverStructure(int atomIndex, String strInfo)
890 // TODO Auto-generated method stub
895 public void releaseReferences(Object svl)
897 // TODO Auto-generated method stub
902 public void updateColours(Object source)
904 // TODO Auto-generated method stub
909 public void componentHidden(ComponentEvent e)
911 // TODO Auto-generated method stub
916 public void componentMoved(ComponentEvent e)
918 // TODO Auto-generated method stub
923 public void componentResized(ComponentEvent e)
925 // TODO Auto-generated method stub
930 public void componentShown(ComponentEvent e)
932 // TODO Auto-generated method stub
937 public void onStructureRedrawn()
939 // TODO Auto-generated method stub
945 * public static void main(String[] args) { JTextField str = new
946 * JTextField("ATGC");
948 * AppVarnaBinding vab = new AppVarnaBinding(); vab.varnagui.set_seq(str);
949 * vab.varnagui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
950 * vab.varnagui.pack(); vab.varnagui.setVisible(true); } }