|
From: Carlos <ma...@us...> - 2007-10-08 19:55:28
|
Update of /cvsroot/tail/TailS/src/java/net/sf/tails/swing/frame/stockAnalysis In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20468/src/java/net/sf/tails/swing/frame/stockAnalysis Modified Files: NewStockAnalysis2.java NewStockAnalysis3.java Log Message: Atualizando tela. Index: NewStockAnalysis2.java =================================================================== RCS file: /cvsroot/tail/TailS/src/java/net/sf/tails/swing/frame/stockAnalysis/NewStockAnalysis2.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NewStockAnalysis2.java 3 Oct 2007 22:04:10 -0000 1.3 --- NewStockAnalysis2.java 8 Oct 2007 19:55:29 -0000 1.4 *************** *** 32,36 **** private static final long serialVersionUID = 1L; private Stock stock; ! private List<String> criteria; private javax.swing.JComboBox analysisComboBox; private javax.swing.JLabel analysisLabel; --- 32,36 ---- private static final long serialVersionUID = 1L; private Stock stock; ! private String[] criteria; private javax.swing.JComboBox analysisComboBox; private javax.swing.JLabel analysisLabel; *************** *** 57,61 **** analysisLabel = new javax.swing.JLabel(); analysisComboBox = new javax.swing.JComboBox(); ! criteria = new ArrayList<String>(); nextButton.setText("Next"); --- 57,61 ---- analysisLabel = new javax.swing.JLabel(); analysisComboBox = new javax.swing.JComboBox(); ! criteria = FrameHelper.getCriteriaFiles(); nextButton.setText("Next"); *************** *** 73,77 **** }); - criteria = FrameHelper.getCriteriaFiles(); criterionPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Additional Criteria", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 14))); criterionPanel.setLayout(new GridLayout(0, 3, 15, 15)); --- 73,76 ---- *************** *** 88,92 **** analysisLabel.setText("Analisys Criterion: "); ! analysisComboBox.setModel(new javax.swing.DefaultComboBoxModel(criteria.toArray())); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); --- 87,91 ---- analysisLabel.setText("Analisys Criterion: "); ! analysisComboBox.setModel(new javax.swing.DefaultComboBoxModel(criteria)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); *************** *** 128,132 **** ); pack(); - this.setSize(700, 280); } --- 127,130 ---- Index: NewStockAnalysis3.java =================================================================== RCS file: /cvsroot/tail/TailS/src/java/net/sf/tails/swing/frame/stockAnalysis/NewStockAnalysis3.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NewStockAnalysis3.java 8 Oct 2007 19:38:19 -0000 1.4 --- NewStockAnalysis3.java 8 Oct 2007 19:55:29 -0000 1.5 *************** *** 8,11 **** --- 8,12 ---- package net.sf.tails.swing.frame.stockAnalysis; + import java.awt.event.ActionEvent; import java.util.List; import java.util.ResourceBundle; *************** *** 22,25 **** --- 23,27 ---- import net.sf.tail.runner.HistoryRunner; import net.sf.tail.series.FullyMemorizedSlicer; + import net.sf.tail.series.PartialMemorizedSlicer; import net.sf.tail.series.RegularSlicer; import net.sf.tails.swing.frame.Index; *************** *** 57,60 **** --- 59,64 ---- private javax.swing.JTextField yearsField; private javax.swing.JLabel yearsLabel; + private javax.swing.JTextField slicesNumberField; + private javax.swing.JLabel slicesNumberLabel; private Index index; *************** *** 89,93 **** --- 93,104 ---- finishButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); + slicesNumberField = new javax.swing.JTextField(); + slicesNumberLabel = new javax.swing.JLabel(); + slicesNumberField.setText("1"); + slicesNumberField.setVisible(false); + slicesNumberLabel.setText("Number of Slices:"); + slicesNumberLabel.setVisible(false); + DateTime date = stock.getSeries().getTick(stock.getSeries().getBegin()).getDate(); startDateField.setText(date.getDayOfMonth() + "/" + date.getMonthOfYear() + "/" + date.getYear()); *************** *** 184,190 **** slicerTypeLabel.setText("Slicer Type:"); ! slicerTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[]{ "Memorized", "Regular" })); slicerTypeComboBox.setMinimumSize(new java.awt.Dimension(178, 23)); slicerTypeComboBox.setPreferredSize(new java.awt.Dimension(178, 23)); finishButton.setText("Finish"); --- 195,206 ---- slicerTypeLabel.setText("Slicer Type:"); ! slicerTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[]{ "Regular", "Fully", "Partial" })); slicerTypeComboBox.setMinimumSize(new java.awt.Dimension(178, 23)); slicerTypeComboBox.setPreferredSize(new java.awt.Dimension(178, 23)); + slicerTypeComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + slicerChangedActionPerformed(evt); + } + }); finishButton.setText("Finish"); *************** *** 216,223 **** .addComponent(startDateLabel) .addComponent(slicerTypeLabel)) ! .addGap(31, 31, 31) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(startDateField, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addComponent(slicerTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(slicesPeriodPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) --- 232,245 ---- .addComponent(startDateLabel) .addComponent(slicerTypeLabel)) ! .addGap(20, 20, 20) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(startDateField, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addComponent(slicerTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ! .addGap(28, 28, 28) ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addComponent(slicesNumberLabel)) ! .addGap(20, 20, 20) ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addComponent(slicesNumberField))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(slicesPeriodPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) *************** *** 240,244 **** .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(slicerTypeLabel) ! .addComponent(slicerTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(14, 14, 14) .addComponent(slicesPeriodPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) --- 262,268 ---- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(slicerTypeLabel) ! .addComponent(slicerTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addComponent(slicesNumberLabel) ! .addComponent(slicesNumberField)) .addGap(14, 14, 14) .addComponent(slicesPeriodPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) *************** *** 252,256 **** } ! private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) { this.dispose(); } --- 276,293 ---- } ! protected void slicerChangedActionPerformed(ActionEvent evt) { ! if (slicerTypeComboBox.getSelectedItem().toString().equals("Partial")) ! { ! slicesNumberField.setVisible(true); ! slicesNumberLabel.setVisible(true); ! } ! else ! { ! slicesNumberField.setVisible(false); ! slicesNumberLabel.setVisible(false); ! } ! } ! ! private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) { this.dispose(); } *************** *** 271,279 **** return; } ! int year = Integer.parseInt(yearsField.getText()); ! int month = Integer.parseInt(monthsField.getText()); ! int day = Integer.parseInt(daysField.getText()); ! int hour = Integer.parseInt(hoursField.getText()); ! int minute = Integer.parseInt(minutesField.getText()); if(year<=0 && month<=0 && day<=0 && hour<=0 && minute<=0) --- 308,323 ---- return; } ! ! int year = 0, month = 0, day = 0, hour = 0, minute = 0; ! try { ! year = Integer.parseInt(yearsField.getText()); ! month = Integer.parseInt(monthsField.getText()); ! day = Integer.parseInt(daysField.getText()); ! hour = Integer.parseInt(hoursField.getText()); ! minute = Integer.parseInt(minutesField.getText()); ! } catch (Exception e) { ! JOptionPane.showMessageDialog(null, messageBundle.getString("INVALID_PERIOD_FIELDS"), "Error", 2); ! } ! if(year<=0 && month<=0 && day<=0 && hour<=0 && minute<=0) *************** *** 297,301 **** TimeSeriesSlicer slicer; Period period = new Period(year, month, 0, day, hour, minute, 0, 0); ! if (slicerTypeComboBox.getSelectedItem().toString().equals("Memorized")) { slicer = new FullyMemorizedSlicer(stock.getSeries(), period, startDate); --- 341,369 ---- TimeSeriesSlicer slicer; Period period = new Period(year, month, 0, day, hour, minute, 0, 0); ! if (slicerTypeComboBox.getSelectedItem().toString().equals("Partial")) ! { ! if (slicesNumberField.getText().equals("")) ! { ! JOptionPane.showMessageDialog(null, messageBundle.getString("EMPTY_SLICESNUMBER_FIELD"), "Error", 2); ! return; ! } ! int slicesNumber = 1; ! try { ! slicesNumber = Integer.parseInt(slicesNumberField.getText()); ! } ! catch (Exception e) { ! JOptionPane.showMessageDialog(null, messageBundle.getString("INVALID_SLICESNUMBER_FIELD"), "Error", 2); ! return; ! } ! ! if (slicesNumber <= 0) ! { ! JOptionPane.showMessageDialog(null, messageBundle.getString("NEGATIVE_SLICESNUMBER_FIELD"), "Error", 2); ! return; ! } ! ! slicer = new PartialMemorizedSlicer(stock.getSeries(), period, startDate, slicesNumber); ! } ! else if (slicerTypeComboBox.getSelectedItem().toString().equals("Fully")) { slicer = new FullyMemorizedSlicer(stock.getSeries(), period, startDate); |