Skip to content

Commit aa16e80

Browse files
committed
Fixed NPE and updated documentation in the DBView class
1 parent 09fc2e2 commit aa16e80

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

ui/javascript/widgets/DBView.js

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ if(!javaxt.express) javaxt.express={};
55
//** DBView
66
//******************************************************************************
77
/**
8-
* Panel used to execute queries and view results in a grid. This widget is
9-
* designed to work with REST services provided by implementations of the
10-
* javaxt.express.services.QueryService class.
8+
* Component used to compile queries and view results in a table. The
9+
* component consists of three elements: a list of tables on the left, a
10+
* query editor in the center, and a table/grid on the bottom (below the
11+
* editor). Queries are executed on the server via REST web services. The
12+
* queries are queued by the server and executed asynchronously. The server
13+
* provides web methods to submit jobs, check job status, and pick up
14+
* completed jobs. See the javaxt.express.services.QueryService class for
15+
* more information.
1116
*
1217
******************************************************************************/
1318

@@ -242,6 +247,9 @@ javaxt.express.DBView = function(parent, config) {
242247
//**************************************************************************
243248
//** setQuery
244249
//**************************************************************************
250+
/** Used to update the query in the query editor. Will clear records in the
251+
* table from any previous query.
252+
*/
245253
this.setQuery = function(query){
246254
if (query){
247255
if (query===editor.getValue()){
@@ -261,6 +269,8 @@ javaxt.express.DBView = function(parent, config) {
261269
//**************************************************************************
262270
//** getQuery
263271
//**************************************************************************
272+
/** Returns text from the query editor
273+
*/
264274
this.getQuery = function(){
265275
return editor.getValue();
266276
};
@@ -269,6 +279,9 @@ javaxt.express.DBView = function(parent, config) {
269279
//**************************************************************************
270280
//** executeQuery
271281
//**************************************************************************
282+
/** Used to execute a query by submitting whatever is in the query editor to
283+
* the server. Note that there is no client-side validation.
284+
*/
272285
this.executeQuery = function(){
273286

274287
//Cancel current query (if running)
@@ -305,6 +318,8 @@ javaxt.express.DBView = function(parent, config) {
305318
//**************************************************************************
306319
//** clear
307320
//**************************************************************************
321+
/** Used to remove text from the query editor and clear the results table.
322+
*/
308323
this.clear = function(){
309324
editor.setValue("");
310325
me.clearResults();
@@ -314,10 +329,15 @@ javaxt.express.DBView = function(parent, config) {
314329
//**************************************************************************
315330
//** clearResults
316331
//**************************************************************************
332+
/** Used to clear the results table.
333+
*/
317334
this.clearResults = function(){
318335
if (grid){
319-
grid.clear();
320-
destroy(grid);
336+
try{
337+
grid.clear();
338+
destroy(grid);
339+
}
340+
catch(e){}
321341
}
322342
gridContainer.innerHTML = "";
323343
};
@@ -326,7 +346,14 @@ javaxt.express.DBView = function(parent, config) {
326346
//**************************************************************************
327347
//** getComponents
328348
//**************************************************************************
329-
/** Returns a handle to individual components of this view
349+
/** Returns a json object with individual components that make up this
350+
* component.
351+
* <ul>
352+
* <li>tree: javaxt.dhtml.Tree used to render table names</li>
353+
* <li>grid: javaxt.dhtml.DataGrid used to render query results</li>
354+
* <li>editor: the component used edit queries</li>
355+
* <li>toolbar: DOM object (table) with buttons</li>
356+
* </ul>
330357
*/
331358
this.getComponents = function(){
332359
return {

0 commit comments

Comments
 (0)