1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package ohos.devtools.views.trace.component; 17 18 import com.intellij.ui.IdeBorderFactory; 19 import com.intellij.ui.JBSplitter; 20 import com.intellij.ui.SideBorder; 21 import com.intellij.ui.components.JBPanel; 22 import com.intellij.util.ui.JBInsets; 23 24 import java.awt.BorderLayout; 25 26 /** 27 * SysAnalystPanel component 28 * 29 * @since 2021/04/20 12:24 30 */ 31 public class SysAnalystPanel extends JBPanel { 32 /** 33 * splitter 34 */ 35 private static JBSplitter splitter; 36 37 /** 38 * bottom tab 39 */ 40 private TabPanel tab; 41 42 private AnalystPanel analystPanel; 43 44 /** 45 * constructor 46 */ SysAnalystPanel()47 public SysAnalystPanel() { 48 setLayout(new BorderLayout()); 49 analystPanel = new AnalystPanel(); 50 tab = new TabPanel(); 51 tab.setVisible(false); 52 tab.setBorder(IdeBorderFactory.createBorder(SideBorder.NONE)); 53 tab.setTabComponentInsets(JBInsets.create(0, 0)); 54 analystPanel.setTab(tab); 55 splitter = new JBSplitter(true); 56 splitter.setFirstComponent(analystPanel); 57 splitter.setSecondComponent(tab); 58 splitter.setHonorComponentsMinimumSize(false); 59 add(splitter, BorderLayout.CENTER); 60 } 61 62 /** 63 * getAnalystPanel 64 * 65 * @return AnalystPanel 66 */ getAnalystPanel()67 public AnalystPanel getAnalystPanel() { 68 return analystPanel; 69 } 70 71 /** 72 * load database 73 * 74 * @param name db name 75 * @param isLocal is local db 76 */ load(final String name, final boolean isLocal)77 public void load(final String name, final boolean isLocal) { 78 analystPanel.load(name, isLocal); 79 } 80 81 /** 82 * getSplitter 83 * 84 * @return JBSplitter 85 */ getSplitter()86 public static JBSplitter getSplitter() { 87 return splitter; 88 } 89 90 /** 91 * setSplitter 92 * 93 * @param splitter splitter 94 */ setSplitter(JBSplitter splitter)95 public static void setSplitter(JBSplitter splitter) { 96 SysAnalystPanel.splitter = splitter; 97 } 98 } 99