2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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.JButton;
50 import javax.swing.JLabel;
51 import javax.swing.JList;
52 import javax.swing.JPanel;
53 import javax.swing.JScrollPane;
54 import javax.swing.JTextField;
55 import javax.swing.ListModel;
56 import javax.swing.ListSelectionModel;
57 import javax.swing.event.ListSelectionEvent;
58 import javax.swing.event.ListSelectionListener;
60 import fr.orsay.lri.varna.VARNAPanel;
61 import fr.orsay.lri.varna.components.ReorderableJList;
62 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
63 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
64 import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
65 import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
66 import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
67 import fr.orsay.lri.varna.models.FullBackup;
68 import fr.orsay.lri.varna.models.VARNAConfig;
69 import fr.orsay.lri.varna.models.rna.Mapping;
70 import fr.orsay.lri.varna.models.rna.RNA;
72 public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
73 implements DropTargetListener, InterfaceVARNAListener,
80 // private static final long serialVersionUID = -790155708306987257L;
82 private String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA";
84 private String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...)))))..";
86 private String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...)))))..";
90 protected JPanel _tools = new JPanel();
92 private JPanel _input = new JPanel();
94 private JPanel _seqPanel = new JPanel();
96 private JPanel _strPanel = new JPanel();
98 private JLabel _info = new JLabel();
100 private JTextField _str = new JTextField();
102 private JTextField _seq = new JTextField();
104 private JLabel _strLabel = new JLabel(MessageManager.getString("label.str"));
106 private JLabel _seqLabel = new JLabel(MessageManager.getString("label.seq"));
108 private JButton _createButton = new JButton(MessageManager.getString("action.create"));
110 private JButton _updateButton = new JButton(MessageManager.getString("action.update"));
112 private JButton _deleteButton = new JButton(MessageManager.getString("action.delete"));
114 private JButton _duplicateButton = new JButton(MessageManager.getString("action.snapshot"));
116 protected JPanel _listPanel = new JPanel();
118 private ReorderableJList _sideList = null;
120 private static String errorOpt = "error";
122 @SuppressWarnings("unused")
123 private boolean _error;
125 private Color _backgroundColor = Color.white;
127 private static int _nextID = 1;
129 @SuppressWarnings("unused")
130 private int _algoCode;
132 private BackupHolder _rnaList;
135 * public AppVarnaBinding() { //super("VARNA in Jalview");
136 * //this.set_seq("ATGC"); //this.set_str(".()."); //RNAPanelDemoInit();
138 * //initVarna("ATGCATGATATATATATAT","....((((...))))....");
139 * initVarna(this.DEFAULT_SEQUENCE,this.DEFAULT_STRUCTURE1); }
142 public AppVarnaBinding(String seq, String struc)
144 // super("VARNA in Jalview");
145 initVarna(seq, struc);
149 public AppVarnaBinding(ArrayList<RNA> rnaList)
152 // super("VARNA in Jalview");
153 initVarnaEdit(rnaList);
156 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");
192 vp = new VARNAPanel("0", ".");
193 _RNA1.setRNA(seq, str);
194 _RNA1.drawRNARadiate(vp.getConfig());
195 } catch (ExceptionNonEqualLength e)
198 } catch (ExceptionUnmatchedClosingParentheses e2)
200 e2.printStackTrace();
201 } catch (ExceptionFileFormatOrSyntax e3)
203 e3.printStackTrace();
205 vp.setPreferredSize(new Dimension(400, 400));
206 _rnaList.add(vp.getConfig().clone(), _RNA1, generateDefaultName(), true);
208 // TODO setBackground(_backgroundColor);
209 vp.setBackground(_backgroundColor);
211 // TODO getContentPane().setLayout(new BorderLayout());
212 // TODO getContentPane().add(vp, BorderLayout.CENTER);
215 vp.addVARNAListener(this);
218 private void initVarnaEdit(ArrayList<RNA> rnaInList)
221 DefaultListModel dlm = new DefaultListModel();
223 int marginTools = 40;
225 DefaultListSelectionModel m = new DefaultListSelectionModel();
226 m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
227 m.setLeadAnchorNotificationEnabled(false);
229 _sideList = new ReorderableJList();
230 _sideList.setModel(dlm);
231 _sideList.addMouseListener(this);
232 _sideList.setSelectionModel(m);
233 _sideList.setPreferredSize(new Dimension(100, 0));
234 _sideList.addListSelectionListener(new ListSelectionListener()
236 public void valueChanged(ListSelectionEvent arg0)
238 // System.out.println(arg0);
239 if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
241 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
242 Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
243 .getSize(), sel.rna.getSize());
244 //vp.showRNAInterpolated(sel.rna, sel.config, map);
245 vp.showRNA(sel.rna, sel.config);
246 // _seq.setText(sel.rna.getSeq());
247 _str.setText(sel.rna.getStructDBN());
251 _rnaList = new BackupHolder(dlm, _sideList);
256 vp = new VARNAPanel("0", ".");
257 for (int i = 0; i < rnaInList.size(); i++)
259 rnaInList.get(i).drawRNARadiate(vp.getConfig());
262 } catch (ExceptionNonEqualLength e)
266 vp.setPreferredSize(new Dimension(400, 400));
267 for (int i = 0; i < rnaInList.size(); i++)
269 if (i < rnaInList.size() - 1)
271 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
276 _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
277 .get(i).getName(), true);
282 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
283 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
286 JScrollPane listScroller = new JScrollPane(_sideList);
287 listScroller.setPreferredSize(new Dimension(150, 0));
289 vp.setBackground(_backgroundColor);
291 Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
293 // _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
294 // _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
295 _seq.setFont(textFieldsFont);
296 _seq.setText(rnaInList.get(0).getSeq());
298 _updateButton.addActionListener(new ActionListener()
300 public void actionPerformed(ActionEvent e)
302 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
303 sel.rna.setSequence("A");
307 // _seqPanel.setLayout(new BorderLayout());
308 // _seqPanel.add(_seqLabel, BorderLayout.WEST);
309 // _seqPanel.add(_seq, BorderLayout.CENTER);
311 _strLabel.setPreferredSize(new Dimension(marginTools, 15));
312 _strLabel.setHorizontalTextPosition(JLabel.LEFT);
313 _str.setFont(textFieldsFont);
314 _strPanel.setLayout(new BorderLayout());
315 _strPanel.add(_strLabel, BorderLayout.WEST);
316 _strPanel.add(_str, BorderLayout.CENTER);
318 _input.setLayout(new GridLayout(1, 0));
319 // _input.add(_seqPanel);
320 _input.add(_strPanel);
322 JPanel goPanel = new JPanel();
323 goPanel.setLayout(new BorderLayout());
325 _tools.setLayout(new BorderLayout());
326 _tools.add(_input, BorderLayout.CENTER);
327 // _tools.add(_info, BorderLayout.SOUTH);
328 _tools.add(goPanel, BorderLayout.EAST);
331 * _deleteButton.addActionListener(new ActionListener() { public void
332 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
333 * _duplicateButton.addActionListener(new ActionListener() { public void
334 * actionPerformed(ActionEvent e) {
335 * _rnaList.add((VARNAConfig)vp.getConfig().
336 * clone(),vp.getRNA().clone(),vp.getRNA
337 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
338 * Date()),true); }});
340 goPanel.add(_updateButton, BorderLayout.CENTER);
342 JPanel ops = new JPanel();
343 ops.setLayout(new GridLayout(1, 2));
344 ops.add(_deleteButton);
345 ops.add(_duplicateButton);
347 JLabel j = new JLabel(MessageManager.getString("label.structures_manager"), JLabel.CENTER);
348 _listPanel.setLayout(new BorderLayout());
350 // _listPanel.add(ops, BorderLayout.SOUTH);
351 _listPanel.add(j, BorderLayout.NORTH);
352 _listPanel.add(listScroller, BorderLayout.CENTER);
354 // JSplitPane split = new
355 // JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
357 * TODO getContentPane().setLayout(new BorderLayout());
358 * getContentPane().add(split, BorderLayout.CENTER);
359 * getContentPane().add(_tools, BorderLayout.NORTH);
362 // TODO setVisible(true);
363 DropTarget dt = new DropTarget(vp, this);
365 vp.addVARNAListener(this);
368 public JPanel getTools()
373 public JPanel getListPanel()
379 * TODO: Is it effective to transfer the whole RNA?
381 * @return Currently selected RNA
383 public RNA getSelectedRNA()
385 return _rnaList.getElementAt(_sideList.getSelectedIndex()).rna;
389 * Substitute currently selected RNA with the edited one
393 public void updateSelectedRNA(RNA rnaEdit)
400 * private void RNAPanelDemoInit() { DefaultListModel dlm = new
401 * DefaultListModel();
404 * int marginTools = 40;
406 * DefaultListSelectionModel m = new DefaultListSelectionModel();
407 * m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
408 * m.setLeadAnchorNotificationEnabled(false);
411 * _sideList = new ReorderableJList(); _sideList.setModel(dlm);
412 * _sideList.addMouseListener(this); _sideList.setSelectionModel(m);
413 * _sideList.setPreferredSize(new Dimension(100, 0));
414 * _sideList.addListSelectionListener( new ListSelectionListener(){ public
415 * void valueChanged(ListSelectionEvent arg0) { //System.out.println(arg0); if
416 * (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) { FullBackup
417 * sel = (FullBackup) _sideList.getSelectedValue(); Mapping map =
418 * Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize());
419 * vp.showRNAInterpolated(sel.rna,sel.config,map);
420 * _seq.setText(sel.rna.getSeq()); _str.setText(sel.rna.getStructDBN()); } }
423 * _rnaList = new BackupHolder(dlm,_sideList); RNA _RNA1 = new
424 * RNA("User defined 1"); RNA _RNA2 = new RNA("User defined 2"); try { vp =
425 * new VARNAPanel("0","."); _RNA1.setRNA(DEFAULT_SEQUENCE,
426 * DEFAULT_STRUCTURE1); _RNA1.drawRNARadiate(vp.getConfig());
427 * _RNA2.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE2);
428 * _RNA2.drawRNARadiate(vp.getConfig()); } catch (ExceptionNonEqualLength e) {
429 * vp.errorDialog(e); } catch (ExceptionUnmatchedClosingParentheses e2) {
430 * e2.printStackTrace(); } catch (ExceptionFileFormatOrSyntax e3) {
431 * e3.printStackTrace(); } vp.setPreferredSize(new Dimension(400, 400));
432 * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
433 * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
435 * JScrollPane listScroller = new JScrollPane(_sideList);
436 * listScroller.setPreferredSize(new Dimension(150, 0));
438 * setBackground(_backgroundColor); vp.setBackground(_backgroundColor);
441 * Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
443 * _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
444 * _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
445 * _seq.setFont(textFieldsFont); _seq.setText(DEFAULT_SEQUENCE);
447 * _createButton.addActionListener(new ActionListener() { public void
448 * actionPerformed(ActionEvent e) { try { RNA nRNA = new
449 * RNA(generateDefaultName()); nRNA.setRNA(_seq.getText(), _str.getText());
450 * nRNA.drawRNARadiate(vp.getConfig()); _rnaList.add(new
451 * VARNAConfig(),nRNA,true); } catch (ExceptionUnmatchedClosingParentheses e1)
452 * { JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
453 * JOptionPane.ERROR_MESSAGE); } catch (ExceptionFileFormatOrSyntax e1) {
454 * JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
455 * JOptionPane.ERROR_MESSAGE); } } });
458 * _seqPanel.setLayout(new BorderLayout()); _seqPanel.add(_seqLabel,
459 * BorderLayout.WEST); _seqPanel.add(_seq, BorderLayout.CENTER);
461 * _strLabel.setPreferredSize(new Dimension(marginTools, 15));
462 * _strLabel.setHorizontalTextPosition(JLabel.LEFT);
463 * _str.setFont(textFieldsFont); _strPanel.setLayout(new BorderLayout());
464 * _strPanel.add(_strLabel, BorderLayout.WEST); _strPanel.add(_str,
465 * BorderLayout.CENTER);
467 * _input.setLayout(new GridLayout(2, 0)); _input.add(_seqPanel);
468 * _input.add(_strPanel);
470 * JPanel goPanel = new JPanel(); goPanel.setLayout(new BorderLayout());
472 * _tools.setLayout(new BorderLayout()); _tools.add(_input,
473 * BorderLayout.CENTER); _tools.add(_info, BorderLayout.SOUTH);
474 * _tools.add(goPanel, BorderLayout.EAST);
476 * _deleteButton.addActionListener(new ActionListener() { public void
477 * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
478 * _duplicateButton.addActionListener(new ActionListener() { public void
479 * actionPerformed(ActionEvent e) {
480 * _rnaList.add((VARNAConfig)vp.getConfig().clone
481 * (),vp.getRNA().clone(),vp.getRNA
482 * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
483 * Date()),true); }});
485 * JPanel ops = new JPanel(); ops.setLayout(new GridLayout(1,2));
486 * ops.add(_deleteButton); ops.add(_duplicateButton);
488 * JLabel j = new JLabel("Structures Manager",JLabel.CENTER);
489 * _listPanel.setLayout(new BorderLayout());
491 * _listPanel.add(ops,BorderLayout.SOUTH);
492 * _listPanel.add(j,BorderLayout.NORTH);
493 * _listPanel.add(listScroller,BorderLayout.CENTER);
495 * goPanel.add(_createButton, BorderLayout.CENTER);
497 * JSplitPane split = new
498 * JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
499 * getContentPane().setLayout(new BorderLayout()); getContentPane().add(split,
500 * BorderLayout.CENTER); getContentPane().add(_tools, BorderLayout.NORTH);
502 * setVisible(true); DropTarget dt = new DropTarget(vp, this);
504 * vp.addVARNAListener(this); }
506 public static String generateDefaultName()
508 return "User file #" + _nextID++;
513 return (RNA) _sideList.getSelectedValue();
516 public String[][] getParameterInfo()
520 // Parameter Name Kind of Value Description,
521 { "sequenceDBN", "String", "A raw RNA sequence" },
522 { "structureDBN", "String",
523 "An RNA structure in dot bracket notation (DBN)" },
524 { errorOpt, "boolean", "To show errors" }, };
530 vp.setBackground(_backgroundColor);
534 @SuppressWarnings("unused")
535 private Color getSafeColor(String col, Color def)
540 result = Color.decode(col);
541 } catch (Exception e)
545 result = Color.getColor(col, def);
546 } catch (Exception e2)
554 public VARNAPanel get_varnaPanel()
559 public void set_varnaPanel(VARNAPanel surface)
564 public String get_seq()
566 return _seq.getText();
569 public void set_seq(String _seq)
571 this._seq.setText(_seq);
574 public String get_str()
576 return _str.getText();
579 public void set_str(String _str)
581 this._str.setText(_str);
584 public JLabel get_info()
589 public void set_info(JLabel _info)
595 * public static void main(String[] args) { AppVarnaBinding d = new
596 * AppVarnaBinding(); d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
597 * d.pack(); d.setVisible(true); }
600 public void dragEnter(DropTargetDragEvent arg0)
602 // TODO Auto-generated method stub
606 public void dragExit(DropTargetEvent arg0)
608 // TODO Auto-generated method stub
612 public void dragOver(DropTargetDragEvent arg0)
614 // TODO Auto-generated method stub
618 public void drop(DropTargetDropEvent dtde)
622 Transferable tr = dtde.getTransferable();
623 DataFlavor[] flavors = tr.getTransferDataFlavors();
624 for (int i = 0; i < flavors.length; i++)
626 if (flavors[i].isFlavorJavaFileListType())
628 dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
629 Object ob = tr.getTransferData(flavors[i]);
630 if (ob instanceof List)
632 List list = (List) ob;
633 for (int j = 0; j < list.size(); j++)
635 Object o = list.get(j);
637 if (dtde.getSource() instanceof DropTarget)
639 DropTarget dt = (DropTarget) dtde.getSource();
640 Component c = dt.getComponent();
641 if (c instanceof VARNAPanel)
643 String path = o.toString();
644 VARNAPanel vp = (VARNAPanel) c;
647 FullBackup bck = VARNAPanel.importSession(path);
648 _rnaList.add(bck.config, bck.rna, bck.name, true);
649 } catch (ExceptionLoadingFailed e3)
652 Collection<RNA> mdls = fr.orsay.lri.varna.factories.RNAFactory
656 r.drawRNA(vp.getConfig());
657 String name = r.getName();
660 name = path.substring(path
661 .lastIndexOf(File.separatorChar) + 1);
665 name += " (Model " + mn++ + ")";
667 _rnaList.add(vp.getConfig().clone(), r, name, true);
674 // If we made it this far, everything worked.
675 dtde.dropComplete(true);
679 // Hmm, the user must not have dropped a file list
681 } catch (Exception e)
689 public void dropActionChanged(DropTargetDragEvent arg0)
693 private class BackupHolder
695 private DefaultListModel _rnaList;
697 private ArrayList<RNA> _rnas = new ArrayList<RNA>();
701 public BackupHolder(DefaultListModel rnaList, JList l)
707 public void add(VARNAConfig c, RNA r)
709 add(c, r, r.getName(), false);
712 public void add(VARNAConfig c, RNA r, boolean select)
714 add(c, r, r.getName(), select);
717 public void add(VARNAConfig c, RNA r, String name)
719 add(c, r, name, false);
722 public void add(VARNAConfig c, RNA r, String name, boolean select)
726 _l.removeSelectionInterval(0, _rnaList.size());
730 name = generateDefaultName();
732 FullBackup bck = new FullBackup(c, r, name);
734 _rnaList.add(0, bck);
737 _l.setSelectedIndex(0);
741 public void remove(int i)
748 public DefaultListModel getModel()
753 public boolean contains(RNA r)
755 return _rnas.contains(r);
759 * public int getSize() { return _rnaList.getSize(); }
761 public FullBackup getElementAt(int i)
763 return (FullBackup) _rnaList.getElementAt(i);
766 public void removeSelected()
768 int i = _l.getSelectedIndex();
771 if (_rnaList.getSize() == 1)
777 } catch (ExceptionUnmatchedClosingParentheses e1)
779 } catch (ExceptionFileFormatOrSyntax e1)
788 if (newi == _rnaList.getSize())
790 newi = _rnaList.getSize() - 2;
792 FullBackup bck = (FullBackup) _rnaList.getElementAt(newi);
793 _l.setSelectedValue(bck, true);
801 public void onLayoutChanged()
803 // TODO Auto-generated method stub
807 public void onUINewStructure(VARNAConfig v, RNA r)
809 // patch to fix infinite loop
810 // The problem is that onUINewStructure is called when user clicks
811 // check with Yann about whether Jalview should do anything with this event.
812 // e.g. if user has used VARNA's menu to import a structure .. Jalview may need to be told which structure is displayed.
814 // _rnaList.add(v, r, "", true);
817 public void onWarningEmitted(String s)
819 // TODO Auto-generated method stub
823 public void mouseClicked(MouseEvent e)
825 if (e.getClickCount() == 2)
827 int index = _sideList.locationToIndex(e.getPoint());
828 ListModel dlm = _sideList.getModel();
829 FullBackup item = (FullBackup) dlm.getElementAt(index);
831 _sideList.ensureIndexIsVisible(index);
833 * TODO Object newName = JOptionPane.showInputDialog( this,
834 * "Specify a new name for this RNA", "Rename RNA",
835 * JOptionPane.QUESTION_MESSAGE, (Icon)null, null, item.toString()); if
836 * (newName!=null) { item.name = newName.toString();
837 * this._sideList.repaint(); }
842 public void mouseEntered(MouseEvent arg0)
844 // TODO Auto-generated method stub
848 public void mouseExited(MouseEvent arg0)
850 // TODO Auto-generated method stub
854 public void mousePressed(MouseEvent arg0)
856 // TODO Auto-generated method stub
860 public void mouseReleased(MouseEvent arg0)
862 // TODO Auto-generated method stub
867 public Color getColour(int atomIndex, int pdbResNum, String chain,
870 // TODO Auto-generated method stub
875 public String[] getPdbFile()
877 // TODO Auto-generated method stub
882 public void highlightAtom(int atomIndex, int pdbResNum, String chain,
885 // TODO Auto-generated method stub
890 public void mouseOverStructure(int atomIndex, String strInfo)
892 // TODO Auto-generated method stub
897 public void releaseReferences(Object svl)
899 // TODO Auto-generated method stub
904 public void updateColours(Object source)
906 // TODO Auto-generated method stub
911 public void componentHidden(ComponentEvent e)
913 // TODO Auto-generated method stub
918 public void componentMoved(ComponentEvent e)
920 // TODO Auto-generated method stub
925 public void componentResized(ComponentEvent e)
927 // TODO Auto-generated method stub
932 public void componentShown(ComponentEvent e)
934 // TODO Auto-generated method stub
939 public void onStructureRedrawn()
941 // TODO Auto-generated method stub
946 public void onZoomLevelChanged()
948 // TODO Auto-generated method stub
953 public void onTranslationChanged()
955 // TODO Auto-generated method stub
961 * public static void main(String[] args) { JTextField str = new
962 * JTextField("ATGC");
964 * AppVarnaBinding vab = new AppVarnaBinding(); vab.varnagui.set_seq(str);
965 * vab.varnagui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
966 * vab.varnagui.pack(); vab.varnagui.setVisible(true); } }