JPopupMenu men = new JPopupMenu(MessageManager
.formatMessage("label.settings_for_param", new String[]
{ type }));
- final FeatureColourI featureColour = (FeatureColourI) typeCol;
-
- /*
- * menu option to select (or deselect) variable colour
- */
- final JCheckBoxMenuItem variableColourCB = new JCheckBoxMenuItem(
- MessageManager.getString("label.variable_colour"));
- variableColourCB.setSelected(!featureColour.isSimpleColour());
- men.add(variableColourCB);
-
- /*
- * checkbox action listener doubles up as listener to OK
- * from the variable colour / filters dialog
- */
- variableColourCB.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- if (e.getSource() == variableColourCB)
- {
- // BH 2018 for JavaScript because this is a checkbox
- men.setVisible(true);
- men.setVisible(false);
- if (featureColour.isSimpleColour())
- {
- /*
- * toggle simple colour to variable colour - show dialog
- */
- FeatureTypeSettings fc = new FeatureTypeSettings(fr, type);
- fc.addActionListener(this);
- }
- else
- {
- /*
- * toggle variable to simple colour - show colour chooser
- */
- String title = MessageManager
- .formatMessage("label.select_colour_for", type);
- ColourChooserListener listener = new ColourChooserListener()
- {
- @Override
- public void colourSelected(Color c)
- {
- table.setValueAt(new FeatureColour(c), rowSelected,
- COLOUR_COLUMN);
- table.validate();
- updateFeatureRenderer(
- ((FeatureTableModel) table.getModel()).getData(),
- false);
- }
- };
- JalviewColourChooser.showColourChooser(FeatureSettings.this,
- title, featureColour.getMaxColour(), listener);
- }
- }
- else
- {
- if (e.getSource() instanceof FeatureTypeSettings)
- {
- /*
- * update after OK in feature colour dialog; the updated
- * colour will have already been set in the FeatureRenderer
- */
- FeatureColourI fci = fr.getFeatureColours().get(type);
- table.setValueAt(fci, rowSelected, COLOUR_COLUMN);
- // BH 2018 setting a table value does not invalidate it.
- // System.out.println("FeatureSettings is valied" +
- // table.validate();
- }
- }
- }
- });
-
- men.addSeparator();
JMenuItem scr = new JMenuItem(
MessageManager.getString("label.sort_by_score"));