View Javadoc

1   
2   package org.xrn.gui;
3   
4   import java.awt.Color;
5   import java.awt.event.ActionEvent;
6   import java.awt.event.ActionListener;
7   import java.awt.event.ItemEvent;
8   import java.awt.event.MouseEvent;
9   import java.awt.event.MouseListener;
10  
11  import javax.swing.JComponent;
12  import javax.swing.JLabel;
13  import javax.swing.JPanel;
14  import javax.swing.JTabbedPane;
15  import javax.swing.JTable;
16  import javax.swing.JTextField;
17  import javax.swing.border.TitledBorder;
18  import javax.swing.event.ListSelectionEvent;
19  import javax.swing.event.ListSelectionListener;
20  
21  import org.xrn.xsd2java.impl.ReleaseImpl;
22  
23  /*
24   * 
25   * The releases panel - shows the list of releases
26   * @author Carsten Maneg
27   * Date Nov 12, 2004
28   * Time 11:10:59 PM
29   */
30  public class OneReleasePanel extends JPanel implements ActionListener, MouseListener, ListSelectionListener{
31      
32      private JPanel panelOwner;
33      private JTable table;
34      private MyTableModel tableModel;
35      
36      private JLabel versionLabel = new JLabel( "Version" );
37      private JTextField versionField = new JTextField();
38      private JLabel buildDateLabel = new JLabel( "Build Date" );
39      private JTextField buildDateField = new JTextField();
40      private JLabel deliveryDateLabel = new JLabel( "Delivery Date" );
41      private JTextField deliveryDateField = new JTextField();
42      private JLabel startDateLabel = new JLabel( "Start Date" );
43      private JTextField startDateField = new JTextField();
44      private JLabel builderLabel = new JLabel( "Builder" );
45      private JTextField builderField = new JTextField();
46  //    private JLabel versionLabel = new JLabel( "Version" );
47  //    private JTextField versionField = new JTextField();
48      
49      private FeaturesPanel featuresPanel = null;
50      private CompositionPanel compositionPanel = null;
51      private ReleaseDeliveriesPanel releaseDeliveriesPanel = null;
52      private DependenciesPanel dependenciesPanel = null;
53      private RequirementsPanel requirementsPanel = null;
54      private SummaryPanel summaryPanel = null;
55      
56      private ReleaseImpl release = null;
57                     
58      /***
59       * Constructor
60       * @param owner - parent of the panel
61       */
62      public OneReleasePanel( JPanel owner ){
63    	
64          setBorder( new TitledBorder( " Release " ) );
65          setLayout( null );
66          
67          panelOwner = owner;
68          
69          releaseDeliveriesPanel = new ReleaseDeliveriesPanel( this, null );        
70          featuresPanel = new FeaturesPanel( this );        
71          compositionPanel = new CompositionPanel( this );
72          dependenciesPanel = new DependenciesPanel( this );
73          requirementsPanel = new RequirementsPanel( this );
74          summaryPanel = new SummaryPanel( this, "big" );
75          
76          versionLabel.setFont( XRNConstants.FONT_BOLD );
77          buildDateLabel.setFont( XRNConstants.FONT_BOLD );
78          
79          dlgObjHinzufuegen( versionLabel, 25, 20, 50, 20 ); 
80          dlgObjHinzufuegen( versionField, 80, 20, 80, 20 ); 
81          dlgObjHinzufuegen( buildDateLabel, 170, 20, 60, 20 ); 
82          dlgObjHinzufuegen( buildDateField, 235, 20, 70, 20 ); 
83          dlgObjHinzufuegen( deliveryDateLabel, 315, 20, 70, 20 ); 
84          dlgObjHinzufuegen( deliveryDateField, 385, 20, 70, 20 ); 
85          dlgObjHinzufuegen( startDateLabel, 465, 20, 50, 20 ); 
86          dlgObjHinzufuegen( startDateField, 515, 20, 80, 20 ); 
87          dlgObjHinzufuegen( builderLabel, 615, 20, 50, 20 ); 
88          dlgObjHinzufuegen( builderField, 670, 20, 80, 20 );
89      
90          JTabbedPane pane = new JTabbedPane();
91          pane.insertTab( "Features", null, featuresPanel, "Features", 0 );
92          pane.insertTab( "Deliveries", null, releaseDeliveriesPanel, "Deliveries", 1 );
93          pane.insertTab( "Composition", null, compositionPanel, "Composition", 2 );
94          pane.insertTab( "Dependencies", null, dependenciesPanel, "Dependencies", 3 );
95          pane.insertTab( "Requirements", null, requirementsPanel, "Requirements", 4 );
96          pane.insertTab( "Summary", null, summaryPanel, "Summary", 5 );
97          dlgObjHinzufuegen( pane, 25, 50, 700, 400 );
98  }
99  
100     /***
101      * 
102      * @param c
103      * @param x0
104      * @param y0
105      * @param width
106      * @param height
107      */
108     public void dlgObjHinzufuegen( JComponent c, int x0, int y0, int width, int height ){
109         c.setBounds( x0, y0, width, height );
110         c.setForeground( Color.black );
111         add(c);
112     }
113     
114     /***
115      * 
116      */
117     public void actionPerformed( ActionEvent e ){
118   	
119 //        if ( e.getSource() == radierenAS ){
120 //  		
121 //            radieren();
122 //        }
123     }
124     
125     /***
126      * Delete the input fields and set the default values 
127      *
128      */
129     public void resetFields( ){
130         buildDateField.setText( "" );
131         builderField.setText( "" );
132         deliveryDateField.setText( "" );
133         startDateField.setText( "" );
134         versionField.setText( "" );
135         featuresPanel.resetFields();
136         compositionPanel.resetFields();
137         releaseDeliveriesPanel.resetFields();
138         dependenciesPanel.resetFields();
139         requirementsPanel.resetFields();
140         summaryPanel.resetFields();
141     }
142     
143     /***
144      * 
145      * @return The release
146      */
147     public ReleaseImpl getRelease(){
148         release = new ReleaseImpl();
149         release.setBuildDate( buildDateField.getText() );
150         release.setBuilderID( builderField.getText() );
151         release.setComposition( compositionPanel.getComposition() );
152         release.setDeliveries( releaseDeliveriesPanel.getReleaseDeliveries() );
153         release.setDeliveryDate( deliveryDateField.getText() );
154         release.setDependencies( dependenciesPanel.getDependencies() );
155         release.setFeatures( featuresPanel.getFeatures() );
156         release.setRequirements( requirementsPanel.getRequirements() );
157         release.setStartDate( startDateField.getText() );
158         release.setSummary( summaryPanel.getSummary() );
159         release.setVersion( versionField.getText() );
160         return this.release;
161     }
162     
163     /***
164      * 
165      * @param release
166      */
167     public void setRelease( ReleaseImpl release ){
168         this.release = release;
169         // first reset old values to show the right data
170         resetFields();
171         
172         buildDateField.setText( release.getBuildDate() );
173         builderField.setText( release.getBuilderID() );
174         deliveryDateField.setText( release.getDeliveryDate() );
175         startDateField.setText( release.getStartDate() );
176         versionField.setText( release.getVersion() );
177         featuresPanel.setFeatures( release.getFeatures() );
178         compositionPanel.setComposition( release.getComposition() );
179         releaseDeliveriesPanel.setReleaseDeliveries( release.getDeliveries() );
180         dependenciesPanel.setDependencies( release.getDependencies() );
181         requirementsPanel.setRequirements( release.getRequirements() );
182         summaryPanel.setSummary( release.getSummary() );
183     }
184     
185 
186     /***
187      * 
188      */
189     public void itemStateChanged( ItemEvent event ){  	
190     }
191 
192     public void valueChanged( ListSelectionEvent e ){
193     }
194     
195     public void mouseClicked( MouseEvent me ){
196     }
197     
198     public void mouseEntered( MouseEvent me ){  	
199     }
200     
201     public void mouseExited( MouseEvent me ){  		
202     }
203     
204     public void mousePressed( MouseEvent me ){  		
205     }
206     
207     public void mouseReleased( MouseEvent me ){  		
208     }
209 
210 }