| java.lang.Object org.josql.Query org.josql.contrib.JoSQLSwingTableModel
JoSQLSwingTableModel | public class JoSQLSwingTableModel extends Query implements TableModel(Code) | | A table model suitable for use with Swing JTable.
This is basically just an extension to
Query that allows the
results to be iterated over, thereby providing the ability for objects to be reported on
that are held in memory.
One limitation here is that the SQL query must return columns rather than the objects
since the values need to be mapped by the renderer and editor. For example:
SELECT lastModified,
name
FROM java.io.File
WHERE name LIKE '%.html'
This query would work but it should be noted that the select "columns" (since they do not have
aliases assigned) will be labeled 1, 2, X and so on.
You can assign aliases to the "columns" and then use them in the report definition file.
|
Method Summary | |
public void | addTableModelListener(TableModelListener l) | public void | clearResults() Clear any results. | public QueryResults | execute(List l) Exectute the query and return the results. | public Class | getColumnClass(int i) The expected class of the object at column i. | public int | getColumnCount() Get the number of columns. | public String | getColumnName(int ind) Get the name of the column, if the query has not yet been parsed then null is returned,
if the column does not have an alias then "ind + 1" is returned. | public QueryResults | getResults() Get any results, will be null unless
JoSQLSwingTableModel.execute(List) has been called. | public int | getRowCount() Number of rows. | public Object | getValueAt(int r, int c) Get the object at row r, column c.
Parameters: r - The row. Parameters: c - The column. | public boolean | isCellEditable(int r, int c) Cells are not editable since we do not store the results separately.
Parameters: r - The row. Parameters: c - The columns. | public void | parse(String sql) Parse the SQL. | public void | removeTableModelListener(TableModelListener l) | public QueryResults | reorder(List objs, SortedMap dirs) Re-order the columns according to the column indices provided in dirs.
Parameters: objs - The objects to reorder. Parameters: dirs - The columns to order by. | public QueryResults | reorder(List objs, String orderBys) Re-order the columns according to the string representation provided by orderBys.
Parameters: objs - The objects to reorder. Parameters: orderBys - The columns to order by. | public void | setValueAt(Object v, int r, int c) Not supported, always throws a:
UnsupportedOperationException . |
JoSQLSwingTableModel | public JoSQLSwingTableModel()(Code) | | |
clearResults | public void clearResults()(Code) | | Clear any results.
|
execute | public QueryResults execute(List l) throws QueryExecutionException(Code) | | Exectute the query and return the results. A reference to the results is also held to
allow them to be iterated over. Note: this will cause a TableModelEvent to be fired to all
registered listeners indicating that ALL the table data has changed.
Parameters: l - The List of objects to execute the query on. The results. throws: QueryExecutionException - If the query cannot be executed, or if the queryis set to return objects rather than "columns". |
getColumnClass | public Class getColumnClass(int i)(Code) | | The expected class of the object at column i.
The class of the column. |
getColumnCount | public int getColumnCount()(Code) | | Get the number of columns.
The column count, returns 0 if the query has not yet been parsed. |
getColumnName | public String getColumnName(int ind)(Code) | | Get the name of the column, if the query has not yet been parsed then null is returned,
if the column does not have an alias then "ind + 1" is returned.
The column name. |
getRowCount | public int getRowCount()(Code) | | Number of rows.
The row count. |
getValueAt | public Object getValueAt(int r, int c)(Code) | | Get the object at row r, column c.
Parameters: r - The row. Parameters: c - The column. The object at that location. |
isCellEditable | public boolean isCellEditable(int r, int c)(Code) | | Cells are not editable since we do not store the results separately.
Parameters: r - The row. Parameters: c - The columns. Always returns false . |
parse | public void parse(String sql) throws QueryParseException(Code) | | Parse the SQL. Note: this will cause a TableModelEvent to be fired to all
registered listeners indicating that the table header has changed.
Parameters: sql - The SQL. throws: QueryParseException - If the sql cannot be parsed or if the query will not return columns. |
Methods inherited from org.josql.Query | public void addBindVariableChangedListener(BindVariableChangedListener bvl)(Code)(Java Doc) public void addFunctionHandler(Object o)(Code)(Java Doc) public void addSaveValueChangedListener(SaveValueChangedListener svl)(Code)(Java Doc) protected void addTiming(String id, double time)(Code)(Java Doc) public void doExecuteOn(List l, String t) throws QueryExecutionException(Code)(Java Doc) public QueryResults execute(List objs) throws QueryExecutionException(Code)(Java Doc) protected void fireBindVariableChangedEvent(String name, Object from, Object to)(Code)(Java Doc) protected void fireSaveValueChangedEvent(Object id, Object from, Object to)(Code)(Java Doc) public Map getAliases()(Code)(Java Doc) public List getAllObjects()(Code)(Java Doc) public String getAnonymousBindVariableName()(Code)(Java Doc) public ClassLoader getClassLoader()(Code)(Java Doc) public List getColumns()(Code)(Java Doc) public Object getCurrentObject()(Code)(Java Doc) public List getDefaultFunctionHandlers()(Code)(Java Doc) public Map getExecuteOnFunctions()(Code)(Java Doc) public Expression getFrom()(Code)(Java Doc) public Class getFromObjectClass()(Code)(Java Doc) public FunctionHandler getFunctionHandler(String id)(Code)(Java Doc) public List getFunctionHandlers()(Code)(Java Doc) public List getGroupByColumns()(Code)(Java Doc) public Object getGroupBySaveValue(Object id, List gbs)(Code)(Java Doc) public Map getGroupBySaveValues(List gbs)(Code)(Java Doc) public Object getGroupByVariable(int ind)(Code)(Java Doc) public Expression getHavingClause()(Code)(Java Doc) public Limit getLimit()(Code)(Java Doc) public List getOrderByColumns()(Code)(Java Doc) public Comparator getOrderByComparator()(Code)(Java Doc) public Query getParent()(Code)(Java Doc) public String getQuery()(Code)(Java Doc) public QueryResults getQueryResults()(Code)(Java Doc) public Object getSaveValue(Object id)(Code)(Java Doc) public Query getTopLevelQuery()(Code)(Java Doc) public Object getVariable(int index)(Code)(Java Doc) public Object getVariable(String name)(Code)(Java Doc) public Class getVariableClass(String name)(Code)(Java Doc) public Map getVariables()(Code)(Java Doc) public Expression getWhereClause()(Code)(Java Doc) public char getWildcardCharacter()(Code)(Java Doc) public void init() throws QueryParseException(Code)(Java Doc) public void initOrderByComparator() throws QueryParseException(Code)(Java Doc) public boolean isWantObjects()(Code)(Java Doc) public boolean isWhereTrue(Object o) throws QueryExecutionException(Code)(Java Doc) public Class loadClass(String name) throws Exception(Code)(Java Doc) public void parse(String q) throws QueryParseException(Code)(Java Doc) public boolean parsed()(Code)(Java Doc) public void removeBindVariableChangedListener(BindVariableChangedListener bvl)(Code)(Java Doc) public void removeSaveValueChangedListener(SaveValueChangedListener svl)(Code)(Java Doc) public QueryResults reorder(List objs, SortedMap dirs) throws QueryExecutionException, QueryParseException(Code)(Java Doc) public QueryResults reorder(List objs, String orderBys) throws QueryParseException, QueryExecutionException(Code)(Java Doc) public void setAllObjects(List objs)(Code)(Java Doc) public void setClassLoader(ClassLoader cl)(Code)(Java Doc) public void setClassName(String n)(Code)(Java Doc) public void setColumns(List cols)(Code)(Java Doc) public void setCurrentGroupByObjects(List objs)(Code)(Java Doc) public void setCurrentObject(Object o)(Code)(Java Doc) public void setExecuteOnFunctions(Map ex)(Code)(Java Doc) public void setFrom(Expression exp)(Code)(Java Doc) public void setFromObjectClass(Class c)(Code)(Java Doc) public void setGroupByColumns(List cols)(Code)(Java Doc) public void setGroupByLimit(Limit g)(Code)(Java Doc) public void setGroupByOrderColumns(List cols)(Code)(Java Doc) public void setHaving(Expression be)(Code)(Java Doc) public void setLimit(Limit l)(Code)(Java Doc) public void setOrderByColumns(List cols)(Code)(Java Doc) public void setParent(Query q)(Code)(Java Doc) public void setSaveValue(Object id, Object value)(Code)(Java Doc) public void setSaveValues(Map s)(Code)(Java Doc) public void setVariable(String name, Object v)(Code)(Java Doc) public void setVariable(int index, Object v)(Code)(Java Doc) public void setVariables(Map bVars)(Code)(Java Doc) public void setWantDistinctResults(boolean v)(Code)(Java Doc) public void setWantObjects(boolean v)(Code)(Java Doc) public void setWantTimings(boolean v)(Code)(Java Doc) public void setWhere(Expression be)(Code)(Java Doc) public void setWildcardCharacter(char c)(Code)(Java Doc) public String toString()(Code)(Java Doc)
|
|
|