View Javadoc

1   /**
2    * Copyright (C) 2008 Atlassian
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   */
16  
17  package com.atlassian.theplugin.idea.ui;
18  
19  import com.atlassian.theplugin.configuration.ProjectToolWindowTableConfiguration;
20  import com.atlassian.theplugin.idea.TableColumnInfo;
21  import com.intellij.util.ui.ListTableModel;
22  import com.intellij.util.ui.UIUtil;
23  
24  import javax.swing.*;
25  import java.awt.*;
26  import java.util.ArrayList;
27  import java.util.List;
28  
29  public class CollapsibleTable extends CollapsiblePanel {
30  
31      private ListTableModel listTableModel;
32  	private AtlassianTableViewWithToolbar table;
33  
34  	public CollapsibleTable(TableColumnProvider tableColumnProvider,
35                              ProjectToolWindowTableConfiguration projectToolWindowConfiguration,
36                              String title, String toolbarPlace, String toolbarName,
37                              final String popupMenuPlace, final String popupMenuName) {
38  
39          super(true, true, title);
40  
41          listTableModel = new ListTableModel(tableColumnProvider.makeColumnInfo());
42          listTableModel.setSortable(true);
43          table = new AtlassianTableViewWithToolbar(tableColumnProvider, listTableModel, projectToolWindowConfiguration,
44  				toolbarPlace, toolbarName, popupMenuPlace, popupMenuName);
45  		setContent(table);
46  		table.setPreferredScrollableViewportSize(table.getTableDimension());
47  	}
48  
49      public AtlassianTableView getTable() {
50          return table.getTable();
51      }
52  
53      public ListTableModel getListTableModel() {
54          this.setName("Setting data");
55          return listTableModel;
56      }
57  
58      public Object getSelectedObject() {
59          return table.getSelectedObject();
60      }
61  
62      public void addItemSelectedListener(TableItemSelectedListener listener) {
63          table.addItemSelectedListener(listener);
64      }
65  
66      public void removeItemSelectedListener(TableItemSelectedListener listener) {
67          table.removeItemSelectedListener(listener);
68      }
69  
70  
71  }
72  
73  
74