01: package net.sourceforge.squirrel_sql.fw.datasetviewer;
02:
03: /*
04: * Copyright (C) 2001-2002 Colin Bell
05: * colbell@users.sourceforge.net
06: *
07: * This library 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 library 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 library; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: */
21:
22: /**
23: * @author gwg
24: *
25: * The data type representing an (application) updateable table object.
26: * See the explanation in IDataSetUpdateableModel for why this
27: * delcaration is in fw but used by the application code.
28: */
29: public interface IDataSetUpdateableTableModel extends
30: IDataSetUpdateableModel {
31: /**
32: * Get warning message about unusual conditions, if any, in the current data
33: * that the user needs to be aware of before proceeding.
34: */
35: public String getWarningOnCurrentData(Object[] values,
36: ColumnDisplayDefinition[] colDefs, int col, Object oldValue);
37:
38: /**
39: * Get warning message about unusual conditions, if any, that will occur
40: * if we proceed with the update as expected.
41: */
42: public String getWarningOnProjectedUpdate(Object[] values,
43: ColumnDisplayDefinition[] colDefs, int col, Object newValue);
44:
45: /**
46: * Re-read the value for a single cell in the table, if possible.
47: * If there is a problem, the message has a non-zero length when this returns.
48: */
49: public Object reReadDatum(Object[] values,
50: ColumnDisplayDefinition[] colDefs, int col,
51: StringBuffer message);
52:
53: /**
54: * Update the data underlying the table.
55: */
56: public String updateTableComponent(Object[] values,
57: ColumnDisplayDefinition[] colDefs, int col,
58: Object oldValue, Object newValue);
59:
60: /**
61: * Get the column number containing the rowID for this table, if any.
62: * If there is no rowID in this table (e.g. because the DB does not
63: * support the rowID concept), then this will be -1.
64: * The name of the column might be something other than "rowID", e.g. "oid".
65: */
66: public int getRowidCol();
67:
68: /**
69: * Delete a set of rows from the DB.
70: * If the delete succeeded this returns a null string.
71: * The deletes are done within a transaction
72: * so they are either all done or all not done.
73: */
74: public String deleteRows(Object[][] rowData,
75: ColumnDisplayDefinition[] colDefs);
76:
77: /**
78: * Let fw get at the default values for the columns in the table
79: * for use in creating a new row to insert.
80: */
81: public String[] getDefaultValues(ColumnDisplayDefinition[] colDefs);
82:
83: /**
84: * Insert a row into the DB.
85: * If the insert succeeds this returns a null string.
86: */
87: public String insertRow(Object[] values,
88: ColumnDisplayDefinition[] colDefs);
89:
90: void addListener(DataSetUpdateableTableModelListener l);
91:
92: void removeListener(DataSetUpdateableTableModelListener l);
93: }
|