RPC 호출을 통해 데이터베이스에서 오는 데이터로 셀 테이블을 채우고 싶습니다. 누군가가 이것을 보여줄 수있는 예제 애플리케이션을 줄 수 있습니까? 나는 혼란스럽고 나는 이것에 처음이에요. 도움을 주셔서 감사합니다GWT CellTable 인구
-2
A
답변
2
나는 CellTable을 시작하는 데 동일한 문제가있었습니다. 필자의 경우, x 좌표와 y 좌표로 데이터 포인트를 나타 내기 위해 다른 데이터 유형으로 CellTable을 채워야했습니다.
내 솔루션은 CellTable이 인터페이스를 구현하는 객체의 인터페이스를 생성하고 제공하는 것이 었습니다 : 을 인터페이스 :
public interface IsDataTablePresentable {
public String xValue();
public String yValue();
}
및 CellTable의 인스턴스 :
final CellTable<IsDataTablePresentable> dataTable = new CellTable<IsDataTablePresentable>();
그런 다음 데이터 유형에 따라 열을 만듭니다. 제 경우에는 해당 xv를 나타내는 TextColumn입니다. 문자열로서 ALUE : I의 y 값을 취할 것을 제외하고는, Y 값에 대한 코드는 동일한 모양
TextColumn<IsDataTablePresentable> xValueColumn = new TextColumn<IsDataTablePresentable>() {
@Override
public String getValue(IsDataTablePresentable object) {
return object.xValue();
}
};
dataTable.addColumn(xValueColumn, "the x-axis title");
; 그 후)
상기 CellTable 데이터를 추가
dataTable.setRowData(0, (ArrayList<IsDataTablePresentable>) <your field or RPC-returned ArrayList or whatever here!>);
그게 전부 야!
편집 : 클래스가 IsDataTablePresentable 구현하기위한 예 :
나는 DevGuide이 기사를 읽어 보시기 바랍니다 서버와의 통신을위한public class timeData implements IsSerializable, IsDataTablePresentable {
...
public String xValue() {
return ""+this.time.getDate() + "." + (this.time.getMonth()+1) + "." + (this.time.getYear()+1900);
}
public String yValue() {
return this.value.toString();
}
...
}
, 너무, 저를 도와 : Communicate with a Server - Google Web Toolkit
하십시오 몇 가지 코드를 제공하십시오 –
샘플 코드가 없습니다. 나는 샘플 코드를 찾고있다. – swingmicro