01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.project.ui.internal.adapters;
18:
19: import org.eclipse.jface.viewers.ITableColorProvider;
20: import org.eclipse.jface.viewers.ITableLabelProvider;
21: import org.eclipse.swt.SWT;
22: import org.eclipse.swt.graphics.Color;
23: import org.eclipse.swt.graphics.Image;
24: import org.eclipse.swt.widgets.Display;
25:
26: /**
27: * Provides ...TODO summary sentence
28: * <p>
29: * TODO Description
30: * </p>
31: * <p>
32: * Responsibilities:
33: * <ul>
34: * <li>
35: * <li>
36: * </ul>
37: * </p>
38: * <p>
39: * Example Use:
40: *
41: * <pre><code>
42: * FeatureTableContentProvider x = new FeatureTableContentProvider( ... );
43: * TODO code example
44: * </code></pre>
45: *
46: * </p>
47: *
48: * @author jones
49: * @since 0.3
50: */
51: public class FeatureTableProvider extends FeatureViewerProvider
52: implements ITableLabelProvider, ITableColorProvider {
53:
54: /**
55: * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
56: */
57: public Image getColumnImage(Object element, int columnIndex) {
58: // TODO implement method body
59: return null;
60: }
61:
62: /**
63: * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
64: */
65: public String getColumnText(Object element, int columnIndex) {
66: if (element instanceof FeatureViewerProvider.Databag) {
67: FeatureViewerProvider.Databag data = (Databag) element;
68: switch (columnIndex) {
69: case 0:
70: return data.descriptor.getDisplayName();
71: case 1:
72: Object value = data.source
73: .getPropertyValue(data.descriptor.getId());
74: if (value instanceof String)
75: return (String) value;
76: return ""; //$NON-NLS-1$
77: }
78: }
79: return null;
80: }
81:
82: /**
83: * @see org.eclipse.jface.viewers.ITableColorProvider#getForeground(java.lang.Object, int)
84: */
85: public Color getForeground(Object element, int columnIndex) {
86: // TODO implement method body
87: return Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
88: }
89:
90: /**
91: * @see org.eclipse.jface.viewers.ITableColorProvider#getBackground(java.lang.Object, int)
92: */
93: public Color getBackground(Object element, int columnIndex) {
94: // TODO implement method body
95: return Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
96: }
97:
98: }
|