在RFT中如何擷取JTable中的所有資料?

來源:互聯網
上載者:User

 

 

在RFT中如何擷取JTable中的所有資料?

 

public


void

testMain(Object[]
args)

{

 

//Start Classics Java Application

startApp

(
"ClassicsJavaA"
);

 

//Navigate to Existing Order Grid

jmb().click(atPath
(
"Order"
));

jmb().click(atPath
(
"Order->View
Existing Order Status..."
));

 

// Frame: View Order Status

nameComboB().click();

nameComboB().click(atText
(
"Claire
Stratus"
));

ok().click();

 

// Frame: View Existing Orders

existingTable().click(atPoint
(172,92));

 

//Get the data for the table

ITestDataTable
orderTable = (ITestDataTable)existingTable().getTestData(
"contents"
);

 

//Display the available data types for the grid, total
rows and columns.

System.
out

.println (
"Available
Data Types: "
+ existingTable().getTestDataTypes
());

System.
out

.println (
"Total Rows in
table : "
+ orderTable.getRowCount());

System.
out

.println (
"Total Cols in
table : "
+ orderTable.getColumnCount());

 

       
 

// Cycle through all rows

       
 

for

(
int

row=0; row <
orderTable.getRowCount();++row)

       
 
{

       
     

// Cycle through all columns

       
     

for

(
int

col=0; col <
orderTable.getColumnCount();++col)

       
     
{

       
         

// Print out values
of cells at (row,col
) coordinates

       
         
System.
out

.println (
"Row "
+ row +
", "
+ orderTable.getColumnHeader
(col) +
": "
+orderTable.getCell
(row,col) );

                   
}

           
}

// Close the frame

close().click();

 

// Frame: ClassicsCD

classicsJava(
ANY

,
MAY_EXIT

).close();

}

}

 

 

控制台輸出:

Available Data Types: {contents=表內容, visible contents=可見表內容,
selected=選中的表儲存格, visible selected=選定可見表儲存格}

Total Rows in table : 1

Total Cols in table : 7

Row 0, ORDER ID: 7

Row 0, ORDER DATE:
3/11/98

Row 0, STATUS: Order Initiated

Row 0, COMPOSER: Bach

Row 0, COMPOSITION:
Brandenburg
Concertos Nos. 1
& 3

Row 0, QUANTITY: 5

Row 0, TOTAL: 84.9500

 

 

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.