Mercurial > projects > dwt-addons
diff dwtx/jface/viewers/TableViewerRow.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/TableViewerRow.d Mon May 19 13:41:06 2008 +0200 +++ b/dwtx/jface/viewers/TableViewerRow.d Thu May 22 01:36:46 2008 +0200 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Tom Shindl <tom.schindl@bestsolution.at> - initial API and implementation - * - Fix for bug 174355 + * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation + * - fix in bug: 174355,195908,198035,215069 * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ @@ -202,4 +202,45 @@ public override Object getElement() { return item.getData(); } + + public int getVisualIndex(int creationIndex) { + int[] order = item.getParent().getColumnOrder(); + + for (int i = 0; i < order.length; i++) { + if (order[i] is creationIndex) { + return i; + } + } + + return super.getVisualIndex(creationIndex); + } + + public int getCreationIndex(int visualIndex) { + if( item !is null && ! item.isDisposed() && hasColumns() && isValidOrderIndex(visualIndex) ) { + return item.getParent().getColumnOrder()[visualIndex]; + } + return super.getCreationIndex(visualIndex); + } + + /* (non-Javadoc) + * @see dwtx.jface.viewers.ViewerRow#getTextBounds(int) + */ + public Rectangle getTextBounds(int index) { + return item.getTextBounds(index); + } + + /* (non-Javadoc) + * @see dwtx.jface.viewers.ViewerRow#getImageBounds(int) + */ + public Rectangle getImageBounds(int index) { + return item.getImageBounds(index); + } + + private bool hasColumns() { + return this.item.getParent().getColumnCount() !is 0; + } + + private bool isValidOrderIndex(int currentIndex) { + return currentIndex < this.item.getParent().getColumnOrder().length; + } }