// to be added, in the correct order or rendering\r
Vector featuresDisplayed = null;\r
\r
+ // A higher level for grouping features of a\r
+ // particular type\r
+ Hashtable featureGroups = null;\r
+\r
+\r
/**\r
* Creates a new FeatureRenderer object.\r
*\r
int start, int end, int x1, int y1, int width, int height)\r
{\r
\r
-//System.out.println(start+" "+end+" "+x1+" "+y1);\r
+ //System.out.println(start+" "+end+" "+x1+" "+y1);\r
if (seq.getDatasetSequence().getSequenceFeatures() == null\r
|| seq.getDatasetSequence().getSequenceFeatures().size()==0)\r
return;\r
if (!type.equals(sf.getType()))\r
continue;\r
\r
+ if(featureGroups!=null\r
+ && sf.getFeatureGroup()!=null\r
+ && featureGroups.containsKey(sf.getFeatureGroup())\r
+ && !((Boolean)featureGroups.get(sf.getFeatureGroup())).booleanValue())\r
+ {\r
+ continue;\r
+ }\r
+\r
if (sf.getBegin() > seq.getEnd())\r
continue;\r
\r
final JInternalFrame frame;\r
JScrollPane scrollPane = new JScrollPane();\r
JTable table;\r
+ JPanel groupPanel;\r
\r
public FeatureSettings(AlignViewport av, final AlignmentPanel ap)\r
{\r
JPanel bigPanel = new JPanel(new BorderLayout());\r
bigPanel.add(transPanel, BorderLayout.SOUTH);\r
bigPanel.add(scrollPane, BorderLayout.CENTER);\r
+ if(groupPanel!=null)\r
+ bigPanel.add(groupPanel, BorderLayout.NORTH);\r
\r
add(bigPanel, BorderLayout.CENTER);\r
add(buttonPanel, BorderLayout.SOUTH);\r
\r
void setTableData()\r
{\r
+ if (fr.featureGroups == null)\r
+ fr.featureGroups = new Hashtable();\r
+ else\r
+ fr.featureGroups.clear();\r
+\r
Vector allFeatures = new Vector();\r
Vector features;\r
Enumeration e;\r
while (e.hasMoreElements())\r
{\r
sf = (SequenceFeature) e.nextElement();\r
+ if(sf.getFeatureGroup()!=null\r
+ && !fr.featureGroups.containsKey(sf.getFeatureGroup()))\r
+ {\r
+ fr.featureGroups.put(sf.getFeatureGroup(), new Boolean(true));\r
+ if(groupPanel==null)\r
+ groupPanel = new JPanel();\r
+\r
+ final JCheckBox check = new JCheckBox(sf.getFeatureGroup(), true);\r
+ check.setFont(new Font("Serif", Font.BOLD, 12));\r
+ check.addItemListener(new ItemListener()\r
+ {\r
+ public void itemStateChanged(ItemEvent evt)\r
+ {\r
+ if (fr.featureGroups.containsKey(check.getText()))\r
+ {\r
+ fr.featureGroups.put(check.getText(),\r
+ new Boolean(check.isSelected()));\r
+ ap.seqPanel.seqCanvas.repaint();\r
+ if (ap.overviewPanel != null)\r
+ ap.overviewPanel.updateOverviewImage();\r
+ }\r
+\r
+ }\r
+ });\r
+ groupPanel.add(check);\r
+ }\r
if (!allFeatures.contains(sf.getType()))\r
{\r
allFeatures.addElement(sf.getType());\r
}\r
if(allFeatures.size()<1)\r
{\r
- try{\r
- frame.setClosed(true);\r
- }catch(Exception ex){}\r
+ try\r
+ { frame.setClosed(true); }\r
+ catch (Exception ex){}\r
+\r
+ JOptionPane.showInternalMessageDialog(\r
+ Desktop.desktop, "No features have been added to this alignment!",\r
+ "No Sequence Features", JOptionPane.WARNING_MESSAGE);\r
+\r
return;\r
}\r
\r