Coverage Report - net.wotonomy.test.TestPanel
 
Classes in this File Line Coverage Branch Coverage Complexity
TestPanel
0% 
0% 
2
 
 1  
 package net.wotonomy.test;
 2  
 
 3  
 import java.awt.BorderLayout;
 4  
 import java.awt.Component;
 5  
 import java.awt.Insets;
 6  
 import java.util.Vector;
 7  
 
 8  
 import javax.swing.JCheckBox;
 9  
 import javax.swing.JComboBox;
 10  
 import javax.swing.JPanel;
 11  
 import javax.swing.JScrollPane;
 12  
 import javax.swing.JSlider;
 13  
 import javax.swing.JTable;
 14  
 import javax.swing.JTextField;
 15  
 import javax.swing.border.EmptyBorder;
 16  
 import javax.swing.text.JTextComponent;
 17  
 
 18  
 import net.wotonomy.ui.swing.components.BetterFlowLayout;
 19  
 import net.wotonomy.ui.swing.components.ButtonPanel;
 20  
 import net.wotonomy.ui.swing.components.InfoPanel;
 21  
 
 22  
 /**
 23  
 * A master-detail panel with a list, some 
 24  
 * textfields and some buttons.
 25  
 */
 26  
 public class TestPanel extends JPanel 
 27  
 {    
 28  
 //        public JList list;
 29  
         public JTable table;
 30  
     public InfoPanel infoPanel;
 31  
         public ButtonPanel savePanel;
 32  
         public ButtonPanel buttonPanel;
 33  
         public JTextComponent firstNameField;
 34  
         public JTextComponent middleNameField, lastNameField;
 35  
         public JComboBox dateBox, monthBox, yearBox;
 36  
         public JSlider slider;
 37  
         public JCheckBox checkbox;
 38  
         
 39  0
     public TestPanel()
 40  0
     {
 41  0
         this.setLayout( new BorderLayout( 10, 10 ) );
 42  0
             this.setBorder( new EmptyBorder( 10, 10, 10, 10 ) );
 43  
 
 44  0
         JPanel overviewPanel = new JPanel();
 45  0
         overviewPanel.setLayout( new BorderLayout() );
 46  
         
 47  
                 //list = new JList();
 48  
         //JScrollPane scrollPane = new JScrollPane( list );
 49  
 
 50  0
                 table = new JTable();
 51  0
         JScrollPane scrollPane = new JScrollPane( table );
 52  
         
 53  0
         overviewPanel.add( scrollPane, BorderLayout.CENTER );
 54  
         
 55  0
         this.add( overviewPanel, BorderLayout.CENTER );
 56  
                 
 57  0
         infoPanel = new InfoPanel();
 58  0
         infoPanel.setColumns( 1 );
 59  
 
 60  
                 // name fields
 61  0
                 firstNameField = new JTextField(); 
 62  
 //                infoPanel.addPair( "First Name", firstNameField );
 63  0
                 middleNameField = new JTextField();
 64  
 //                infoPanel.addPair( "Middle Name", middleNameField );
 65  0
                 lastNameField = new JTextField();
 66  
 //                infoPanel.addPair( "Last Name", lastNameField );
 67  0
              checkbox = new JCheckBox();
 68  
 
 69  0
                 infoPanel.addRow( "Name", new Component[] { 
 70  0
                         firstNameField, middleNameField, lastNameField, checkbox } );
 71  
                 
 72  
                 // date comboboxen
 73  0
                 Vector datesList = new Vector();
 74  0
                 for ( int i = 1; i < 32; i++ ) datesList.add( new Integer( i ) );
 75  0
                 dateBox = new JComboBox( datesList );
 76  0
         dateBox.setEditable( true );
 77  0
                 monthBox = new JComboBox();
 78  0
                 yearBox = new JComboBox();
 79  0
                 infoPanel.addRow( "Create Date",  
 80  0
                         dateBox, monthBox, yearBox );
 81  
                         
 82  
                 // year slider
 83  0
                 infoPanel.addRow( "Day of Month", slider = new JSlider(
 84  0
                         JSlider.HORIZONTAL, 1, 31, 1 ) );
 85  
                 
 86  
                 // navigation buttons
 87  
         
 88  0
         JPanel navigationPanel = new JPanel();
 89  0
         navigationPanel.setLayout( new BorderLayout() );
 90  
         
 91  0
         buttonPanel = new ButtonPanel( new String[] { "Tree View", "Add", "Remove" } );
 92  0
         buttonPanel.setAlignment( BetterFlowLayout.LEFT );
 93  0
         buttonPanel.setInsets( new Insets( 0, 0, 0, 0 ) );
 94  0
         navigationPanel.add( buttonPanel, BorderLayout.WEST );
 95  
                 
 96  0
         savePanel = new ButtonPanel( new String[] { "Refresh All", "Commit" } );
 97  0
         savePanel.setAlignment( BetterFlowLayout.RIGHT );
 98  0
         navigationPanel.add( savePanel, BorderLayout.EAST );
 99  
 
 100  
         // bottom panel layout
 101  
         
 102  0
         JPanel bottomPanel = new JPanel();
 103  0
         bottomPanel.setLayout( new BorderLayout() );
 104  0
         bottomPanel.add( infoPanel, BorderLayout.NORTH );
 105  0
         bottomPanel.add( navigationPanel, BorderLayout.SOUTH );
 106  
         
 107  0
                 this.add( bottomPanel, BorderLayout.SOUTH );
 108  0
    }
 109  
     
 110  
 }