01: /*
02: * Beryl - A web platform based on XML, XSLT and Java
03: * This file is part of the Beryl XML GUI
04: *
05: * Copyright (C) 2004 Wenzel Jakob <wazlaf@tigris.org>
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11:
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-3107 USA
20: */
21:
22: package org.beryl.gui.model;
23:
24: import java.io.Serializable;
25:
26: import org.beryl.gui.GUIException;
27: import org.beryl.gui.Widget;
28: import org.beryl.gui.table.TableEditor;
29: import org.beryl.gui.table.TableRenderer;
30: import org.beryl.gui.widgets.Table;
31:
32: /**
33: * A <tt>TableRow</tt> represents a row on a table widget.
34: * Columns are accessed by keys rather than their index - this
35: * makes it possible to use a <tt>TableRow</tt> both as a
36: * row in a table and as data model of a <tt>Frame</tt> at
37: * the same time.
38: */
39:
40: public class TableRow extends MapDataModel implements TableRenderer,
41: TableEditor, Serializable {
42: public boolean isEditable(String key) {
43: return false;
44: }
45:
46: /**
47: * If there are custom renderers, override this and set it to true.
48: * This method exists solely for performance reasons
49: * @param key The row key
50: * @return True if there is a custom renderer
51: */
52:
53: public boolean hasCustomRenderer(String key) {
54: return false;
55: }
56:
57: /**
58: * This function, if overridden provides the possibility
59: * of adding a custom table value editor
60: * @param key The row key to edit
61: * @return A Widget
62: */
63: public Widget getEditor(Table table, Object value, TableRow row,
64: String key) throws GUIException {
65: return null;
66: }
67:
68: /**
69: * This function, if overridden provides the possibility
70: * of adding a custom table value render
71: * @param key The row key to render
72: * @return A Widget
73: */
74: public Widget getRenderer(Table table, Object value,
75: boolean isSelected, boolean hasFocus, TableRow row,
76: String key) throws GUIException {
77: return null;
78: }
79: }
|