Package org.td.ui

Source Code of org.td.ui.ApplicationController

package org.td.ui;

import java.util.Date;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.swing.SwingUtilities;

import javax.swing.table.TableColumn;
import org.td.common.beans.Trade;
import org.td.ui.table.components.CalendarCellEditor;
import org.td.ui.table.components.CalendarCellRenderer;


public class ApplicationController {
   
  private ApplicationFrame view;
  private AppTableModel tableModel;
    private final ResourceBundle i18n;

  public ApplicationController() {
    //will be moved to spring container
    i18n = ResourceBundle.getBundle("MessageBundle",
                new Locale("ru", "RU"));
    SwingUtilities.invokeLater(new Runnable() {
            public void run() {
            view = new ApplicationFrame(i18n);
            setModel();
            view.setVisible(true);
            }
        });
   
  }
 
  private void setModel(){
    //ConnectionHandler -> call DB here
    //temp metho� initTrade();
    tableModel = new AppTableModel(initTrade(), i18n);
    view.getTable().setModel(tableModel);

       
        TableColumn column = view.getTable().getColumnModel().getColumn(10);
        column.setCellEditor(new CalendarCellEditor());
        //column.setCellRenderer(new CalendarCellRenderer());
        //table.setDefaultEditor(Date.class, new CalendarCellRenderer());

  }
 
  private Trade[] initTrade(){
   
    Trade trade = new Trade();
    trade.setBasketId(1);
    trade.setCloseDate(new Date());
    trade.setClosePrice(45.67);
    trade.setCloseSignal("Some signal");
    trade.setEntryDate(new Date());
    trade.setOpenSignal("Signal to open");
    trade.setPrice(67.66);
    trade.setStopLoss(67.33);
    trade.setStopProfit(34.55);
    trade.setTicker("GAZP");
    trade.setType('L');
    trade.setVol(107);
   
    return new Trade[] {trade};
  }
}
TOP

Related Classes of org.td.ui.ApplicationController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.