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

📄 logfilterui.java

📁 这是一款应用程序与数据库联接
💻 JAVA
字号:
/* ===========================================================
 * JDBMonitor : a flexiable JDBC Monitor for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2006-2006, by yang zhongke
 *
 * Project Info:  http://www.cownew.com
 *
 * This library is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU Lesser General Public License as published by 
 * the Free Software Foundation; either version 2.1 of the License, or 
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
 * USA.  
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
 * in the United States and other countries.]
 *
 * ---------------
 * LogFilterUI.java
 * ---------------
 * (C) Copyright 2006-2006, by yang zhongke
 *
 * Original Author:  yang zhongke;
 *
 * Changes
 * -------
 *
 */
package com.cownew.JDBMonitor.listenerImpl.dataBaseListener;

import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.sql.Timestamp;
import java.util.Vector;

import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import com.cownew.JDBMonitor.common.SQLTypeEnum;
import com.cownew.JDBMonitor.listenerImpl.uicommon.JCownewDialog;
import com.cownew.JDBMonitor.listenerImpl.uicommon.JDateTimeField;

/**
 * the filter UI for DataBaseLogReportUI
 * @author yang zhongke
 */
public class LogFilterUI extends JCownewDialog
{
	private static final long serialVersionUID = 4516168586268902155L;
	
	protected JDateTimeField dtfBegin;
	protected JDateTimeField dtfEnd;
	
	
	protected JTextField txtSQL;
	
	protected JCheckBox cbTypeExecute;
	protected JCheckBox cbTypeExecuteQuery;
	protected JCheckBox cbTypeExecuteUpdate;
	protected JCheckBox cbTyperollback;
	protected JCheckBox cbTypeExecuteBatch;

	public LogFilterUI(Frame owner) throws HeadlessException
	{
		super(owner);
	}

	protected void initUI()
	{
		super.initUI();
		container.setLayout(new GridLayout(4,1));
		
		//BeginTime
		JPanel panelBeginTime = new JPanel();
		panelBeginTime.setLayout(new GridLayout(1,4));

		JLabel labelExeTimeFrom = new JLabel("BeginTime from:");
		panelBeginTime.add(labelExeTimeFrom);
		
		dtfBegin = new JDateTimeField();
		panelBeginTime.add(dtfBegin);
		
		JLabel labelExeTimeTo = new JLabel("to:");
		panelBeginTime.add(labelExeTimeTo);
		
		dtfEnd = new JDateTimeField();
		panelBeginTime.add(dtfEnd);
		
		container.add(panelBeginTime);
		
		//sql like
		JPanel panelSQL = new JPanel();
		panelSQL.setLayout(new GridLayout(1,2));
		JLabel labelSQL = new JLabel("SQL Like:");
		panelSQL.add(labelSQL);
		
		txtSQL = new JTextField();
		panelSQL.add(txtSQL);		
		container.add(panelSQL);	
		
		//sql type
		JPanel panelSQLType = new JPanel();
		panelSQLType.setLayout(new GridLayout(1,6));
		JLabel labelSQLType = new JLabel("SQL Type:");
		panelSQLType.add(labelSQLType);
		
		cbTypeExecute = new JCheckBox("Execute");
		panelSQLType.add(cbTypeExecute);
		
		cbTypeExecuteQuery = new JCheckBox("ExecuteQuery");
		panelSQLType.add(cbTypeExecuteQuery);
		
		cbTypeExecuteUpdate = new JCheckBox("ExecuteUpdate");
		panelSQLType.add(cbTypeExecuteUpdate);
		
		cbTyperollback = new JCheckBox("Rollback");
		panelSQLType.add(cbTyperollback);
		
		cbTypeExecuteBatch = new JCheckBox("ExecuteBatch");
		panelSQLType.add(cbTypeExecuteBatch);
		
		container.add(panelSQLType);
		
		//btn
		JPanel panelBtn = new JPanel();
		panelBtn.setLayout(new GridLayout(1,2));
		panelBtn.add(createOKBtn());
		panelBtn.add(createCancelBtn());		
		container.add(panelBtn);
				
	}

	
	public Timestamp getBeginTimeBegin()
	{
		return dtfBegin.getTimeStamp();
	}
	
	public Timestamp getBeginTimeEnd()
	{
		return dtfEnd.getTimeStamp();
	}
	
	
	public String getSQLLike()
	{
		return txtSQL.getText();
	}
	
	public Vector getSQLTypeList()
	{
		Vector vector = new Vector();
		if(cbTypeExecute.isSelected())
		{
			vector.add(SQLTypeEnum.execute);
		}
		if(cbTypeExecuteBatch.isSelected())
		{
			vector.add(SQLTypeEnum.executeBatch);
		}
		if(cbTypeExecuteQuery.isSelected())
		{
			vector.add(SQLTypeEnum.executeQuery);
		}
		if(cbTypeExecuteUpdate.isSelected())
		{
			vector.add(SQLTypeEnum.executeUpdate);
		}
		if(cbTyperollback.isSelected())
		{
			vector.add(SQLTypeEnum.rollback);
		}
		return vector;
	}

}

⌨️ 快捷键说明

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