import java.util.*;
import java.awt.*;
+
import javax.swing.*;
import javax.swing.event.*;
import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
import fr.orsay.lri.varna.models.VARNAConfig;
+import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation;
import fr.orsay.lri.varna.models.rna.ModeleBaseNucleotide;
import fr.orsay.lri.varna.models.rna.ModeleStyleBP;
import fr.orsay.lri.varna.models.rna.RNA;
-public class AppVarna extends JInternalFrame implements InterfaceVARNAListener// implements Runnable,SequenceStructureBinding, ViewSetProvider
+public class AppVarna extends JInternalFrame implements InterfaceVARNAListener,SecondaryStructureListener// implements Runnable,SequenceStructureBinding, ViewSetProvider
{
AppVarnaBinding vab;
public String name;
+ public StructureSelectionManager ssm;
+
/*public AppVarna(){
vab = new AppVarnaBinding();
initVarna();
}*/
- public AppVarna(String seq,String struc,String name){
+ public AppVarna(String seq,String struc,String name,AlignmentPanel ap){
ArrayList<RNA> rnaList = new ArrayList<RNA>();
RNA rna1 = new RNA(name);
try {
//vab = new AppVarnaBinding(seq,struc);
//System.out.println("Hallo: "+name);
this.name=name;
- initVarna();
+ initVarna();
+ ssm = ap.getStructureSelectionManager();
+ ssm.addStructureViewerListener(this);
}
public void initVarna(){
@Override
public void onUINewStructure(VARNAConfig v, RNA r) {
- //TODO _rnaList.add(v, r,"",true);
// TODO Auto-generated method stub
}
// TODO Auto-generated method stub
}
-
+/**
+ * If a mouseOver event from the AlignmentPanel
+ * is noticed the currently selected RNA in the
+ * VARNA window is highlighted at the specific position.
+ * To be able to remove it before the next highlight
+ * it is saved in _lastHighlight
+ */
+private HighlightRegionAnnotation _lastHighlight;
+@Override
+public void mouseOverSequence(SequenceI sequence, int index) {
+ // TODO Auto-generated method stub
+ RNA rna=vab.getSelectedRNA();
+ rna.removeHighlightRegion(_lastHighlight);
+
+ HighlightRegionAnnotation highlight = new HighlightRegionAnnotation(rna.getBasesBetween(index,index));
+ rna.addHighlightRegion(highlight);
+ _lastHighlight=highlight;
+ vab.updateSelectedRNA(rna);
+}
+
+@Override
+public void mouseOverStructure(int atomIndex, String strInfo) {
+ // TODO Auto-generated method stub
+
+}
}
}
}
});
-
_rnaList = new BackupHolder(dlm,_sideList);
try {
public JPanel getListPanel(){
return _listPanel;
}
+
+ /**
+ * TODO: Is it effective to transfer the whole RNA?
+ * @return Currently selected RNA
+ */
+ public RNA getSelectedRNA(){
+ return _rnaList.getElementAt(_sideList.getSelectedIndex()).rna;
+ }
+
+ /**
+ * Substitute currently selected RNA with the edited one
+ * @param rnaEdit
+ */
+ public void updateSelectedRNA(RNA rnaEdit){
+ vp.repaint();
+ vp.showRNA(rnaEdit);
+ }
/*
private void RNAPanelDemoInit()
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.structure;
+
+import jalview.datamodel.*;
+
+public interface SecondaryStructureListener
+{
+ public void mouseOverSequence(SequenceI sequence, int index);
+ public void mouseOverStructure(int atomIndex, String strInfo);
+
+}