+ static void addColourOrFilterByOptions(final AlignmentPanel ap,
+ final AlignmentAnnotation alignmentAnnotation,
+ final JPopupMenu pop)
+ {
+ JMenuItem item;
+ item = new JMenuItem(
+ MessageManager.getString("label.colour_by_annotation"));
+ item.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ AnnotationColourChooser.displayFor(ap.av, ap, alignmentAnnotation,
+ false);
+ };
+ });
+ pop.add(item);
+ if (alignmentAnnotation.sequenceRef != null)
+ {
+ item = new JMenuItem(
+ MessageManager.getString("label.colour_by_annotation") + " ("
+ + MessageManager.getString("label.per_seq") + ")");
+ item.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ AnnotationColourChooser.displayFor(ap.av, ap, alignmentAnnotation,
+ true);
+ };
+ });
+ pop.add(item);
+ }
+ item = new JMenuItem(
+ MessageManager.getString("action.select_by_annotation"));
+ item.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ AnnotationColumnChooser.displayFor(ap.av, ap, alignmentAnnotation);
+ };
+ });
+ pop.add(item);
+ }
+
+ static void addContactMatrixOptions(final AlignmentPanel ap,
+ final AlignmentAnnotation alignmentAnnotation,
+ final JPopupMenu pop)
+ {
+
+ final ContactMatrixI cm = ap.av.getContactMatrix(alignmentAnnotation);
+ JMenuItem item;
+ if (cm != null)
+ {
+ pop.addSeparator();
+
+ if (cm.hasGroups())
+ {
+ JCheckBoxMenuItem chitem = new JCheckBoxMenuItem(
+ MessageManager.getString("action.show_groups_on_matrix"));
+ chitem.setToolTipText(MessageManager
+ .getString("action.show_groups_on_matrix_tooltip"));
+ boolean showGroups = alignmentAnnotation
+ .isShowGroupsForContactMatrix();
+ final AlignmentAnnotation sel_row = alignmentAnnotation;
+ chitem.setState(showGroups);
+ chitem.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ sel_row.setShowGroupsForContactMatrix(chitem.getState());
+ // so any annotation colour changes are propagated - though they
+ // probably won't be unless the annotation row colours are removed
+ // too!
+ ap.alignmentChanged();
+ }
+ });
+ pop.add(chitem);
+ }
+ if (cm.hasTree())
+ {
+ item = new JMenuItem(
+ MessageManager.getString("action.show_tree_for_matrix"));
+ item.setToolTipText(MessageManager
+ .getString("action.show_tree_for_matrix_tooltip"));
+ item.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+
+ ap.alignFrame.showContactMapTree(alignmentAnnotation, cm);
+
+ }
+ });
+ pop.add(item);
+ }
+ else
+ {
+ item = new JMenuItem(
+ MessageManager.getString("action.cluster_matrix"));
+ item.setToolTipText(
+ MessageManager.getString("action.cluster_matrix_tooltip"));
+ item.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ final long progBar;
+ ap.alignFrame.setProgressBar(
+ MessageManager.formatMessage(
+ "action.clustering_matrix_for",
+ cm.getAnnotDescr(), 5f),
+ progBar = System.currentTimeMillis());
+ cm.setGroupSet(GroupSet.makeGroups(cm, true));
+ cm.randomlyReColourGroups();
+ cm.transferGroupColorsTo(alignmentAnnotation);
+ ap.alignmentChanged();
+ ap.alignFrame.showContactMapTree(alignmentAnnotation, cm);
+ ap.alignFrame.setProgressBar(null, progBar);
+ }
+ }).start();
+ }
+ });
+ pop.add(item);
+ }
+ }
+ }
+