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

📄 talklist.java

📁 MSN客服自动化机器人
💻 JAVA
字号:
package jm.form.msn.form;import java.awt.BorderLayout;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.io.File;import java.util.Vector;import javax.imageio.ImageIO;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTable;import javax.swing.ListSelectionModel;import javax.swing.WindowConstants;import jm.entity.ESM000200;import jm.form.msn.config.JMMRConfigConstants;import jm.form.msn.util.Manager;import jm.framework.util.DBOutValue;import jm.framework.util.SimpleEntityTable;import jm.util.JMEntity;import jm.util.JMVector;/** * 维护对话信息 * 梦界家园MSNP15 * @author ISHome * @since 0.5.0.1 * @version 0.5.0.2.1 */public class TalkList extends javax.swing.JDialog implements JMMRConfigConstants {	private JPanel topPanel;	private JButton view;	private JButton delete;	private JButton search;	private JButton add;	private JTable tableList;	private JScrollPane bottomScrollPane;	private Vector rowData;	private Vector columnNames;	private Manager manager = null;	public TalkList(JFrame form, Manager server) {		super(form, true);		manager = server;		initGUI();	}	public TalkList(JDialog form, Manager server) {		super(form, true);		manager = server;		initGUI();	}	private void initGUI() {		try {			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);			getContentPane().setBackground(new java.awt.Color(255,255,255));			{				topPanel = new JPanel();				GridLayout jPanel1Layout = new GridLayout(1, 1);				jPanel1Layout.setColumns(1);				jPanel1Layout.setHgap(5);				jPanel1Layout.setVgap(5);				topPanel.setLayout(jPanel1Layout);				getContentPane().add(topPanel, BorderLayout.NORTH);				topPanel.setPreferredSize(new java.awt.Dimension(632, 30));				topPanel.setBackground(new java.awt.Color(255,255,255));				{					add = new JButton();					topPanel.add(add);					add.setText(manager.getConfigMap().get(LANG_TALKLIST_BUTTON_ADD_TEXT));					add.setToolTipText(manager.getConfigMap().get(LANG_TALKLIST_BUTTON_ADD_HELP));					add.setFont(BUTTON_FOUNT);					add.addActionListener(new ActionListener() {						public void actionPerformed(ActionEvent evt) {							add();						}					});				}				{					search = new JButton();					topPanel.add(search);					search.setText(manager.getConfigMap().get(LANG_TALKLIST_BUTTON_SEARCH_TEXT));					search.setToolTipText(manager.getConfigMap().get(LANG_TALKLIST_BUTTON_SEARCH_HELP));					search.setFont(BUTTON_FOUNT);					search.addActionListener(new ActionListener() {						public void actionPerformed(ActionEvent e) {							search();						}					});				}				{					delete = new JButton();					topPanel.add(delete);					delete.setText(manager.getConfigMap().get(LANG_TALKLIST_BUTTON_DELETE_TEXT));					delete.setToolTipText(manager.getConfigMap().get(LANG_TALKLIST_BUTTON_DELETE_HELP));					delete.setFont(BUTTON_FOUNT);					delete.addActionListener(new ActionListener() {						public void actionPerformed(ActionEvent e) {							delete();						}					});				}				{					view = new JButton();					topPanel.add(view);					view.setText(manager.getConfigMap().get(LANG_TALKLIST_BUTTON_VIEW_TEXT));					view.setToolTipText(manager.getConfigMap().get(LANG_TALKLIST_BUTTON_VIEW_HELP));					view.setFont(BUTTON_FOUNT);					view.addActionListener(new ActionListener() {						public void actionPerformed(ActionEvent e) {							view();						}					});				}			}			{				bottomScrollPane = new JScrollPane();				getContentPane().add(bottomScrollPane, BorderLayout.CENTER);				bottomScrollPane.setBackground(new java.awt.Color(255,255,255));				{					rowData = new Vector();					columnNames = new Vector();					ESM000200 talk = new ESM000200();					String[] names = talk.getNames().split(JMEntity.SPLIT);					for (int i = 0; i < names.length; i++) {						columnNames.add(names[i]);					}					tableList = new JTable(rowData, columnNames);					tableList.setFont(LABEL_FOUNT);					tableList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);					bottomScrollPane.setViewportView(tableList);				}			}			{				this.setTitle(manager.getConfigMap().get(LANG_TALKLIST_FORM_TITLE));				this.addWindowListener(new WindowAdapter() {					/**					 * 窗口正处在关闭过程中时调用。此时可重写关闭操作。					 * 					 * @param e					 */					public void windowClosing(WindowEvent e) {						dispose();// 关闭画面					}				});			}			// 配置系统图标			this.setIconImage(ImageIO.read(new File(manager.getConfigMap().get(STYLES_MAIN_FORM_TALK))));			this.pack();			this.setSize(640, 480);		} catch (Exception e) {			manager.showErrorMessageDialog(manager.getConfigMap().get(LANG_TALKLIST_FORM_FAILED));		}	}		/**	 * 追加	 */	private void add(){		this.setVisible(false);		TalkEdit form = new TalkEdit(manager.getMainForm(), manager);		manager.openFrame(form);		this.setVisible(true);	}		/**	 * 删除	 */	private void delete() {		try {			// 读取数据库全部TAG			ESM000200 talk = new ESM000200();			int selelt = tableList.getSelectedRow();			if (rowData.size() == 0) {				manager.showInfoMessageDialog(manager.getConfigMap().get(LANG_TALKLIST_FORM_NO_SEARCH_DATA));				return;			}			Vector item = (Vector) rowData.get(selelt);			talk.setNumID("" + item.get(0));			SimpleEntityTable _set = new SimpleEntityTable(talk, true);			DBOutValue _out = _set.delete();			if (!_out.getResult()) {				return;			}			rowData.remove(selelt);			tableList.updateUI();			manager.showInfoMessageDialog(manager.getConfigMap().get(LANG_TALKLIST_FORM_DELETE_OK));		} catch (Exception e) {			if (tableList.getSelectedRow() < 0) {				manager.showErrorMessageDialog(manager.getConfigMap().get(LANG_TALKLIST_FORM_NO_SELECT_FAILED));			} else {				manager.showErrorMessageDialog(manager.getConfigMap().get(LANG_TALKLIST_FORM_NO_DELETE_FAILED));			}		}	}	/**	 * 查看当前	 */	private void view() {		try {			ESM000200 talk = new ESM000200();			Vector item = (Vector) rowData.get(tableList.getSelectedRow());			talk.setNumID("" + item.get(0));			talk.setTag("" + item.get(1));			talk.setTalkValue("" + item.get(2));			TalkEdit form = new TalkEdit(manager.getMainForm(), manager);			form.reLoad(talk);			this.setVisible(false);			manager.openFrame(form);			this.setVisible(true);					} catch (Exception e) {			if (tableList.getSelectedRow() < 0) {				manager.showInfoMessageDialog(manager.getConfigMap().get(LANG_TALKLIST_FORM_NO_SELECT_FAILED));			} else {				manager.showErrorMessageDialog(manager.getConfigMap().get(LANG_TALKLIST_FORM_NO_VIEW_FAILED));			}		}	}	/**	 * 检索	 */	private void search() {		try {			rowData.clear();			tableList.updateUI();			// 读取数据库全部TAG			ESM000200 talk = new ESM000200();			SimpleEntityTable _set = new SimpleEntityTable(talk, true);			DBOutValue _out = _set.select();			if (!_out.getResult() || _out.getResultCount() == 0) {				return;			}			// 整理列表			JMVector faqs = _out.getResultList();			Vector item;			for (int i = 0; i < faqs.size(); i++) {				item = new Vector();				talk = (ESM000200) faqs.get(i);				item.add(talk.getNumID());				item.add(talk.getTag());				item.add(talk.getTalkValue());				rowData.add(item);			}			tableList.updateUI();		} catch (Exception e) {			manager.showErrorMessageDialog(manager.getConfigMap().get(LANG_TALKLIST_FORM_NO_SEARCH_FAILED));		}	}}

⌨️ 快捷键说明

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