1 /* 2 * Copyright 2017 Google Inc. 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 * https://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 */ 16 17 package traceviewer.ui 18 19 import traceviewer.ui.tracks.MultiLineTrack 20 import trebuchet.model.ProcessModel 21 import java.awt.Dimension 22 import java.awt.GridBagConstraints 23 import java.awt.GridBagLayout 24 import javax.swing.JPanel 25 26 class ProcessPanel(val process: ProcessModel, renderState: RenderState) : JPanel(GridBagLayout()) { 27 init { 28 val constraints = GridBagConstraints() 29 constraints.gridwidth = GridBagConstraints.REMAINDER 30 constraints.anchor = GridBagConstraints.LINE_START 31 constraints.fill = GridBagConstraints.HORIZONTAL 32 add(ProcessLabel(process.name), constraints) <lambda>null33 process.threads.forEach { 34 constraints.gridwidth = 1 35 constraints.weightx = 0.0 36 constraints.anchor = GridBagConstraints.PAGE_START 37 add(RowLabel(it.name), constraints) 38 constraints.weightx = 1.0 39 constraints.gridwidth = GridBagConstraints.REMAINDER 40 add(MultiLineTrack(it, renderState), constraints) 41 } 42 maximumSize = Dimension(Int.MAX_VALUE, preferredSize.height) 43 isOpaque = true 44 background = ThemeColors.RowLabelBackground 45 } 46 }