import javax.swing.*;\r
import java.awt.event.*;\r
import jalview.datamodel.*;\r
+import jalview.schemes.*;\r
import jalview.gui.*;\r
import jalview.io.EBIFetchClient;\r
import java.awt.event.ActionListener;\r
Sequence seq,\r
SeqCanvas seqcanvas)\r
{\r
-\r
- pdb = entry;\r
- sequence = seq;\r
-\r
- Thread worker = new Thread(this);\r
- worker.start();\r
-\r
+ /*Uncomment this to modify in Jbuilder\r
try\r
{\r
jbInit();\r
catch (Exception ex)\r
{\r
ex.printStackTrace();\r
- }\r
+ }*/\r
+\r
+\r
+ pdb = entry;\r
+ sequence = seq;\r
+\r
+ Thread worker = new Thread(this);\r
+ worker.start();\r
\r
pdbcanvas = new PDBCanvas(seqcanvas, seq);\r
\r
\r
pdbcanvas.setPDBFile(pdbfile);\r
\r
+ try\r
+ {\r
+ jbInit();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
catch (Exception ex)\r
{\r
charge_actionPerformed(e);\r
}\r
});\r
- hydro.setText("Hydrophobicity");\r
- hydro.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- hydro_actionPerformed(e);\r
- }\r
- });\r
chain.setText("By Chain");\r
chain.addActionListener(new ActionListener()\r
{\r
seqButton_actionPerformed(e);\r
}\r
});\r
- molecule.setText("By Molecule");\r
- molecule.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- molecule_actionPerformed(e);\r
- }\r
- });\r
allchains.setSelected(true);\r
allchains.setText("Show All Chains");\r
allchains.addItemListener(new ItemListener()\r
allchains_itemStateChanged(e);\r
}\r
});\r
+ zappo.setText("Zappo");\r
+ zappo.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ zappo_actionPerformed(e);\r
+ }\r
+ });\r
+ taylor.setText("Taylor");\r
+ taylor.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ taylor_actionPerformed(e);\r
+ }\r
+ });\r
+ hydro.setText("Hydro");\r
+ hydro.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ hydro_actionPerformed(e);\r
+ }\r
+ });\r
+ helix.setText("Helix");\r
+ helix.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ helix_actionPerformed(e);\r
+ }\r
+ });\r
+ strand.setText("Strand");\r
+ strand.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ strand_actionPerformed(e);\r
+ }\r
+ });\r
+ turn.setText("Turn");\r
+ turn.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ turn_actionPerformed(e);\r
+ }\r
+ });\r
+ buried.setText("Buried");\r
+ buried.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ buried_actionPerformed(e);\r
+ }\r
+ });\r
+ user.setText("User Defined...");\r
+ user.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ user_actionPerformed(e);\r
+ }\r
+ });\r
+ viewMenu.setText("View");\r
jMenuBar1.add(fileMenu);\r
jMenuBar1.add(coloursMenu);\r
+ jMenuBar1.add(viewMenu);\r
fileMenu.add(saveMenu);\r
fileMenu.add(mapping);\r
saveMenu.add(png);\r
saveMenu.add(eps);\r
coloursMenu.add(seqButton);\r
coloursMenu.add(chain);\r
- coloursMenu.add(hydro);\r
coloursMenu.add(charge);\r
- coloursMenu.addSeparator();\r
- coloursMenu.add(wire);\r
- coloursMenu.add(depth);\r
- coloursMenu.add(zbuffer);\r
- coloursMenu.add(molecule);\r
- coloursMenu.add(allchains);\r
+ coloursMenu.add(zappo);\r
+ coloursMenu.add(taylor);\r
+ coloursMenu.add(hydro);\r
+ coloursMenu.add(helix);\r
+ coloursMenu.add(strand);\r
+ coloursMenu.add(turn);\r
+ coloursMenu.add(buried);\r
+ coloursMenu.add(user);\r
ButtonGroup bg = new ButtonGroup();\r
bg.add(seqButton);\r
bg.add(chain);\r
- bg.add(hydro);\r
bg.add(charge);\r
+ bg.add(zappo);\r
+ bg.add(taylor);\r
+ bg.add(hydro);\r
+ bg.add(helix);\r
+ bg.add(strand);\r
+ bg.add(turn);\r
+ bg.add(buried);\r
+ bg.add(user);\r
+\r
+\r
+ if(jalview.gui.UserDefinedColours.getUserColourSchemes()!=null)\r
+ {\r
+ java.util.Enumeration userColours = jalview.gui.UserDefinedColours.\r
+ getUserColourSchemes().keys();\r
+\r
+ while (userColours.hasMoreElements())\r
+ {\r
+ final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(userColours.\r
+ nextElement().toString());\r
+ radioItem.setName("USER_DEFINED");\r
+ radioItem.addMouseListener(new MouseAdapter()\r
+ {\r
+ public void mousePressed(MouseEvent evt)\r
+ {\r
+ if(evt.isControlDown() || SwingUtilities.isRightMouseButton(evt))\r
+ {\r
+ radioItem.removeActionListener(radioItem.getActionListeners()[0]);\r
+\r
+ int option = JOptionPane.showInternalConfirmDialog(jalview.gui.Desktop.desktop,\r
+ "Remove from default list?",\r
+ "Remove user defined colour",\r
+ JOptionPane.YES_NO_OPTION);\r
+ if(option == JOptionPane.YES_OPTION)\r
+ {\r
+ jalview.gui.UserDefinedColours.removeColourFromDefaults(radioItem.getText());\r
+ coloursMenu.remove(radioItem);\r
+ }\r
+ else\r
+ radioItem.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent evt)\r
+ {\r
+ user_actionPerformed(evt);\r
+ }\r
+ });\r
+ }\r
+ }\r
+ });\r
+ radioItem.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent evt)\r
+ {\r
+ user_actionPerformed(evt);\r
+ }\r
+ });\r
+ coloursMenu.add(radioItem);\r
+ bg.add(radioItem);\r
+ }\r
+ }\r
+\r
+ viewMenu.add(wire);\r
+ viewMenu.add(depth);\r
+ viewMenu.add(zbuffer);\r
+ viewMenu.add(allchains);\r
}\r
\r
JMenuBar jMenuBar1 = new JMenuBar();\r
JCheckBoxMenuItem wire = new JCheckBoxMenuItem();\r
JCheckBoxMenuItem depth = new JCheckBoxMenuItem();\r
JCheckBoxMenuItem zbuffer = new JCheckBoxMenuItem();\r
+ JCheckBoxMenuItem allchains = new JCheckBoxMenuItem();\r
+\r
JRadioButtonMenuItem charge = new JRadioButtonMenuItem();\r
- JRadioButtonMenuItem hydro = new JRadioButtonMenuItem();\r
JRadioButtonMenuItem chain = new JRadioButtonMenuItem();\r
JRadioButtonMenuItem seqButton = new JRadioButtonMenuItem();\r
- JCheckBoxMenuItem molecule = new JCheckBoxMenuItem();\r
- JCheckBoxMenuItem allchains = new JCheckBoxMenuItem();\r
+ JRadioButtonMenuItem hydro = new JRadioButtonMenuItem();\r
+ JRadioButtonMenuItem taylor = new JRadioButtonMenuItem();\r
+ JRadioButtonMenuItem zappo = new JRadioButtonMenuItem();\r
+ JRadioButtonMenuItem user = new JRadioButtonMenuItem();\r
+ JRadioButtonMenuItem buried = new JRadioButtonMenuItem();\r
+ JRadioButtonMenuItem turn = new JRadioButtonMenuItem();\r
+ JRadioButtonMenuItem strand = new JRadioButtonMenuItem();\r
+ JRadioButtonMenuItem helix = new JRadioButtonMenuItem();\r
+ JMenu viewMenu = new JMenu();\r
\r
/**\r
* DOCUMENT ME!\r
}\r
public void charge_actionPerformed(ActionEvent e)\r
{\r
- clearButtonGroup();\r
+ pdbcanvas.bysequence = false;\r
pdbcanvas.pdb.setChargeColours();\r
pdbcanvas.redrawneeded=true;\r
pdbcanvas.repaint();\r
\r
public void hydro_actionPerformed(ActionEvent e)\r
{\r
- clearButtonGroup();\r
- pdbcanvas.pdb.setHydrophobicityColours();\r
+ pdbcanvas.bysequence = false;\r
+ pdbcanvas.pdb.setColours(new HydrophobicColourScheme());\r
pdbcanvas.redrawneeded=true;\r
pdbcanvas.repaint();\r
}\r
\r
public void chain_actionPerformed(ActionEvent e)\r
{\r
- clearButtonGroup();\r
+ pdbcanvas.bysequence = false;\r
pdbcanvas.pdb.setChainColours();\r
pdbcanvas.redrawneeded=true;\r
pdbcanvas.repaint();\r
\r
public void seqButton_actionPerformed(ActionEvent e)\r
{\r
- clearButtonGroup();\r
- pdbcanvas.bysequence = seqButton.isSelected();\r
+ pdbcanvas.bysequence = true;\r
pdbcanvas.updateSeqColours();\r
}\r
\r
- void clearButtonGroup()\r
- {\r
- pdbcanvas.bysequence = false;\r
- pdbcanvas.bymolecule = false;\r
- }\r
\r
public void mapping_actionPerformed(ActionEvent e)\r
{\r
{\r
pdbcanvas.setAllchainsVisible(allchains.getState());\r
}\r
+\r
+ public void zappo_actionPerformed(ActionEvent e)\r
+ {\r
+ pdbcanvas.bysequence = false;\r
+ pdbcanvas.pdb.setColours(new ZappoColourScheme());\r
+ pdbcanvas.redrawneeded=true;\r
+ pdbcanvas.repaint();\r
+ }\r
+\r
+ public void taylor_actionPerformed(ActionEvent e)\r
+ {\r
+ pdbcanvas.bysequence = false;\r
+ pdbcanvas.pdb.setColours(new TaylorColourScheme());\r
+ pdbcanvas.redrawneeded=true;\r
+ pdbcanvas.repaint();\r
+ }\r
+\r
+ public void helix_actionPerformed(ActionEvent e)\r
+ {\r
+ pdbcanvas.bysequence = false;\r
+ pdbcanvas.pdb.setColours(new HelixColourScheme());\r
+ pdbcanvas.redrawneeded=true;\r
+ pdbcanvas.repaint();\r
+ }\r
+\r
+ public void strand_actionPerformed(ActionEvent e)\r
+ {\r
+ pdbcanvas.bysequence = false;\r
+ pdbcanvas.pdb.setColours(new StrandColourScheme());\r
+ pdbcanvas.redrawneeded=true;\r
+ pdbcanvas.repaint();\r
+ }\r
+\r
+ public void turn_actionPerformed(ActionEvent e)\r
+ {\r
+ pdbcanvas.bysequence = false;\r
+ pdbcanvas.pdb.setColours(new TurnColourScheme());\r
+ pdbcanvas.redrawneeded=true;\r
+ pdbcanvas.repaint();\r
+ }\r
+\r
+ public void buried_actionPerformed(ActionEvent e)\r
+ {\r
+ pdbcanvas.bysequence = false;\r
+ pdbcanvas.pdb.setColours(new BuriedColourScheme());\r
+ pdbcanvas.redrawneeded=true;\r
+ pdbcanvas.repaint();\r
+ }\r
+\r
+ public void user_actionPerformed(ActionEvent e)\r
+ {\r
+ if (e.getActionCommand().equals("User Defined..."))\r
+ {\r
+ new UserDefinedColours(pdbcanvas, null);\r
+ }\r
+ else\r
+ {\r
+ UserColourScheme udc = (UserColourScheme) UserDefinedColours.\r
+ getUserColourSchemes().get(e.getActionCommand());\r
+\r
+ pdbcanvas.pdb.setColours(udc);\r
+ pdbcanvas.redrawneeded=true;\r
+ pdbcanvas.repaint();\r
+ }\r
+ }\r
}\r