/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.gui.StructureViewer.ViewerType;
import jalview.io.AppletFormatAdapter;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
PDBEntry[] pdbentrys = new PDBEntry[files.length];
for (int i = 0; i < pdbentrys.length; i++)
{
- PDBEntry pdbentry = new PDBEntry();
- pdbentry.setFile(files[i]);
- pdbentry.setId(ids[i]);
+ // PDBEntry pdbentry = new PDBEntry(files[i], ids[i]);
+ PDBEntry pdbentry = new PDBEntry(ids[i], null, PDBEntry.Type.PDB,
+ files[i]);
pdbentrys[i] = pdbentry;
}
// / TODO: check if protocol is needed to be set, and if chains are
seqColour.setSelected(false);
viewerColour.setSelected(true);
}
- if (usetoColour)
+ else if (usetoColour)
{
useAlignmentPanelForColourbyseq(ap);
jmb.setColourBySequence(true);
this.addInternalFrameListener(new InternalFrameAdapter()
{
+ @Override
public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
{
- closeViewer();
+ closeViewer(false);
}
});
initJmol(loadStatus); // pdbentry, seq, JBPCHECK!
}
this.addInternalFrameListener(new InternalFrameAdapter()
{
+ @Override
public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
{
- closeViewer();
+ closeViewer(false);
}
});
openNewJmol(ap, pe, seqs);
}
- public AlignmentPanel[] getAllAlignmentPanels()
- {
- AlignmentPanel[] t;
- AlignmentPanel[] list = new AlignmentPanel[0];
- for (String setid : _aps)
- {
- AlignmentPanel[] panels = PaintRefresher.getAssociatedPanels(setid);
- if (panels != null)
- {
- t = new AlignmentPanel[list.length + panels.length];
- System.arraycopy(list, 0, t, 0, list.length);
- System.arraycopy(panels, 0, t, list.length, panels.length);
- list = t;
- }
- }
-
- return list;
- }
-
- /**
- * set the primary alignmentPanel reference and add another alignPanel to the
- * list of ones to use for colouring and aligning
- *
- * @param nap
- */
- public void addAlignmentPanel(AlignmentPanel nap)
- {
- if (getAlignmentPanel() == null)
- {
- setAlignmentPanel(nap);
- }
- if (!_aps.contains(nap.av.getSequenceSetId()))
- {
- _aps.add(nap.av.getSequenceSetId());
- }
- }
-
- /**
- * remove any references held to the given alignment panel
- *
- * @param nap
- */
- public void removeAlignmentPanel(AlignmentPanel nap)
- {
- try
- {
- _alignwith.remove(nap);
- _colourwith.remove(nap);
- if (getAlignmentPanel() == nap)
- {
- setAlignmentPanel(null);
- for (AlignmentPanel aps : getAllAlignmentPanels())
- {
- if (aps != nap)
- {
- setAlignmentPanel(aps);
- break;
- }
- }
- }
- } catch (Exception ex)
- {
- }
- if (getAlignmentPanel() != null)
- {
- buildActionMenu();
- }
- }
-
- public void useAlignmentPanelForSuperposition(AlignmentPanel nap)
- {
- addAlignmentPanel(nap);
- if (!_alignwith.contains(nap))
- {
- _alignwith.add(nap);
- }
- }
-
- public void excludeAlignmentPanelForSuperposition(AlignmentPanel nap)
- {
- if (_alignwith.contains(nap))
- {
- _alignwith.remove(nap);
- }
- }
-
- public void useAlignmentPanelForColourbyseq(AlignmentPanel nap,
- boolean enableColourBySeq)
- {
- useAlignmentPanelForColourbyseq(nap);
- getBinding().setColourBySequence(enableColourBySeq);
- seqColour.setSelected(enableColourBySeq);
- viewerColour.setSelected(!enableColourBySeq);
- }
-
- public void useAlignmentPanelForColourbyseq(AlignmentPanel nap)
- {
- addAlignmentPanel(nap);
- if (!_colourwith.contains(nap))
- {
- _colourwith.add(nap);
- }
- }
-
- public void excludeAlignmentPanelForColourbyseq(AlignmentPanel nap)
- {
- if (_colourwith.contains(nap))
- {
- _colourwith.remove(nap);
- }
- }
-
/**
* pdb retrieval thread.
*/
;
jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow,
null);
- jmb.newJmolPopup(true, "Jmol", true);
+ jmb.newJmolPopup("Jmol");
if (command == null)
{
command = "";
jmb.centerViewer(toshow);
}
- public void closeViewer()
+ public void closeViewer(boolean closeExternalViewer)
{
+ // JMol does not use an external viewer
jmb.closeViewer();
setAlignmentPanel(null);
_aps.clear();
}
try
{
- pdbseq = pdbclient.getSequenceRecords(pdbid = jmb.getPdbEntry(
- pi)
- .getId());
+ pdbseq = pdbclient.getSequenceRecords(pdbid);
} catch (OutOfMemoryError oomerror)
{
new OOMWarning("Retrieving PDB id " + pdbid, oomerror);
{
// just transfer the file name from the first sequence's first
// PDBEntry
- file = new File(((PDBEntry) pdbseq.getSequenceAt(0).getPDBId()
- .elementAt(0)).getFile()).getAbsolutePath();
+ file = new File(pdbseq.getSequenceAt(0).getPDBId()
+ .elementAt(0).getFile()).getAbsolutePath();
jmb.getPdbEntry(pi).setFile(file);
files.append(" \"" + Platform.escapeString(file) + "\"");
jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer();
try
{
- for (int pdbe = 0; pdbe < jmb.getPdbCount(); pdbe++)
- {
- cap.appendText(jmb.printMapping(jmb.getPdbEntry(pdbe).getFile()));
- cap.appendText("\n");
- }
+ cap.appendText(jmb.printMappings());
} catch (OutOfMemoryError e)
{
new OOMWarning(
if (im.getGraphics() != null)
{
- Rectangle rect = new Rectangle(width, height);
- jmb.viewer.renderScreenImage(im.getGraphics(), rect.getSize(), rect);
+ jmb.viewer.renderScreenImage(im.getGraphics(), width, height);
im.writeImage();
}
}
// Set the colour using the current view for the associated alignframe
for (AlignmentPanel ap : _colourwith)
{
- jmb.colourBySequence(ap.av.showSequenceFeatures, ap);
+ jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap);
}
}
}
{
final Dimension currentSize = new Dimension();
- final Rectangle rectClip = new Rectangle();
-
+ @Override
public void paintComponent(Graphics g)
{
getSize(currentSize);
- g.getClipBounds(rectClip);
- if (jmb.fileLoadingError != null)
+ if (jmb != null && jmb.fileLoadingError != null)
{
g.setColor(Color.black);
g.fillRect(0, 0, currentSize.width, currentSize.height);
}
else
{
- jmb.viewer.renderScreenImage(g, currentSize, rectClip);
+ jmb.viewer.renderScreenImage(g, currentSize.width,
+ currentSize.height);
}
}
}
return jmb == null ? null : jmb.viewer.getStateInfo();
}
+ @Override
+ public ViewerType getViewerType()
+ {
+ return ViewerType.JMOL;
+ }
+
}