|
From: Márcio V. d. S. <mv...@us...> - 2007-12-03 18:25:21
|
Update of /cvsroot/tail/TailS/src/java/net/sf/tails/swing/frame/stockAnalysis In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17586/src/java/net/sf/tails/swing/frame/stockAnalysis Modified Files: NewStockAnalysis2.java NewStockAnalysis3.java Log Message: Index: NewStockAnalysis2.java =================================================================== RCS file: /cvsroot/tail/TailS/src/java/net/sf/tails/swing/frame/stockAnalysis/NewStockAnalysis2.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** NewStockAnalysis2.java 5 Nov 2007 17:19:39 -0000 1.15 --- NewStockAnalysis2.java 3 Dec 2007 18:25:22 -0000 1.16 *************** *** 115,119 **** }); ! criterionPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Additional Criteria")); criterionPanel.setLayout(new GridLayout(0, 1, 10, 10)); criterionPanel.setMaximumSize(new Dimension(400, 0)); --- 115,119 ---- }); ! criterionPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Additional Criteria to report")); criterionPanel.setLayout(new GridLayout(0, 1, 10, 10)); criterionPanel.setMaximumSize(new Dimension(400, 0)); Index: NewStockAnalysis3.java =================================================================== RCS file: /cvsroot/tail/TailS/src/java/net/sf/tails/swing/frame/stockAnalysis/NewStockAnalysis3.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** NewStockAnalysis3.java 21 Nov 2007 21:55:11 -0000 1.16 --- NewStockAnalysis3.java 3 Dec 2007 18:25:22 -0000 1.17 *************** *** 13,16 **** --- 13,18 ---- import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + import java.awt.event.KeyEvent; + import java.awt.event.KeyListener; import java.util.List; import java.util.ResourceBundle; *************** *** 44,47 **** --- 46,51 ---- import org.joda.time.Period; + import com.greef.ui.calendar.JCalendar; + /** * *************** *** 51,333 **** private static final ResourceBundle messageBundle = ResourceBundle.getBundle("net.sf.tails.i18n.Messages"); private static final ResourceBundle iconBundle = ResourceBundle.getBundle("net.sf.tails.i18n.icons"); ! private static final long serialVersionUID = 1L; private SerializableTimeSeries stock; private AnalysisCriterion selectedCriterion; private List<AnalysisCriterion> additionalCriteria; ! private JTextField daysField; ! private JLabel daysLabel; ! private JButton finishButton; ! private JTextField hoursField; ! private JLabel hoursLabel; ! private JButton cancelButton; ! private JTextField minutesField; ! private JLabel minutesLabel; ! private JTextField monthsField; ! private JLabel monthsLabel; ! private JComboBox slicerTypeComboBox; ! private JLabel slicerTypeLabel; ! private JPanel slicesPeriodPanel; ! private JTextField startDateField; ! private JLabel startDateLabel; ! private JTextField yearsField; ! private JLabel yearsLabel; ! private JTextField slicesNumberField; ! private JLabel slicesNumberLabel; ! private JComboBox runnerTypeComboBox; ! private JLabel runnerTypeLabel; private Index index; ! private FrameHelper helper; ! ! public NewStockAnalysis3(Index index, SerializableTimeSeries stock, AnalysisCriterion selectedCriterion, List<AnalysisCriterion> additionalCriteria) { ! this.index = index; ! this.stock = stock; ! this.selectedCriterion = selectedCriterion; ! this.additionalCriteria = additionalCriteria; ! initComponents(); ! this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); ! this.setIconImage(new ImageIcon(iconBundle.getString("TAILS_ICON")).getImage()); ! this.setResizable(false); ! this.setLocationByPlatform(true); ! this.setTitle(messageBundle.getString("STOCKANALYSIS_TITLE")); ! } ! ! private void initComponents() { ! helper = new FrameHelper(); ! slicesPeriodPanel = new JPanel(); ! yearsLabel = new JLabel(); ! yearsField = new JTextField(); ! monthsLabel = new JLabel(); ! monthsField = new JTextField(); ! daysLabel = new JLabel(); ! daysField = new JTextField(); ! hoursLabel = new JLabel(); ! hoursField = new JTextField(); ! minutesLabel = new JLabel(); ! minutesField = new JTextField(); ! startDateLabel = new JLabel(); ! slicerTypeLabel = new JLabel(); ! runnerTypeLabel = new JLabel(); ! slicerTypeComboBox = new JComboBox(); ! runnerTypeComboBox = new JComboBox(); ! startDateField = new JTextField(); ! finishButton = new JButton(); ! cancelButton = new JButton(); ! slicesNumberField = new JTextField(); ! slicesNumberLabel = new 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()); ! ! slicesPeriodPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Slices Period", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION)); ! yearsLabel.setFont(new Font("Dialog", 1, 10)); ! yearsLabel.setText("Years:"); ! yearsField.setMinimumSize(new Dimension(26, 19)); ! yearsField.setPreferredSize(new Dimension(26, 19)); ! yearsField.setText("0"); - monthsLabel.setFont(new Font("Dialog", 1, 10)); - monthsLabel.setText("Months:"); ! monthsField.setMinimumSize(new Dimension(26, 19)); ! monthsField.setPreferredSize(new Dimension(26, 19)); ! monthsField.setText("0"); ! daysLabel.setFont(new Font("Dialog", 1, 10)); ! daysLabel.setText("Days:"); ! daysField.setMinimumSize(new Dimension(26, 19)); ! daysField.setPreferredSize(new Dimension(26, 19)); ! daysField.setText("0"); ! hoursLabel.setFont(new Font("Dialog", 1, 10)); ! hoursLabel.setText("Hours:"); ! hoursField.setMinimumSize(new Dimension(26, 19)); ! hoursField.setPreferredSize(new Dimension(26, 19)); ! hoursField.setText("0"); ! minutesLabel.setFont(new Font("Dialog", 1, 10)); ! minutesLabel.setText("Minutes:"); ! minutesField.setMinimumSize(new Dimension(26, 19)); ! minutesField.setPreferredSize(new Dimension(26, 19)); ! minutesField.setText("0"); ! GroupLayout slicesPeriodPanelLayout = new GroupLayout(slicesPeriodPanel); ! slicesPeriodPanel.setLayout(slicesPeriodPanelLayout); ! slicesPeriodPanelLayout.setHorizontalGroup( ! slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(slicesPeriodPanelLayout.createSequentialGroup() ! .addContainerGap() ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) ! .addGroup(GroupLayout.Alignment.LEADING, slicesPeriodPanelLayout.createSequentialGroup() ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(monthsLabel) ! .addComponent(yearsLabel) ! .addComponent(daysLabel) ! .addComponent(hoursLabel) ! .addComponent(minutesLabel)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) ! .addComponent(hoursField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .addComponent(daysField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .addComponent(yearsField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .addComponent(monthsField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .addComponent(minutesField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ! .addGap(468, 468, 468)) ! ); ! slicesPeriodPanelLayout.setVerticalGroup( ! slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(slicesPeriodPanelLayout.createSequentialGroup() ! .addContainerGap() ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(yearsLabel) ! .addComponent(yearsField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(monthsLabel) ! .addComponent(monthsField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(daysField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addComponent(daysLabel)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(hoursLabel) ! .addComponent(hoursField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(minutesLabel) ! .addComponent(minutesField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addContainerGap(21, Short.MAX_VALUE)) ! ); ! startDateLabel.setText("Start Date:"); ! ! runnerTypeLabel.setText("Runner Type:"); ! runnerTypeComboBox.setModel(new DefaultComboBoxModel(new String[]{ "HistoryRunnerFactory", "ShortSellRunnerFactory" })); ! runnerTypeComboBox.setMinimumSize(new Dimension(178, 23)); ! runnerTypeComboBox.setPreferredSize(new Dimension(178, 23)); ! ! slicerTypeLabel.setText("Slicer Type:"); ! ! slicerTypeComboBox.setModel(new DefaultComboBoxModel(new String[]{ "Regular", "Fully", "Partial" })); ! slicerTypeComboBox.setMinimumSize(new Dimension(178, 23)); ! slicerTypeComboBox.setPreferredSize(new Dimension(178, 23)); ! slicerTypeComboBox.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent evt) { ! slicerChangedActionPerformed(evt); ! } ! }); ! finishButton.setText("Finish"); ! finishButton.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent evt) { ! finishButtonActionPerformed(evt); ! } ! }); ! cancelButton.setText("Cancel"); ! cancelButton.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent evt) { ! cancelButtonActionPerformed(evt); ! } ! }); ! GroupLayout layout = new GroupLayout(getContentPane()); ! getContentPane().setLayout(layout); ! layout.setHorizontalGroup( ! layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addGap(30, 30, 30) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addGap(11, 11, 11) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(runnerTypeLabel) ! .addComponent(startDateLabel) ! .addComponent(slicerTypeLabel)) ! .addGap(20, 20, 20) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(runnerTypeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addComponent(startDateField, GroupLayout.PREFERRED_SIZE, 180, GroupLayout.PREFERRED_SIZE) ! .addComponent(slicerTypeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addGap(28, 28, 28) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(slicesNumberLabel)) ! .addGap(20, 20, 20) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(slicesNumberField))) ! .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() ! .addComponent(slicesPeriodPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)))) ! .addGroup(layout.createSequentialGroup() ! .addGap(235, 235, 235) ! .addComponent(finishButton) ! .addGap(19, 19, 19) ! .addComponent(cancelButton))) ! .addContainerGap(30, Short.MAX_VALUE)) ! ); ! layout.setVerticalGroup( ! layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addGap(23, 23, 23) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(startDateLabel) ! .addComponent(startDateField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addGap(15, 15, 15) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(runnerTypeLabel) ! .addComponent(runnerTypeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addGap(15, 15, 15) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(slicerTypeLabel) ! .addComponent(slicerTypeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addComponent(slicesNumberLabel) ! .addComponent(slicesNumberField)) ! .addGap(14, 14, 14) ! .addComponent(slicesPeriodPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addGap(18, 18, 18) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(finishButton) ! .addComponent(cancelButton)) ! .addContainerGap(20, Short.MAX_VALUE)) ! ); ! pack(); ! } ! 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(ActionEvent evt) { ! this.dispose(); ! } ! private void finishButtonActionPerformed(ActionEvent evt) { Cursor cursor = Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ); setCursor( cursor ); ! DateTime startDate; try { startDate = helper.getDate(startDateField.getText()); --- 55,396 ---- private static final ResourceBundle messageBundle = ResourceBundle.getBundle("net.sf.tails.i18n.Messages"); private static final ResourceBundle iconBundle = ResourceBundle.getBundle("net.sf.tails.i18n.icons"); ! private static final long serialVersionUID = 1L; private SerializableTimeSeries stock; private AnalysisCriterion selectedCriterion; private List<AnalysisCriterion> additionalCriteria; ! private JTextField daysField; ! private JLabel daysLabel; ! private JButton finishButton; ! private JTextField hoursField; ! private JLabel hoursLabel; ! private JButton cancelButton; ! private JTextField minutesField; ! private JLabel minutesLabel; ! private JTextField monthsField; ! private JLabel monthsLabel; ! private JComboBox slicerTypeComboBox; ! private JLabel slicerTypeLabel; ! private JPanel slicesPeriodPanel; ! private JTextField startDateField; ! private JLabel startDateLabel; ! private JTextField yearsField; ! private JLabel yearsLabel; ! private JTextField slicesNumberField; ! private JLabel slicesNumberLabel; ! private JComboBox runnerTypeComboBox; ! private JLabel runnerTypeLabel; private Index index; ! private FrameHelper helper; ! private JButton calendarButton; ! private JCalendar calendar = new JCalendar(); ! public NewStockAnalysis3(Index index, SerializableTimeSeries stock, AnalysisCriterion selectedCriterion, List<AnalysisCriterion> additionalCriteria) { ! this.index = index; ! this.stock = stock; ! this.selectedCriterion = selectedCriterion; ! this.additionalCriteria = additionalCriteria; ! initComponents(); ! this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); ! this.setIconImage(new ImageIcon(iconBundle.getString("TAILS_ICON")).getImage()); ! this.setResizable(false); ! this.setLocationByPlatform(true); ! this.setTitle(messageBundle.getString("STOCKANALYSIS_TITLE")); ! } ! private void initComponents() { ! helper = new FrameHelper(); ! slicesPeriodPanel = new JPanel(); ! yearsLabel = new JLabel(); ! yearsField = new JTextField(); ! monthsLabel = new JLabel(); ! monthsField = new JTextField(); ! daysLabel = new JLabel(); ! daysField = new JTextField(); ! hoursLabel = new JLabel(); ! hoursField = new JTextField(); ! minutesLabel = new JLabel(); ! minutesField = new JTextField(); ! startDateLabel = new JLabel(); ! slicerTypeLabel = new JLabel(); ! runnerTypeLabel = new JLabel(); ! slicerTypeComboBox = new JComboBox(); ! runnerTypeComboBox = new JComboBox(); ! startDateField = new JTextField(); ! calendarButton = new JButton("Calendar"); ! finishButton = new JButton(); ! cancelButton = new JButton(); ! slicesNumberField = new JTextField(); ! slicesNumberLabel = new JLabel(); ! slicesNumberField.setText("1"); ! slicesNumberField.setVisible(false); ! slicesNumberLabel.setText("Number of Slices:"); ! slicesNumberLabel.setVisible(false); ! DateTime date = getStockDate(); ! calendar.setYear(date.getYear()); ! calendar.setMonth(date.getMonthOfYear()); ! calendar.setVisible(false); ! calendarButton.setVisible(false); ! ! startDateField.setText(date.getDayOfMonth() + "/" + date.getMonthOfYear() + "/" + date.getYear()); ! slicesPeriodPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Slices Period", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION)); ! yearsLabel.setFont(new Font("Dialog", 1, 10)); ! yearsLabel.setText("Years:"); ! yearsField.setMinimumSize(new Dimension(26, 19)); ! yearsField.setPreferredSize(new Dimension(26, 19)); ! yearsField.setText("0"); ! monthsLabel.setFont(new Font("Dialog", 1, 10)); ! monthsLabel.setText("Months:"); ! monthsField.setMinimumSize(new Dimension(26, 19)); ! monthsField.setPreferredSize(new Dimension(26, 19)); ! monthsField.setText("0"); ! daysLabel.setFont(new Font("Dialog", 1, 10)); ! daysLabel.setText("Days:"); ! daysField.setMinimumSize(new Dimension(26, 19)); ! daysField.setPreferredSize(new Dimension(26, 19)); ! daysField.setText("0"); ! hoursLabel.setFont(new Font("Dialog", 1, 10)); ! hoursLabel.setText("Hours:"); ! hoursField.setMinimumSize(new Dimension(26, 19)); ! hoursField.setPreferredSize(new Dimension(26, 19)); ! hoursField.setText("0"); ! minutesLabel.setFont(new Font("Dialog", 1, 10)); ! minutesLabel.setText("Minutes:"); ! minutesField.setMinimumSize(new Dimension(26, 19)); ! minutesField.setPreferredSize(new Dimension(26, 19)); ! minutesField.setText("0"); ! GroupLayout slicesPeriodPanelLayout = new GroupLayout(slicesPeriodPanel); ! slicesPeriodPanel.setLayout(slicesPeriodPanelLayout); ! slicesPeriodPanelLayout.setHorizontalGroup( ! slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(slicesPeriodPanelLayout.createSequentialGroup() ! .addContainerGap() ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) ! .addGroup(GroupLayout.Alignment.LEADING, slicesPeriodPanelLayout.createSequentialGroup() ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(monthsLabel) ! .addComponent(yearsLabel) ! .addComponent(daysLabel) ! .addComponent(hoursLabel) ! .addComponent(minutesLabel)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) ! .addComponent(hoursField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .addComponent(daysField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .addComponent(yearsField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .addComponent(monthsField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .addComponent(minutesField, 40, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ! .addGap(468, 468, 468)) ! ); ! slicesPeriodPanelLayout.setVerticalGroup( ! slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(slicesPeriodPanelLayout.createSequentialGroup() ! .addContainerGap() ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(yearsLabel) ! .addComponent(yearsField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(monthsLabel) ! .addComponent(monthsField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(daysField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addComponent(daysLabel)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(hoursLabel) ! .addComponent(hoursField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(slicesPeriodPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(minutesLabel) ! .addComponent(minutesField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addContainerGap(21, Short.MAX_VALUE)) ! ); ! startDateLabel.setText("Start Date:"); ! ! runnerTypeLabel.setText("Runner Type:"); ! ! runnerTypeComboBox.setModel(new DefaultComboBoxModel(new String[]{ "HistoryRunnerFactory", "ShortSellRunnerFactory" })); ! runnerTypeComboBox.setMinimumSize(new Dimension(178, 23)); ! runnerTypeComboBox.setPreferredSize(new Dimension(178, 23)); ! ! slicerTypeLabel.setText("Slicer Type:"); ! ! slicerTypeComboBox.setModel(new DefaultComboBoxModel(new String[]{ "Regular", "Fully", "Partial" })); ! slicerTypeComboBox.setMinimumSize(new Dimension(178, 23)); ! slicerTypeComboBox.setPreferredSize(new Dimension(178, 23)); ! slicerTypeComboBox.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent evt) { ! slicerChangedActionPerformed(evt); ! } ! }); ! ! calendar.enableInputMethods(true); ! ! calendar.addKeyListener(new KeyListener(){ ! ! @Override ! public void keyPressed(KeyEvent e) { ! updateDate(e); ! ! } ! ! @Override ! public void keyReleased(KeyEvent e) { ! // TODO Auto-generated method stub ! ! } ! ! @Override ! public void keyTyped(KeyEvent e) { ! // TODO Auto-generated method stub ! ! } ! ! }); ! ! finishButton.setText("Finish"); ! finishButton.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent evt) { ! finishButtonActionPerformed(evt); ! } ! }); ! ! calendarButton.setText("Calendar"); ! calendarButton.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent evt) { ! CalendarButtonActionPerformed(evt); ! } ! ! private void CalendarButtonActionPerformed(ActionEvent evt) { ! if(calendar.isVisible()){ ! calendar.setVisible(false); ! }else{ ! //calendar.setVisible(true); ! } ! } ! }); ! ! cancelButton.setText("Cancel"); ! cancelButton.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent evt) { ! cancelButtonActionPerformed(evt); ! } ! }); ! ! GroupLayout layout = new GroupLayout(getContentPane()); ! getContentPane().setLayout(layout); ! layout.setHorizontalGroup( ! layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addGap(30, 30, 30) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addGap(11, 11, 11) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(runnerTypeLabel) ! .addComponent(startDateLabel) ! .addComponent(slicerTypeLabel)) ! .addGap(20, 20, 20) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(runnerTypeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addComponent(startDateField, GroupLayout.PREFERRED_SIZE, 180, GroupLayout.PREFERRED_SIZE) ! .addComponent(slicerTypeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addGap(28, 28, 28) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(calendarButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) ! .addComponent(slicesNumberLabel)) ! .addGap(20, 20, 20) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addComponent(calendar) ! .addComponent(slicesNumberField))) ! .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() ! .addComponent(slicesPeriodPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)))) ! .addGroup(layout.createSequentialGroup() ! .addGap(235, 235, 235) ! .addComponent(finishButton) ! .addGap(19, 19, 19) ! .addComponent(cancelButton))) ! .addContainerGap(30, Short.MAX_VALUE)) ! ); ! layout.setVerticalGroup( ! layout.createParallelGroup(GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addGap(23, 23, 23) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(startDateLabel).addComponent(startDateField) ! .addComponent(calendarButton, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addComponent(calendar)) ! .addGap(15, 15, 15) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(runnerTypeLabel) ! .addComponent(runnerTypeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ! .addGap(15, 15, 15) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(slicerTypeLabel) ! .addComponent(slicerTypeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addComponent(slicesNumberLabel) ! .addComponent(slicesNumberField)) ! .addGap(14, 14, 14) ! .addComponent(slicesPeriodPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ! .addGap(18, 18, 18) ! .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) ! .addComponent(finishButton) ! .addComponent(cancelButton)) ! .addContainerGap(20, Short.MAX_VALUE)) ! ); ! pack(); ! } ! ! private DateTime getStockDate() { ! return stock.getSeries().getTick(stock.getSeries().getBegin()).getDate(); ! } ! ! 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(ActionEvent evt) { ! this.dispose(); ! } ! private void updateDate(KeyEvent e) { ! startDateField.setText("fjewijfei"); ! ! } ! ! private void finishButtonActionPerformed(ActionEvent evt) { Cursor cursor = Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ); setCursor( cursor ); ! DateTime startDate; try { startDate = helper.getDate(startDateField.getText()); *************** *** 336,340 **** return; } ! if(yearsField.getText().equals("") || monthsField.getText().equals("") || daysField.getText().equals("") || hoursField.getText().equals("") || minutesField.getText().equals("")) { --- 399,403 ---- return; } ! if(yearsField.getText().equals("") || monthsField.getText().equals("") || daysField.getText().equals("") || hoursField.getText().equals("") || minutesField.getText().equals("")) { *************** *** 342,349 **** 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()); --- 405,412 ---- 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()); *************** *** 354,358 **** } ! if(year<=0 && month<=0 && day<=0 && hour<=0 && minute<=0) { --- 417,421 ---- } ! if(year<=0 && month<=0 && day<=0 && hour<=0 && minute<=0) { *************** *** 363,369 **** return; } ! if(startDate.isBefore(stock.getSeries().getTick(stock.getSeries().getBegin()).getDate().getMillis()) || ! startDate.isAfter(stock.getSeries().getTick(stock.getSeries().getEnd()).getDate().getMillis())) { JOptionPane.showMessageDialog(null, "Start Date must be between " + --- 426,432 ---- return; } ! if(startDate.isBefore(stock.getSeries().getTick(stock.getSeries().getBegin()).getDate().getMillis()) || ! startDate.isAfter(stock.getSeries().getTick(stock.getSeries().getEnd()).getDate().getMillis())) { JOptionPane.showMessageDialog(null, "Start Date must be between " + *************** *** 376,380 **** Period period = new Period(year, month, 0, day, hour, minute, 0, 0); if (slicerTypeComboBox.getSelectedItem().toString().equals("Partial")) ! { if (slicesNumberField.getText().equals("")) { --- 439,443 ---- Period period = new Period(year, month, 0, day, hour, minute, 0, 0); if (slicerTypeComboBox.getSelectedItem().toString().equals("Partial")) ! { if (slicesNumberField.getText().equals("")) { *************** *** 390,394 **** return; } ! if (slicesNumber <= 0) { --- 453,457 ---- return; } ! if (slicesNumber <= 0) { *************** *** 396,413 **** return; } ! ! slicer = new PartialMemorizedSlicer(stock, period, startDate, slicesNumber); ! } else if (slicerTypeComboBox.getSelectedItem().toString().equals("Fully")) ! { ! slicer = new FullyMemorizedSlicer(stock, period, startDate); ! } ! else ! { ! slicer = new RegularSlicer(stock, period, startDate); ! } StockAnalysis stockAnalysis = null; ! try { stockAnalysis = new StockAnalysis(stock, selectedCriterion, slicer, new HigherValueEvaluatorFactory(), helper.getSelectedRunner(runnerTypeComboBox.getSelectedItem().toString())); --- 459,476 ---- return; } ! ! slicer = new PartialMemorizedSlicer(stock, period, startDate, slicesNumber); ! } else if (slicerTypeComboBox.getSelectedItem().toString().equals("Fully")) ! { ! slicer = new FullyMemorizedSlicer(stock, period, startDate); ! } ! else ! { ! slicer = new RegularSlicer(stock, period, startDate); ! } StockAnalysis stockAnalysis = null; ! try { stockAnalysis = new StockAnalysis(stock, selectedCriterion, slicer, new HigherValueEvaluatorFactory(), helper.getSelectedRunner(runnerTypeComboBox.getSelectedItem().toString())); *************** *** 416,427 **** return; } ! ! stockAnalysis.addCriteria(additionalCriteria); ! index.loadStockAnalysis(stockAnalysis); ! ! this.dispose(); ! cursor = Cursor.getDefaultCursor(); setCursor( cursor ); ! } } --- 479,490 ---- return; } ! ! stockAnalysis.addCriteria(additionalCriteria); ! index.loadStockAnalysis(stockAnalysis); ! ! this.dispose(); ! cursor = Cursor.getDefaultCursor(); setCursor( cursor ); ! } } |