From: tcofoegbu Date: Mon, 21 Mar 2016 14:34:34 +0000 (+0000) Subject: JAL-2028 added improvement for preconfigured ordering of custom display options X-Git-Tag: Release_2_10_0~294 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b44b99801b03025f1d769f20476bc90823d92499;p=jalview.git JAL-2028 added improvement for preconfigured ordering of custom display options --- diff --git a/src/jalview/gui/PDBSearchPanel.java b/src/jalview/gui/PDBSearchPanel.java index cef9ddd..a228c67 100644 --- a/src/jalview/gui/PDBSearchPanel.java +++ b/src/jalview/gui/PDBSearchPanel.java @@ -62,6 +62,7 @@ public class PDBSearchPanel extends GPDBSearchPanel { new Thread() { + @Override public void run() { lbl_loading.setVisible(false); @@ -109,6 +110,9 @@ public class PDBSearchPanel extends GPDBSearchPanel { tbl_summary.setModel(PDBRestResponse.getTableModel(request, resultList.getSearchSummary())); + // request.ge + // TableRowSorter sorter = new TableRowSorter<>( + // tbl_pdbDocFieldConfig.getModel()); } long endTime = System.currentTimeMillis(); @@ -179,6 +183,7 @@ public class PDBSearchPanel extends GPDBSearchPanel mainFrame.dispose(); } + @Override public void transferToSequenceFetcher(String ids) { // mainFrame.dispose(); @@ -231,6 +236,7 @@ public class PDBSearchPanel extends GPDBSearchPanel { new Thread() { + @Override public void run() { try @@ -276,6 +282,7 @@ public class PDBSearchPanel extends GPDBSearchPanel /** * Populates search target combo-box options */ + @Override public void populateCmbSearchTargetOptions() { List searchableTargets = new ArrayList(); diff --git a/src/jalview/jbgui/PDBDocFieldPreferences.java b/src/jalview/jbgui/PDBDocFieldPreferences.java index 875eb2e..da67196 100644 --- a/src/jalview/jbgui/PDBDocFieldPreferences.java +++ b/src/jalview/jbgui/PDBDocFieldPreferences.java @@ -21,9 +21,11 @@ package jalview.jbgui; import jalview.ws.dbsources.PDBRestClient.PDBDocField; +import jalview.ws.dbsources.PDBRestClient.PDBDocField.Group; import java.util.ArrayList; import java.util.Collection; +import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; @@ -36,6 +38,7 @@ import javax.swing.table.AbstractTableModel; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; + @SuppressWarnings("serial") public class PDBDocFieldPreferences extends JScrollPane { @@ -82,7 +85,7 @@ public class PDBDocFieldPreferences extends JScrollPane columnNames = new String[] { "", "Display", "Group" }; break; case STRUCTURE_CHOOSER: - columnNames = new String[] { " ", "Display", "Group" }; + columnNames = new String[] { "", "Display", "Group" }; break; case PREFERENCES: columnNames = new String[] { "PDB Field", "Show in search summary", @@ -148,6 +151,16 @@ public class PDBDocFieldPreferences extends JScrollPane sortKeys.add(new RowSorter.SortKey(columnIndexToSort, SortOrder.ASCENDING)); sorter.setSortKeys(sortKeys); + sorter.setComparator( + columnIndexToSort, + new Comparator() + { + @Override + public int compare(Group o1, Group o2) + { + return o1.getSortOrder() - o2.getSortOrder(); + } + }); sorter.sort(); break; case PREFERENCES: diff --git a/src/jalview/ws/dbsources/PDBRestClient.java b/src/jalview/ws/dbsources/PDBRestClient.java index ebe18f7..59cbe67 100644 --- a/src/jalview/ws/dbsources/PDBRestClient.java +++ b/src/jalview/ws/dbsources/PDBRestClient.java @@ -492,24 +492,38 @@ public class PDBRestClient "Version", "_version_", Group.MISCELLENOUS), ALL("ALL", "text", Group.MISCELLENOUS); - private enum Group + public enum Group { - DATE_OF("Date Of"), NAMES_AND_TAXONOMY("Names & Taxonomy"), MISCELLENOUS( - "Miscellenous"), QUALITY_MEASURES("Quality Measures"), CROSS_REFS( - "Cross References"), PROCEDURE_AND_SOFTWARE( - "Procedures & Softwares"); + DATE_OF("Date Of", 5), NAMES_AND_TAXONOMY("Names & Taxonomy", 3), + MISCELLENOUS("Miscellenous", 6), QUALITY_MEASURES("Quality Measures", + 1), CROSS_REFS("Cross References", 2), + PROCEDURE_AND_SOFTWARE("Procedures & Softwares", 4); - Group(String name) + Group(String name, int sortOrder) { this.name = name; + this.sortOrder = sortOrder; } private String name; + private int sortOrder; + public String getName() { return this.name; } + + public int getSortOrder() + { + return sortOrder; + } + + @Override + public String toString() + { + return this.name; + } }; private String name; @@ -534,9 +548,9 @@ public class PDBRestClient return code; } - public String getGroup() + public Group getGroup() { - return group.getName(); + return group; } @Override