import jalview.gui.structurechooser.PDBStructureChooserQuerySource;
import jalview.gui.structurechooser.StructureChooserQuerySource;
import jalview.io.DataSourceType;
+import jalview.jbgui.FilterOption;
import jalview.jbgui.GStructureChooser;
-import jalview.jbgui.GStructureChooser.FilterOption;
import jalview.structure.StructureMapping;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
cmb_filterOption.removeAllItems();
if (haveData)
{
- cmb_filterOption.addItem(new FilterOption(
- MessageManager.getString("label.best_quality"),
- "overall_quality", VIEWS_FILTER, false));
- cmb_filterOption.addItem(new FilterOption(
- MessageManager.getString("label.best_resolution"),
- "resolution", VIEWS_FILTER, false));
- cmb_filterOption.addItem(new FilterOption(
- MessageManager.getString("label.most_protein_chain"),
- "number_of_protein_chains", VIEWS_FILTER, false));
- cmb_filterOption.addItem(new FilterOption(
- MessageManager.getString("label.most_bound_molecules"),
- "number_of_bound_molecules", VIEWS_FILTER, false));
- cmb_filterOption.addItem(new FilterOption(
- MessageManager.getString("label.most_polymer_residues"),
- "number_of_polymer_residues", VIEWS_FILTER, true));
+ List<FilterOption> filters = data.getAvailableFilterOptions(VIEWS_FILTER);
+ for (FilterOption filter:filters)
+ {
+ cmb_filterOption.addItem(filter);
+ }
}
cmb_filterOption.addItem(
new FilterOption(MessageManager.getString("label.enter_pdb_id"),
package jalview.gui.structurechooser;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import jalview.fts.core.FTSRestRequest;
import jalview.fts.core.FTSRestResponse;
import jalview.fts.service.pdb.PDBFTSRestClient;
-import jalview.jbgui.GStructureChooser.FilterOption;
+import jalview.jbgui.FilterOption;
+import jalview.util.MessageManager;
/**
* logic for querying the PDBe API for structures of sequences
lastPdbRequest = pdbRequest;
return resultList;
}
+ public List<FilterOption> getAvailableFilterOptions(String VIEWS_FILTER)
+ {
+ List<FilterOption> filters = new ArrayList<FilterOption>();
+ filters.add(new FilterOption(
+ MessageManager.getString("label.best_quality"),
+ "overall_quality", VIEWS_FILTER, false));
+ filters.add(new FilterOption(
+ MessageManager.getString("label.best_resolution"),
+ "resolution", VIEWS_FILTER, false));
+ filters.add(new FilterOption(
+ MessageManager.getString("label.most_protein_chain"),
+ "number_of_protein_chains", VIEWS_FILTER, false));
+ filters.add(new FilterOption(
+ MessageManager.getString("label.most_bound_molecules"),
+ "number_of_bound_molecules", VIEWS_FILTER, false));
+ filters.add(new FilterOption(
+ MessageManager.getString("label.most_polymer_residues"),
+ "number_of_polymer_residues", VIEWS_FILTER, true));
+
+ return filters;
+ }
/**
* FTSRestClient specific query builder to pick top ranked entry from a
package jalview.gui.structurechooser;
import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
-import java.util.Set;
import java.util.Vector;
import javax.swing.JTable;
import javax.swing.table.TableModel;
import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.DBRefSource;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.fts.api.FTSData;
import jalview.fts.api.FTSDataColumnI;
import jalview.fts.api.FTSRestClientI;
import jalview.fts.core.FTSDataColumnPreferences;
-import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
import jalview.fts.core.FTSRestRequest;
import jalview.fts.core.FTSRestResponse;
-import jalview.fts.service.pdb.PDBFTSRestClient;
-import jalview.jbgui.GStructureChooser.FilterOption;
+import jalview.jbgui.FilterOption;
/**
* logic for querying sources of structural data for structures of sequences
public abstract PDBEntry[] collectSelectedRows(JTable restable,
int[] selectedRows, List<SequenceI> selectedSeqsToView);
+ /**
+ * @param VIEWS_FILTER
+ * - a String key that can be used by the caller to tag the returned filter
+ * options to distinguish them in a collection
+ * @return list of FilterOption - convention is that the last one in the list
+ * will be constructed with 'addSeparator==true'
+ */
+ public abstract List<FilterOption> getAvailableFilterOptions(String VIEWS_FILTER);
}
\ No newline at end of file
package jalview.gui.structurechooser;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Objects;
import java.util.Set;
import javax.swing.JTable;
-import javax.swing.table.TableModel;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
-import jalview.fts.api.FTSData;
import jalview.fts.api.FTSDataColumnI;
-import jalview.fts.api.FTSRestClientI;
import jalview.fts.core.FTSDataColumnPreferences;
import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
import jalview.fts.core.FTSRestRequest;
import jalview.fts.core.FTSRestResponse;
-import jalview.fts.service.pdb.PDBFTSRestClient;
import jalview.fts.service.threedbeacons.TDBeaconsFTSRestClient;
-import jalview.jbgui.GStructureChooser.FilterOption;
+import jalview.jbgui.FilterOption;
+import jalview.util.MessageManager;
/**
* logic for querying the PDBe API for structures of sequences
return pdbRequest;
}
-
+@Override
+ public List<FilterOption> getAvailableFilterOptions(String VIEWS_FILTER)
+ {
+ List<FilterOption> filters = new ArrayList<FilterOption>();
+ filters.add(new FilterOption(
+ MessageManager.getString("label.best_quality"),
+ "overall_quality", VIEWS_FILTER, false));
+ filters.add(new FilterOption(
+ MessageManager.getString("label.best_resolution"),
+ "resolution", VIEWS_FILTER, false));
+ filters.add(new FilterOption(
+ MessageManager.getString("label.most_protein_chain"),
+ "number_of_protein_chains", VIEWS_FILTER, false));
+ filters.add(new FilterOption(
+ MessageManager.getString("label.most_bound_molecules"),
+ "number_of_bound_molecules", VIEWS_FILTER, false));
+ filters.add(new FilterOption(
+ MessageManager.getString("label.most_polymer_residues"),
+ "number_of_polymer_residues", VIEWS_FILTER, true));
+
+ return filters;
+ }
/**
* FTSRestClient specific query builder to pick top ranked entry from a
* fetchStructuresMetaData query
--- /dev/null
+package jalview.jbgui;
+
+/**
+ * This inner class provides the data model for the structure filter combo-box
+ *
+ * @author tcnofoegbu
+ *
+ */
+public class FilterOption
+{
+ private String name;
+
+ private String value;
+
+ private String view;
+
+ private boolean addSeparatorAfter;
+
+ /**
+ * Model for structure filter option
+ *
+ * @param name
+ * - the name of the Option
+ * @param value
+ * - the value of the option
+ * @param view
+ * - the category of the filter option
+ * @param addSeparatorAfter
+ * - if true, a horizontal separator is rendered immediately after
+ * this filter option, otherwise
+ */
+ public FilterOption(String name, String value, String view,
+ boolean addSeparatorAfter)
+ {
+ this.name = name;
+ this.value = value;
+ this.view = view;
+ this.addSeparatorAfter = addSeparatorAfter;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public String getView()
+ {
+ return view;
+ }
+
+ public void setView(String view)
+ {
+ this.view = view;
+ }
+
+ @Override
+ public String toString()
+ {
+ return this.name;
+ }
+
+ public boolean isAddSeparatorAfter()
+ {
+ return addSeparatorAfter;
+ }
+
+ public void setAddSeparatorAfter(boolean addSeparatorAfter)
+ {
+ this.addSeparatorAfter = addSeparatorAfter;
+ }
+}
\ No newline at end of file
}
/**
- * This inner class provides the data model for the structure filter combo-box
- *
- * @author tcnofoegbu
- *
- */
- public class FilterOption
- {
- private String name;
-
- private String value;
-
- private String view;
-
- private boolean addSeparatorAfter;
-
- /**
- * Model for structure filter option
- *
- * @param name
- * - the name of the Option
- * @param value
- * - the value of the option
- * @param view
- * - the category of the filter option
- * @param addSeparatorAfter
- * - if true, a horizontal separator is rendered immediately after
- * this filter option, otherwise
- */
- public FilterOption(String name, String value, String view,
- boolean addSeparatorAfter)
- {
- this.name = name;
- this.value = value;
- this.view = view;
- this.addSeparatorAfter = addSeparatorAfter;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- }
-
- public String getView()
- {
- return view;
- }
-
- public void setView(String view)
- {
- this.view = view;
- }
-
- @Override
- public String toString()
- {
- return this.name;
- }
-
- public boolean isAddSeparatorAfter()
- {
- return addSeparatorAfter;
- }
-
- public void setAddSeparatorAfter(boolean addSeparatorAfter)
- {
- this.addSeparatorAfter = addSeparatorAfter;
- }
- }
-
- /**
* This inner class provides the provides the data model for associate
* sequence combo-box - cmb_assSeq
*
import jalview.fts.api.FTSData;
import jalview.gui.structurechooser.PDBStructureChooserQuerySource;
import jalview.gui.structurechooser.StructureChooserQuerySource;
-import jalview.jbgui.GStructureChooser.FilterOption;
+import jalview.jbgui.FilterOption;
import jalview.ws.params.InvalidArgumentException;
import java.util.Collection;