import java.awt.event.*;\r
import jalview.datamodel.*;\r
import jalview.appletgui.*;\r
+import jalview.schemes.*;\r
import java.awt.event.ActionListener;\r
import java.awt.event.ActionEvent;\r
\r
{\r
public void actionPerformed(ActionEvent e)\r
{\r
- hydro_actionPerformed();\r
+ pdbcanvas.setColours(new HydrophobicColourScheme());\r
}\r
});\r
chain.setLabel("By Chain");\r
allchains_itemStateChanged(itemEvent);\r
}\r
});\r
+ viewMenu.setLabel("View");\r
+ zappo.setLabel("Zappo");\r
+ zappo.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent actionEvent)\r
+ {\r
+ pdbcanvas.setColours(new ZappoColourScheme());\r
+ }\r
+ });\r
+ taylor.setLabel("Taylor");\r
+ taylor.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent actionEvent)\r
+ {\r
+ pdbcanvas.setColours(new TaylorColourScheme());\r
+ }\r
+ });\r
+ helix.setLabel("Helix Propensity");\r
+ helix.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent actionEvent)\r
+ {\r
+ pdbcanvas.setColours(new HelixColourScheme());\r
+ }\r
+ });\r
+ strand.setLabel("Strand Propensity");\r
+ strand.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent actionEvent)\r
+ {\r
+ pdbcanvas.setColours(new StrandColourScheme());\r
+ }\r
+ });\r
+ turn.setLabel("Turn Propensity");\r
+ turn.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent actionEvent)\r
+ {\r
+ pdbcanvas.setColours(new TurnColourScheme());\r
+ }\r
+ });\r
+ buried.setLabel("Buried Index");\r
+ buried.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent actionEvent)\r
+ {\r
+ pdbcanvas.setColours(new BuriedColourScheme());\r
+ }\r
+ });\r
+ user.setLabel("User Defined...");\r
+ user.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent actionEvent)\r
+ {\r
+ pdbcanvas.bysequence = false;\r
+ new jalview.appletgui.UserDefinedColours(pdbcanvas);\r
+ }\r
+ });\r
jMenuBar1.add(fileMenu);\r
jMenuBar1.add(coloursMenu);\r
- fileMenu.add(mapping);;\r
+ jMenuBar1.add(viewMenu);\r
+ fileMenu.add(mapping);;\r
\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(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
+ viewMenu.add(wire);\r
+ viewMenu.add(depth);\r
+ viewMenu.add(zbuffer);\r
+ viewMenu.add(allchains);\r
allchains.setState(true);\r
}\r
\r
MenuItem seqButton = new MenuItem();\r
\r
CheckboxMenuItem allchains = new CheckboxMenuItem();\r
+ Menu viewMenu = new Menu();\r
+ MenuItem turn = new MenuItem();\r
+ MenuItem strand = new MenuItem();\r
+ MenuItem helix = new MenuItem();\r
+ MenuItem taylor = new MenuItem();\r
+ MenuItem zappo = new MenuItem();\r
+ MenuItem buried = new MenuItem();\r
+ MenuItem user = new MenuItem();\r
\r
public void charge_actionPerformed()\r
{\r
- clearButtonGroup();\r
+ pdbcanvas.bysequence = false;\r
pdbcanvas.pdb.setChargeColours();\r
pdbcanvas.redrawneeded=true;\r
pdbcanvas.repaint();\r
}\r
\r
- public void hydro_actionPerformed()\r
- {\r
- clearButtonGroup();\r
- // pdbcanvas.pdb.setHydrophobicityColours();\r
- pdbcanvas.redrawneeded=true;\r
- pdbcanvas.repaint();\r
- }\r
-\r
public void chain_actionPerformed()\r
{\r
- clearButtonGroup();\r
- pdbcanvas.pdb.setChainColours();\r
+ pdbcanvas.bysequence = false;\r
+ pdbcanvas.pdb.setChainColours();\r
pdbcanvas.redrawneeded=true;\r
pdbcanvas.repaint();\r
}\r
\r
public void seqButton_actionPerformed()\r
{\r
- clearButtonGroup();\r
pdbcanvas.bysequence = true;\r
pdbcanvas.updateSeqColours();\r
pdbcanvas.repaint();\r
}\r
\r
- void clearButtonGroup()\r
- {\r
- pdbcanvas.bysequence = false;\r
- pdbcanvas.bymolecule = false;\r
- }\r
\r
public void mapping_actionPerformed()\r
{\r
{\r
pdbcanvas.setAllchainsVisible(allchains.getState());\r
}\r
+\r
}\r
Vector oldColours = new Vector();\r
ColourSchemeI oldColourScheme;\r
Frame frame;\r
+ MCview.AppletPDBCanvas pdbcanvas;\r
\r
int R = 0, G = 0, B = 0;\r
\r
\r
public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg)\r
{\r
- try {\r
- jbInit();\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
- frame = new Frame();\r
- frame.add(this);\r
- jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420, 345);\r
-\r
- if (sg != null)\r
- {\r
- frame.setTitle(frame.getTitle() + " (" + sg.getName() + ")");\r
- }\r
-\r
this.ap = ap;\r
seqGroup = sg;\r
\r
oldColourScheme = ap.av.getGlobalColourScheme();\r
}\r
\r
+ init();\r
+ }\r
+\r
+ public UserDefinedColours(MCview.AppletPDBCanvas pdb)\r
+ {\r
+ this.pdbcanvas = pdb;\r
+ init();\r
+ }\r
+\r
+ void init()\r
+ {\r
+ try\r
+ {\r
+ jbInit();\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ e.printStackTrace();\r
+ }\r
+ frame = new Frame();\r
+ frame.add(this);\r
+ jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420, 345);\r
+\r
+ if (seqGroup != null)\r
+ {\r
+ frame.setTitle(frame.getTitle() + " (" + seqGroup.getName() + ")");\r
+ }\r
+\r
for (int i = 0; i < 20; i++)\r
{\r
makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +\r
makeButton("Gap", "'.','-',' '");\r
\r
validate();\r
-\r
}\r
-\r
protected void rText_actionPerformed(ActionEvent e)\r
{\r
try\r
\r
protected void applyButton_actionPerformed(ActionEvent e)\r
{\r
-\r
Color[] newColours = new Color[24];\r
for (int i = 0; i < 24; i++)\r
{\r
}\r
\r
UserColourScheme ucs = new UserColourScheme(newColours);\r
- ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus());\r
+ if(ap!=null)\r
+ ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus());\r
\r
- if (seqGroup != null)\r
+ if(ap!=null)\r
{\r
- seqGroup.cs = ucs;\r
+ if (seqGroup != null)\r
+ {\r
+ seqGroup.cs = ucs;\r
+ }\r
+ else\r
+ {\r
+ ap.av.setGlobalColourScheme(ucs);\r
+ }\r
+ ap.seqPanel.seqCanvas.img = null;\r
+ ap.repaint();\r
}\r
- else\r
+ else if(pdbcanvas!=null)\r
{\r
- ap.av.setGlobalColourScheme(ucs);\r
+ pdbcanvas.pdb.setColours(ucs);\r
+ pdbcanvas.updateSeqColours();\r
}\r
-\r
- ap.seqPanel.seqCanvas.img = null;\r
- ap.repaint();\r
}\r
\r
\r
\r
UserColourScheme ucs = new UserColourScheme(newColours);\r
\r
- if (seqGroup != null)\r
+ if(ap!=null)\r
{\r
- seqGroup.cs = ucs;\r
+ if (seqGroup != null)\r
+ {\r
+ seqGroup.cs = ucs;\r
+ }\r
+ else\r
+ {\r
+ ap.av.setGlobalColourScheme(ucs);\r
+ }\r
+ ap.repaint();\r
}\r
- else\r
+ else if(pdbcanvas!=null)\r
{\r
- ap.av.setGlobalColourScheme(ucs);\r
+ pdbcanvas.pdb.setColours(ucs);\r
}\r
\r
- ap.repaint();\r
-\r
frame.setVisible(false);\r
}\r
\r