01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: * Tom Schindl <tom.schindl@bestsolution.at> - port to MyGWT (issue 39)
11: *******************************************************************************/package net.mygwt.ui.client.viewer;
12:
13: import net.mygwt.ui.client.util.DefaultComparator;
14:
15: /**
16: * Instances of this class represent a column of a <code>ColumnViewer</code>.
17: * Label providers can be configured for each column separately.
18: */
19: public abstract class ViewerColumn {
20:
21: private static final ViewerSorter sorter = new ViewerSorter(
22: new DefaultComparator());
23:
24: static String COLUMN_VIEWER_KEY = "mygwt.columnviewer";
25:
26: protected ColumnViewer viewer;
27: private ViewerSorter viewerSorter;
28: private CellLabelProvider labelProvider;
29:
30: protected ViewerColumn(ColumnViewer viewer) {
31: this .viewer = viewer;
32: }
33:
34: public ViewerSorter getViewerSorter() {
35: if (viewerSorter == null) {
36: return sorter;
37: }
38: return viewerSorter;
39: }
40:
41: public void setViewerSorter(ViewerSorter viewerSorter) {
42: this .viewerSorter = viewerSorter;
43: }
44:
45: /**
46: * Returns the label provider for the column.
47: *
48: * @return the label provider
49: */
50: public CellLabelProvider getLabelProvider() {
51: return labelProvider;
52: }
53:
54: /**
55: * Set the label provider for the column.
56: *
57: * @param labelProvider
58: */
59: public void setLabelProvider(CellLabelProvider labelProvider) {
60: this.labelProvider = labelProvider;
61: }
62:
63: }
|