import java.awt.BorderLayout;
-public class PDBViewer
- extends JInternalFrame implements Runnable
+public class PDBViewer extends JInternalFrame implements Runnable
{
/**
PDBCanvas pdbcanvas;
PDBEntry pdbentry;
- SequenceI[]seq;
- String[]chains;
+
+ SequenceI[] seq;
+
+ String[] chains;
+
AlignmentPanel ap;
+
String protocol;
+
String tmpPDBFile;
- public PDBViewer(PDBEntry pdbentry,
- SequenceI[] seq,
- String[] chains,
- AlignmentPanel ap,
- String protocol)
+ public PDBViewer(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
+ AlignmentPanel ap, String protocol)
{
this.pdbentry = pdbentry;
try
{
jbInit();
- }
- catch (Exception ex)
+ } catch (Exception ex)
{
ex.printStackTrace();
}
-
- StringBuffer title = new StringBuffer(seq[0].getName()
- + ":"
- + pdbentry.getFile());
+ StringBuffer title = new StringBuffer(seq[0].getName() + ":"
+ + pdbentry.getFile());
pdbcanvas = new PDBCanvas();
{
tmpPDBFile = pdbentry.getFile();
PDBfile pdbfile = new PDBfile(tmpPDBFile,
- jalview.io.AppletFormatAdapter.FILE);
+ jalview.io.AppletFormatAdapter.FILE);
pdbcanvas.init(pdbentry, seq, chains, ap, protocol);
- }
- catch (java.io.IOException ex)
+ } catch (java.io.IOException ex)
{
ex.printStackTrace();
}
worker.start();
}
-
-
if (pdbentry.getProperty() != null)
{
if (pdbentry.getProperty().get("method") != null)
EBIFetchClient ebi = new EBIFetchClient();
String query = "pdb:" + pdbentry.getId();
pdbentry.setFile(ebi.fetchDataAsFile(query, "default", "raw")
- .getAbsolutePath());
+ .getAbsolutePath());
- if(pdbentry.getFile()!=null)
+ if (pdbentry.getFile() != null)
pdbcanvas.init(pdbentry, seq, chains, ap, protocol);
- }
- catch (Exception ex)
+ } catch (Exception ex)
{
- pdbcanvas.errorMessage = "Error retrieving file: "+pdbentry.getId();
+ pdbcanvas.errorMessage = "Error retrieving file: " + pdbentry.getId();
ex.printStackTrace();
}
}
- private void jbInit()
- throws Exception
+ private void jbInit() throws Exception
{
this.addKeyListener(new KeyAdapter()
{
if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
{
- java.util.Enumeration userColours = jalview.gui.UserDefinedColours.
- getUserColourSchemes().keys();
+ java.util.Enumeration userColours = jalview.gui.UserDefinedColours
+ .getUserColourSchemes().keys();
while (userColours.hasMoreElements())
{
final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(
- userColours.
- nextElement().toString());
+ userColours.nextElement().toString());
radioItem.setName("USER_DEFINED");
radioItem.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent evt)
{
- if (evt.isControlDown() || SwingUtilities.isRightMouseButton(evt))
+ if (evt.isControlDown()
+ || SwingUtilities.isRightMouseButton(evt))
{
- radioItem.removeActionListener(radioItem.getActionListeners()[0]);
-
- int option = JOptionPane.showInternalConfirmDialog(jalview.gui.
- Desktop.desktop,
- "Remove from default list?",
- "Remove user defined colour",
- JOptionPane.YES_NO_OPTION);
+ radioItem
+ .removeActionListener(radioItem.getActionListeners()[0]);
+
+ int option = JOptionPane.showInternalConfirmDialog(
+ jalview.gui.Desktop.desktop,
+ "Remove from default list?",
+ "Remove user defined colour",
+ JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION)
{
- jalview.gui.UserDefinedColours.removeColourFromDefaults(
- radioItem.getText());
+ jalview.gui.UserDefinedColours
+ .removeColourFromDefaults(radioItem.getText());
coloursMenu.remove(radioItem);
}
else
}
JMenuBar jMenuBar1 = new JMenuBar();
+
JMenu fileMenu = new JMenu();
+
JMenu coloursMenu = new JMenu();
+
JMenu saveMenu = new JMenu();
+
JMenuItem png = new JMenuItem();
+
JMenuItem eps = new JMenuItem();
+
JMenuItem mapping = new JMenuItem();
+
JCheckBoxMenuItem wire = new JCheckBoxMenuItem();
+
JCheckBoxMenuItem depth = new JCheckBoxMenuItem();
+
JCheckBoxMenuItem zbuffer = new JCheckBoxMenuItem();
+
JCheckBoxMenuItem allchains = new JCheckBoxMenuItem();
JRadioButtonMenuItem charge = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem chain = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem seqButton = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem hydro = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem taylor = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem zappo = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem user = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem buried = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem turn = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem strand = new JRadioButtonMenuItem();
+
JRadioButtonMenuItem helix = new JRadioButtonMenuItem();
+
JMenu viewMenu = new JMenu();
+
JMenuItem background = new JMenuItem();
+
JMenuItem savePDB = new JMenuItem();
/**
* DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
*/
public void eps_actionPerformed(ActionEvent e)
{
/**
* DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
*/
public void png_actionPerformed(ActionEvent e)
{
if (type == jalview.util.ImageMaker.PNG)
{
- im = new jalview.util.ImageMaker(this,
- jalview.util.ImageMaker.PNG,
- "Make PNG image from view",
- width, height,
- null, null);
+ im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.PNG,
+ "Make PNG image from view", width, height, null, null);
}
else
{
- im = new jalview.util.ImageMaker(this,
- jalview.util.ImageMaker.EPS,
- "Make EPS file from view",
- width, height,
- null, this.getTitle());
+ im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.EPS,
+ "Make EPS file from view", width, height, null, this
+ .getTitle());
}
if (im.getGraphics() != null)
pdbcanvas.setAllchainsVisible(allchains.getState());
}
-
public void zappo_actionPerformed(ActionEvent e)
{
pdbcanvas.bysequence = false;
{
if (e.getActionCommand().equals("User Defined..."))
{
- // new UserDefinedColours(pdbcanvas, null);
+ // new UserDefinedColours(pdbcanvas, null);
}
else
{
- UserColourScheme udc = (UserColourScheme) UserDefinedColours.
- getUserColourSchemes().get(e.getActionCommand());
+ UserColourScheme udc = (UserColourScheme) UserDefinedColours
+ .getUserColourSchemes().get(e.getActionCommand());
pdbcanvas.pdb.setColours(udc);
pdbcanvas.redrawneeded = true;
public void background_actionPerformed(ActionEvent e)
{
java.awt.Color col = JColorChooser.showDialog(this,
- "Select Background Colour",
- pdbcanvas.backgroundColour);
+ "Select Background Colour", pdbcanvas.backgroundColour);
if (col != null)
{
public void savePDB_actionPerformed(ActionEvent e)
{
- JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty(
- "LAST_DIRECTORY"));
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache
+ .getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle("Save PDB File");
PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
String data;
- while ( (data = in.readLine()) != null)
+ while ((data = in.readLine()) != null)
{
- if (
- ! (data.indexOf("<PRE>") > -1 || data.indexOf("</PRE>") > -1)
- )
+ if (!(data.indexOf("<PRE>") > -1 || data.indexOf("</PRE>") > -1))
{
out.println(data);
}
}
out.close();
- }
- catch (Exception ex)
+ } catch (Exception ex)
{
ex.printStackTrace();
}