OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return tableName.replace(/\"/g, "\"\""); | 67 return tableName.replace(/\"/g, "\"\""); |
68 }, | 68 }, |
69 | 69 |
70 update: function() | 70 update: function() |
71 { | 71 { |
72 this.database.executeSql("SELECT rowid, * FROM \"" + this._escapeTableNa
me(this.tableName) + "\"", this._queryFinished.bind(this), this._queryError.bind
(this)); | 72 this.database.executeSql("SELECT rowid, * FROM \"" + this._escapeTableNa
me(this.tableName) + "\"", this._queryFinished.bind(this), this._queryError.bind
(this)); |
73 }, | 73 }, |
74 | 74 |
75 _queryFinished: function(columnNames, values) | 75 _queryFinished: function(columnNames, values) |
76 { | 76 { |
77 this.detachChildViews(); | 77 this.detachChildWidgets(); |
78 this.element.removeChildren(); | 78 this.element.removeChildren(); |
79 | 79 |
80 this._dataGrid = WebInspector.SortableDataGrid.create(columnNames, value
s); | 80 this._dataGrid = WebInspector.SortableDataGrid.create(columnNames, value
s); |
81 this._visibleColumnsInput.setVisible(!!this._dataGrid); | 81 this._visibleColumnsInput.setVisible(!!this._dataGrid); |
82 if (!this._dataGrid) { | 82 if (!this._dataGrid) { |
83 this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("
The “%s”\ntable is empty.", this.tableName)); | 83 this._emptyWidget = new WebInspector.EmptyWidget(WebInspector.UIStri
ng("The “%s”\ntable is empty.", this.tableName)); |
84 this._emptyView.show(this.element); | 84 this._emptyWidget.show(this.element); |
85 return; | 85 return; |
86 } | 86 } |
87 this._dataGrid.show(this.element); | 87 this._dataGrid.show(this.element); |
88 this._dataGrid.autoSizeColumns(5); | 88 this._dataGrid.autoSizeColumns(5); |
89 | 89 |
90 this._columnsMap = new Map(); | 90 this._columnsMap = new Map(); |
91 for (var i = 1; i < columnNames.length; ++i) | 91 for (var i = 1; i < columnNames.length; ++i) |
92 this._columnsMap.set(columnNames[i], String(i)); | 92 this._columnsMap.set(columnNames[i], String(i)); |
93 this._lastVisibleColumns = ""; | 93 this._lastVisibleColumns = ""; |
94 var visibleColumnsText = this._visibleColumnsSetting.get()[this.tableNam
e] || ""; | 94 var visibleColumnsText = this._visibleColumnsSetting.get()[this.tableNam
e] || ""; |
(...skipping 26 matching lines...) Expand all Loading... |
121 return; | 121 return; |
122 var visibleColumnsRegistry = this._visibleColumnsSetting.get(); | 122 var visibleColumnsRegistry = this._visibleColumnsSetting.get(); |
123 visibleColumnsRegistry[this.tableName] = text; | 123 visibleColumnsRegistry[this.tableName] = text; |
124 this._visibleColumnsSetting.set(visibleColumnsRegistry); | 124 this._visibleColumnsSetting.set(visibleColumnsRegistry); |
125 this._dataGrid.setColumnsVisiblity(columnsVisibility); | 125 this._dataGrid.setColumnsVisiblity(columnsVisibility); |
126 this._lastVisibleColumns = newVisibleColumns; | 126 this._lastVisibleColumns = newVisibleColumns; |
127 }, | 127 }, |
128 | 128 |
129 _queryError: function(error) | 129 _queryError: function(error) |
130 { | 130 { |
131 this.detachChildViews(); | 131 this.detachChildWidgets(); |
132 this.element.removeChildren(); | 132 this.element.removeChildren(); |
133 | 133 |
134 var errorMsgElement = createElement("div"); | 134 var errorMsgElement = createElement("div"); |
135 errorMsgElement.className = "storage-table-error"; | 135 errorMsgElement.className = "storage-table-error"; |
136 errorMsgElement.textContent = WebInspector.UIString("An error occurred t
rying to\nread the “%s” table.", this.tableName); | 136 errorMsgElement.textContent = WebInspector.UIString("An error occurred t
rying to\nread the “%s” table.", this.tableName); |
137 this.element.appendChild(errorMsgElement); | 137 this.element.appendChild(errorMsgElement); |
138 }, | 138 }, |
139 | 139 |
140 _refreshButtonClicked: function(event) | 140 _refreshButtonClicked: function(event) |
141 { | 141 { |
142 this.update(); | 142 this.update(); |
143 }, | 143 }, |
144 | 144 |
145 __proto__: WebInspector.VBox.prototype | 145 __proto__: WebInspector.VBox.prototype |
146 } | 146 } |
OLD | NEW |