label.single_file_description = Keep the last version of the file
label.keep_all_versions_description = Keep all previous versions of the file
label.rolled_backups_description = Keep the last nine versions of the file from _bak.1 (newest) to _bak.9 (oldest)
+label.cancel_changes_description = Cancel changes made to your last saved Custom scheme
label.previously_saved_scheme = Previously saved scheme
label.no_backup_files = NO BACKUP FILES
label.include_backup_files = Include backup files
label.single_file_description = Conserve la última versión del archivo
label.keep_all_versions_description = Mantener todas las versiones anteriores del archivo
label.rolled_backups_description = Mantenga las últimas nueve versiones del archivo desde _bak.1 (más reciente) a _bak.9 (más antigua)
+label.cancel_changes_description = Cancelar los cambios realizados en su último esquema personalizado guardado
label.previously_saved_scheme = Esquema previamente guardado
label.no_backup_files = NO ARCHIVOS DE RESPALDOS
label.include_backup_files = Incluir archivos de respaldos
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureColourI;
+import jalview.bin.Cache;
import jalview.datamodel.GraphLine;
import jalview.datamodel.features.FeatureAttributes;
import jalview.datamodel.features.FeatureAttributes.Datatype;
private JPanel maxColour = new JPanel();
- private JComboBox<String> threshold = new JComboBox<>();
+ private JComboBox<Object> threshold = new JComboBox<>();
private JSlider slider = new JSlider();
/*
* choice of option for 'colour for no value'
*/
- private JComboBox<String> noValueCombo;
+ private JComboBox<Object> noValueCombo;
/*
* choice of what to colour by text (Label or attribute)
*/
- private JComboBox<String> colourByTextCombo;
+ private JComboBox<Object> colourByTextCombo;
/*
* choice of what to colour by range (Score or attribute)
*/
- private JComboBox<String> colourByRangeCombo;
+ private JComboBox<Object> colourByRangeCombo;
private JRadioButton andFilters;
* @param withRange
* @param withText
*/
- protected JComboBox<String> populateAttributesDropdown(
+ protected JComboBox<Object> populateAttributesDropdown(
List<String[]> attNames, boolean withRange, boolean withText)
{
List<String> displayAtts = new ArrayList<>();
tooltips.add(desc == null ? "" : desc);
}
- JComboBox<String> attCombo = JvSwingUtils
- .buildComboWithTooltips(displayAtts, tooltips);
-
+ // now convert String List to Object List for buildComboWithTooltips
+ List<Object> displayAttsObjects = new ArrayList<>(displayAtts);
+ JComboBox<Object> attCombo = JvSwingUtils
+ .buildComboWithTooltips(displayAttsObjects, tooltips);
+
return attCombo;
}
* drop-down choice of attribute, with description as a tooltip
* if we can obtain it
*/
- final JComboBox<String> attCombo = populateAttributesDropdown(attNames,
+ final JComboBox<Object> attCombo = populateAttributesDropdown(attNames,
true, true);
String filterBy = setSelectedAttribute(attCombo, filter);
* @param attCombo
* @param filter
*/
- private String setSelectedAttribute(JComboBox<String> attCombo,
+ private String setSelectedAttribute(JComboBox<Object> attCombo,
FeatureMatcherI filter)
{
String item = null;
* @param valueField
* @param filterIndex
*/
- protected boolean updateFilter(JComboBox<String> attCombo,
+ protected boolean updateFilter(JComboBox<Object> attCombo,
JComboBox<Condition> condCombo, JTextField valueField,
int filterIndex)
{
- String attName = (String) attCombo.getSelectedItem();
+ String attName;
+ try
+ {
+ attName = (String) attCombo.getSelectedItem();
+ } catch (Exception e)
+ {
+ Cache.log.error("Problem casting Combo box entry to String");
+ attName = attCombo.getSelectedItem().toString();
+ }
Condition cond = (Condition) condCombo.getSelectedItem();
String pattern = valueField.getText().trim();
*/
package jalview.gui;
-import jalview.io.IntKeyStringValueEntry;
import jalview.util.MessageManager;
import java.awt.BorderLayout;
* @param entries
* @param tooltips
*/
- public static JComboBox<String> buildComboWithTooltips(
- List<String> entries, List<String> tooltips)
+ public static JComboBox<Object> buildComboWithTooltips(
+ List<Object> entries, List<String> tooltips)
{
- JComboBox<String> combo = new JComboBox<>();
+ JComboBox<Object> combo = new JComboBox<>();
final ComboBoxTooltipRenderer renderer = new ComboBoxTooltipRenderer();
combo.setRenderer(renderer);
- for (String attName : entries)
+ for (Object attName : entries)
{
combo.addItem(attName);
}
}
/**
- * A helper method to build a drop-down choice of values, with tooltips for the
- * entries
- *
- * @param entries
- * @param tooltips
- */
- public static JComboBox<IntKeyStringValueEntry> buildIntKeyStringValueComboWithTooltips(
- List<IntKeyStringValueEntry> entries, List<String> tooltips)
- {
- JComboBox<IntKeyStringValueEntry> combo = new JComboBox<>();
- final ComboBoxTooltipRenderer renderer = new ComboBoxTooltipRenderer();
- combo.setRenderer(renderer);
- for (IntKeyStringValueEntry attName : entries)
- {
- combo.addItem(attName);
- }
- renderer.setTooltips(tooltips);
- final MouseAdapter mouseListener = new MouseAdapter()
- {
- @Override
- public void mouseEntered(MouseEvent e)
- {
- int j = combo.getSelectedIndex();
- if (j > -1)
- {
- combo.setToolTipText(tooltips.get(j));
- }
- }
-
- @Override
- public void mouseExited(MouseEvent e)
- {
- combo.setToolTipText(null);
- }
- };
- for (Component c : combo.getComponents())
- {
- c.addMouseListener(mouseListener);
- }
- return combo;
- }
-
- /**
* Adds a titled border to the component in the default font and position (top
* left), optionally witht italic text
*
protected JButton revertButton = new JButton();
- protected JComboBox<IntKeyStringValueEntry> backupfilesPresetsCombo = new JComboBox<>();
+ protected JComboBox<Object> backupfilesPresetsCombo = new JComboBox<>();
private int backupfilesPresetsComboLastSelected = 0;
presetsComboLabel = new JLabel(title + ":");
presetsPanel.add(presetsComboLabel, gbc);
- List<IntKeyStringValueEntry> entries = Arrays
+ List<Object> entries = Arrays
.asList(BackupFilesPresetEntry.backupfilesPresetEntries);
List<String> tooltips = Arrays.asList(
BackupFilesPresetEntry.backupfilesPresetEntryDescriptions);
- backupfilesPresetsCombo = JvSwingUtils
- .buildIntKeyStringValueComboWithTooltips(entries, tooltips);
+ backupfilesPresetsCombo = JvSwingUtils.buildComboWithTooltips(entries,
+ tooltips);
/*
for (int i = 0; i < BackupFilesPresetEntry.backupfilesPresetEntries.length; i++)
{
presetsPanel.add(backupfilesPresetsCombo, gbc);
revertButton.setText(MessageManager.getString("label.cancel_changes"));
+ revertButton.setToolTipText(
+ MessageManager.getString("label.cancel_changes_description"));
revertButton.addActionListener(new ActionListener()
{
@Override
updateBackupFilesExampleLabel();
}
- protected int getComboIntStringKey(JComboBox<IntKeyStringValueEntry> c)
+ protected int getComboIntStringKey(
+ JComboBox<Object> backupfilesPresetsCombo2)
{
- IntKeyStringValueEntry e = (IntKeyStringValueEntry) c.getSelectedItem();
+ IntKeyStringValueEntry e;
+ try
+ {
+ e = (IntKeyStringValueEntry) backupfilesPresetsCombo2
+ .getSelectedItem();
+ } catch (Exception ex)
+ {
+ Cache.log.error(
+ "Problem casting Combo entry to IntKeyStringValueEntry.");
+ e = null;
+ }
return e != null ? e.k : 0;
}
- protected void setComboIntStringKey(JComboBox<IntKeyStringValueEntry> c,
+ protected void setComboIntStringKey(
+ JComboBox<Object> backupfilesPresetsCombo2,
int key)
{
- for (int i = 0; i < c.getItemCount(); i++)
+ for (int i = 0; i < backupfilesPresetsCombo2.getItemCount(); i++)
{
- IntKeyStringValueEntry e = c.getItemAt(i);
+ IntKeyStringValueEntry e;
+ try
+ {
+ e = (IntKeyStringValueEntry) backupfilesPresetsCombo2.getItemAt(i);
+ } catch (Exception ex)
+ {
+ Cache.log.error(
+ "Problem casting Combo entry to IntKeyStringValueEntry. Skipping item. ");
+ continue;
+ }
if (e.k == key)
{
- c.setSelectedIndex(i);
+ backupfilesPresetsCombo2.setSelectedIndex(i);
break;
}
}