KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > TableViewerFocusCellManager


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  ******************************************************************************/

11
12 package org.eclipse.jface.viewers;
13
14 import org.eclipse.swt.widgets.Table;
15
16 /**
17  * This class is responsible to provide the concept of cells for {@link Table}.
18  * This concept is needed to provide features like editor activation with the
19  * keyboard
20  *
21  * @since 3.3
22  *
23  */

24 public class TableViewerFocusCellManager extends SWTFocusCellManager {
25     private static final CellNavigationStrategy TABLE_NAVIGATE = new CellNavigationStrategy();
26
27     /**
28      * Create a new manager
29      *
30      * @param viewer
31      * the viewer the manager is bound to
32      * @param focusDrawingDelegate
33      * the delegate responsible to highlight selected cell
34      */

35     public TableViewerFocusCellManager(TableViewer viewer,
36             FocusCellHighlighter focusDrawingDelegate) {
37         super(viewer, focusDrawingDelegate, TABLE_NAVIGATE);
38     }
39
40     ViewerCell getInitialFocusCell() {
41         Table table = (Table) getViewer().getControl();
42
43         if (table.getItemCount() > 0) {
44             return getViewer().getViewerRowFromItem(table.getItem(0))
45                     .getCell(0);
46         }
47
48         return null;
49     }
50
51 }
52
Popular Tags