+ addLinks(seq, features);
+
+ if (seq == null)
+ {
+ addFeatureDetails(features);
+ }
+ }
+
+ /**
+ * Add a link to show feature details for each sequence feature
+ *
+ * @param features
+ */
+ protected void addFeatureDetails(List<SequenceFeature> features)
+ {
+ if (features == null || features.isEmpty())
+ {
+ return;
+ }
+ JMenu details = new JMenu(
+ MessageManager.getString("label.feature_details"));
+ add(details);
+
+ for (final SequenceFeature sf : features)
+ {
+ int start = sf.getBegin();
+ int end = sf.getEnd();
+ String desc = null;
+ if (start == end)
+ {
+ desc = String.format("%s %d", sf.getType(), start);
+ }
+ else
+ {
+ desc = String.format("%s %d-%d", sf.getType(), start, end);
+ }
+ String tooltip = desc;
+ String description = sf.getDescription();
+ if (description != null)
+ {
+ description = StringUtils.stripHtmlTags(description);
+ if (description.length() > 12)
+ {
+ desc = desc + " " + description.substring(0, 12) + "..";
+ }
+ else
+ {
+ desc = desc + " " + description;
+ }
+ tooltip = tooltip + " " + description;
+ }
+ if (sf.getFeatureGroup() != null)
+ {
+ tooltip = tooltip + (" (" + sf.getFeatureGroup() + ")");
+ }
+ JMenuItem item = new JMenuItem(desc);
+ item.setToolTipText(tooltip);
+ item.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showFeatureDetails(sf);
+ }
+ });
+ details.add(item);
+ }
+ }
+
+ /**
+ * Opens a panel showing a text report of feature dteails
+ *
+ * @param sf
+ */
+ protected void showFeatureDetails(SequenceFeature sf)
+ {
+ JInternalFrame details;
+ if (/** @j2sNative true || */ false)
+ {
+ details = new JInternalFrame();
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setOpaque(true);
+ panel.setBackground(Color.white);
+ // TODO JAL-3026 set style of table correctly for feature details
+ JLabel reprt = new JLabel(MessageManager.formatMessage("label.html_content",
+ new Object[]
+ { sf.getDetailsReport()}));
+ reprt.setBackground(Color.WHITE);
+ reprt.setOpaque(true);
+ panel.add(reprt,BorderLayout.CENTER);
+ details.setContentPane(panel);
+ details.pack();
+ }
+ else