import java.util.Vector;
import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
*/
public AppJmol(String[] files, String[] ids, SequenceI[][] seqs,
AlignmentPanel ap, boolean usetoColour, boolean useToAlign,
- boolean leaveColouringToJmol, String loadStatus,
- Rectangle bounds, String viewid)
+ boolean leaveColouringToJmol, String loadStatus, Rectangle bounds,
+ String viewid)
{
PDBEntry[] pdbentrys = new PDBEntry[files.length];
for (int i = 0; i < pdbentrys.length; i++)
this.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
- public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
+ public void internalFrameClosing(
+ InternalFrameEvent internalFrameEvent)
{
closeViewer(false);
}
IProgressIndicator progressBar = null;
+ @Override
+ protected IProgressIndicator getIProgressIndicator()
+ {
+ return progressBar;
+ }
+
/**
- * add a single PDB structure to a new or existing Jmol view
+ * display a single PDB structure in a new Jmol view
*
* @param pdbentry
* @param seq
final AlignmentPanel ap)
{
progressBar = ap.alignFrame;
- String pdbId = pdbentry.getId();
- /*
- * If the PDB file is already loaded, the user may just choose to add to an
- * existing viewer (or cancel)
- */
- if (addAlreadyLoadedFile(seq, chains, ap, pdbId))
- {
- return;
- }
-
- /*
- * Check if there are other Jmol views involving this alignment and prompt
- * user about adding this molecule to one of them
- */
- if (addToExistingViewer(pdbentry, seq, chains, ap, pdbId))
- {
- return;
- }
-
- /*
- * If the options above are declined or do not apply, open a new viewer
- */
openNewJmol(ap, new PDBEntry[] { pdbentry }, new SequenceI[][] { seq });
}
addAlignmentPanel(ap);
useAlignmentPanelForColourbyseq(ap);
- if (pdbentrys.length > 1)
- {
- alignAddedStructures = true;
+ alignAddedStructures = true;
useAlignmentPanelForSuperposition(ap);
- }
+
jmb.setColourBySequence(true);
setSize(400, 400); // probably should be a configurable/dynamic default here
initMenus();
this.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
- public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
+ public void internalFrameClosing(
+ InternalFrameEvent internalFrameEvent)
{
closeViewer(false);
}
openNewJmol(ap, pe, seqs);
}
- /**
- * Returns a list of any Jmol viewers. The list is restricted to those linked
- * to the given alignment panel if it is not null.
- */
- @Override
- protected List<StructureViewerBase> getViewersFor(AlignmentPanel apanel)
- {
- List<StructureViewerBase> result = new ArrayList<StructureViewerBase>();
- JInternalFrame[] frames = Desktop.instance.getAllFrames();
-
- for (JInternalFrame frame : frames)
- {
- if (frame instanceof AppJmol)
- {
- if (apanel == null
- || ((StructureViewerBase) frame).isLinkedWith(apanel))
- {
- result.add((StructureViewerBase) frame);
- }
- }
- }
- return result;
- }
void initJmol(String command)
{
scriptWindow.setVisible(false);
}
- jmb.allocateViewer(renderPanel, true, "", null, null, "",
- scriptWindow, null);
+ jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow,
+ null);
// jmb.newJmolPopup("Jmol");
if (command == null)
{
jmb.setFinishedInit(true);
}
-
-
boolean allChainsSelected = false;
@Override
void showSelectedChains()
{
- Vector<String> toshow = new Vector<String>();
+ Vector<String> toshow = new Vector<>();
for (int i = 0; i < chainMenu.getItemCount(); i++)
{
if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem)
int waitFor = 35;
int waitTotal = 0;
while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled()
- : !(jmb.isFinishedInit() && jmb.getStructureFiles() != null && jmb
- .getStructureFiles().length == files.size()))
+ : !(jmb.isFinishedInit() && jmb.getStructureFiles() != null
+ && jmb.getStructureFiles().length == files.size()))
{
try
{
}
if (waitTotal > waitMax)
{
- System.err
- .println("Timed out waiting for Jmol to load files after "
- + waitTotal + "ms");
-// System.err.println("finished: " + jmb.isFinishedInit()
-// + "; loaded: " + Arrays.toString(jmb.getPdbFile())
-// + "; files: " + files.toString());
+ System.err.println("Timed out waiting for Jmol to load files after "
+ + waitTotal + "ms");
+ // System.err.println("finished: " + jmb.isFinishedInit()
+ // + "; loaded: " + Arrays.toString(jmb.getPdbFile())
+ // + "; files: " + files.toString());
jmb.getStructureFiles();
break;
}
// todo - record which pdbids were successfully imported.
StringBuilder errormsgs = new StringBuilder();
- List<String> files = new ArrayList<String>();
+ List<String> files = new ArrayList<>();
String pdbid = "";
try
{
long hdl = pdbid.hashCode() - System.currentTimeMillis();
if (progressBar != null)
{
- progressBar.setProgressBar(MessageManager.formatMessage(
- "status.fetching_pdb", new String[] { pdbid }), hdl);
+ progressBar.setProgressBar(MessageManager
+ .formatMessage("status.fetching_pdb", new String[]
+ { pdbid }), hdl);
}
try
{
}
if (errormsgs.length() > 0)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
- .formatMessage("label.pdb_entries_couldnt_be_retrieved",
- new String[] { errormsgs.toString() }),
+ JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.formatMessage(
+ "label.pdb_entries_couldnt_be_retrieved", new String[]
+ { errormsgs.toString() }),
MessageManager.getString("label.couldnt_load_file"),
JvOptionPane.ERROR_MESSAGE);
}
if (e == jmb.getPdbCount() - 1 || sb.length() > 20)
{
lines++;
- g.drawString(sb.toString(), 20, currentSize.height / 2 - lines
- * g.getFontMetrics().getHeight());
+ g.drawString(sb.toString(), 20, currentSize.height / 2
+ - lines * g.getFontMetrics().getHeight());
}
}
}