OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Nokia Inc. All rights reserved. | 2 * Copyright (C) 2008 Nokia Inc. All rights reserved. |
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 this._domStorage.addEventListener( | 59 this._domStorage.addEventListener( |
60 Resources.DOMStorage.Events.DOMStorageItemRemoved, this._domStorageIte
mRemoved, this), | 60 Resources.DOMStorage.Events.DOMStorageItemRemoved, this._domStorageIte
mRemoved, this), |
61 this._domStorage.addEventListener( | 61 this._domStorage.addEventListener( |
62 Resources.DOMStorage.Events.DOMStorageItemAdded, this._domStorageItemA
dded, this), | 62 Resources.DOMStorage.Events.DOMStorageItemAdded, this._domStorageItemA
dded, this), |
63 this._domStorage.addEventListener( | 63 this._domStorage.addEventListener( |
64 Resources.DOMStorage.Events.DOMStorageItemUpdated, this._domStorageIte
mUpdated, this), | 64 Resources.DOMStorage.Events.DOMStorageItemUpdated, this._domStorageIte
mUpdated, this), |
65 ]; | 65 ]; |
66 this.refreshItems(); | 66 this.refreshItems(); |
67 } | 67 } |
68 | 68 |
69 /** | 69 _domStorageItemsCleared() { |
70 * @param {!Common.Event} event | |
71 */ | |
72 _domStorageItemsCleared(event) { | |
73 if (!this.isShowing() || !this._dataGrid) | 70 if (!this.isShowing() || !this._dataGrid) |
74 return; | 71 return; |
75 | 72 |
76 this._dataGrid.rootNode().removeChildren(); | 73 this._dataGrid.rootNode().removeChildren(); |
77 this._dataGrid.addCreationNode(false); | 74 this._dataGrid.addCreationNode(false); |
78 this.setCanDeleteSelected(false); | 75 this.setCanDeleteSelected(false); |
79 } | 76 } |
80 | 77 |
81 /** | 78 /** |
82 * @param {!Common.Event} event | 79 * @param {!Common.Event} event |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 */ | 197 */ |
201 refreshItems() { | 198 refreshItems() { |
202 this._domStorage.getItems((error, items) => this._showDOMStorageItems(error,
items)); | 199 this._domStorage.getItems((error, items) => this._showDOMStorageItems(error,
items)); |
203 } | 200 } |
204 | 201 |
205 /** | 202 /** |
206 * @override | 203 * @override |
207 */ | 204 */ |
208 deleteAllItems() { | 205 deleteAllItems() { |
209 this._domStorage.clear(); | 206 this._domStorage.clear(); |
| 207 // explicitly clear the view because the event won't be fired when it has no
items |
| 208 this._domStorageItemsCleared(); |
210 } | 209 } |
211 | 210 |
212 _editingCallback(editingNode, columnIdentifier, oldText, newText) { | 211 _editingCallback(editingNode, columnIdentifier, oldText, newText) { |
213 var domStorage = this._domStorage; | 212 var domStorage = this._domStorage; |
214 if (columnIdentifier === 'key') { | 213 if (columnIdentifier === 'key') { |
215 if (typeof oldText === 'string') | 214 if (typeof oldText === 'string') |
216 domStorage.removeItem(oldText); | 215 domStorage.removeItem(oldText); |
217 domStorage.setItem(newText, editingNode.data.value || ''); | 216 domStorage.setItem(newText, editingNode.data.value || ''); |
218 this._removeDupes(editingNode); | 217 this._removeDupes(editingNode); |
219 } else { | 218 } else { |
(...skipping 15 matching lines...) Expand all Loading... |
235 } | 234 } |
236 | 235 |
237 _deleteCallback(node) { | 236 _deleteCallback(node) { |
238 if (!node || node.isCreationNode) | 237 if (!node || node.isCreationNode) |
239 return; | 238 return; |
240 | 239 |
241 if (this._domStorage) | 240 if (this._domStorage) |
242 this._domStorage.removeItem(node.data.key); | 241 this._domStorage.removeItem(node.data.key); |
243 } | 242 } |
244 }; | 243 }; |
OLD | NEW |