рефакторинг фильтров. обобщил их от интерфейса
This commit is contained in:
@@ -3,18 +3,17 @@ import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.DBbjectFilter_;
|
||||
import Common.Visual.TextField.StyledTextField;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.MatteBorder;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.table.TableModel;
|
||||
import javax.swing.table.TableRowSorter;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
public class HeaderTextFilter {
|
||||
public class HeaderTextFilter<D extends DBObject> implements DBbjectFilter_<D> {
|
||||
DataSet dataSet = null; //таблица к интерфейсу которой относится фильтр.
|
||||
int columnIndex = CommonConstants.Nan; //номер столбца к которому привязан фильтр.
|
||||
JTextField textField = null;
|
||||
@@ -27,6 +26,12 @@ public class HeaderTextFilter {
|
||||
columnIndex = columnIndex_in;
|
||||
offset=offset_in;
|
||||
}
|
||||
@Override
|
||||
public boolean Validate(D object) {
|
||||
Object field = dataSet.getUI().getFieldAt(object, columnIndex);
|
||||
return (field instanceof String) && field.toString().contains(filterValue);
|
||||
}
|
||||
//---
|
||||
public void Mount(DataTable control) {
|
||||
popup = new JPopupMenu() {
|
||||
{
|
||||
@@ -105,8 +110,4 @@ public class HeaderTextFilter {
|
||||
public void setFilterValue(String filterValue_in) {
|
||||
this.filterValue = filterValue_in;
|
||||
}
|
||||
public boolean Validate(DBObject object) {
|
||||
Object field = dataSet.getUI().getFieldAt(object, columnIndex);
|
||||
return (field instanceof String) && field.toString().contains(filterValue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user