?? queryfilter.java
字號:
/* * This source code is part of TWaver 1.3.1 * * SERVA Software PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * Copyright 2000-2005 SERVA Software, Inc. All rights reserved. */package demo.table;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextField;
import twaver.table.TTable;
import twaver.table.TTableRowFilter;
public class QueryFilter extends JPanel implements TTableRowFilter, ActionListener{
private TTable table;
private JComboBox filedSelection;
private JTextField textField;
private String ALL = "<html><font color=red>-- select column --</font><html>";
public QueryFilter(TTable table){
this.table = table;
List list = new ArrayList();
list.add(ALL);
list.addAll(table.getTableModel().getRawColumn());
this.filedSelection = new JComboBox(list.toArray());
this.textField = new JTextField();
this.textField.setPreferredSize(new Dimension(50, textField.getPreferredSize().height));
this.textField.addActionListener(this);
this.textField.setToolTipText("please input key word for search");
this.filedSelection.addActionListener(this);
this.setLayout(new BorderLayout());
this.add(filedSelection, BorderLayout.WEST);
this.add(textField, BorderLayout.CENTER);
}
public boolean isVisible(TTable table, Vector rowData) {
Object item = this.filedSelection.getSelectedItem();
if(item == ALL){
return true;
}
String text = textField.getText();
if(text == null || text.trim().equals("")){
return true;
}
int index = table.getTableModel().getRawColumn().indexOf(item);
Object value = rowData.get(index);
if(value != null){
if(value.toString().toLowerCase().indexOf(text.toLowerCase()) >= 0){
return true;
}
}
return false;
}
public void actionPerformed(ActionEvent e) {
table.getTableModel().publishData();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -