2 * Copyright 2000-2012 JetBrains s.r.o.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package com.intellij.openapi.vcs.changes;
18 import com.intellij.openapi.util.Disposer;
19 import com.intellij.ui.components.JBTabbedPane;
23 import java.util.ArrayList;
24 import java.util.List;
27 * Created with IntelliJ IDEA.
28 * User: Irina.Chernushina
32 public class TabbedRefreshablePanel implements RefreshablePanel {
33 private final JBTabbedPane myPane;
34 private final JPanel myPanel;
35 private final List<RefreshablePanel> myPanels;
37 public TabbedRefreshablePanel() {
38 myPanels = new ArrayList<>();
39 myPane = new JBTabbedPane();
40 myPanel = new JPanel(new BorderLayout());
41 myPanel.add(myPane, BorderLayout.CENTER);
44 public void addTab(final String title, final RefreshablePanel panel) {
46 myPane.add(title, panel.getPanel());
50 public boolean refreshDataSynch() {
51 for (RefreshablePanel panel : myPanels) {
52 if (! panel.refreshDataSynch()) return false;
58 public boolean isStillValid(Object o) {
59 for (RefreshablePanel panel : myPanels) {
60 if (! panel.isStillValid(o)) return false;
66 public void dataChanged() {
67 for (RefreshablePanel panel : myPanels) {
73 public void refresh() {
74 for (RefreshablePanel panel : myPanels) {
80 public JPanel getPanel() {
86 for (RefreshablePanel panel : myPanels) {
92 public void dispose() {
93 for (RefreshablePanel panel : myPanels) {
94 Disposer.dispose(panel);