Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 213586 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/nebula/widgets/grid/GridItem.java (+38 lines)
Lines 1861-1864 Link Here
1861
    {
1861
    {
1862
        this.height = height;
1862
        this.height = height;
1863
    }
1863
    }
1864
    
1865
    /**
1866
     * Clears all properties of this item and resets values to their defaults.
1867
     * 
1868
     * @param allChildren <code>true</code> if all child items should be
1869
     * cleared recursively, and <code>false</code> otherwise
1870
     */
1871
    void clear(boolean allChildren)
1872
    {
1873
    	backgrounds.clear();
1874
    	checks.clear();
1875
    	checkable.clear();
1876
    	columnSpans.clear();
1877
    	fonts.clear();
1878
    	foregrounds.clear();
1879
    	grayeds.clear();
1880
    	images.clear();
1881
    	texts.clear();
1882
    	tooltips.clear();
1883
    	
1884
    	defaultForeground = null;
1885
    	defaultBackground = null;
1886
    	defaultFont = null;
1887
1888
    	hasSetData = false;
1889
    	headerText = null;
1890
1891
    	// Recursively clear children if requested.
1892
    	if (allChildren)
1893
    	{
1894
            for (int i = children.size() - 1; i >= 0; i--)
1895
            {
1896
                ((GridItem)children.get(i)).clear(true);
1897
            }
1898
    	}
1899
    	
1900
    	init();
1901
    }
1864
}
1902
}
(-)src/org/eclipse/nebula/widgets/grid/Grid.java (+135 lines)
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
    	checkWidget();
9694
        if (index < 0 || index >= items.size()) {
9695
            SWT.error(SWT.ERROR_INVALID_RANGE);
9696
        }
9697
        
9698
    	GridItem item = getItem(index);
9699
		item.clear(allChildren);
9700
    	redraw();
9701
    }
9702
    
9703
    /**
9704
     * Clears the items in the receiver which are between the given
9705
     * zero-relative start and end indices (inclusive).  The text, icon
9706
     * and other attributes of the items are set to their default values.
9707
     * If the table was created with the <code>SWT.VIRTUAL</code> style,
9708
     * these attributes are requested again as needed.
9709
     *
9710
     * @param start the start index of the item to clear
9711
     * @param end the end index of the item to clear
9712
     * @param allChildren <code>true</code> if all child items of the range of items should be
9713
     * cleared recursively, and <code>false</code> otherwise
9714
     *
9715
     * @exception IllegalArgumentException <ul>
9716
     *    <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>
9717
     * </ul>
9718
     * @exception SWTException <ul>
9719
     *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9720
     *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9721
     * </ul>
9722
     * 
9723
     * @see SWT#VIRTUAL
9724
     * @see SWT#SetData
9725
     */
9726
    public void clear(int start, int end, boolean allChildren) {
9727
    	checkWidget();
9728
    	if (start > end) return;
9729
    	
9730
    	int count = items.size();
9731
    	if (!(0 <= start && start <= end && end < count)) {
9732
    		SWT.error(SWT.ERROR_INVALID_RANGE);
9733
    	}
9734
		for (int i=start; i<=end; i++) {
9735
			GridItem item = (GridItem)items.get(i);
9736
			item.clear(allChildren);
9737
		}
9738
		redraw();
9739
    }
9740
    
9741
    /**
9742
     * Clears the items at the given zero-relative indices in the receiver.
9743
     * The text, icon and other attributes of the items are set to their default
9744
     * values.  If the table was created with the <code>SWT.VIRTUAL</code> style,
9745
     * these attributes are requested again as needed.
9746
     *
9747
     * @param indices the array of indices of the items
9748
     * @param allChildren <code>true</code> if all child items of the indexed items should be
9749
     * cleared recursively, and <code>false</code> otherwise
9750
     *
9751
     * @exception IllegalArgumentException <ul>
9752
     *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
9753
     *    <li>ERROR_NULL_ARGUMENT - if the indices array is null</li>
9754
     * </ul>
9755
     * @exception SWTException <ul>
9756
     *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9757
     *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9758
     * </ul>
9759
     * 
9760
     * @see SWT#VIRTUAL
9761
     * @see SWT#SetData
9762
     */
9763
    public void clear(int [] indices, boolean allChildren) {
9764
    	checkWidget();
9765
    	if (indices == null) {
9766
    		SWT.error(SWT.ERROR_NULL_ARGUMENT);
9767
    	}
9768
    	if (indices.length == 0) return;
9769
    	
9770
    	int count = items.size();
9771
    	for (int i=0; i<indices.length; i++) {
9772
    		if (!(0 <= indices[i] && indices[i] < count)) {
9773
    			SWT.error(SWT.ERROR_INVALID_RANGE);
9774
    		}
9775
    	}
9776
    	for (int i=0; i<indices.length; i++) {
9777
			GridItem item = (GridItem)items.get(indices[i]);
9778
			item.clear(allChildren);
9779
    	}
9780
		redraw();
9781
    }
9782
    
9783
    /**
9784
     * Clears all the items in the receiver. The text, icon and other
9785
     * attributes of the items are set to their default values. If the
9786
     * table was created with the <code>SWT.VIRTUAL</code> style, these
9787
     * attributes are requested again as needed.
9788
     * 
9789
     * @param allChildren <code>true</code> if all child items of each item should be
9790
     * cleared recursively, and <code>false</code> otherwise
9791
     *
9792
     * @exception SWTException <ul>
9793
     *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9794
     *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9795
     * </ul>
9796
     * 
9797
     * @see SWT#VIRTUAL
9798
     * @see SWT#SetData
9799
     */
9800
    public void clearAll(boolean allChildren) {
9801
    	checkWidget();
9802
    	if (items.size() > 0)
9803
    		clear(0, items.size()-1, allChildren);
9804
    }
9670
}
9805
}
9671
9806
9672
9807

Return to bug 213586