From 71ca5630223ddd30ab463e4f736fac9667e9cb18 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 11 Jul 2018 20:39:49 +0100 Subject: [PATCH] JAL-3026 JLabel for SequenceFeature details in jalview-js --- src/jalview/gui/PopupMenu.java | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 26c2759..2bcd229 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -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); } -- 1.7.10.2