4848import org .biojava .nbio .structure .StructureException ;
4949import org .biojava .nbio .structure .StructureIdentifier ;
5050import org .biojava .nbio .structure .align .gui .MenuCreator ;
51- import org .biojava .nbio .structure .align .gui .MultipleAlignmentJmolDisplay ;
5251import org .biojava .nbio .structure .align .gui .MultipleAlignmentGUI ;
52+ import org .biojava .nbio .structure .align .gui .MultipleAlignmentJmolDisplay ;
5353import org .biojava .nbio .structure .align .multiple .Block ;
5454import org .biojava .nbio .structure .align .multiple .BlockSet ;
5555import org .biojava .nbio .structure .align .multiple .MultipleAlignment ;
@@ -78,8 +78,7 @@ public class MultipleAlignmentJmol extends AbstractAlignmentJmol {
7878 private JCheckBox colorByBlocks ;
7979 private List <JCheckBox > selectedStructures ;
8080
81- private static final String LIGAND_DISPLAY_SCRIPT =
82- "select ligand; wireframe 40; spacefill 120; color CPK;" ;
81+ private static final String LIGAND_DISPLAY_SCRIPT = "select ligand; wireframe 40; spacefill 120; color CPK;" ;
8382
8483 private static final Logger logger = LoggerFactory
8584 .getLogger (MultipleAlignmentJmol .class );
@@ -162,17 +161,19 @@ public void windowClosing(WindowEvent e) {
162161
163162 // / STRUCTURE SELECTION
164163 if (multAln != null ) {
165- Box hBox0 = Box .createHorizontalBox ();
166- hBox0 .setMaximumSize (new Dimension (Short .MAX_VALUE , 30 ));
167164
165+ Box hBox00 = Box .createHorizontalBox ();
166+ hBox00 .setMaximumSize (new Dimension (Short .MAX_VALUE , 30 ));
167+
168168 JButton show = new JButton ("Show Only: " );
169169 show .addActionListener (new ActionListener () {
170170
171171 @ Override
172172 public void actionPerformed (ActionEvent e ) {
173173 jmolPanel .evalString ("save selection;" );
174- String cmd = getJmolString (multAln , transformedAtoms ,
175- colorPalette , colorByBlocks .isSelected ());
174+ String cmd = getJmolString (multAln ,
175+ transformedAtoms , colorPalette ,
176+ colorByBlocks .isSelected ());
176177 cmd += "; restrict " ;
177178 for (int st = 0 ; st < multAln .size (); st ++) {
178179 if (selectedStructures .get (st ).isSelected ()) {
@@ -183,21 +184,28 @@ public void actionPerformed(ActionEvent e) {
183184 jmolPanel .executeCmd (cmd + " restore selection;" );
184185 }
185186 });
187+ hBox00 .add (show );
188+ hBox00 .add (Box .createGlue ());
189+ vBox .add (hBox00 );
190+
191+ // A line of structures of maximum 5
192+ for (int line = 0 ; line < 1 + (multAln .size () / 5 ); line ++) {
193+ Box hBox0 = Box .createHorizontalBox ();
194+ hBox0 .setMaximumSize (new Dimension (Short .MAX_VALUE , 30 ));
195+
196+ for (int str = line * 5 ; str < Math .min ((line + 1 ) * 5 ,
197+ multAln .size ()); str ++) {
198+ JCheckBox structureSelection = new JCheckBox (multAln
199+ .getEnsemble ().getStructureIdentifiers ().get (str )
200+ .getIdentifier ());
201+ hBox0 .add (structureSelection );
202+ hBox0 .add (Box .createGlue ());
203+ structureSelection .setSelected (true );
204+ selectedStructures .add (structureSelection );
205+ }
186206
187- hBox0 .add (show );
188- hBox0 .add (Box .createGlue ());
189-
190- for (int str = 0 ; str < multAln .size (); str ++) {
191- JCheckBox structureSelection = new JCheckBox (multAln
192- .getEnsemble ().getStructureIdentifiers ().get (str )
193- .getIdentifier ());
194- hBox0 .add (structureSelection );
195- hBox0 .add (Box .createGlue ());
196- structureSelection .setSelected (true );
197- selectedStructures .add (structureSelection );
207+ vBox .add (hBox0 );
198208 }
199-
200- vBox .add (hBox0 );
201209 }
202210
203211 // / COMBO BOXES
@@ -260,7 +268,6 @@ public void actionPerformed(ActionEvent e) {
260268
261269 // / CHECK BOXES
262270 Box hBox2 = Box .createHorizontalBox ();
263- hBox2 .setMaximumSize (new Dimension (Short .MAX_VALUE , 30 ));
264271
265272 JButton resetDisplay = new JButton ("Reset Display" );
266273 resetDisplay .addActionListener (new ActionListener () {
@@ -414,12 +421,12 @@ public void actionPerformed(ActionEvent ae) {
414421 // Kimura, Structural and Fractional Dissimilarity Score
415422 Phylogeny kimura = MultipleAlignmentTools
416423 .getKimuraTree (multAln );
417- Phylogeny sdm = MultipleAlignmentTools
418- .getHSDMTree (multAln );
424+ Phylogeny sdm = MultipleAlignmentTools .getHSDMTree (multAln );
419425 // Phylogeny structural = MultipleAlignmentTools
420- // .getStructuralTree(multAln);
426+ // .getStructuralTree(multAln);
421427
422- Archaeopteryx .createApplication (new Phylogeny [] { kimura , sdm });
428+ Archaeopteryx
429+ .createApplication (new Phylogeny [] { kimura , sdm });
423430 }
424431 } catch (Exception e ) {
425432 logger .error ("Could not complete display option." , e );
0 commit comments