|
Lines 9667-9672
Link Here
|
| 9667 |
Rectangle bottom = new Rectangle(rhw, getClientArea().height - DRAG_SCROLL_AREA_HEIGHT, getClientArea().width - rhw, DRAG_SCROLL_AREA_HEIGHT); |
9667 |
Rectangle bottom = new Rectangle(rhw, getClientArea().height - DRAG_SCROLL_AREA_HEIGHT, getClientArea().width - rhw, DRAG_SCROLL_AREA_HEIGHT); |
| 9668 |
return top.contains(point) || bottom.contains(point); |
9668 |
return top.contains(point) || bottom.contains(point); |
| 9669 |
} |
9669 |
} |
|
|
9670 |
|
| 9671 |
/** |
| 9672 |
* Clears the item at the given zero-relative index in the receiver. |
| 9673 |
* The text, icon and other attributes of the item are set to the default |
| 9674 |
* value. If the table was created with the <code>SWT.VIRTUAL</code> style, |
| 9675 |
* these attributes are requested again as needed. |
| 9676 |
* |
| 9677 |
* @param index the index of the item to clear |
| 9678 |
* @param allChildren <code>true</code> if all child items of the indexed item should be |
| 9679 |
* cleared recursively, and <code>false</code> otherwise |
| 9680 |
* |
| 9681 |
* @exception IllegalArgumentException <ul> |
| 9682 |
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> |
| 9683 |
* </ul> |
| 9684 |
* @exception SWTException <ul> |
| 9685 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
| 9686 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
| 9687 |
* </ul> |
| 9688 |
* |
| 9689 |
* @see SWT#VIRTUAL |
| 9690 |
* @see SWT#SetData |
| 9691 |
*/ |
| 9692 |
public void clear(int index, boolean allChildren) { |
| 9693 |
GridItem item = getItem(index); |
| 9694 |
if (item != null) { |
| 9695 |
item.clear(allChildren); |
| 9696 |
redraw(); |
| 9697 |
} |
| 9698 |
} |
| 9699 |
|
| 9700 |
/** |
| 9701 |
* Clears the items in the receiver which are between the given |
| 9702 |
* zero-relative start and end indices (inclusive). The text, icon |
| 9703 |
* and other attributes of the items are set to their default values. |
| 9704 |
* If the table was created with the <code>SWT.VIRTUAL</code> style, |
| 9705 |
* these attributes are requested again as needed. |
| 9706 |
* |
| 9707 |
* @param start the start index of the item to clear |
| 9708 |
* @param end the end index of the item to clear |
| 9709 |
* @param allChildren <code>true</code> if all child items of the range of items should be |
| 9710 |
* cleared recursively, and <code>false</code> otherwise |
| 9711 |
* |
| 9712 |
* @exception IllegalArgumentException <ul> |
| 9713 |
* <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li> |
| 9714 |
* </ul> |
| 9715 |
* @exception SWTException <ul> |
| 9716 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
| 9717 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
| 9718 |
* </ul> |
| 9719 |
* |
| 9720 |
* @see SWT#VIRTUAL |
| 9721 |
* @see SWT#SetData |
| 9722 |
*/ |
| 9723 |
public void clear(int start, int end, boolean allChildren) { |
| 9724 |
checkWidget(); |
| 9725 |
if (start > end) return; |
| 9726 |
|
| 9727 |
int count = items.size(); |
| 9728 |
if (!(0 <= start && start <= end && end < count)) { |
| 9729 |
SWT.error(SWT.ERROR_INVALID_RANGE); |
| 9730 |
} |
| 9731 |
boolean cleared = false; |
| 9732 |
for (int i=start; i<=end; i++) { |
| 9733 |
GridItem item = (GridItem)items.get(i); |
| 9734 |
if (item != null) { |
| 9735 |
item.clear(allChildren); |
| 9736 |
cleared = true; |
| 9737 |
} |
| 9738 |
} |
| 9739 |
if (cleared) { |
| 9740 |
redraw(); |
| 9741 |
} |
| 9742 |
} |
| 9743 |
|
| 9744 |
/** |
| 9745 |
* Clears the items at the given zero-relative indices in the receiver. |
| 9746 |
* The text, icon and other attributes of the items are set to their default |
| 9747 |
* values. If the table was created with the <code>SWT.VIRTUAL</code> style, |
| 9748 |
* these attributes are requested again as needed. |
| 9749 |
* |
| 9750 |
* @param indices the array of indices of the items |
| 9751 |
* @param allChildren <code>true</code> if all child items of the indexed items should be |
| 9752 |
* cleared recursively, and <code>false</code> otherwise |
| 9753 |
* |
| 9754 |
* @exception IllegalArgumentException <ul> |
| 9755 |
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> |
| 9756 |
* <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> |
| 9757 |
* </ul> |
| 9758 |
* @exception SWTException <ul> |
| 9759 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
| 9760 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
| 9761 |
* </ul> |
| 9762 |
* |
| 9763 |
* @see SWT#VIRTUAL |
| 9764 |
* @see SWT#SetData |
| 9765 |
*/ |
| 9766 |
public void clear(int [] indices, boolean allChildren) { |
| 9767 |
checkWidget(); |
| 9768 |
if (indices == null) |
| 9769 |
SWT.error(SWT.ERROR_NULL_ARGUMENT); |
| 9770 |
if (indices.length == 0) return; |
| 9771 |
|
| 9772 |
int count = items.size(); |
| 9773 |
for (int i=0; i<indices.length; i++) { |
| 9774 |
if (!(0 <= indices[i] && indices[i] < count)) { |
| 9775 |
SWT.error(SWT.ERROR_INVALID_RANGE); |
| 9776 |
} |
| 9777 |
} |
| 9778 |
boolean cleared = false; |
| 9779 |
for (int i=0; i<indices.length; i++) { |
| 9780 |
GridItem item = (GridItem)items.get(indices[i]); |
| 9781 |
if (item != null) { |
| 9782 |
item.clear(allChildren); |
| 9783 |
cleared = true; |
| 9784 |
} |
| 9785 |
} |
| 9786 |
if (cleared) { |
| 9787 |
redraw(); |
| 9788 |
} |
| 9789 |
} |
| 9790 |
|
| 9791 |
/** |
| 9792 |
* Clears all the items in the receiver. The text, icon and other |
| 9793 |
* attributes of the items are set to their default values. If the |
| 9794 |
* table was created with the <code>SWT.VIRTUAL</code> style, these |
| 9795 |
* attributes are requested again as needed. |
| 9796 |
* |
| 9797 |
* @param allChildren <code>true</code> if all child items of each item should be |
| 9798 |
* cleared recursively, and <code>false</code> otherwise |
| 9799 |
* |
| 9800 |
* @exception SWTException <ul> |
| 9801 |
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
| 9802 |
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
| 9803 |
* </ul> |
| 9804 |
* |
| 9805 |
* @see SWT#VIRTUAL |
| 9806 |
* @see SWT#SetData |
| 9807 |
*/ |
| 9808 |
public void clearAll(boolean allChildren) { |
| 9809 |
checkWidget(); |
| 9810 |
if (items.size() > 0) |
| 9811 |
clear(0, items.size()-1, allChildren); |
| 9812 |
} |
| 9670 |
} |
9813 |
} |
| 9671 |
|
9814 |
|
| 9672 |
|
9815 |
|