2012-08-07 6 views
1

플렉스 테이블에서는 3 개의 위젯이 런타임에 한 행에 추가됩니다.GWT에서 flexTable의 getWidgets

첫 번째 위젯은 ListBox이고 세 번째 위젯은 listBox 또는 textBox가 될 수 있습니다.

세 번째 widjet에 대해 알고 싶습니다. listBox 또는 textBox입니까? 내 코드는 처음 2 위젯에 대해 알고

int count=flexTable.getRowCount(); 
     for(int i =0;i<count;i++){ 

      ListBox lbPropreties = (ListBox) flexTable.getWidget(i, 0); 
      String propertyname =lbPropreties.getValue(lbPropreties.getSelectedIndex()); 
      ListBox lbCondition = (ListBox) flexTable.getWidget(i, 1); 
      String condition =lbCondition.getValue(lbCondition.getSelectedIndex()); 





     } 

감사합니다

답변

3

쉬운 솔루션 :

Widget thirdWidget = flexTable.getWidget(i, 2); 

if (thirdWidget instanceof ListBox) { 
    ListBox listBox = (ListBox) thirdWidget; 
    ... 

} else if (thirdWidget instanceof TextBox) { 
    TextBox textBox = (TextBox) thirdWidget; 
    ... 
} 
또는

, 당신이 사용하는 위젯의 종류, 저장하는 몇 가지 변수를 사용 세 번째 열을 추가 할 때.