• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.distributed;
17 
18 import com.intellij.ui.JBSplitter;
19 import com.intellij.ui.components.JBPanel;
20 import ohos.devtools.views.distributed.bean.DistributedParams;
21 
22 import java.awt.BorderLayout;
23 
24 /**
25  * DistributedPanel
26  *
27  * @since 2021/7/6 15:36
28  */
29 public class DistributedPanel extends JBPanel {
30     /**
31      * slitter
32      */
33     private static JBSplitter splitter;
34 
35     /**
36      * bottom tab
37      */
38     private static DistributedDataPane tab;
39 
40     private DistributedChartPanel chartPanel;
41 
42     /**
43      * constructor
44      */
DistributedPanel()45     public DistributedPanel() {
46         setLayout(new BorderLayout());
47         chartPanel = new DistributedChartPanel();
48         splitter = new JBSplitter(true);
49         add(splitter, BorderLayout.CENTER);
50     }
51 
52     /**
53      * load by paramstest
54      *
55      * @param params params
56      */
load(DistributedParams params)57     public void load(DistributedParams params) {
58         chartPanel.load(params);
59         tab = new DistributedDataPane(it -> {
60             tab.setVisible(false);
61             splitter.setProportion(1.0f);
62         }, rectangle -> {
63             rectangle.getWidth();
64         });
65         splitter.setFirstComponent(chartPanel);
66         splitter.setSecondComponent(tab);
67         splitter.setHonorComponentsMinimumSize(false);
68         splitter.setProportion(1.0f);
69     }
70 
getSplitter()71     public static JBSplitter getSplitter() {
72         return splitter;
73     }
74 
getTab()75     public static DistributedDataPane getTab() {
76         return tab;
77     }
78 }
79