2014-02-21 2 views
0

나는 rpc 호출을 사용하여 결과의 ​​목록을 얻는다. 결과 목록은 정확합니다. 왜냐하면 대화 상자를 사용할 때 모든 데이터가 거기에 있기 때문입니다. 그러나 CellTable에 넣을 때 일부 행이 손실되었습니다. 왜 이런 일이 생길까요? 자신의 equals()hashCode()이 사용되도록왜 CellTable에 모든 결과가 표시되지 않습니까?

public void onSuccess(List<List<String>> result) { 
      CellTable<List<String>> bugsTable = new CellTable<List<String>>(); 
      // Create columns 
      TextColumn<List<String>> idColumn = new TextColumn<List<String>>() { 
       @Override 
       public String getValue(List<String> recordSet) { 
       return recordSet.get(0).toString(); 
       } 
      }; 

      TextColumn<List<String>> idCommitColumn = new TextColumn<List<String>>() { 
       @Override 
       public String getValue(List<String> recordSet) { 
        return recordSet.get(1).toString(); 
       } 
      }; 

      TextColumn<List<String>> erMessageColumn = new TextColumn<List<String>>() { 
       @Override 
       public String getValue(List<String> recordSet) { 
        return recordSet.get(2).toString(); 
       } 
      }; 

      // Add the columns. 
      bugsTable.addColumn(idColumn, "ID"); 
      bugsTable.addColumn(idCommitColumn, "ID commit"); 
      bugsTable.addColumn(erMessageColumn, "Message"); 

      // Set the total row count. This isn't strictly necessary, but it affects 
      // paging calculations, so its good habit to keep the row count up to date. 
      bugsTable.setRowCount(result.size(), true); 

      // Push the data into the widget. 
      bugsTable.setRowData(0, result); 
      tabP.add(bugsTable, "bugs"); 
      RootPanel.get("loadingbarImg").setVisible(false); 
     } 
    }); 

답변

2

기본 ProvidesKey (SimpleKeyProvider) 키를 스스로 개체를 사용합니다. java.util.List 계약은 equals()hashCode() 동작을 정의하며 동일한 항목이있는 두 개의 목록이 equals()이고 동일한 hashCode()을 가지므로 목록에 동일한 행이 있으면 문제가 될 수 있습니다.

해결 방법 : 행에 List<String>을 사용하지 말고 특정 행 클래스를 정의하십시오.

관련 문제