Mercurial > projects > dwt-addons
comparison 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 |
comparison
equal
deleted
inserted
replaced
9:6c14e54dfc11 | 10:b6c35faf97c8 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 ******************************************************************************/ | |
13 | |
14 module dwtx.jface.viewers.TableViewerFocusCellManager; | |
15 | |
16 import dwtx.jface.viewers.SWTFocusCellManager; | |
17 import dwtx.jface.viewers.CellNavigationStrategy; | |
18 import dwtx.jface.viewers.TableViewer; | |
19 import dwtx.jface.viewers.FocusCellHighlighter; | |
20 import dwtx.jface.viewers.ViewerCell; | |
21 | |
22 import dwt.widgets.Table; | |
23 | |
24 import dwt.dwthelper.utils; | |
25 | |
26 /** | |
27 * This class is responsible to provide the concept of cells for {@link Table}. | |
28 * This concept is needed to provide features like editor activation with the | |
29 * keyboard | |
30 * | |
31 * @since 3.3 | |
32 * | |
33 */ | |
34 public class TableViewerFocusCellManager : SWTFocusCellManager { | |
35 private static const CellNavigationStrategy TABLE_NAVIGATE; | |
36 static this(){ | |
37 TABLE_NAVIGATE = new CellNavigationStrategy(); | |
38 } | |
39 /** | |
40 * Create a new manager | |
41 * | |
42 * @param viewer | |
43 * the viewer the manager is bound to | |
44 * @param focusDrawingDelegate | |
45 * the delegate responsible to highlight selected cell | |
46 */ | |
47 public this(TableViewer viewer, | |
48 FocusCellHighlighter focusDrawingDelegate) { | |
49 super(viewer, focusDrawingDelegate, TABLE_NAVIGATE); | |
50 } | |
51 | |
52 ViewerCell getInitialFocusCell() { | |
53 Table table = cast(Table) getViewer().getControl(); | |
54 | |
55 if (table.getItemCount() > 0) { | |
56 return getViewer().getViewerRowFromItem_package(table.getItem(0)) | |
57 .getCell(0); | |
58 } | |
59 | |
60 return null; | |
61 } | |
62 | |
63 } |