001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/
004    package graphlab.ui.components;
005    
006    import graphlab.platform.core.BlackBoard;
007    import graphlab.ui.components.gbody.GBody;
008    import graphlab.ui.components.gmenu.GMenuBar;
009    import graphlab.ui.components.gsidebar.GSidebar;
010    
011    import javax.swing.*;
012    import java.awt.*;
013    
014    /**
015     * this class is the extension of JFrame, which is not only a simple JFrame, it
016     * is a frame work that has all parts of an User Interface, it contains:
017     * Toolbar, Status Bar, Side Bar, Menu Bar and a Body which is the main program
018     *
019     * @author azin azadi
020    
021     */
022    public class GFrame extends javax.swing.JFrame {
023        /**
024         *
025         */
026        private static final long serialVersionUID = 1087497772015236434L;
027        public BlackBoard blackboard;
028    //    static GWinAdapter winAdapter;
029    //    static {
030    //        winAdapter = new GWinAdapter();
031    //    }
032    
033        private GBody body1;
034        private GMenuBar gMenuBar2;
035        private GSidebar gSidebar1;
036        private GToolbar gToolbar1;
037        private GStatusBar gStatusbar1;
038    
039    
040        /**
041         * Creates new form GFrame
042         */
043        public GFrame(BlackBoard blackboard) {
044            this.blackboard = blackboard;
045            this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
046    
047            initComponents();
048            gToolbar1.createToolBar();
049            validate();
050        }
051    
052        /**
053         * This method is called from within the constructor to initialize the form.
054         */
055        private void initComponents() {// GEN-BEGIN:initComponents
056            java.awt.GridBagConstraints gridBagConstraints;
057    
058            body1 = new GBody();
059            gToolbar1 = new GToolbar();
060            gSidebar1 = new GSidebar(body1, blackboard);
061            gMenuBar2 = new GMenuBar();
062            gStatusbar1 = new GStatusBar(blackboard);
063            getContentPane().setLayout(new java.awt.GridBagLayout());
064    
065            gridBagConstraints = new java.awt.GridBagConstraints();
066            gridBagConstraints.gridx = 0;
067            gridBagConstraints.gridy = 1;
068            gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
069            gridBagConstraints.weighty = 1.0;
070            getContentPane().add(gSidebar1, gridBagConstraints);
071    
072            gridBagConstraints = new java.awt.GridBagConstraints();
073            gridBagConstraints.gridx = 1;
074            gridBagConstraints.gridy = 1;
075            gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
076            gridBagConstraints.weightx = 1.0;
077            gridBagConstraints.weighty = 1.0;
078            getContentPane().add(body1, gridBagConstraints);
079    
080            gridBagConstraints = new java.awt.GridBagConstraints();
081            gridBagConstraints.gridx = 0;
082            gridBagConstraints.gridy = 0;
083            gridBagConstraints.gridwidth = 2;
084            gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
085            getContentPane().add(gToolbar1, gridBagConstraints);
086    
087            gridBagConstraints = new java.awt.GridBagConstraints();
088            gridBagConstraints.gridx = 0;
089            gridBagConstraints.gridy = 2;
090            gridBagConstraints.gridwidth = 2;
091            gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
092            getContentPane().add(gStatusbar1, gridBagConstraints);
093    
094            setJMenuBar(gMenuBar2);
095    
096            pack();
097        }
098    
099        public GSidebar getSidebar() {
100            return gSidebar1;
101        }
102    
103        public GMenuBar getMenu() {
104            return gMenuBar2;
105        }
106    
107        public GToolbar getToolbar() {
108            return gToolbar1;
109        }
110    
111        public GBody getBody() {
112            return body1;
113        }
114    
115        public GStatusBar getStatusbar() {
116            return gStatusbar1;
117        }
118    }