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

📄 normaltakeclothespanel.java

📁 一个优秀的干洗店管理系统
💻 JAVA
字号:
package view.panel.takeClothes;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.util.Iterator;
import java.util.Vector;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

import vo.OrderItemVo;
import vo.OrderVo;
import vo.VipVo;
import control.takeClothes.NormalTakeClothesListener;

public class NormalTakeClothesPanel extends JPanel{
	private JLabel headerLabel,vipCardIdLabel,vipNameLabel,vipCardRestMnyLabel,takeClthDateLabel,neededMoneyLb,ifPaidLabel;
	private JScrollPane buyingClothesTableScrollPane;
	private JTable buyingClothesTable;
	private String[] tableHeaders = { "衣服名称", "服务类型", "品牌", "衣服附件", "衣服瑕疵", "颜色",
			"折后价", "数量", "总额" ,"衣服备注"};
	private JButton okBtn,cancelBtn;
	private OrderVo orderVo;
	private VipVo vipVo;
	
	public NormalTakeClothesPanel(){
		this.setLayout(new BorderLayout());
		
		JPanel panel = new JPanel();
		panel.setLayout(new GridLayout(2,1));
		panel.add(buildVipInfoPanel());
		panel.add(buildBuyingClothesTableScrollPane());
		
		this.add(panel);
		this.add(buildBtnPanel(),BorderLayout.SOUTH);
	}
	
	public JPanel buildVipInfoPanel(){
		JPanel panel = new JPanel();
		panel.setLayout(new BorderLayout());
		panel.add(buildHeaderPanel(),BorderLayout.NORTH);
		panel.add(buildDetailPanel());
		return panel;
	}
	
	public JPanel buildHeaderPanel(){
		JPanel panel = new JPanel();
		panel.add(buildHeaderLb());
		return panel;
	}
	
	public JLabel buildHeaderLb(){
		if(headerLabel == null){
			headerLabel = new JLabel("取衣单号");
			headerLabel.setFont(new Font("", Font.BOLD, 20));
		}
		return headerLabel;
	}
	
	public JPanel buildDetailPanel(){
		JPanel panel = new JPanel();
		panel.setLayout(new GridLayout(2,6));
		panel.add(buildLabel("会员卡号:"));
		panel.add(buildVipCardIdLabel());
		panel.add(buildLabel("会员姓名:"));
		panel.add(buildVipNameLabel());
		panel.add(buildLabel("卡内余额:"));
		panel.add(buildVipCardRestMnyLabel());
		panel.add(buildLabel("预取日期:"));
		panel.add(buildTakeClthDateLabel());
		panel.add(buildLabel("应收金额:"));
		panel.add(buildNeededMoneyLb());
		panel.add(buildLabel("是否付费:"));
		panel.add(buildIfPaidLabel());
		return panel;
	}
	
	
	public JLabel buildLabel(String content){
		return new JLabel(content);
	}
	
	public JLabel buildVipCardIdLabel(){
		if(vipCardIdLabel == null){
			vipCardIdLabel = new JLabel();
		}
		return vipCardIdLabel;
	}
	
	public JLabel buildVipNameLabel(){
		if(vipNameLabel == null){
			vipNameLabel = new JLabel();
		}
		return vipNameLabel;
	}
	
	public JLabel buildTakeClthDateLabel(){
		if(takeClthDateLabel == null){
			takeClthDateLabel = new JLabel();
		}
		return takeClthDateLabel;
	}
	
	public JLabel buildVipCardRestMnyLabel(){
		if(vipCardRestMnyLabel == null){
			vipCardRestMnyLabel = new JLabel();
		}
		return vipCardRestMnyLabel;
	}
	
	public JLabel buildNeededMoneyLb(){
		if(neededMoneyLb == null){
			neededMoneyLb = new JLabel();
		}
		return neededMoneyLb;
	}
	
	public JLabel buildIfPaidLabel(){
		if(ifPaidLabel == null){
			ifPaidLabel = new JLabel();
		}
		return ifPaidLabel;
	}
	
	
	public JScrollPane buildBuyingClothesTableScrollPane(){
		if(buyingClothesTableScrollPane == null){
			buyingClothesTableScrollPane = new JScrollPane(buildBuyingClothesTable());
		}
		return buyingClothesTableScrollPane;
	}
	
	public JTable buildBuyingClothesTable() {
		if (buyingClothesTable == null) {
			Object[][] data = {};
			DefaultTableModel tableModel = new DefaultTableModel(data, tableHeaders) {
				public boolean isCellEditable(int rowIndex, int columnIndex) {
					return false;
				}
			};
			buyingClothesTable = new JTable(tableModel);
		}
		return buyingClothesTable;
	}
	
	  public JPanel buildBtnPanel() {
			JPanel panel = new JPanel();
			panel.setLayout(new FlowLayout());
			panel.add(buildOkBtn());
			panel.add(buildCancelBtn());
			return panel;
		}
	    
		public JButton buildOkBtn() {
			if (okBtn == null) {
				okBtn = new JButton("确定");
			}
			return okBtn;
		}

		public JButton buildCancelBtn() {
			if (cancelBtn == null) {
				cancelBtn = new JButton("取消");
			}
			return cancelBtn;
		}
		
		public void initiallize(OrderVo iniOrderVo,VipVo iniVipVo){
			this.orderVo = iniOrderVo;
			this.vipVo = iniVipVo;
			if(orderVo == null){
				return;
			}			
			if(vipVo != null){
				this.buildVipNameLabel().setText(vipVo.getVipName());
				this.buildVipCardRestMnyLabel().setText(
						new Double(vipVo.getVipCard().getRestMoney()).toString());
			}
			this.buildHeaderLb().setText("洗衣单号" + new Long(orderVo.getOrderId()).toString());
			this.buildVipCardIdLabel().setText(
					new Integer(orderVo.getCustomerId()).toString());
			if(vipVo == null){
				this.buildVipNameLabel().setText("无卡客户");
			}
			this.buildTakeClthDateLabel().setText(orderVo.getTakeClothesDate());
			this.buildNeededMoneyLb().setText(
					new Double(orderVo.getOrderValue()).toString());
			this.buildIfPaidLabel().setText(orderVo.isPaidOrNot()?"是":"否");
			
			Vector itemVector = null;
			itemVector = orderVo.getOrderItemVector();
			if(itemVector == null){
				return;
			}	
			DefaultTableModel itemModel = (DefaultTableModel)this.buildBuyingClothesTable().getModel();
			Iterator itItem =  itemVector.iterator();
			while(itItem.hasNext()){
				OrderItemVo item = (OrderItemVo)itItem.next();
				Object[] rowContent = {item.getClothesType().getClothesName(),
						item.getClothesType().getServiceType(),
						item.getClothesBrand(),item.getAccessory(),
						item.getFlaw(),item.getColor(),
						new Double(item.getItemValue()/item.getClothesQuatity()).toString(),
						new Integer(item.getClothesQuatity()).toString(),
						new Double(item.getItemValue()).toString(),
						item.getClothesAdditionInfo()};
				itemModel.addRow(rowContent);
			}
		}
		
		public OrderVo getOrderVo(){
			return this.orderVo;
		}
		public VipVo getVipVo(){
			return this.vipVo;
		}
}

⌨️ 快捷键说明

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