Mercurial > projects > dwt-addons
diff dwtx/jface/viewers/TableViewer.d @ 70:46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 22 May 2008 01:36:46 +0200 |
parents | ea8ff534f622 |
children | 7ffeace6c47f |
line wrap: on
line diff
--- a/dwtx/jface/viewers/TableViewer.d Mon May 19 13:41:06 2008 +0200 +++ b/dwtx/jface/viewers/TableViewer.d Thu May 22 01:36:46 2008 +0200 @@ -23,7 +23,6 @@ import dwtx.jface.viewers.ViewerRow; import dwtx.jface.viewers.TableViewerEditor; import dwtx.jface.viewers.ColumnViewerEditorActivationStrategy; - import dwt.DWT; import dwt.graphics.Point; import dwt.widgets.Composite; @@ -47,16 +46,16 @@ * </p> * <p> * Label providers for table viewers must implement either the - * <code>ITableLabelProvider</code> or the <code>ILabelProvider</code> - * interface (see <code>TableViewer.setLabelProvider</code> for more details). + * <code>ITableLabelProvider</code> or the <code>ILabelProvider</code> interface + * (see <code>TableViewer.setLabelProvider</code> for more details). * </p> * <p> * As of 3.1 the TableViewer now supports the DWT.VIRTUAL flag. If the - * underlying table is DWT.VIRTUAL, the content provider may implement - * {@link ILazyContentProvider} instead of {@link IStructuredContentProvider}. - * Note that in this case, the viewer does not support sorting or filtering. - * Also note that in this case, the Widget based APIs may return null if the - * element is not specified or not created yet. + * underlying table is DWT.VIRTUAL, the content provider may implement {@link + * ILazyContentProvider} instead of {@link IStructuredContentProvider} . Note + * that in this case, the viewer does not support sorting or filtering. Also + * note that in this case, the Widget based APIs may return null if the element + * is not specified or not created yet. * </p> * <p> * Users of DWT.VIRTUAL should also avoid using getItems() from the Table within @@ -64,7 +63,11 @@ * TreeViewer to populate the items. It also has the side effect of creating all * of the items thereby eliminating the performance improvements of DWT.VIRTUAL. * </p> - * + * <p> + * Users setting up an editable table with more than 1 column <b>have</b> to pass the + * DWT.FULL_SELECTION style bit + * </p> + * * @see DWT#VIRTUAL * @see #doFindItem(Object) * @see #internalRefresh(Object, bool) @@ -89,9 +92,9 @@ * <code>MULTI, H_SCROLL, V_SCROLL,</code> and <code>BORDER</code>. The * viewer has no input, no content provider, a default label provider, no * sorter, and no filters. The table has no columns. - * + * * @param parent - * the parent control + * the parent control */ public this(Composite parent) { this(parent, DWT.MULTI | DWT.H_SCROLL | DWT.V_SCROLL | DWT.BORDER); @@ -102,11 +105,11 @@ * parent. The table control is created using the given style bits. The * viewer has no input, no content provider, a default label provider, no * sorter, and no filters. The table has no columns. - * + * * @param parent - * the parent control + * the parent control * @param style - * DWT style bits + * DWT style bits */ public this(Composite parent, int style) { this(new Table(parent, style)); @@ -116,9 +119,9 @@ * Creates a table viewer on the given table control. The viewer has no * input, no content provider, a default label provider, no sorter, and no * filters. - * + * * @param table - * the table control + * the table control */ public this(Table table) { this.table = table; @@ -131,7 +134,7 @@ /** * Returns this table viewer's table control. - * + * * @return the table control */ public Table getTable() { @@ -139,7 +142,9 @@ } protected override ColumnViewerEditor createViewerEditor() { - return new TableViewerEditor(this,null,new ColumnViewerEditorActivationStrategy(this),ColumnViewerEditor.DEFAULT); + return new TableViewerEditor(this, null, + new ColumnViewerEditorActivationStrategy(this), + ColumnViewerEditor.DEFAULT); } /** @@ -153,12 +158,12 @@ * Use Table#setSelection(int[] indices) and Table#showSelection() if you * wish to set selection more efficiently when using a ILazyContentProvider. * </p> - * + * * @param selection - * the new selection + * the new selection * @param reveal - * <code>true</code> if the selection is to be made visible, - * and <code>false</code> otherwise + * <code>true</code> if the selection is to be made visible, and + * <code>false</code> otherwise * @see Table#setSelection(int[]) * @see Table#showSelection() */ @@ -167,7 +172,7 @@ } protected override ViewerRow getViewerRowFromItem(Widget item) { - if( cachedRow is null ) { + if (cachedRow is null) { cachedRow = new TableViewerRow(cast(TableItem) item); } else { cachedRow.setItem(cast(TableItem) item); @@ -178,7 +183,7 @@ /** * Create a new row with style at index - * + * * @param style * @param rowIndex * @return ViewerRow @@ -199,11 +204,11 @@ protected override Item getItemAt(Point p) { TableItem[] selection = table.getSelection(); - if( selection.length is 1 ) { + if (selection.length is 1) { int columnCount = table.getColumnCount(); - for( int i = 0; i < columnCount; i++ ) { - if( selection[0].getBounds(i).contains(p) ) { + for (int i = 0; i < columnCount; i++) { + if (selection[0].getBounds(i).contains(p)) { return selection[0]; } } @@ -219,7 +224,7 @@ } protected override int doIndexOf(Item item) { - return table.indexOf(cast(TableItem)item); + return table.indexOf(cast(TableItem) item); } protected override void doSetItemCount(int count) { @@ -278,7 +283,7 @@ } protected override void doShowItem(Item item) { - table.showItem(cast(TableItem)item); + table.showItem(cast(TableItem) item); } protected override void doDeselectAll() { @@ -312,38 +317,37 @@ /** * Refreshes this viewer starting with the given element. Labels are updated - * as described in <code>refresh(bool updateLabels)</code>. The - * methods attempts to preserve the selection. + * as described in <code>refresh(bool updateLabels)</code>. The methods + * attempts to preserve the selection. * <p> * Unlike the <code>update</code> methods, this handles structural changes * to the given element (e.g. addition or removal of children). If only the * given element needs updating, it is more efficient to use the * <code>update</code> methods. * </p> - * + * * <p> * Subclasses who can provide this feature can open this method for the * public * </p> - * + * * @param element - * the element + * the element * @param updateLabels - * <code>true</code> to update labels for existing elements, - * <code>false</code> to only update labels as needed, assuming - * that labels for existing elements are unchanged. + * <code>true</code> to update labels for existing elements, + * <code>false</code> to only update labels as needed, assuming that labels + * for existing elements are unchanged. * @param reveal - * <code>true</code> to make the preserved selection visible - * afterwards - * + * <code>true</code> to make the preserved selection visible afterwards + * * @since 3.3 */ public void refresh(Object element, bool updateLabels, bool reveal) { - if (isBusy()) + if (checkBusy()) return; - if( isCellEditorActive() ) { + if (isCellEditorActive()) { cancelEditing(); } @@ -362,26 +366,25 @@ /** * Refreshes this viewer with information freshly obtained from this - * viewer's model. If <code>updateLabels</code> is <code>true</code> - * then labels for otherwise unaffected elements are updated as well. - * Otherwise, it assumes labels for existing elements are unchanged, and - * labels are only obtained as needed (for example, for new elements). + * viewer's model. If <code>updateLabels</code> is <code>true</code> then + * labels for otherwise unaffected elements are updated as well. Otherwise, + * it assumes labels for existing elements are unchanged, and labels are + * only obtained as needed (for example, for new elements). * <p> * Calling <code>refresh(true)</code> has the same effect as * <code>refresh()</code>. * <p> * Note that the implementation may still obtain labels for existing - * elements even if <code>updateLabels</code> is false. The intent is - * simply to allow optimization where possible. - * + * elements even if <code>updateLabels</code> is false. The intent is simply + * to allow optimization where possible. + * * @param updateLabels - * <code>true</code> to update labels for existing elements, - * <code>false</code> to only update labels as needed, assuming - * that labels for existing elements are unchanged. + * <code>true</code> to update labels for existing elements, + * <code>false</code> to only update labels as needed, assuming that labels + * for existing elements are unchanged. * @param reveal - * <code>true</code> to make the preserved selection visible - * afterwards - * + * <code>true</code> to make the preserved selection visible afterwards + * * @since 3.3 */ public void refresh(bool updateLabels, bool reveal) {