In Web pages, tables consist of rows, which in turn consist of cells. The actual width and height of each cell is computed based in part on its content (e.g., the amount of text in the cell, the size of an image in the cell), and the height of a row is the maximum of the heights of all cells in the row. Consequently, the final layout of a table in a Web page can only be computed once the content of each cell has been retrieved from the Internet. Using the proxy pattern described in Figure 10-7, describe an object model and an algorithm that would enable a Web browser to start displaying a table before the size of all cells is known, possibly redrawing the table as the content of each cell is downloaded.

What will be an ideal response?

The proxy design pattern is applied to the table cell. When created, TableCellProxy estimates its dimensions as best

as it can and updates them as the content is retrieved. Every time TableCellProxy provides a new estimate of its

dimensions, it signals Table (e.g., via a semaphore or a listener). The Table then recomputes the dimensions and

positions of all of its rows and redraws itself.

In general, the challenge of this type of approach is not the algorithm but to provide a visual behavior that does not

confuse the user, especially when only part of the table is visible.



Computer Science & Information Technology

You might also like to view...

Any Office 365 user can add new users, set up the services the business needs to use, set permission levels for each user, and manage SharePoint team sites

Indicate whether the statement is true or false

Computer Science & Information Technology

A ____ is the software that compresses a video stream when a video is stored, and decompresses the file when the video is played.

A. WinZip B. Stuffit C. codec D. IZip

Computer Science & Information Technology