1   package debugger.gui;
2   
3   import debugger.gui.resources.CreoleListenerImpl;
4   import debugger.resources.ResourcesFactory;
5   
6   import javax.swing.*;
7   import java.awt.*;
8   import java.awt.event.ActionListener;
9   import java.awt.event.ActionEvent;
10  
11  /**
12   * Copyright (c) Ontos AG (http://www.ontosearch.com).
13   * This class is part of JAPE Debugger component for
14   * GATE (Copyright (c) "The University of Sheffield" see http://gate.ac.uk/) <br>
15   * @author Andrey Shafirin, Oleg Mishenko, Vladimir Karasev
16   */
17  
18  public class MainPanel extends JComponent {
19      public MainPanel() {
20          initGui();
21      }
22  
23      private void initGui() {
24          JSplitPane rightLeftSplitPane;
25          JSplitPane upperLowerSplitPane;
26          this.setLayout(new GridBagLayout());
27          GridBagConstraints c = new GridBagConstraints();
28          c.gridx = 0;
29          c.gridy = 0;
30          c.gridwidth = 1;
31          c.gridheight = 1;
32          c.weightx = 1;
33          c.weighty = 1;
34          c.anchor = GridBagConstraints.NORTHWEST;
35          c.fill = GridBagConstraints.BOTH;
36          c.insets = new Insets(4, 4, 4, 4);
37  
38          JPanel panel = new JPanel(new BorderLayout());
39          JButton refreshButton = new JButton("Refresh resources");
40          refreshButton.addActionListener(new ActionListener() {
41              public void actionPerformed(ActionEvent e) {
42                  ResourcesFactory.updateRoots();
43                  GuiFactory.getResourceView().refresh();
44              }
45          });
46          panel.add(refreshButton, BorderLayout.NORTH);
47          panel.add(GuiFactory.getResourceView(), BorderLayout.CENTER);
48  
49          rightLeftSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel, GuiFactory.getDebugPanel());
50  //        rightLeftSplitPane.setDividerSize(4);
51          rightLeftSplitPane.setDividerLocation(250);
52          this.add(rightLeftSplitPane, c);
53  
54          upperLowerSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, rightLeftSplitPane, GuiFactory.getDocumentEditor());
55          upperLowerSplitPane.setDividerLocation(500);
56  //        upperLowerSplitPane.setDividerSize(4);
57          this.add(upperLowerSplitPane, c);
58      }
59  }
60