1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16import {Component, Input} from '@angular/core'; 17import {PersistentStore} from 'common/persistent_store'; 18import {TraceType} from 'trace/trace_type'; 19import {CollapsibleSections} from 'viewers/common/collapsible_sections'; 20import {CollapsibleSectionType} from 'viewers/common/collapsible_section_type'; 21import {ShadingMode} from 'viewers/components/rects/shading_mode'; 22import {viewerCardStyle} from 'viewers/components/styles/viewer_card.styles'; 23import {UiData} from './ui_data'; 24 25@Component({ 26 selector: 'viewer-window-manager', 27 template: ` 28 <div class="card-grid"> 29 <collapsed-sections 30 [class.empty]="sections.areAllSectionsExpanded()" 31 [sections]="sections" 32 (sectionChange)="sections.onCollapseStateChange($event, false)"> 33 </collapsed-sections> 34 <rects-view 35 class="rects-view" 36 [class.collapsed]="sections.isSectionCollapsed(CollapsibleSectionType.RECTS)" 37 [title]="rectsTitle" 38 [store]="store" 39 [rects]="inputData?.rectsToDraw ?? []" 40 [displays]="inputData?.displays ?? []" 41 [highlightedItem]="inputData?.highlightedItem ?? ''" 42 [shadingModes]="shadingModes" 43 [dependencies]="inputData?.dependencies ?? []" 44 [userOptions]="inputData?.rectsUserOptions ?? {}" 45 [pinnedItems]="inputData?.pinnedItems ?? []" 46 [isDarkMode]="inputData?.isDarkMode ?? false" 47 (collapseButtonClicked)="sections.onCollapseStateChange(CollapsibleSectionType.RECTS, true)"></rects-view> 48 <hierarchy-view 49 class="hierarchy-view" 50 [class.collapsed]="sections.isSectionCollapsed(CollapsibleSectionType.HIERARCHY)" 51 [tree]="inputData?.hierarchyTrees?.at(0)" 52 [dependencies]="inputData?.dependencies ?? []" 53 [highlightedItem]="inputData?.highlightedItem ?? ''" 54 [pinnedItems]="inputData?.pinnedItems ?? []" 55 [textFilter]="inputData?.hierarchyFilter" 56 [store]="store" 57 [userOptions]="inputData?.hierarchyUserOptions ?? {}" 58 [rectIdToShowState]="inputData?.rectIdToShowState" 59 (collapseButtonClicked)="sections.onCollapseStateChange(CollapsibleSectionType.HIERARCHY, true)"></hierarchy-view> 60 <properties-view 61 class="properties-view" 62 [class.collapsed]="sections.isSectionCollapsed(CollapsibleSectionType.PROPERTIES)" 63 [userOptions]="inputData?.propertiesUserOptions ?? {}" 64 [propertiesTree]="inputData?.propertiesTree" 65 [traceType]="${TraceType.WINDOW_MANAGER}" 66 [textFilter]="inputData?.propertiesFilter" 67 [highlightedProperty]="inputData?.highlightedProperty ?? ''" 68 [store]="store" 69 [isProtoDump]="false" 70 placeholderText="No selected item." 71 (collapseButtonClicked)="sections.onCollapseStateChange(CollapsibleSectionType.PROPERTIES, true)"></properties-view> 72 </div> 73 `, 74 styles: [viewerCardStyle], 75}) 76export class ViewerWindowManagerComponent { 77 @Input() inputData: UiData | undefined; 78 @Input() store: PersistentStore | undefined; 79 @Input() active = false; 80 TraceType = TraceType; 81 CollapsibleSectionType = CollapsibleSectionType; 82 83 rectsTitle = 'WINDOWS'; 84 sections = new CollapsibleSections([ 85 { 86 type: CollapsibleSectionType.RECTS, 87 label: this.rectsTitle, 88 isCollapsed: false, 89 }, 90 { 91 type: CollapsibleSectionType.HIERARCHY, 92 label: CollapsibleSectionType.HIERARCHY, 93 isCollapsed: false, 94 }, 95 { 96 type: CollapsibleSectionType.PROPERTIES, 97 label: CollapsibleSectionType.PROPERTIES, 98 isCollapsed: false, 99 }, 100 ]); 101 shadingModes = [ 102 ShadingMode.GRADIENT, 103 ShadingMode.OPACITY, 104 ShadingMode.WIRE_FRAME, 105 ]; 106} 107