10
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2006 Tom Schindl 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 * Tom Schindl - initial API and implementation
|
|
10 * Boris Bokowski (IBM Corporation) - Javadoc improvements
|
|
11 * Port to the D programming language:
|
|
12 * Frank Benoit <benoit@tionex.de>
|
|
13 ******************************************************************************/
|
|
14
|
|
15 module dwtx.jface.viewers.TableViewerColumn;
|
|
16
|
|
17 import dwtx.jface.viewers.ViewerColumn;
|
|
18 import dwtx.jface.viewers.TableViewer;
|
|
19
|
|
20 import dwt.widgets.Table;
|
|
21 import dwt.widgets.TableColumn;
|
|
22
|
|
23 import dwt.dwthelper.utils;
|
|
24
|
|
25 /**
|
|
26 * ViewerColumn implementation for TableViewer to enable column-specific label
|
|
27 * providers and editing support.
|
|
28 *
|
|
29 * @since 3.3
|
|
30 */
|
|
31 public final class TableViewerColumn : ViewerColumn {
|
|
32 private TableColumn column;
|
|
33
|
|
34 /**
|
|
35 * Creates a new viewer column for the given {@link TableViewer} on a new
|
|
36 * {@link TableColumn} with the given style bits. The column is added at the
|
|
37 * end of the list of columns.
|
|
38 *
|
|
39 * @param viewer
|
|
40 * the table viewer to which this column belongs
|
|
41 * @param style
|
|
42 * the style used to create the column, for applicable style bits
|
|
43 * see {@link TableColumn}
|
|
44 * @see TableColumn#TableColumn(Table, int)
|
|
45 */
|
|
46 public this(TableViewer viewer, int style) {
|
|
47 this(viewer, style, -1);
|
|
48 }
|
|
49
|
|
50 /**
|
|
51 * Creates a new viewer column for the given {@link TableViewer} on a new
|
|
52 * {@link TableColumn} with the given style bits. The column is inserted at
|
|
53 * the given index into the list of columns.
|
|
54 *
|
|
55 * @param viewer
|
|
56 * the table viewer to which this column belongs
|
|
57 * @param style
|
|
58 * the style used to create the column, for applicable style bits
|
|
59 * see {@link TableColumn}
|
|
60 * @param index
|
|
61 * the index at which to place the newly created column
|
|
62 * @see TableColumn#TableColumn(Table, int, int)
|
|
63 */
|
|
64 public this(TableViewer viewer, int style, int index) {
|
|
65 this(viewer, createColumn(viewer.getTable(), style, index));
|
|
66 }
|
|
67
|
|
68 /**
|
|
69 * Creates a new viewer column for the given {@link TableViewer} on the given
|
|
70 * {@link TableColumn}.
|
|
71 *
|
|
72 * @param viewer
|
|
73 * the table viewer to which this column belongs
|
|
74 * @param column
|
|
75 * the underlying table column
|
|
76 */
|
|
77 public this(TableViewer viewer, TableColumn column) {
|
|
78 super(viewer, column);
|
|
79 this.column = column;
|
|
80 }
|
|
81
|
|
82 private static TableColumn createColumn(Table table, int style, int index) {
|
|
83 if (index >= 0) {
|
|
84 return new TableColumn(table, style, index);
|
|
85 }
|
|
86
|
|
87 return new TableColumn(table, style);
|
|
88 }
|
|
89
|
|
90 /**
|
|
91 * @return the underlying DWT table column
|
|
92 */
|
|
93 public TableColumn getColumn() {
|
|
94 return column;
|
|
95 }
|
|
96 }
|