allows web-page embedding
[jalview.git] / src / jalview / jbgui / GAlignmentPanel.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.jbgui;
22
23 import java.awt.BorderLayout;
24 import java.awt.Color;
25 import java.awt.Dimension;
26
27 import javax.swing.BorderFactory;
28 import javax.swing.ButtonGroup;
29 import javax.swing.JPanel;
30 import javax.swing.JScrollBar;
31 import javax.swing.JScrollPane;
32 import javax.swing.border.Border;
33
34 public class GAlignmentPanel extends JPanel
35 {
36           protected JScrollBar vscroll = new JScrollBar();
37
38           protected JScrollBar hscroll = new JScrollBar();
39
40           BorderLayout borderLayout1 = new BorderLayout();
41
42           BorderLayout borderLayout3 = new BorderLayout();
43
44           BorderLayout borderLayout5 = new BorderLayout();
45
46           BorderLayout borderLayout6 = new BorderLayout();
47
48           ButtonGroup buttonGroup1 = new ButtonGroup();
49
50           BorderLayout borderLayout7 = new BorderLayout();
51
52           BorderLayout borderLayout10 = new BorderLayout();
53
54           BorderLayout borderLayout11 = new BorderLayout();
55
56           public JScrollPane annotationScroller = new JScrollPane();
57
58           Border border1;
59
60           BorderLayout borderLayout4 = new BorderLayout();
61
62           
63           static JPanel newJPanel() {  // BH 2019
64                   JPanel p = new JPanel();
65                   // leaving this in, as it prevents 
66                   // the checkerboard business, despite how
67                   // funky that looks. Remove if you want to.
68                   p.setBackground(Color.white);
69                         return p;
70           }
71
72   protected JPanel sequenceHolderPanel = newJPanel();
73   protected JPanel seqPanelHolder = newJPanel();
74   protected JPanel scalePanelHolder = newJPanel();
75   protected JPanel idPanelHolder = newJPanel();
76   protected JPanel idSpaceFillerPanel1 = newJPanel();
77   public JPanel annotationSpaceFillerHolder = newJPanel();
78   protected JPanel hscrollFillerPanel = newJPanel();
79   JPanel hscrollHolder = newJPanel();
80
81
82
83   public GAlignmentPanel()
84   {
85     try
86     {
87       jbInit();
88     } catch (Exception e)
89     {
90       e.printStackTrace();
91     }
92   }
93
94   private void jbInit() throws Exception
95   {
96         //  annotationScroller.setBackground(Color.white);  // BH 2019
97           
98     border1 = BorderFactory.createLineBorder(Color.gray, 1);
99     idPanelHolder.setBorder(null);
100     idPanelHolder.setPreferredSize(new Dimension(70, 10));
101     this.setLayout(borderLayout7);
102     sequenceHolderPanel
103             .setMaximumSize(new Dimension(2147483647, 2147483647));
104     sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));
105     sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));
106     sequenceHolderPanel.setLayout(borderLayout3);
107     seqPanelHolder.setLayout(borderLayout1);
108     scalePanelHolder.setBackground(Color.white);
109     scalePanelHolder.setMinimumSize(new Dimension(10, 80));
110     scalePanelHolder.setPreferredSize(new Dimension(10, 30));
111     scalePanelHolder.setLayout(borderLayout6);
112     idPanelHolder.setLayout(borderLayout5);
113     idSpaceFillerPanel1.setBackground(Color.white);
114     idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));
115     idSpaceFillerPanel1.setLayout(borderLayout11);
116     annotationSpaceFillerHolder.setBackground(Color.white);
117     annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));
118     annotationSpaceFillerHolder.setLayout(borderLayout4);
119     hscroll.setOrientation(JScrollBar.HORIZONTAL);
120     hscrollHolder.setLayout(borderLayout10);
121     hscrollFillerPanel.setBackground(Color.white);
122     hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));
123     hscrollHolder.setBackground(Color.white);
124     annotationScroller.setBorder(null);
125     annotationScroller.setPreferredSize(new Dimension(10, 80));
126     this.setPreferredSize(new Dimension(220, 166));
127
128     sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);
129     sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);
130     seqPanelHolder.add(vscroll, BorderLayout.EAST);
131     sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);
132
133     // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH);
134     this.add(idPanelHolder, BorderLayout.WEST);
135     idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);
136     idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);
137     this.add(hscrollHolder, BorderLayout.SOUTH);
138     hscrollHolder.add(hscroll, BorderLayout.CENTER);
139     hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);
140     this.add(sequenceHolderPanel, BorderLayout.CENTER);
141   }
142 }