- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.PNG,
- "Make PNG image from view", width, height, null, null);
- }
- else
+ String[] filesInViewer = jmb.getPdbFile();
+ // TODO: replace with reference fetching/transfer code (validate PDBentry
+ // as a DBRef?)
+ Pdb pdbclient = new Pdb();
+ for (int pi = 0; pi < jmb.getPdbCount(); pi++)
+ {
+ String file = jmb.getPdbEntry(pi).getFile();
+ if (file == null)
+ {
+ // retrieve the pdb and store it locally
+ AlignmentI pdbseq = null;
+ pdbid = jmb.getPdbEntry(pi).getId();
+ long hdl = pdbid.hashCode() - System.currentTimeMillis();
+ if (progressBar != null)
+ {
+ progressBar.setProgressBar(MessageManager.formatMessage(
+ "status.fetching_pdb", new String[] { pdbid }), hdl);
+ }
+ try
+ {
+ pdbseq = pdbclient.getSequenceRecords(pdbid);
+ } catch (OutOfMemoryError oomerror)
+ {
+ new OOMWarning("Retrieving PDB id " + pdbid, oomerror);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ errormsgs.append("'").append(pdbid).append("'");
+ } finally
+ {
+ if (progressBar != null)
+ {
+ progressBar.setProgressBar(
+ MessageManager.getString("label.state_completed"),
+ hdl);
+ }
+ }
+ if (pdbseq != null)
+ {
+ // just transfer the file name from the first sequence's first
+ // PDBEntry
+ file = new File(pdbseq.getSequenceAt(0).getAllPDBEntries()
+ .elementAt(0).getFile()).getAbsolutePath();
+ jmb.getPdbEntry(pi).setFile(file);
+ files.add(file);
+ }
+ else
+ {
+ errormsgs.append("'").append(pdbid).append("' ");
+ }
+ }
+ else
+ {
+ if (filesInViewer != null && filesInViewer.length > 0)
+ {
+ addingStructures = true; // already files loaded.
+ for (int c = 0; c < filesInViewer.length; c++)
+ {
+ if (filesInViewer[c].equals(file))
+ {
+ file = null;
+ break;
+ }
+ }
+ }
+ if (file != null)
+ {
+ files.add(file);
+ }
+ }
+ }
+ } catch (OutOfMemoryError oomerror)