Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 86204 Details for
Bug 213586
Grid needs clear methods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
2nd try with new patch
org.eclipse.nebula.widgets.grid.patch.txt (text/plain), 7.74 KB, created by
Chuck Mastrandrea
on 2008-01-04 11:00:42 EST
(
hide
)
Description:
2nd try with new patch
Filename:
MIME Type:
Creator:
Chuck Mastrandrea
Created:
2008-01-04 11:00:42 EST
Size:
7.74 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.nebula.widgets.grid >Index: src/org/eclipse/nebula/widgets/grid/GridItem.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.swt.nebula/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridItem.java,v >retrieving revision 1.20 >diff -u -r1.20 GridItem.java >--- src/org/eclipse/nebula/widgets/grid/GridItem.java 7 Dec 2007 18:26:59 -0000 1.20 >+++ src/org/eclipse/nebula/widgets/grid/GridItem.java 4 Jan 2008 15:58:27 -0000 >@@ -1861,4 +1861,42 @@ > { > this.height = height; > } >+ >+ /** >+ * Clears all properties of this item and resets values to their defaults. >+ * >+ * @param allChildren <code>true</code> if all child items should be >+ * cleared recursively, and <code>false</code> otherwise >+ */ >+ void clear(boolean allChildren) >+ { >+ backgrounds.clear(); >+ checks.clear(); >+ checkable.clear(); >+ columnSpans.clear(); >+ fonts.clear(); >+ foregrounds.clear(); >+ grayeds.clear(); >+ images.clear(); >+ texts.clear(); >+ tooltips.clear(); >+ >+ defaultForeground = null; >+ defaultBackground = null; >+ defaultFont = null; >+ >+ hasSetData = false; >+ headerText = null; >+ >+ // Recursively clear children if requested. >+ if (allChildren) >+ { >+ for (int i = children.size() - 1; i >= 0; i--) >+ { >+ ((GridItem)children.get(i)).clear(true); >+ } >+ } >+ >+ init(); >+ } > } >Index: src/org/eclipse/nebula/widgets/grid/Grid.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.swt.nebula/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java,v >retrieving revision 1.52 >diff -u -r1.52 Grid.java >--- src/org/eclipse/nebula/widgets/grid/Grid.java 2 Jan 2008 19:39:57 -0000 1.52 >+++ src/org/eclipse/nebula/widgets/grid/Grid.java 4 Jan 2008 15:58:27 -0000 >@@ -9667,6 +9667,141 @@ > Rectangle bottom = new Rectangle(rhw, getClientArea().height - DRAG_SCROLL_AREA_HEIGHT, getClientArea().width - rhw, DRAG_SCROLL_AREA_HEIGHT); > return top.contains(point) || bottom.contains(point); > } >+ >+ /** >+ * Clears the item at the given zero-relative index in the receiver. >+ * The text, icon and other attributes of the item are set to the default >+ * value. If the table was created with the <code>SWT.VIRTUAL</code> style, >+ * these attributes are requested again as needed. >+ * >+ * @param index the index of the item to clear >+ * @param allChildren <code>true</code> if all child items of the indexed item should be >+ * cleared recursively, and <code>false</code> otherwise >+ * >+ * @exception IllegalArgumentException <ul> >+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> >+ * </ul> >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @see SWT#VIRTUAL >+ * @see SWT#SetData >+ */ >+ public void clear(int index, boolean allChildren) { >+ checkWidget(); >+ if (index < 0 || index >= items.size()) { >+ SWT.error(SWT.ERROR_INVALID_RANGE); >+ } >+ >+ GridItem item = getItem(index); >+ item.clear(allChildren); >+ redraw(); >+ } >+ >+ /** >+ * Clears the items in the receiver which are between the given >+ * zero-relative start and end indices (inclusive). The text, icon >+ * and other attributes of the items are set to their default values. >+ * If the table was created with the <code>SWT.VIRTUAL</code> style, >+ * these attributes are requested again as needed. >+ * >+ * @param start the start index of the item to clear >+ * @param end the end index of the item to clear >+ * @param allChildren <code>true</code> if all child items of the range of items should be >+ * cleared recursively, and <code>false</code> otherwise >+ * >+ * @exception IllegalArgumentException <ul> >+ * <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> >+ * </ul> >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @see SWT#VIRTUAL >+ * @see SWT#SetData >+ */ >+ public void clear(int start, int end, boolean allChildren) { >+ checkWidget(); >+ if (start > end) return; >+ >+ int count = items.size(); >+ if (!(0 <= start && start <= end && end < count)) { >+ SWT.error(SWT.ERROR_INVALID_RANGE); >+ } >+ for (int i=start; i<=end; i++) { >+ GridItem item = (GridItem)items.get(i); >+ item.clear(allChildren); >+ } >+ redraw(); >+ } >+ >+ /** >+ * Clears the items at the given zero-relative indices in the receiver. >+ * The text, icon and other attributes of the items are set to their default >+ * values. If the table was created with the <code>SWT.VIRTUAL</code> style, >+ * these attributes are requested again as needed. >+ * >+ * @param indices the array of indices of the items >+ * @param allChildren <code>true</code> if all child items of the indexed items should be >+ * cleared recursively, and <code>false</code> otherwise >+ * >+ * @exception IllegalArgumentException <ul> >+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> >+ * <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> >+ * </ul> >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @see SWT#VIRTUAL >+ * @see SWT#SetData >+ */ >+ public void clear(int [] indices, boolean allChildren) { >+ checkWidget(); >+ if (indices == null) { >+ SWT.error(SWT.ERROR_NULL_ARGUMENT); >+ } >+ if (indices.length == 0) return; >+ >+ int count = items.size(); >+ for (int i=0; i<indices.length; i++) { >+ if (!(0 <= indices[i] && indices[i] < count)) { >+ SWT.error(SWT.ERROR_INVALID_RANGE); >+ } >+ } >+ for (int i=0; i<indices.length; i++) { >+ GridItem item = (GridItem)items.get(indices[i]); >+ item.clear(allChildren); >+ } >+ redraw(); >+ } >+ >+ /** >+ * Clears all the items in the receiver. The text, icon and other >+ * attributes of the items are set to their default values. If the >+ * table was created with the <code>SWT.VIRTUAL</code> style, these >+ * attributes are requested again as needed. >+ * >+ * @param allChildren <code>true</code> if all child items of each item should be >+ * cleared recursively, and <code>false</code> otherwise >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @see SWT#VIRTUAL >+ * @see SWT#SetData >+ */ >+ public void clearAll(boolean allChildren) { >+ checkWidget(); >+ if (items.size() > 0) >+ clear(0, items.size()-1, allChildren); >+ } > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
wim.jongman
:
iplog+
wim.jongman
:
review-
Actions:
View
|
Diff
Attachments on
bug 213586
:
85650
|
85651
|
86104
|
86190
| 86204