⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 brokerviewimpl.java

📁 java写的股票交易系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
          bc = (BrokerController) brokerControllers.get(i);
          bc.handleUpdateCustomerGesture(cust);
        }
      }
    };

  // Following is an anonymous inner class declaration
  // The attribute custDetailsPageHandler is registered as the 
  // action event listener with the "Customer Details" button of  
  // the gui, by the constructor of this class.
  transient  ActionListener custDetailsPageHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // This method is called when the "Customer Details" 
        // button is clicked by the user
        System.out.println("BrokerViewImpl: " +
          "custDetailsPageHandler");
        BrokerController bc;
        String custId;
        //modified by ourteam 051228
        //begin
        String custName;
        custName = gui.getCustNameOnCustPan();
        String custAddr;
        custAddr = gui.getCustAddrOnCustPan();
        //end
        //** 1  Assign custId with the value of the customer id
        //** on the gui. Use getCustIdOnCustPan() method of gui.
        custId = gui.getCustIdOnCustPan();
        //** 2 Create a for loop: 
        //**   Hint: See actionPerformed method of the
        //**         custGetHandler object.
        //**   Invoke the handleGetCustomerGesture method on 
        //**   every object in the ArrayList brokerControllers.
        for (int i=0; i<brokerControllers.size(); i++) {
          bc = (BrokerController) brokerControllers.get(i);
        //modified by ourteam 051228
        //begin
          bc.handleGetCustomerGesture(custId, custName, custAddr);
        //end
        }
      }
    };

   //modified  by  ourteam 051228
   //begin
   transient  ActionListener portPageHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // This method is called when the "Customer Details" 
        // button is clicked by the user
        System.out.println("BrokerViewImpl: " +
          "portPageHandler");
        BrokerController bc;
        String custId;
        
        String custName;
        custName = gui.getCustNameOnPortPan();
        ArrayList custShares;
        custShares = gui.getCustSharesOnPortPan();
        Share[] shares=null;
        if(custShares!=null){
        	shares=new Share[custShares.size()];
	        for(int i=0;i<custShares.size();i++){
	        	shares[i]=(Share)custShares.get(i);
	        }
	     }
        //end
        //** 1  Assign custId with the value of the customer id
        //** on the gui. Use getCustIdOnCustPan() method of gui.
        custId = gui.getCustIdOnPortPan();
        //** 2 Create a for loop: 
        //**   Hint: See actionPerformed method of the
        //**         custGetHandler object.
        //**   Invoke the handleGetCustomerGesture method on 
        //**   every object in the ArrayList brokerControllers.
        for (int i=0; i<brokerControllers.size(); i++) {
          bc = (BrokerController) brokerControllers.get(i);
        
          //modified by Crane 051229
          bc.handleGetPortfolioGesture(custId, custName, shares);
          //bc.handleGetPortfolioGesture(custId, custName, custShares);
        }
      }
    };
    
    transient ActionListener portGetHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // This method is called when the "Get Customer" button
        // is clicked by the user
        System.out.println("BrokerViewImpl: portGetHandler");
        BrokerController bc;
        String custId;
        custId = gui.getCustIdOnPortPan();
        //modified by ourteam 051228
        //begin
        String custName;
        custName = gui.getCustNameOnPortPan();
        
        ArrayList custShares;
        custShares = gui.getCustSharesOnPortPan();
        Share[] shares=null;
        if(custShares!=null){
        	shares=new Share[custShares.size()];
	        for(int i=0;i<custShares.size();i++){
	        	shares[i]=(Share)custShares.get(i);
	        }
	     }
        
        for (int i=0; i<brokerControllers.size(); i++) {
          bc = (BrokerController) brokerControllers.get(i);
        
          bc.handleGetPortfolioGesture(custId,custName,shares);
          
        }
      }
    };

  
  transient ActionListener portAddHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // This method is called when the "Add Customer" button
        // is clicked by the user
        System.out.println("BrokerViewImpl: portAddHandler");
        BrokerController bc;
        Portfolio port;
        //** 1 Assign to cust a customer object that represents
        //**   the customer information on the gui. To get this 
        //**   object use the getCustomerOnCustPan() method of gui
        port = gui.getPortfolioOnPortPan();
        //port.getShares(0).
       
        //** 2 Create a for loop: 
        //**   Hint: See actionPerformed method of the
        //**         custGetHandler object.
        //**   Invoke the handleAddCustomerGesture method on 
        //**   every object in the ArrayList brokerControllers.
        for (int i=0; i<brokerControllers.size(); i++) {
          bc = (BrokerController) brokerControllers.get(i);
          bc.handleAddPortfolioGesture(port);
        }
      }
    };

  
  transient  ActionListener portDeleteHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // This method is called when the "Delete Customer"
        //  button is clicked by the user
        System.out.println("BrokerViewImpl: portDeleteHandler");
        BrokerController bc;
        Portfolio port;
        //** 1 Assign to cust a customer object that represents
        //**   the customer information on the gui. To get this 
        //**   object Use the getCustomerOnCustPan() method of gui.
        port = gui.getPortfolioOnPortPan();
        //** 2 Create a for loop: 
        //**   Hint: See actionPerformed method of the
        //**         custGetHandler object.
        //**   Invoke the handleDeleteCustomerGesture method on 
        //**   every object in the ArrayList brokerControllers.
        for (int i=0; i<brokerControllers.size(); i++) {
          bc = (BrokerController) brokerControllers.get(i);
          bc.handleDeletePortfolioGesture(port);
        }
      }
    };

   //end
  // Following is an anonymous inner class declaration
  // The attribute allCustsPageHandler is registered as the action
  // event listener with the "All Customers" button of the 
  // gui, by the constructor of this class.
  transient ActionListener allCustsPageHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // This method is called when the "All Customers" 
        // button is clicked by the user
        System.out.println("BrokerViewImpl: "
          + "allCustsPageHandler");
        //showCard("allcustomers");
        BrokerController bc;
        //** 1 Create a for loop: 
        //**   Hint: See actionPerformed method of the
        //**         custGetHandler object.
        //**   Invoke the handleGetAllCustomersGesture method on 
        //**   every object in the ArrayList brokerControllers.
        for (int i=0; i<brokerControllers.size(); i++) {
          bc = (BrokerController) brokerControllers.get(i);
          bc.handleGetAllCustomersGesture();
        }
      }
    };

//modified  by  ourteam 051228
//begin
    transient ActionListener allStocksPageHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        
        System.out.println("BrokerViewImpl: "
          + "allStocksPageHandler");
        //showCard("allcustomers");
        BrokerController bc;
        
        for (int i=0; i<brokerControllers.size(); i++) {
          bc = (BrokerController) brokerControllers.get(i);
          bc.handleGetAllStocksGesture();
        }
      }
    };
    //end
  // No action required for this method
  // This method supports the showing of the portfolio page.
  // The portfolio page is a final iteration action item.
  /*transient ActionListener portfolioPageHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.out.println("BrokerViewImpl: portfolioPageHandler");
      }
    };*/
  
  //modified by ourteam 051228
  //begin  
  transient ActionListener stockGetHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // This method is called when the "Get Customer" button
        // is clicked by the user
        System.out.println("BrokerViewImpl: stockGetHandler");
        BrokerController bc;
        String symbol;
        symbol = gui.getStockSymbolOnCustPan();
        String price;
        price = gui.getStockPriceOnCustPan();
        //end
        //  Assign custId with the value of the customer id on
        //  the gui. Use the getCustIdOnCustPan() method of gui
        // Create a for loop: 
        // For every object in the ArrayList brokerControllers:
        // -Use get method to get the object and assign to bc.
        // -Invoke the handleGetCustomerGesture method on bc.
        for (int i=0; i<brokerControllers.size(); i++) {
          bc = (BrokerController) brokerControllers.get(i);
        //modified by ourteam 051228
        //begin
        //  bc.handleGetCustomerGesture(custId);
          bc.handleGetStockGesture(symbol,price);
          
        }
      }
    };

  // No action required for this method
  // This method supports the showing of the stock page.
  // The stock page is a final iteration action item.
 transient ActionListener stockPageHandler =
    new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.out.println("BrokerViewImpl: stockPageHandler");
        //modified by ourteam 051228
        //begin
        String stockSymbol, stockPrice;
        stockSymbol = gui.getSymbolOnStockPan();
        stockPrice = gui.getPriceOnStockPan();
        //end
        //modified by ourteam 051228
        //begin
        BrokerController bc;
        for (int i=0; i<brokerControllers.size(); i++) {
          bc = (BrokerController) brokerControllers.get(i);
          bc.handleGetStockGesture(stockSymbol, stockPrice);
        }
        //end
      }
    };

  transient ActionListener custPanelListeners[] = {custGetHandler,
    custAddHandler, custDeleteHandler, custUpdateHandler};
  //modified  by  ourteam 051228
  //begin
  transient ActionListener portPanelListeners[] = {portGetHandler,
    portAddHandler, portDeleteHandler};
   //end
   transient ActionListener stockPanelListeners[] = {stockGetHandler,
    allStocksPageHandler};
    
  transient ActionListener selectionPanelListeners[] = {
    custDetailsPageHandler, allCustsPageHandler, portPageHandler,
    stockPageHandler};

  public static void main(String args[]){
    try {
      BrokerModel model = new trader.db.BrokerModelDbImpl("localhost");
      BrokerViewImpl view = new BrokerViewImpl(model);
    } catch (Exception e) {
      System.out.println(e.toString());
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -