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

📄 clothesinandoutcountdialog.java

📁 一个优秀的干洗店管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package view.dialog.countmanage;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.table.DefaultTableModel;
import javax.swing.tree.DefaultMutableTreeNode;

import view.common.CenterWindow;
import view.common.DataPicker;
import view.common.GBC;
import view.control.viewaction.ClothesInAndOutCountDialogTreeAction;

import common.LogWriter;

import control.clothesinandout.ClothesInAndOutAction;

public class ClothesInAndOutCountDialog extends JDialog {
	// 日期输入框的标签
	private JLabel dateLabel, toLabel;
	// 构造日历控件
	protected DataPicker picker = new DataPicker();
	// 用于选择日期的JComboBox
	protected JComboBox fromDateBox, toDateBox;
	// 收取衣物统计
	private JScrollPane collectionTableScrollPane;

	private JScrollPane itemTableScrollPane;

	private JLabel label;

	private JTable collectionTable, itemTable;

	private JPanel clothesInListPanel, labelPanel;

	private JPanel clothesInCountPanel;

	// 收取衣物数量金额统计列表
	private JScrollPane countTableScrollPane;

	private JTable countTable;

	// 索赔衣物列表
	private JTable damagedCollectionTable, itemDamagedTable;

	private JPanel clothesDamagedRecorderPanel;

	// 反回重洗列表
	private JPanel clothesReturnedRecorderPanel;

	private JTable returnedCollectionTable, returnedItemTable;

	// 过期未领列表
	private JPanel clotheOvertimePanel;

	private JTable overTimeCollectionTable, overTimeItemTable;

	private JTree tree;

	private JPanel countPanel;

	public JPanel infoPanel;

	public CardLayout cl = new CardLayout();

	public CardLayout getCardLayout() {
		return cl;
	}

	// 分割面板
	private JSplitPane splitPane;
	private LogWriter log;

	public ClothesInAndOutCountDialog(JFrame frame, LogWriter log) {
		super(frame, "收衣取衣统计管理", true);
		this.log = log;
		log.log("进入类ClothesInAndOutCountDialog的构造方法", LogWriter.INFO);
		initialPanel();
	}

	private void initialPanel() {
		this.setSize(800, 600);
		CenterWindow.centerWindow(this);
		this.setLayout(new BorderLayout());
		this.add(buildCountPanel(), BorderLayout.NORTH);
		this.add(buildSplitPane());

	}

	private JPanel buildCountPanel() {
		if (countPanel == null) {
			countPanel = new JPanel();
			countPanel.setLayout(new FlowLayout());
			initComponent();
			countPanel.add(dateLabel);
			countPanel.add(this.buildFromDateBox());
			countPanel.add(toLabel);
			countPanel.add(this.buildToDateBox());
			countPanel.add(buildButton("统计"));
			countPanel.add(buildButton("打印"));
			countPanel.add(buildButton("退出"));
		}
		return countPanel;
	}

	public JSplitPane buildSplitPane() {
		if (splitPane == null) {
			splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
			splitPane.setOneTouchExpandable(true);
			splitPane.setLeftComponent(new JScrollPane(buildClothesTree()));
			splitPane.setRightComponent(buildInfoPanel());
		}
		return splitPane;
	}

	public JPanel buildInfoPanel() {
		if (infoPanel == null) {
			infoPanel = new JPanel();
			infoPanel.setLayout(cl);
			infoPanel.add(buildClothesInListPanel(), "1");
			infoPanel.add(buildClothesInCountPanel(), "2");
			infoPanel.add(buildClothesDamagedRecorderPanel(), "3");
			infoPanel.add(buildClothesReturnedRecorderPanel(), "4");
			infoPanel.add(buildClotheOvertimePanel(), "5");
		}
		return infoPanel;
	}

	public JTree buildClothesTree() {
		if (tree == null) {
			DefaultMutableTreeNode root = new DefaultMutableTreeNode("收衣取衣统计管理");
			DefaultMutableTreeNode clothesInRecorder = new DefaultMutableTreeNode(
					"收衣取衣记录");
			DefaultMutableTreeNode clothesInCount = new DefaultMutableTreeNode(
					"收衣数量金额统计");
			DefaultMutableTreeNode clothesDamagedRecorder = new DefaultMutableTreeNode(
					"索赔衣物记录");
			DefaultMutableTreeNode clothesReturnedRecorder = new DefaultMutableTreeNode(
					"返回重洗记录");
			DefaultMutableTreeNode clothesOvertime = new DefaultMutableTreeNode(
					"过期未取走衣物");
			root.add(clothesInRecorder);
			root.add(clothesInCount);
			root.add(clothesDamagedRecorder);
			root.add(clothesReturnedRecorder);
			root.add(clothesOvertime);
			tree = new JTree(root);
		}
		tree.setRootVisible(false);
		ClothesInAndOutCountDialogTreeAction action = new ClothesInAndOutCountDialogTreeAction();
		action.setDialog(this);
		tree.addTreeSelectionListener(action);
		return tree;
	}

	public JTree getJTree() {
		return tree;
	}

	private JPanel buildClothesInListPanel() {
		if (clothesInListPanel == null) {
			clothesInListPanel = new JPanel();
			clothesInListPanel.setBorder(BorderFactory
					.createTitledBorder("收取衣物记录列表"));
			clothesInListPanel.setLayout(new GridBagLayout());
			clothesInListPanel.add(buildCollectionTableScrollPane(), new GBC(0,
					0, 1, 6).setFill(GBC.BOTH).setWeight(100, 100));
			clothesInListPanel.add(buildLabelPanel(), new GBC(0, 6, 1, 1)
					.setFill(GBC.BOTH).setWeight(10, 10));
			clothesInListPanel.add(buildItemTableScrollPane(), new GBC(0, 7, 1,
					4).setFill(GBC.BOTH).setWeight(100, 100));
		}
		return clothesInListPanel;
	}

	private JScrollPane buildItemTableScrollPane() {
		if (itemTableScrollPane == null) {
			itemTableScrollPane = new JScrollPane(buildItemTable());
		}
		return itemTableScrollPane;
	}

	private JScrollPane buildCollectionTableScrollPane() {
		if (collectionTableScrollPane == null) {
			collectionTableScrollPane = new JScrollPane(buildCollectionTable());
		}
		return collectionTableScrollPane;
	}

	private JPanel buildLabelPanel() {
		labelPanel = new JPanel();
		labelPanel.add(buildLabel());
		return labelPanel;
	}

	public JLabel buildLabel() {
		label = new JLabel("相关交易单详细信息");
		return label;
	}

	public JTable buildItemTable() {
		if (itemTable == null) {
			String[] head = { "衣服名称", "数量", "服务类型", "折后价", "总金额", "扣折", "衣服附件",
					"颜色", "备注" };
			Object[][] data = {};
			DefaultTableModel model = new DefaultTableModel(data, head) {
				public boolean isCellEditable(int rowIndex, int columnIndex) {
					return false;
				}
			};
			itemTable = new JTable(model);
			itemTable.getTableHeader().setReorderingAllowed(false);
		}
		itemTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		return itemTable;
	}

	public JTable buildCollectionTable() {
		if (collectionTable == null) {
			String[] names = { "交易单号", "添加日期", "取衣日期", "应收金额", "实收金额", "会员编号",

⌨️ 快捷键说明

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