📄 cartevent.java
字号:
package apusic.myshop.control.event;import java.util.Collection;import java.util.HashMap;/** * This class represents a shopping cart event. * It allows updates on multiple items in the shopping cart. */public class CartEvent extends BaseEvent implements java.io.Serializable { public static final int ADD_ITEM = 0; public static final int DELETE_ITEM = 1; public static final int UPDATE_ITEM = 2; private int actionType; private Collection itemIds; private HashMap quantities; public CartEvent(int actionType, Collection itemIds) { this.actionType = actionType; this.itemIds = itemIds; } public CartEvent(int actionType, Collection itemIds, HashMap quantities) { this.actionType = actionType; this.itemIds = itemIds; this.quantities = quantities; } public Collection getItemIds() { return itemIds; } public int getActionType() { return actionType; } public int getItemQty(String itemId) { if (quantities != null) return ((Integer)quantities.get(itemId)).intValue(); else return -1; } public String toString() { return "CartEvent(" + actionType + ", " + itemIds + ")"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -