Go to the documentation of this file.00001 package instruction.gui.dialog;
00002
00003 import instruction.gui.tab.ConfigurationTab;
00004 import instruction.gui.tab.CycMappingTab;
00005 import instruction.gui.tab.DialogTab;
00006
00007 import javax.swing.JDialog;
00008 import java.awt.Dimension;
00009 import javax.swing.JPanel;
00010 import java.awt.BorderLayout;
00011 import javax.swing.JTabbedPane;
00012 import java.awt.GridBagLayout;
00013 import javax.swing.JButton;
00014
00015 import java.awt.Component;
00016 import java.awt.GridBagConstraints;
00017 import java.awt.Insets;
00018
00019 public class ConfigDlg extends JDialog {
00020
00021 private static final long serialVersionUID = 4020020290843825826L;
00022 private JPanel jContentPane = null;
00023 private JPanel jButtonPanel = null;
00024 private JButton jButtonOK = null;
00025 private JButton jButtonCancel = null;
00026 private JTabbedPane jTabbedPane = null;
00027
00032 public ConfigDlg () {
00033
00034 super();
00035 initialize();
00036 }
00037
00042 private void initialize() {
00043
00044 this.setSize( new Dimension( 693, 516 ) );
00045 this.setContentPane( getJContentPane() );
00046 this.setTitle( "Plan Importer Settings" );
00047
00048 }
00049
00055 private JPanel getJContentPane() {
00056
00057 if ( jContentPane == null ) {
00058 BorderLayout borderLayout = new BorderLayout();
00059 borderLayout.setHgap( 5 );
00060 borderLayout.setVgap( 5 );
00061 jContentPane = new JPanel();
00062 jContentPane.setLayout( borderLayout );
00063 jContentPane.add( getJButtonPanel(), BorderLayout.SOUTH );
00064 jContentPane.add( getJTabbedPane(), BorderLayout.CENTER );
00065 }
00066 return jContentPane;
00067 }
00068
00074 private JPanel getJButtonPanel() {
00075
00076 if ( jButtonPanel == null ) {
00077 GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
00078 gridBagConstraints1.gridx = 1;
00079 gridBagConstraints1.insets = new Insets( 5, 5, 5, 5 );
00080 gridBagConstraints1.anchor = GridBagConstraints.CENTER;
00081 gridBagConstraints1.gridy = 0;
00082 GridBagConstraints gridBagConstraints = new GridBagConstraints();
00083 gridBagConstraints.gridx = 0;
00084 gridBagConstraints.insets = new Insets( 5, 5, 5, 5 );
00085 gridBagConstraints.anchor = GridBagConstraints.CENTER;
00086 gridBagConstraints.gridy = 0;
00087 jButtonPanel = new JPanel();
00088 jButtonPanel.setLayout( new GridBagLayout() );
00089 jButtonPanel.setPreferredSize( new Dimension( 0, 50 ) );
00090 jButtonPanel.add( getJButtonOK(), gridBagConstraints );
00091 jButtonPanel.add( getJButtonCancel(), gridBagConstraints1 );
00092 }
00093 return jButtonPanel;
00094 }
00095
00101 private JButton getJButtonOK() {
00102
00103 if ( jButtonOK == null ) {
00104 jButtonOK = new JButton();
00105 jButtonOK.setText( "OK" );
00106 jButtonOK.addActionListener( new java.awt.event.ActionListener() {
00107 public void actionPerformed( java.awt.event.ActionEvent e ) {
00108
00109 int numTabs = jTabbedPane.getTabCount();
00110 for ( int i = 0; i < numTabs; i++ ) {
00111 Component tab = jTabbedPane.getComponentAt( i );
00112 if ( tab instanceof DialogTab )
00113 ( (DialogTab) tab ).onOK();
00114
00115 }
00116 ConfigDlg.this.setVisible( false );
00117 }
00118 } );
00119 }
00120 return jButtonOK;
00121 }
00122
00128 private JButton getJButtonCancel() {
00129
00130 if ( jButtonCancel == null ) {
00131 jButtonCancel = new JButton();
00132 jButtonCancel.setText( "Cancel" );
00133 jButtonCancel.addActionListener( new java.awt.event.ActionListener() {
00134 public void actionPerformed( java.awt.event.ActionEvent e ) {
00135 ConfigDlg.this.setVisible( false );
00136 }
00137 } );
00138 }
00139 return jButtonCancel;
00140 }
00141
00147 private JTabbedPane getJTabbedPane() {
00148
00149 if ( jTabbedPane == null ) {
00150 jTabbedPane = new JTabbedPane();
00151 jTabbedPane.addTab( "Settings", new ConfigurationTab() );
00152 jTabbedPane.addTab( "Cyc Mapping", new CycMappingTab() );
00153 }
00154 return jTabbedPane;
00155 }
00156
00157 }