2 VARNA is a tool for the automated drawing, visualization and annotation of the secondary structure of RNA, designed as a companion software for web servers and databases.
3 Copyright (C) 2008 Kevin Darty, Alain Denise and Yann Ponty.
4 electronic mail : Yann.Ponty@lri.fr
5 paper mail : LRI, bat 490 Université Paris-Sud 91405 Orsay Cedex France
7 This file is part of VARNA version 3.1.
8 VARNA version 3.1 is free software: you can redistribute it and/or 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 VARNA version 3.1 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along with VARNA version 3.1.
16 If not, see http://www.gnu.org/licenses.
18 package fr.orsay.lri.varna.views;
20 import java.awt.BorderLayout;
21 import java.awt.Color;
22 import java.awt.Dimension;
23 import java.awt.event.ActionEvent;
24 import java.awt.event.ActionListener;
25 import java.util.ArrayList;
27 import javax.swing.BorderFactory;
28 import javax.swing.JPanel;
29 import javax.swing.JTextArea;
30 import javax.swing.Timer;
32 import fr.orsay.lri.varna.VARNAPanel;
33 import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
34 import fr.orsay.lri.varna.models.VARNAConfig;
37 * BH j2s SwingJS replaces thread with simple javax.swing.Timer
40 public class VueAboutPanel extends JPanel {
45 private static final long serialVersionUID = 4525998278180950602L;
47 private AboutAnimator _anim;
48 private JPanel _textPanel;
49 private JTextArea _textArea;
51 public VueAboutPanel() {
57 setBorder(BorderFactory.createEtchedBorder());
58 setLayout(new BorderLayout());
59 setBackground(Color.WHITE);
61 String message = "VARNA "
62 + VARNAConfig.MAJOR_VERSION
64 + VARNAConfig.MINOR_VERSION
67 + "Created by: Kevin Darty, Alain Denise and Yann Ponty\n"
68 + "Contact: ponty@lri.fr\n"
70 + "VARNA is freely distributed under the terms of the GNU GPL 3.0 license.\n"
72 + "Supported by the BRASERO project (ANR-06-BLAN-0045)\n";
74 _textArea = new JTextArea();
75 _textArea.setText(message);
76 _textArea.setEditable(false);
78 _textPanel = new JPanel();
79 _textPanel.setBackground(Color.WHITE);
80 _textPanel.setLayout(new BorderLayout());
81 _textPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 0, 15,
83 _textPanel.add(_textArea);
85 VARNAPanel vp = new VARNAPanel("GGGGAAAACCCC", "((((....))))");
86 vp.setModifiable(false);
87 vp.setPreferredSize(new Dimension(100, 100));
88 // vp.setBorder(BorderFactory.createLineBorder(Color.gray));
90 _anim = new AboutAnimator(vp);
92 .addRNA("GGGGAAGGGGAAAACCCCAACCCC",
93 "((((..((((....))))..))))");
94 _anim.addRNA("GGGGAAGGGGAAGGGGAAAACCCCAACCCCAACCCC",
95 "((((..((((..((((....))))..))))..))))");
98 "GGGGAGGGGAAAACCCCAGGGGAGGGGAAAACCCCAGGGGAAAACCCCAGGGGAAAACCCCACCCCAGGGGAAAACCCCACCCC",
99 "((((.((((....)))).((((.((((....)))).((((....)))).((((....)))).)))).((((....)))).))))");
102 "GGGGGGGGAAAACCCCAGGGGAAAACCCCAGGGGGGGGAAAACCCCAGGGGAAAACCCCAGGGGAAAACCCCAGGGGAAAACCCCGGGGAAAACCCCACCCCAGGGGAAAACCCCAGGGGAAAACCCCCCCC",
103 "((((((((....)))).((((....)))).((((((((....)))).((((....)))).((((....)))).((((....))))((((....)))).)))).((((....)))).((((....))))))))");
104 _anim.addRNA("GGGGAAAACCCC", "((((....))))");
105 _anim.addRNA("GGGGAAGGGGAAAACCCCAGGGGAAAACCCCACCCC",
106 "((((..((((....)))).((((....)))).))))");
107 _anim.addRNA("GGGGAGGGGAAAACCCCAGGGGAAAACCCCAGGGGAAAACCCCACCCC",
108 "((((.((((....)))).((((....)))).((((....)))).))))");
111 "GGGGAGGGGAAAAAAACCCCAGGGGAAAAAAACCCCAGGGGAAAAAAACCCCACCCC",
112 "((((.((((.......)))).((((.......)))).((((.......)))).))))");
115 add(vp, BorderLayout.WEST);
116 add(_textPanel, BorderLayout.CENTER);
117 } catch (ExceptionNonEqualLength e) {
121 public void gracefulStop() {
122 _anim.gracefulStop();
125 private class AboutAnimator implements ActionListener {
127 ArrayList<String> _structures = new ArrayList<String>();
128 ArrayList<String> _sequences = new ArrayList<String>();
130 boolean _over = false;
132 public AboutAnimator(VARNAPanel vp) {
138 * mode pointer for timer cycle -- DELAY1, TASK, DELAY2, STOP
146 final int DELAY1 = 0, TASK = 1, DELAY2 = 2, STOP = 3;
150 public void actionPerformed(ActionEvent e) {
154 public void start() {
159 public void addRNA(String seq, String str) {
161 _structures.add(str);
164 public void gracefulStop() {
175 initialDelay = _period;
178 String seq = _sequences.get(i);
179 String str = _structures.get(i);
181 _vp.drawRNAInterpolated(seq, str);
184 } catch (ExceptionNonEqualLength e) {
189 i = (i + 1) % _sequences.size();
198 if (initialDelay >= 0) {
199 Timer t = new Timer(initialDelay, this);
204 System.out.println("VueAbout done");