JAL-3026 JLabel for SequenceFeature details in jalview-js
authorJim Procter <jprocter@issues.jalview.org>
Wed, 11 Jul 2018 19:39:49 +0000 (20:39 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 11 Jul 2018 19:39:49 +0000 (20:39 +0100)
src/jalview/gui/PopupMenu.java

index 26c2759..2bcd229 100644 (file)
@@ -54,6 +54,7 @@ import jalview.util.StringUtils;
 import jalview.util.UrlLink;
 import jalview.util.dialogrunner.RunResponse;
 
+import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -71,9 +72,13 @@ import java.util.TreeMap;
 import java.util.Vector;
 
 import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
+import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
+import javax.swing.JTextArea;
 
 /**
  * DOCUMENT ME!
@@ -591,13 +596,33 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
    */
   protected void showFeatureDetails(SequenceFeature sf)
   {
-    CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer();
-    // it appears Java's CSS does not support border-collaps :-(
-    cap.addStylesheetRule("table { border-collapse: collapse;}");
-    cap.addStylesheetRule("table, td, th {border: 1px solid black;}");
-    cap.setText(sf.getDetailsReport());
-
-    Desktop.addInternalFrame(cap,
+    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
+    {
+      CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer();
+      // it appears Java's CSS does not support border-collaps :-(
+      cap.addStylesheetRule("table { border-collapse: collapse;}");
+      cap.addStylesheetRule("table, td, th {border: 1px solid black;}");
+      cap.setText(sf.getDetailsReport());
+      details = cap;
+    }
+    Desktop.addInternalFrame(details,
             MessageManager.getString("label.feature_details"), 500, 500);
   }