Mercurial > projects > dwt-addons
diff dwtx/jface/viewers/TableViewerFocusCellManager.d @ 10:b6c35faf97c8
Viewers
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 31 Mar 2008 00:47:19 +0200 |
parents | |
children | ea8ff534f622 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwtx/jface/viewers/TableViewerFocusCellManager.d Mon Mar 31 00:47:19 2008 +0200 @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2007 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Port to the D programming language: + * Frank Benoit <benoit@tionex.de> + ******************************************************************************/ + +module dwtx.jface.viewers.TableViewerFocusCellManager; + +import dwtx.jface.viewers.SWTFocusCellManager; +import dwtx.jface.viewers.CellNavigationStrategy; +import dwtx.jface.viewers.TableViewer; +import dwtx.jface.viewers.FocusCellHighlighter; +import dwtx.jface.viewers.ViewerCell; + +import dwt.widgets.Table; + +import dwt.dwthelper.utils; + +/** + * This class is responsible to provide the concept of cells for {@link Table}. + * This concept is needed to provide features like editor activation with the + * keyboard + * + * @since 3.3 + * + */ +public class TableViewerFocusCellManager : SWTFocusCellManager { + private static const CellNavigationStrategy TABLE_NAVIGATE; + static this(){ + TABLE_NAVIGATE = new CellNavigationStrategy(); + } + /** + * Create a new manager + * + * @param viewer + * the viewer the manager is bound to + * @param focusDrawingDelegate + * the delegate responsible to highlight selected cell + */ + public this(TableViewer viewer, + FocusCellHighlighter focusDrawingDelegate) { + super(viewer, focusDrawingDelegate, TABLE_NAVIGATE); + } + + ViewerCell getInitialFocusCell() { + Table table = cast(Table) getViewer().getControl(); + + if (table.getItemCount() > 0) { + return getViewer().getViewerRowFromItem_package(table.getItem(0)) + .getCell(0); + } + + return null; + } + +}