KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > deferred > AbstractVirtualTable


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.viewers.deferred;
12
13 import org.eclipse.swt.widgets.Control;
14
15 /**
16  * Wrapper for a virtual-table-like widget. Contains all methods needed for lazy updates.
17  * The JFace algorithms for deferred or lazy content providers should talk to this class
18  * instead of directly to a TableViewer. This will allow them to be used with other virtual
19  * viewers and widgets in the future.
20  *
21  * <p>
22  * For example, if SWT starts to support virtual Lists in the future, it should be possible
23  * to create an adapter from <code>AbstractVirtualTable</code> to <code>ListViewer</code> in
24  * order to reuse the existing algorithms for deferred updates.
25  * </p>
26  *
27  * <p>
28  * This is package visiblity by design. It would only need to be made public if there was
29  * a demand to use the deferred content provider algorithms like
30  * <code>BackgroundContentProvider</code> with non-JFace viewers.
31  * </p>
32  *
33  * @since 3.1
34  */

35 abstract class AbstractVirtualTable {
36     /**
37      * Tells the receiver that the item at given row has changed. This may indicate
38      * that a different element is now at this row, but does not necessarily indicate
39      * that the element itself has changed. The receiver should request information for
40      * this row the next time it becomes visibile.
41      *
42      * @param index row to clear
43      */

44     public abstract void clear(int index);
45     
46     /**
47      * Notifies the receiver that the given element is now located at the given index.
48      *
49      * @param element object located at the row
50      * @param itemIndex row number
51      */

52     public abstract void replace(Object JavaDoc element, int itemIndex);
53     
54     /**
55      * Sets the item count for this table
56      *
57      * @param total new total number of items
58      */

59     public abstract void setItemCount(int total);
60     
61     /**
62      * Returns the index of the top item visible in the table
63      *
64      * @return the index of the top item visible in the table
65      */

66     public abstract int getTopIndex();
67     
68     /**
69      * Returns the number of items currently visible in the table. This is
70      * the size of the currently visible window, not the total size of the table.
71      *
72      * @return the number of items currently visible in the table
73      */

74     public abstract int getVisibleItemCount();
75     
76     /**
77      * Returns the total number of items in the table
78      *
79      * @return the total number of items in the table
80      */

81     public abstract int getItemCount();
82     
83     /**
84      * Returns the SWT control that this API is wrappering.
85      * @return Control.
86      */

87     public abstract Control getControl();
88 }
89
Popular Tags