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: * MyGWT - derived implementation
11: *******************************************************************************/package net.mygwt.ui.client.viewer;
12:
13: /**
14: * The <code>CellLabelProvider</code> is an implementation of a label provider
15: * for structured viewers.
16: */
17: public class CellLabelProvider implements IBaseLabelProvider {
18:
19: /**
20: * Returns the cell's text.
21: *
22: * @param element the element
23: * @return the text
24: */
25: public String getText(Object element) {
26: return element.toString();
27: }
28:
29: /**
30: * Returns the cell's icon style.
31: *
32: * @param element the element
33: * @return the icon style
34: */
35: public String getIconStyle(Object element) {
36: return null;
37: }
38:
39: /**
40: * Returns the cell's text style.
41: *
42: * @param element the element
43: * @return the text style
44: */
45: public String getTextStyle(Object element) {
46: return null;
47: }
48:
49: /**
50: * Update the label for cell.
51: *
52: * @param cell the viewer cell
53: */
54: public void update(ViewerCell cell) {
55: cell.setText(getText(cell.getElement()));
56: cell.setIconStyle(getIconStyle(cell.getElement()));
57: cell.setTextStyle(getTextStyle(cell.getElement()));
58: }
59:
60: }
|