implements jalview.api.FeatureRenderer
{
/*
- * column indices of fields in Feature Settings table
- * todo: transfer valuers as data beans instead of Object[][]
+ * a data bean to hold one row of feature settings from the gui
*/
- public static final int TYPE_COLUMN = 0;
+ public static class FeatureSettingsBean
+ {
+ public final String featureType;
+
+ public final FeatureColourI featureColour;
- public static final int COLOUR_COLUMN = 1;
+ public final KeyedMatcherSetI filter;
- public static final int FILTER_COLUMN = 2;
+ public final Boolean show;
- public static final int SHOW_COLUMN = 3;
+ public FeatureSettingsBean(String type, FeatureColourI colour,
+ KeyedMatcherSetI theFilter, Boolean isShown)
+ {
+ featureType = type;
+ featureColour = colour;
+ filter = theFilter;
+ show = isShown;
+ }
+ }
/*
* global transparency for feature
* Replace current ordering with new ordering
*
* @param data
- * { String(Type), Colour(Type), Boolean(Displayed) }
+ * an array of { Type, Colour, Filter, Boolean }
* @return true if any visible features have been reordered, else false
*/
- public boolean setFeaturePriority(Object[][] data)
+ public boolean setFeaturePriority(FeatureSettingsBean[] data)
{
return setFeaturePriority(data, true);
}
/**
- * Sets the priority order for features, with the highest priority (displayed
- * on top) at the start of the data array
+ * Sets the priority order for features, with the highest priority (displayed on
+ * top) at the start of the data array
*
* @param data
- * { String(Type), Colour(Type), Boolean(Displayed) }
+ * an array of { Type, Colour, Filter, Boolean }
* @param visibleNew
* when true current featureDisplay list will be cleared
- * @return true if any visible features have been reordered or recoloured,
- * else false (i.e. no need to repaint)
+ * @return true if any visible features have been reordered or recoloured, else
+ * false (i.e. no need to repaint)
*/
- public boolean setFeaturePriority(Object[][] data, boolean visibleNew)
+ public boolean setFeaturePriority(FeatureSettingsBean[] data,
+ boolean visibleNew)
{
/*
* note visible feature ordering and colours before update
{
for (int i = 0; i < data.length; i++)
{
- String type = data[i][TYPE_COLUMN].toString();
- setColour(type, (FeatureColourI) data[i][COLOUR_COLUMN]);
- if (((Boolean) data[i][SHOW_COLUMN]).booleanValue())
+ String type = data[i].featureType;
+ setColour(type, data[i].featureColour);
+ if (data[i].show)
{
av_featuresdisplayed.setVisible(type);
}