X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2Fseqfeatures%2FFeatureRendererModel.java;h=8bdcad46c701a9e1cd1b8a0ba28e865085853438;hb=1a34e43f7fb8e6d4f559026c6f0a207893124c6d;hp=479767593428bf88bc81141a1c942c92e3bb0bf4;hpb=8690631b5afe2db0a06ef1b074d2633598c403ae;p=jalview.git diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java index 4797675..8bdcad4 100644 --- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -50,16 +50,27 @@ public abstract class FeatureRendererModel 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 @@ -673,26 +684,27 @@ public abstract class FeatureRendererModel * 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 @@ -731,9 +743,9 @@ public abstract class FeatureRendererModel { 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); }