]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - ui/util/ViewerUtils.java
1 package org
.argeo
.eclipse
.ui
.util
;
3 import org
.eclipse
.jface
.viewers
.TableViewer
;
4 import org
.eclipse
.jface
.viewers
.TableViewerColumn
;
5 import org
.eclipse
.jface
.viewers
.TreeViewer
;
6 import org
.eclipse
.jface
.viewers
.TreeViewerColumn
;
7 import org
.eclipse
.swt
.widgets
.Table
;
8 import org
.eclipse
.swt
.widgets
.TableColumn
;
9 import org
.eclipse
.swt
.widgets
.TreeColumn
;
12 * Centralise useful methods to manage JFace Table, Tree and TreeColumn viewers.
14 public class ViewerUtils
{
17 * Creates a basic column for the given table. For the time being, we do not
18 * support movable columns.
20 public static TableColumn
createColumn(Table parent
, String name
, int style
, int width
) {
21 TableColumn result
= new TableColumn(parent
, style
);
23 result
.setWidth(width
);
24 result
.setResizable(true);
29 * Creates a TableViewerColumn for the given viewer. For the time being, we do
30 * not support movable columns.
32 public static TableViewerColumn
createTableViewerColumn(TableViewer parent
, String name
, int style
, int width
) {
33 TableViewerColumn tvc
= new TableViewerColumn(parent
, style
);
34 TableColumn column
= tvc
.getColumn();
36 column
.setWidth(width
);
37 column
.setResizable(true);
41 // public static TableViewerColumn createTableViewerColumn(TableViewer parent,
42 // Localized name, int style, int width) {
43 // return createTableViewerColumn(parent, name.lead(), style, width);
47 * Creates a TreeViewerColumn for the given viewer. For the time being, we do
48 * not support movable columns.
50 public static TreeViewerColumn
createTreeViewerColumn(TreeViewer parent
, String name
, int style
, int width
) {
51 TreeViewerColumn tvc
= new TreeViewerColumn(parent
, style
);
52 TreeColumn column
= tvc
.getColumn();
54 column
.setWidth(width
);
55 column
.setResizable(true);