import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemes;
import jalview.schemes.PIDColourScheme;
+import jalview.schemes.ResidueColourScheme;
import jalview.util.GroupUrlLink;
import jalview.util.GroupUrlLink.UrlStringTooLongException;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import jalview.util.StringUtils;
import jalview.util.UrlLink;
-import jalview.util.dialogrunner.RunResponse;
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.TreeMap;
import java.util.Vector;
+import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
-import javax.swing.JTextArea;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JScrollPane;
/**
* DOCUMENT ME!
protected JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();
+ protected JRadioButtonMenuItem annotationColour;
+
protected JMenuItem modifyConservation = new JMenuItem();
AlignmentPanel ap;
}
}
}
- // for the case when no sequences are even visible
+
+ /*
+ * offer 'Reveal All'
+ * - in the IdPanel (seq not null) if any sequence is hidden
+ * - in the IdPanel or SeqPanel if all sequences are hidden (seq is null)
+ */
if (alignPanel.av.hasHiddenRows())
{
+ boolean addOption = seq != null;
+ if (!addOption && alignPanel.av.getAlignment().getHeight() == 0)
+ {
+ addOption = true;
+ }
+ if (addOption)
{
menuItem = new JMenuItem(
MessageManager.getString("action.reveal_all"));
}
}
});
-
add(menuItem);
}
}
protected void showFeatureDetails(SequenceFeature sf)
{
JInternalFrame details;
- if (/** @j2sNative true || */ false)
+ if (Platform.isJS())// ** @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()}));
+ 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);
+ panel.add(reprt, BorderLayout.CENTER);
details.setContentPane(panel);
details.pack();
}
else
+ /**
+ * Java only
+ *
+ * @j2sNative
+ */
{
CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer();
// it appears Java's CSS does not support border-collaps :-(
{
sqi = sqi.getDatasetSequence();
}
- DBRefEntry[] dbr = sqi.getDBRefs();
- if (dbr != null && dbr.length > 0)
+ List<DBRefEntry> dbr = sqi.getDBRefs();
+ int nd;
+ if (dbr != null && (nd = dbr.size()) > 0)
{
- for (int d = 0; d < dbr.length; d++)
+ for (int d = 0; d < nd; d++)
{
- String src = dbr[d].getSource(); // jalview.util.DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase();
+ DBRefEntry e = dbr.get(d);
+ String src = e.getSource(); // jalview.util.DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase();
Object[] sarray = commonDbrefs.get(src);
if (sarray == null)
{
if (((String[]) sarray[1])[sq] == null)
{
- if (!dbr[d].hasMap() || (dbr[d].getMap()
+ if (!e.hasMap() || (e.getMap()
.locateMappedRange(start, end) != null))
{
- ((String[]) sarray[1])[sq] = dbr[d].getAccessionId();
+ ((String[]) sarray[1])[sq] = e.getAccessionId();
((int[]) sarray[0])[0]++;
}
}
}
});
+ annotationColour = new JRadioButtonMenuItem(
+ MessageManager.getString("action.by_annotation"));
+ annotationColour.setName(ResidueColourScheme.ANNOTATION_COLOUR);
+ annotationColour.setEnabled(false);
+ annotationColour.setToolTipText(
+ MessageManager.getString("label.by_annotation_tooltip"));
+
modifyConservation.setText(MessageManager
.getString("label.modify_conservation_threshold"));
modifyConservation.addActionListener(new ActionListener()
colourMenu.add(textColour);
colourMenu.addSeparator();
- ColourMenuHelper.addMenuItems(colourMenu, this, sg, false);
+ ButtonGroup bg = ColourMenuHelper.addMenuItems(colourMenu, this, sg,
+ false);
+ bg.add(annotationColour);
+ colourMenu.add(annotationColour);
colourMenu.addSeparator();
colourMenu.add(conservationMenuItem);
public void createSequenceDetailsReport(SequenceI[] sequences)
{
- CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer();
StringBuilder contents = new StringBuilder(128);
+ contents.append("<html><body>");
for (SequenceI seq : sequences)
{
contents.append("<p><h2>" + MessageManager.formatMessage(
contents, seq, true, true, ap.getSeqPanel().seqCanvas.fr);
contents.append("</p>");
}
- cap.setText("<html>" + contents.toString() + "</html>");
+ contents.append("</body></html>");
+ String report = contents.toString();
+
+ JInternalFrame frame;
+ if (Platform.isJS())
+ {
+ JLabel textLabel = new JLabel();
+ textLabel.setText(report);
+ textLabel.setBackground(Color.WHITE);
+ JPanel pane = new JPanel(new BorderLayout());
+ pane.setOpaque(true);
+ pane.setBackground(Color.WHITE);
+ pane.add(textLabel, BorderLayout.NORTH);
+ frame = new JInternalFrame();
+ frame.getContentPane().add(new JScrollPane(pane));
+ }
+ else
+ /**
+ * Java only
+ *
+ * @j2sNative
+ */
+ {
+ 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) }
{ MessageManager
.getString("label.selection") })),
500, 400);
-
}
protected void showNonconserved_actionPerformed()
MessageManager.getString("label.group_description"));
dialog.showDialog(ap.alignFrame,
MessageManager.getString("label.edit_group_name_description"),
- new RunResponse(JvOptionPane.OK_OPTION)
+ new Runnable()
{
@Override
public void run()
dialog.showDialog(ap.alignFrame,
MessageManager.getString(
"label.edit_sequence_name_description"),
- new RunResponse(JvOptionPane.OK_OPTION)
+ new Runnable()
{
@Override
public void run()
public void copy_actionPerformed()
{
- ap.alignFrame.copy_actionPerformed(null);
+ ap.alignFrame.copy_actionPerformed();
}
public void cut_actionPerformed()
{
- ap.alignFrame.cut_actionPerformed(null);
+ ap.alignFrame.cut_actionPerformed();
}
void changeCase(ActionEvent e)
*/
if (!seqs.isEmpty())
{
- new FeatureEditor(ap).createFeatures(seqs, features, new Runnable()
- {
- public void run()
- {
- ap.alignFrame.setShowSeqFeatures(true);
- ap.av.setSearchResults(null); // clear highlighting
- ap.repaint(); // draw new/amended features
- }
- });
+ new FeatureEditor(ap, seqs, features, true).showDialog();
}
}
null, MessageManager.getString("label.edit_sequence"), null);
dialog.showDialog(ap.alignFrame,
MessageManager.getString("label.edit_sequence"),
- new RunResponse(JvOptionPane.OK_OPTION)
+ new Runnable()
{
@Override
public void run()
* switch to the chosen colour scheme (or null for None)
*/
ColourSchemeI colourScheme = ColourSchemes.getInstance()
- .getColourScheme(colourSchemeName, sg,
+ .getColourScheme(colourSchemeName, ap.av, sg,
ap.av.getHiddenRepSequences());
sg.setColourScheme(colourScheme);
if (colourScheme instanceof Blosum62ColourScheme