10
|
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 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.viewers.deferred.AbstractVirtualTable;
|
|
14
|
|
15 import dwt.widgets.Control;
|
|
16
|
|
17 /**
|
|
18 * Wrapper for a virtual-table-like widget. Contains all methods needed for lazy updates.
|
|
19 * The JFace algorithms for deferred or lazy content providers should talk to this class
|
|
20 * instead of directly to a TableViewer. This will allow them to be used with other virtual
|
|
21 * viewers and widgets in the future.
|
|
22 *
|
|
23 * <p>
|
|
24 * For example, if DWT starts to support virtual Lists in the future, it should be possible
|
|
25 * to create an adapter from <code>AbstractVirtualTable</code> to <code>ListViewer</code> in
|
|
26 * order to reuse the existing algorithms for deferred updates.
|
|
27 * </p>
|
|
28 *
|
|
29 * <p>
|
|
30 * This is package visiblity by design. It would only need to be made public if there was
|
|
31 * a demand to use the deferred content provider algorithms like
|
|
32 * <code>BackgroundContentProvider</code> with non-JFace viewers.
|
|
33 * </p>
|
|
34 *
|
|
35 * @since 3.1
|
|
36 */
|
|
37 abstract class AbstractVirtualTable {
|
|
38 /**
|
|
39 * Tells the receiver that the item at given row has changed. This may indicate
|
|
40 * that a different element is now at this row, but does not necessarily indicate
|
|
41 * that the element itself has changed. The receiver should request information for
|
|
42 * this row the next time it becomes visibile.
|
|
43 *
|
|
44 * @param index row to clear
|
|
45 */
|
|
46 public abstract void clear(int index);
|
|
47
|
|
48 /**
|
|
49 * Notifies the receiver that the given element is now located at the given index.
|
|
50 *
|
|
51 * @param element object located at the row
|
|
52 * @param itemIndex row number
|
|
53 */
|
|
54 public abstract void replace(Object element, int itemIndex);
|
|
55
|
|
56 /**
|
|
57 * Sets the item count for this table
|
|
58 *
|
|
59 * @param total new total number of items
|
|
60 */
|
|
61 public abstract void setItemCount(int total);
|
|
62
|
|
63 /**
|
|
64 * Returns the index of the top item visible in the table
|
|
65 *
|
|
66 * @return the index of the top item visible in the table
|
|
67 */
|
|
68 public abstract int getTopIndex();
|
|
69
|
|
70 /**
|
|
71 * Returns the number of items currently visible in the table. This is
|
|
72 * the size of the currently visible window, not the total size of the table.
|
|
73 *
|
|
74 * @return the number of items currently visible in the table
|
|
75 */
|
|
76 public abstract int getVisibleItemCount();
|
|
77
|
|
78 /**
|
|
79 * Returns the total number of items in the table
|
|
80 *
|
|
81 * @return the total number of items in the table
|
|
82 */
|
|
83 public abstract int getItemCount();
|
|
84
|
|
85 /**
|
|
86 * Returns the DWT control that this API is wrappering.
|
|
87 * @return Control.
|
|
88 */
|
|
89 public abstract Control getControl();
|
|
90 }
|