📄 brokerviewimpl.java
字号:
// -Invoke the handleGetCustomerGesture method on bc.
for (int i=0; i<brokerControllers.size(); i++) {
bc = (BrokerController) brokerControllers.get(i);
bc.handleGetCustomerGesture(custId);
}
}
};
// Following is an anonymous inner class declaration
// The attribute custAddHandler is registered as the action
// event listener with the "Add Customer" button of the gui,
// by the constructor of this class.
transient ActionListener custAddHandler =
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: custAddHandler");
BrokerController bc;
Customer cust;
//** 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
cust = gui.getCustomerOnCustPan();
//** 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.handleAddCustomerGesture(cust);
}
}
};
// Following is an anonymous inner class declaration
// The attribute custDeleteHandler is registered as the action
// event listener with the "Delete Customer" button of the
// gui, by the constructor of this class.
transient ActionListener custDeleteHandler =
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: custDeleteHandler");
BrokerController bc;
Customer cust;
//** 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.
cust = gui.getCustomerOnCustPan();
//** 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.handleDeleteCustomerGesture(cust);
}
}
};
// Following is an anonymous inner class declaration
// The attribute custUpdateHandler is registered as the action
// event listener with the "Update Customer" button of the
// gui, by the constructor of this class.
transient ActionListener custUpdateHandler =
new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("BrokerViewImpl: custUpdateHandler");
BrokerController bc;
Customer cust;
//** 1 Assign to cust a customer object that represents
//** the customer information on the gui. To get this
//** object Use the getCustOnCustPan() method of gui.
cust = gui.getCustomerOnCustPan();
//** 2 Create a for loop:
//** Hint: See actionPerformed method of the
//** custGetHandler object.
//** Invoke the handleUpdateCustomerGesture method on
//** every object in the ArrayList brokerControllers.
for (int i=0; i<brokerControllers.size(); i++) {
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;
//** 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);
bc.handleGetCustomerGesture(custId);
}
}
};
// 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();
}
}
};
// 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");
}
};
// 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");
}
};
transient ActionListener custPanelListeners[] = {custGetHandler,
custAddHandler, custDeleteHandler, custUpdateHandler};
transient ActionListener selectionPanelListeners[] = {
custDetailsPageHandler, allCustsPageHandler, portfolioPageHandler,
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 + -