noColourmenuItem.setSelected(true);\r
}\r
\r
- if (sg.cs instanceof ConservationColourScheme)\r
+ if (sg.cs!=null && sg.cs.conservationApplied())\r
{\r
conservationMenuItem.setSelected(true);\r
}\r
{\r
sequenceMenu.setVisible(false);\r
}\r
+ else\r
+ {\r
+ java.util.Vector links = Preferences.sequenceURLLinks;\r
+\r
+ JMenu linkMenu = new JMenu("Link");\r
+ JMenuItem item;\r
+ for(int i=0; i<links.size(); i++)\r
+ {\r
+ String link = links.elementAt(i).toString();\r
+\r
+ item = new JMenuItem(link.substring(0, link.indexOf("|")));\r
+\r
+ final String url = link.substring(link.indexOf("|")+1, link.indexOf("$SEQUENCE_ID$"))\r
+ + sequence.getName() +\r
+ link.substring(link.indexOf("$SEQUENCE_ID$") + 13);\r
+\r
+\r
+ item.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ showLink(url);\r
+ }\r
+ });\r
+\r
+ linkMenu.add(item);\r
+ }\r
+ add(linkMenu);\r
+ }\r
}\r
\r
/**\r
colourMenu.add(buriedColour);\r
colourMenu.add(nucleotideMenuItem);\r
colourMenu.add(userDefinedColour);\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
+ JMenuItem item = new JMenuItem(userColours.\r
+ nextElement().toString());\r
+ item.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent evt)\r
+ {\r
+ userDefinedColour_actionPerformed(evt);\r
+ }\r
+ });\r
+ colourMenu.add(item);\r
+ }\r
+ }\r
+\r
+\r
colourMenu.addSeparator();\r
colourMenu.add(abovePIDColour);\r
colourMenu.add(conservationMenuItem);\r
abovePIDColour_actionPerformed(e);\r
}\r
});\r
- userDefinedColour.setText("User Defined");\r
+ userDefinedColour.setText("User Defined...");\r
userDefinedColour.addActionListener(new java.awt.event.ActionListener()\r
{\r
public void actionPerformed(ActionEvent e)\r
void refresh()\r
{\r
SequenceGroup sg = getGroup();\r
- SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
-\r
- if (superG != null)\r
+ if(sg!=null)\r
{\r
+ SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
+\r
+ if (superG != null)\r
+ {\r
superG.setSuperGroupProperties(sg);\r
+ }\r
}\r
-\r
ap.seqPanel.repaint();\r
}\r
\r
protected void abovePIDColour_actionPerformed(ActionEvent e)\r
{\r
SequenceGroup sg = getGroup();\r
+ if(sg.cs==null)\r
+ return;\r
\r
if (abovePIDColour.isSelected())\r
{\r
int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs,\r
getGroup().getName());\r
\r
- if (sg.cs instanceof ResidueColourScheme)\r
- {\r
- ((ResidueColourScheme) sg.cs).setThreshold(threshold);\r
- }\r
- else if (sg.cs instanceof ScoreColourScheme)\r
- {\r
- ((ScoreColourScheme) sg.cs).setThreshold(threshold);\r
- }\r
+ sg.cs.setThreshold(threshold, ap.av.getIgnoreGapsConsensus());\r
\r
SliderPanel.showPIDSlider();\r
}\r
else // remove PIDColouring\r
{\r
- ResidueColourScheme rcs = (ResidueColourScheme) sg.cs;\r
- rcs.setThreshold(0);\r
- sg.cs = rcs;\r
+ sg.cs.setThreshold(0, ap.av.getIgnoreGapsConsensus());\r
}\r
\r
refresh();\r
*/\r
protected void userDefinedColour_actionPerformed(ActionEvent e)\r
{\r
- new UserDefinedColours(ap, getGroup());\r
- }\r
-\r
+ SequenceGroup sg = getGroup();\r
+\r
+ if (e.getActionCommand().equals("User Defined..."))\r
+ new UserDefinedColours(ap, sg);\r
+ else\r
+ {\r
+ UserColourScheme udc = (UserColourScheme) UserDefinedColours.\r
+ getUserColourSchemes().get(e.getActionCommand());\r
+\r
+ sg.cs = udc;\r
+ }\r
+ }\r
/**\r
* DOCUMENT ME!\r
*\r
protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
{\r
SequenceGroup sg = getGroup();\r
+ if(sg.cs==null)\r
+ return;\r
\r
if (conservationMenuItem.isSelected())\r
{\r
c.calculate();\r
c.verdict(false, ap.av.ConsPercGaps);\r
\r
- ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
-\r
- sg.cs = ccs;\r
+ sg.cs.setConservation(c);\r
\r
- SliderPanel.setConservationSlider(ap, ccs, sg.getName());\r
+ SliderPanel.setConservationSlider(ap, sg.cs, sg.getName());\r
SliderPanel.showConservationSlider();\r
}\r
else // remove ConservationColouring\r
{\r
- ConservationColourScheme ccs = (ConservationColourScheme) sg.cs;\r
- sg.cs = ccs.cs;\r
+ sg.cs.setConservation(null);\r
}\r
\r
refresh();\r
SequenceGroup getGroup()\r
{\r
SequenceGroup sg = ap.av.getSelectionGroup();\r
-\r
- // this method won't add a new group if it already exists\r
- ap.av.alignment.addGroup(sg);\r
+ // this method won't add a new group if it already exists\r
+ if(sg!=null)\r
+ ap.av.alignment.addGroup(sg);\r
\r
return sg;\r
}\r
getGroup().setColourText(showColourText.isSelected());\r
refresh();\r
}\r
+\r
+ public void showLink(String url)\r
+ {\r
+ try\r
+ {\r
+ jalview.util.BrowserLauncher.openURL(url);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Unixers: Couldn't find default web browser."\r
+ +"\nAdd the full path to your browser in Preferences.",\r
+ "Web browser not found", JOptionPane.WARNING_MESSAGE );\r
+\r
+\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
}\r