1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
7 base
.require('tile_view');
9 base
.require('ui.list_and_associated_view');
11 base
.requireStylesheet('analysis_view');
13 base
.exportTo('ccfv', function() {
14 var TileView
= ccfv
.TileView
;
16 var AnalysisView
= ui
.define('x-analysis-view');
18 AnalysisView
.prototype = {
19 __proto__
: HTMLUnknownElement
.prototype,
21 decorate: function() {
22 this.selection_
= undefined;
23 this.updateChildren_();
26 set selection(selection
) {
28 this.selection_
.deactivate();
29 this.selection_
= selection
;
31 this.selection_
.activate();
32 this.updateChildren_();
36 return this.selection_
;
39 updateChildren_: function() {
40 if (!this.selection_
) {
41 this.textContent
= 'Select something';
44 if (this.selection_
.tiles
) {
45 this.updateChildrenGivenTiles_(this.selection_
.tiles
);
48 throw new Error('I am confused about what you selected');
51 updateChildrenGivenTiles_: function(tiles
) {
52 this.textContent
= '';
53 var tileListEl
= new ui
.ListAndAssociatedView();
54 tileListEl
.view
= new TileView();
55 tileListEl
.viewProperty
= 'tile';
56 tileListEl
.list
= tiles
;
57 tileListEl
.listProperty
= 'title';
58 this.appendChild(tileListEl
);
63 AnalysisView
: AnalysisView