2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 The Jalview Authors
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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 import jalview.util.MessageManager;
23 import java.awt.BorderLayout;
24 import java.awt.Color;
25 import java.awt.Component;
26 import java.awt.Dimension;
28 import java.awt.GridLayout;
29 import java.awt.datatransfer.DataFlavor;
30 import java.awt.datatransfer.Transferable;
31 import java.awt.dnd.DnDConstants;
32 import java.awt.dnd.DropTarget;
33 import java.awt.dnd.DropTargetDragEvent;
34 import java.awt.dnd.DropTargetDropEvent;
35 import java.awt.dnd.DropTargetEvent;
36 import java.awt.dnd.DropTargetListener;
37 import java.awt.event.ActionEvent;
38 import java.awt.event.ActionListener;
39 import java.awt.event.ComponentEvent;
40 import java.awt.event.MouseEvent;
41 import java.awt.event.MouseListener;
43 import java.util.ArrayList;
44 import java.util.Collection;
45 import java.util.List;
47 import javax.swing.DefaultListModel;
48 import javax.swing.DefaultListSelectionModel;
49 import javax.swing.Icon;
50 import javax.swing.JButton;
51 import javax.swing.JFrame;
52 import javax.swing.JLabel;
53 import javax.swing.JList;
54 import javax.swing.JOptionPane;
55 import javax.swing.JPanel;
56 import javax.swing.JScrollPane;
57 import javax.swing.JSplitPane;
58 import javax.swing.JTextField;
59 import javax.swing.ListModel;
60 import javax.swing.ListSelectionModel;
61 import javax.swing.UIManager;
62 import javax.swing.UnsupportedLookAndFeelException;
63 import javax.swing.event.ListSelectionEvent;
64 import javax.swing.event.ListSelectionListener;
66 import fr.orsay.lri.varna.VARNAPanel;
67 import fr.orsay.lri.varna.components.ReorderableJList;
68 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
69 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
70 import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
71 import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
72 import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
73 import fr.orsay.lri.varna.models.FullBackup;
74 import fr.orsay.lri.varna.models.VARNAConfig;
75 import fr.orsay.lri.varna.models.rna.Mapping;
76 import fr.orsay.lri.varna.models.rna.RNA;
78 public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
79 implements DropTargetListener, InterfaceVARNAListener,
86 // private static final long serialVersionUID = -790155708306987257L;
88 private String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA";
90 private String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...)))))..";
92 private String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...)))))..";
96 protected JPanel _tools = new JPanel();
98 private JPanel _input = new JPanel();
100 private JPanel _seqPanel = new JPanel();
102 private JPanel _strPanel = new JPanel();
104 private JLabel _info = new JLabel();
106 private JTextField _str = new JTextField();
108 private JTextField _seq = new JTextField();
110 private JLabel _strLabel = new JLabel(MessageManager.getString("label.str"));
112 private JLabel _seqLabel = new JLabel(MessageManager.getString("label.seq"));
114 private JButton _createButton = new JButton(MessageManager.getString("action.create"));
116 private JButton _updateButton = new JButton(MessageManager.getString("action.update"));
118 private JButton _deleteButton = new JButton(MessageManager.getString("action.delete"));
120 private JButton _duplicateButton = new JButton(MessageManager.getString("action.snapshot"));
122 protected JPanel _listPanel = new JPanel();
124 private ReorderableJList _sideList = null;
126 private static String errorOpt = "error";
128 @SuppressWarnings("unused")
129 private boolean _error;
131 private Color _backgroundColor = Color.white;
133 private static int _nextID = 1;
135 @SuppressWarnings("unused")
136 private int _algoCode;
138 private BackupHolder _rnaList;
141 * public AppVarnaBinding() { //super("VARNA in Jalview");
142 * //this.set_seq("ATGC"); //this.set_str(".()."); //RNAPanelDemoInit();
144 * //initVarna("ATGCATGATATATATATAT","....((((...))))....");
145 * initVarna(this.DEFAULT_SEQUENCE,this.DEFAULT_STRUCTURE1); }
148 public AppVarnaBinding(String seq, String struc)
150 // super("VARNA in Jalview");
151 initVarna(seq, struc);
154 public AppVarnaBinding(ArrayList<RNA> rnaList)
156 // super("VARNA in Jalview");
157 initVarnaEdit(rnaList);
160 private void initVarna(String seq, String str)
162 DefaultListModel dlm = new DefaultListModel();
164 DefaultListSelectionModel m = new DefaultListSelectionModel();
165 m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
166 m.setLeadAnchorNotificationEnabled(false);
168 _sideList = new ReorderableJList();
169 _sideList.setModel(dlm);
170 _sideList.addMouseListener(this);
171 _sideList.setSelectionModel(m);
172 _sideList.setPreferredSize(new Dimension(100, 0));
173 _sideList.addListSelectionListener(new ListSelectionListener()
175 public void valueChanged(ListSelectionEvent arg0)
177 if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
179 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
180 Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
181 .getSize(), sel.rna.getSize());
182 vp.showRNAInterpolated(sel.rna, sel.config, map);
183 _seq.setText(sel.rna.getSeq());
184 _str.setText(sel.rna.getStructDBN());
189 _rnaList = new BackupHolder(dlm, _sideList);
190 RNA _RNA1 = new RNA("User defined 1");
194 vp = new VARNAPanel("0", ".");
195 _RNA1.setRNA(seq, str);
196 _RNA1.drawRNARadiate(vp.getConfig());
197 } catch (ExceptionNonEqualLength e)
200 } catch (ExceptionUnmatchedClosingParentheses e2)
202 e2.printStackTrace();
203 } catch (ExceptionFileFormatOrSyntax e3)
205 e3.printStackTrace();
207 vp.setPreferredSize(new Dimension(400, 400));
208 _rnaList.add(vp.getConfig().clone(), _RNA1, generateDefaultName(), true);
210 // TODO setBackground(_backgroundColor);
211 vp.setBackground(_backgroundColor);
213 // TODO getContentPane().setLayout(new BorderLayout());
214 // TODO getContentPane().add(vp, BorderLayout.CENTER);
217 vp.addVARNAListener(this);
220 private void initVarnaEdit(ArrayList<RNA> rnaInList)
222 DefaultListModel dlm = new DefaultListModel();
224 int marginTools = 40;
226 DefaultListSelectionModel m = new DefaultListSelectionModel();
227 m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
228 m.setLeadAnchorNotificationEnabled(false);
230 _sideList = new ReorderableJList();
231 _sideList.setModel(dlm);
232 _sideList.addMouseListener(this);
233 _sideList.setSelectionModel(m);
234 _sideList.setPreferredSize(new Dimension(100, 0));
235 _sideList.addListSelectionListener(new ListSelectionListener()
237 public void valueChanged(ListSelectionEvent arg0)
239 // System.out.println(arg0);
240 if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
242 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
243 Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
244 .getSize(), sel.rna.getSize());
245 vp.showRNAInterpolated(sel.rna, sel.config, map);
246 // _seq.setText(sel.rna.getSeq());
247 _str.setText(sel.rna.getStructDBN());
251 _rnaList = new BackupHolder(dlm, _sideList);
255 vp = new VARNAPanel("0", ".");
256 for (int i = 0; i < rnaInList.size(); i++)
258 rnaInList.get(i).drawRNARadiate(vp.getConfig());
260 } catch (ExceptionNonEqualLength e)
264 vp.setPreferredSize(new Dimension(400, 400));
265 for (int i = 0; i < rnaInList.size(); i++)
267 if (i < rnaInList.size() - 1)
269 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
274 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
275 .get(i).getName(), true);
280 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
281 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
284 JScrollPane listScroller = new JScrollPane(_sideList);
285 listScroller.setPreferredSize(new Dimension(150, 0));
287 vp.setBackground(_backgroundColor);
289 Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
291 // _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
292 // _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
293 _seq.setFont(textFieldsFont);
294 _seq.setText(rnaInList.get(0).getSeq());
296 _updateButton.addActionListener(new ActionListener()
298 public void actionPerformed(ActionEvent e)
300 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
301 sel.rna.setSequence("A");
305 // _seqPanel.setLayout(new BorderLayout());
306 // _seqPanel.add(_seqLabel, BorderLayout.WEST);
307 // _seqPanel.add(_seq, BorderLayout.CENTER);
309 _strLabel.setPreferredSize(new Dimension(marginTools, 15));
310 _strLabel.setHorizontalTextPosition(JLabel.LEFT);
311 _str.setFont(textFieldsFont);
312 _strPanel.setLayout(new BorderLayout());
313 _strPanel.add(_strLabel, BorderLayout.WEST);
314 _strPanel.add(_str, BorderLayout.CENTER);
316 _input.setLayout(new GridLayout(1, 0));
317 // _input.add(_seqPanel);
318 _input.add(_strPanel);
320 JPanel goPanel = new JPanel();
321 goPanel.setLayout(new BorderLayout());
323 _tools.setLayout(new BorderLayout());
324 _tools.add(_input, BorderLayout.CENTER);
325 // _tools.add(_info, BorderLayout.SOUTH);
326 _tools.add(goPanel, BorderLayout.EAST);
329 * _deleteButton.addActionListener(new ActionListener() { public void
330 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
331 * _duplicateButton.addActionListener(new ActionListener() { public void
332 * actionPerformed(ActionEvent e) {
333 * _rnaList.add((VARNAConfig)vp.getConfig().
334 * clone(),vp.getRNA().clone(),vp.getRNA
335 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
336 * Date()),true); }});
338 goPanel.add(_updateButton, BorderLayout.CENTER);
340 JPanel ops = new JPanel();
341 ops.setLayout(new GridLayout(1, 2));
342 ops.add(_deleteButton);
343 ops.add(_duplicateButton);
345 JLabel j = new JLabel(MessageManager.getString("label.structures_manager"), JLabel.CENTER);
346 _listPanel.setLayout(new BorderLayout());
348 // _listPanel.add(ops, BorderLayout.SOUTH);
349 _listPanel.add(j, BorderLayout.NORTH);
350 _listPanel.add(listScroller, BorderLayout.CENTER);
352 // JSplitPane split = new
353 // JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
355 * TODO getContentPane().setLayout(new BorderLayout());
356 * getContentPane().add(split, BorderLayout.CENTER);
357 * getContentPane().add(_tools, BorderLayout.NORTH);
360 // TODO setVisible(true);
361 DropTarget dt = new DropTarget(vp, this);
363 vp.addVARNAListener(this);
366 public JPanel getTools()
371 public JPanel getListPanel()
377 * TODO: Is it effective to transfer the whole RNA?
379 * @return Currently selected RNA
381 public RNA getSelectedRNA()
383 return _rnaList.getElementAt(_sideList.getSelectedIndex()).rna;
387 * Substitute currently selected RNA with the edited one
391 public void updateSelectedRNA(RNA rnaEdit)
398 * private void RNAPanelDemoInit() { DefaultListModel dlm = new
399 * DefaultListModel();
402 * int marginTools = 40;
404 * DefaultListSelectionModel m = new DefaultListSelectionModel();
405 * m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
406 * m.setLeadAnchorNotificationEnabled(false);
409 * _sideList = new ReorderableJList(); _sideList.setModel(dlm);
410 * _sideList.addMouseListener(this); _sideList.setSelectionModel(m);
411 * _sideList.setPreferredSize(new Dimension(100, 0));
412 * _sideList.addListSelectionListener( new ListSelectionListener(){ public
413 * void valueChanged(ListSelectionEvent arg0) { //System.out.println(arg0); if
414 * (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) { FullBackup
415 * sel = (FullBackup) _sideList.getSelectedValue(); Mapping map =
416 * Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize());
417 * vp.showRNAInterpolated(sel.rna,sel.config,map);
418 * _seq.setText(sel.rna.getSeq()); _str.setText(sel.rna.getStructDBN()); } }
421 * _rnaList = new BackupHolder(dlm,_sideList); RNA _RNA1 = new
422 * RNA("User defined 1"); RNA _RNA2 = new RNA("User defined 2"); try { vp =
423 * new VARNAPanel("0","."); _RNA1.setRNA(DEFAULT_SEQUENCE,
424 * DEFAULT_STRUCTURE1); _RNA1.drawRNARadiate(vp.getConfig());
425 * _RNA2.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE2);
426 * _RNA2.drawRNARadiate(vp.getConfig()); } catch (ExceptionNonEqualLength e) {
427 * vp.errorDialog(e); } catch (ExceptionUnmatchedClosingParentheses e2) {
428 * e2.printStackTrace(); } catch (ExceptionFileFormatOrSyntax e3) {
429 * e3.printStackTrace(); } vp.setPreferredSize(new Dimension(400, 400));
430 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
431 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
433 * JScrollPane listScroller = new JScrollPane(_sideList);
434 * listScroller.setPreferredSize(new Dimension(150, 0));
436 * setBackground(_backgroundColor); vp.setBackground(_backgroundColor);
439 * Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
441 * _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
442 * _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
443 * _seq.setFont(textFieldsFont); _seq.setText(DEFAULT_SEQUENCE);
445 * _createButton.addActionListener(new ActionListener() { public void
446 * actionPerformed(ActionEvent e) { try { RNA nRNA = new
447 * RNA(generateDefaultName()); nRNA.setRNA(_seq.getText(), _str.getText());
448 * nRNA.drawRNARadiate(vp.getConfig()); _rnaList.add(new
449 * VARNAConfig(),nRNA,true); } catch (ExceptionUnmatchedClosingParentheses e1)
450 * { JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
451 * JOptionPane.ERROR_MESSAGE); } catch (ExceptionFileFormatOrSyntax e1) {
452 * JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
453 * JOptionPane.ERROR_MESSAGE); } } });
456 * _seqPanel.setLayout(new BorderLayout()); _seqPanel.add(_seqLabel,
457 * BorderLayout.WEST); _seqPanel.add(_seq, BorderLayout.CENTER);
459 * _strLabel.setPreferredSize(new Dimension(marginTools, 15));
460 * _strLabel.setHorizontalTextPosition(JLabel.LEFT);
461 * _str.setFont(textFieldsFont); _strPanel.setLayout(new BorderLayout());
462 * _strPanel.add(_strLabel, BorderLayout.WEST); _strPanel.add(_str,
463 * BorderLayout.CENTER);
465 * _input.setLayout(new GridLayout(2, 0)); _input.add(_seqPanel);
466 * _input.add(_strPanel);
468 * JPanel goPanel = new JPanel(); goPanel.setLayout(new BorderLayout());
470 * _tools.setLayout(new BorderLayout()); _tools.add(_input,
471 * BorderLayout.CENTER); _tools.add(_info, BorderLayout.SOUTH);
472 * _tools.add(goPanel, BorderLayout.EAST);
474 * _deleteButton.addActionListener(new ActionListener() { public void
475 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
476 * _duplicateButton.addActionListener(new ActionListener() { public void
477 * actionPerformed(ActionEvent e) {
478 * _rnaList.add((VARNAConfig)vp.getConfig().clone
479 * (),vp.getRNA().clone(),vp.getRNA
480 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
481 * Date()),true); }});
483 * JPanel ops = new JPanel(); ops.setLayout(new GridLayout(1,2));
484 * ops.add(_deleteButton); ops.add(_duplicateButton);
486 * JLabel j = new JLabel("Structures Manager",JLabel.CENTER);
487 * _listPanel.setLayout(new BorderLayout());
489 * _listPanel.add(ops,BorderLayout.SOUTH);
490 * _listPanel.add(j,BorderLayout.NORTH);
491 * _listPanel.add(listScroller,BorderLayout.CENTER);
493 * goPanel.add(_createButton, BorderLayout.CENTER);
495 * JSplitPane split = new
496 * JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
497 * getContentPane().setLayout(new BorderLayout()); getContentPane().add(split,
498 * BorderLayout.CENTER); getContentPane().add(_tools, BorderLayout.NORTH);
500 * setVisible(true); DropTarget dt = new DropTarget(vp, this);
502 * vp.addVARNAListener(this); }
504 public static String generateDefaultName()
506 return "User file #" + _nextID++;
511 return (RNA) _sideList.getSelectedValue();
514 public String[][] getParameterInfo()
518 // Parameter Name Kind of Value Description,
519 { "sequenceDBN", "String", "A raw RNA sequence" },
520 { "structureDBN", "String",
521 "An RNA structure in dot bracket notation (DBN)" },
522 { errorOpt, "boolean", "To show errors" }, };
528 vp.setBackground(_backgroundColor);
532 @SuppressWarnings("unused")
533 private Color getSafeColor(String col, Color def)
538 result = Color.decode(col);
539 } catch (Exception e)
543 result = Color.getColor(col, def);
544 } catch (Exception e2)
552 public VARNAPanel get_varnaPanel()
557 public void set_varnaPanel(VARNAPanel surface)
562 public String get_seq()
564 return _seq.getText();
567 public void set_seq(String _seq)
569 this._seq.setText(_seq);
572 public String get_str()
574 return _str.getText();
577 public void set_str(String _str)
579 this._str.setText(_str);
582 public JLabel get_info()
587 public void set_info(JLabel _info)
593 * public static void main(String[] args) { AppVarnaBinding d = new
594 * AppVarnaBinding(); d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
595 * d.pack(); d.setVisible(true); }
598 public void dragEnter(DropTargetDragEvent arg0)
600 // TODO Auto-generated method stub
604 public void dragExit(DropTargetEvent arg0)
606 // TODO Auto-generated method stub
610 public void dragOver(DropTargetDragEvent arg0)
612 // TODO Auto-generated method stub
616 public void drop(DropTargetDropEvent dtde)
620 Transferable tr = dtde.getTransferable();
621 DataFlavor[] flavors = tr.getTransferDataFlavors();
622 for (int i = 0; i < flavors.length; i++)
624 if (flavors[i].isFlavorJavaFileListType())
626 dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
627 Object ob = tr.getTransferData(flavors[i]);
628 if (ob instanceof List)
630 List list = (List) ob;
631 for (int j = 0; j < list.size(); j++)
633 Object o = list.get(j);
635 if (dtde.getSource() instanceof DropTarget)
637 DropTarget dt = (DropTarget) dtde.getSource();
638 Component c = dt.getComponent();
639 if (c instanceof VARNAPanel)
641 String path = o.toString();
642 VARNAPanel vp = (VARNAPanel) c;
645 FullBackup bck = VARNAPanel.importSession(path);
646 _rnaList.add(bck.config, bck.rna, bck.name, true);
647 } catch (ExceptionLoadingFailed e3)
650 Collection<RNA> mdls = fr.orsay.lri.varna.factories.RNAFactory
654 r.drawRNA(vp.getConfig());
655 String name = r.getName();
658 name = path.substring(path
659 .lastIndexOf(File.separatorChar) + 1);
663 name += " (Model " + mn++ + ")";
665 _rnaList.add(vp.getConfig().clone(), r, name, true);
672 // If we made it this far, everything worked.
673 dtde.dropComplete(true);
677 // Hmm, the user must not have dropped a file list
679 } catch (Exception e)
687 public void dropActionChanged(DropTargetDragEvent arg0)
691 private class BackupHolder
693 private DefaultListModel _rnaList;
695 private ArrayList<RNA> _rnas = new ArrayList<RNA>();
699 public BackupHolder(DefaultListModel rnaList, JList l)
705 public void add(VARNAConfig c, RNA r)
707 add(c, r, r.getName(), false);
710 public void add(VARNAConfig c, RNA r, boolean select)
712 add(c, r, r.getName(), select);
715 public void add(VARNAConfig c, RNA r, String name)
717 add(c, r, name, false);
720 public void add(VARNAConfig c, RNA r, String name, boolean select)
724 _l.removeSelectionInterval(0, _rnaList.size());
728 name = generateDefaultName();
730 FullBackup bck = new FullBackup(c, r, name);
732 _rnaList.add(0, bck);
735 _l.setSelectedIndex(0);
739 public void remove(int i)
746 public DefaultListModel getModel()
751 public boolean contains(RNA r)
753 return _rnas.contains(r);
757 * public int getSize() { return _rnaList.getSize(); }
759 public FullBackup getElementAt(int i)
761 return (FullBackup) _rnaList.getElementAt(i);
764 public void removeSelected()
766 int i = _l.getSelectedIndex();
769 if (_rnaList.getSize() == 1)
775 } catch (ExceptionUnmatchedClosingParentheses e1)
777 } catch (ExceptionFileFormatOrSyntax e1)
786 if (newi == _rnaList.getSize())
788 newi = _rnaList.getSize() - 2;
790 FullBackup bck = (FullBackup) _rnaList.getElementAt(newi);
791 _l.setSelectedValue(bck, true);
799 public void onLayoutChanged()
801 // TODO Auto-generated method stub
805 public void onUINewStructure(VARNAConfig v, RNA r)
807 _rnaList.add(v, r, "", true);
810 public void onWarningEmitted(String s)
812 // TODO Auto-generated method stub
816 public void mouseClicked(MouseEvent e)
818 if (e.getClickCount() == 2)
820 int index = _sideList.locationToIndex(e.getPoint());
821 ListModel dlm = _sideList.getModel();
822 FullBackup item = (FullBackup) dlm.getElementAt(index);
824 _sideList.ensureIndexIsVisible(index);
826 * TODO Object newName = JOptionPane.showInputDialog( this,
827 * "Specify a new name for this RNA", "Rename RNA",
828 * JOptionPane.QUESTION_MESSAGE, (Icon)null, null, item.toString()); if
829 * (newName!=null) { item.name = newName.toString();
830 * this._sideList.repaint(); }
835 public void mouseEntered(MouseEvent arg0)
837 // TODO Auto-generated method stub
841 public void mouseExited(MouseEvent arg0)
843 // TODO Auto-generated method stub
847 public void mousePressed(MouseEvent arg0)
849 // TODO Auto-generated method stub
853 public void mouseReleased(MouseEvent arg0)
855 // TODO Auto-generated method stub
860 public Color getColour(int atomIndex, int pdbResNum, String chain,
863 // TODO Auto-generated method stub
868 public String[] getPdbFile()
870 // TODO Auto-generated method stub
875 public void highlightAtom(int atomIndex, int pdbResNum, String chain,
878 // TODO Auto-generated method stub
883 public void mouseOverStructure(int atomIndex, String strInfo)
885 // TODO Auto-generated method stub
890 public void releaseReferences(Object svl)
892 // TODO Auto-generated method stub
897 public void updateColours(Object source)
899 // TODO Auto-generated method stub
904 public void componentHidden(ComponentEvent e)
906 // TODO Auto-generated method stub
911 public void componentMoved(ComponentEvent e)
913 // TODO Auto-generated method stub
918 public void componentResized(ComponentEvent e)
920 // TODO Auto-generated method stub
925 public void componentShown(ComponentEvent e)
927 // TODO Auto-generated method stub
932 public void onStructureRedrawn()
934 // TODO Auto-generated method stub
940 * public static void main(String[] args) { JTextField str = new
941 * JTextField("ATGC");
943 * AppVarnaBinding vab = new AppVarnaBinding(); vab.varnagui.set_seq(str);
944 * vab.varnagui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
945 * vab.varnagui.pack(); vab.varnagui.setVisible(true); } }