Created 3Dbeacons data_columns.txt Test passed for data columns
[jalview.git] / src / jalview / fts / core / FTSRestResponse.java
index 5d8fb96..a5c8705 100644 (file)
@@ -21,6 +21,7 @@
 
 package jalview.fts.core;
 
+import jalview.datamodel.SequenceI;
 import jalview.fts.api.FTSData;
 import jalview.fts.api.FTSDataColumnI;
 
@@ -40,6 +41,8 @@ import javax.swing.table.DefaultTableModel;
 public class FTSRestResponse
 {
   private int numberOfItemsFound;
+  
+  private int sequenceLength;
 
   private String responseTime;
 
@@ -74,6 +77,14 @@ public class FTSRestResponse
   {
     this.searchSummary = searchSummary;
   }
+  
+  public int getSequenceLength() {
+    return sequenceLength;
+  }
+  
+  public void setSequenceLength(int sequenceLength) {
+    this.sequenceLength = sequenceLength;
+  }
 
   /**
    * Convenience method to obtain a Table model for a given summary List based
@@ -90,8 +101,8 @@ public class FTSRestResponse
   public static DefaultTableModel getTableModel(FTSRestRequest request,
           Collection<FTSData> summariesList)
   {
-    final FTSDataColumnI[] cols = request.getWantedFields().toArray(
-            new FTSDataColumnI[0]);
+    final FTSDataColumnI[] cols = request.getWantedFields()
+            .toArray(new FTSDataColumnI[0]);
     final int colOffset = request.getAssociatedSequence() == null ? 0 : 1;
     DefaultTableModel tableModel = new DefaultTableModel()
     {
@@ -106,7 +117,7 @@ public class FTSRestResponse
       {
         if (colOffset == 1 && columnIndex == 0)
         {
-          return String.class;
+          return SequenceI.class;
         }
         return cols[columnIndex - colOffset].getDataType()
                 .getDataTypeClass();
@@ -141,15 +152,15 @@ public class FTSRestResponse
     {
       try
       {
-        tbl_summary.getColumn(wantedField.getName()).setMinWidth(
-                wantedField.getMinWidth());
-        tbl_summary.getColumn(wantedField.getName()).setMaxWidth(
-                wantedField.getMaxWidth());
-        int prefedWidth = columnPrefs.get(wantedField.getName()) == null ? wantedField
-                .getPreferredWidth() : columnPrefs.get(wantedField
-                .getName());
-        tbl_summary.getColumn(wantedField.getName()).setPreferredWidth(
-                prefedWidth);
+        tbl_summary.getColumn(wantedField.getName())
+                .setMinWidth(wantedField.getMinWidth());
+        tbl_summary.getColumn(wantedField.getName())
+                .setMaxWidth(wantedField.getMaxWidth());
+        int prefedWidth = columnPrefs.get(wantedField.getName()) == null
+                ? wantedField.getPreferredWidth()
+                : columnPrefs.get(wantedField.getName());
+        tbl_summary.getColumn(wantedField.getName())
+                .setPreferredWidth(prefedWidth);
       } catch (Exception e)
       {
         e.printStackTrace();
@@ -157,15 +168,16 @@ public class FTSRestResponse
       if (wantedField.getDataType().getDataTypeClass() == Double.class)
       {
         DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer(
-                wantedField.getDataType().isFormtted(), wantedField
-                        .getDataType().getSignificantFigures());
+                wantedField.getDataType().isFormtted(),
+                wantedField.getDataType().getSignificantFigures());
         tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr);
       }
-      else if (wantedField.getDataType().getDataTypeClass() == Integer.class)
+      else if (wantedField.getDataType()
+              .getDataTypeClass() == Integer.class)
       {
         DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer(
-                wantedField.getDataType().isFormtted(), wantedField
-                        .getDataType().getSignificantFigures());
+                wantedField.getDataType().isFormtted(),
+                wantedField.getDataType().getSignificantFigures());
         tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr);
       }
     }