From: gmungoc Date: Mon, 20 Aug 2018 10:52:01 +0000 (+0100) Subject: JAL-3032 variant of Sequence Details panel for JalviewJS X-Git-Tag: Release_2_11_4_0~45^2~18^2~481^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c45f4774f08ed968eaefb6cff55025ce9d21ad0c;p=jalview.git JAL-3032 variant of Sequence Details panel for JalviewJS --- diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 8e2cda4..5a12a02 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -25,6 +25,7 @@ import jalview.analysis.AlignmentAnnotationUtils; import jalview.analysis.AlignmentUtils; import jalview.analysis.Conservation; import jalview.bin.Cache; +import jalview.bin.Jalview; import jalview.commands.ChangeCaseCommand; import jalview.commands.EditCommand; import jalview.commands.EditCommand.Action; @@ -72,12 +73,14 @@ import java.util.TreeMap; import java.util.Vector; import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComponent; 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.JScrollPane; /** * DOCUMENT ME! @@ -1633,8 +1636,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener public void createSequenceDetailsReport(SequenceI[] sequences) { - CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer(); StringBuilder contents = new StringBuilder(128); + contents.append(""); for (SequenceI seq : sequences) { contents.append("

" + MessageManager.formatMessage( @@ -1645,9 +1648,30 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener contents, seq, true, true, ap.getSeqPanel().seqCanvas.fr); contents.append("

"); } - cap.setText("" + contents.toString() + ""); + contents.append(""); + String report = contents.toString(); + + JInternalFrame frame; + if (Jalview.isJS()) + { + JLabel textLabel = new JLabel(); + textLabel.setText(report); + textLabel.setBackground(Color.WHITE); + JPanel pane = new JPanel(new BorderLayout()); + ((JPanel) pane).setOpaque(true); + pane.setBackground(Color.WHITE); + ((JPanel) pane).add(textLabel, BorderLayout.NORTH); + frame = new JInternalFrame(); + frame.getContentPane().add(new JScrollPane(pane)); + } + else + { + CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer(); + cap.setText(report); + frame = cap; + } - Desktop.addInternalFrame(cap, + Desktop.addInternalFrame(frame, MessageManager.formatMessage("label.sequence_details_for", (sequences.length == 1 ? new Object[] { sequences[0].getDisplayId(true) } @@ -1655,7 +1679,6 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener { MessageManager .getString("label.selection") })), 500, 400); - } protected void showNonconserved_actionPerformed()