no message
This commit is contained in:
@@ -3,15 +3,24 @@ import Common.UI.Menus_2023.StableMenuItem;
|
||||
import Common.Utils.Utils;
|
||||
|
||||
import javax.swing.*;
|
||||
public class TableFilter<D extends DBObject> {
|
||||
DataSet table;
|
||||
public JMenuItem menuItem; //пункт меню фильтра. ( возможно потом сделать и кнопку)
|
||||
//одиночный фильтр, пункт фильтрационного меню.
|
||||
public abstract class DBObjectFilter<D extends DBObject> {
|
||||
String description;
|
||||
public boolean active = true; //включен ли фильтр
|
||||
public int count = 0;
|
||||
protected boolean validate(D object) {
|
||||
return true;
|
||||
boolean active = true; //включен ли фильтр
|
||||
int count = 0;
|
||||
//--
|
||||
public JMenuItem menuItem; //пункт меню фильтра. ( возможно потом сделать и кнопку)
|
||||
//--
|
||||
static String getNotActiveIconPath() {
|
||||
return "/icons/NotPick.png";
|
||||
}
|
||||
static String getActiveIconPath() {
|
||||
return "/icons/Pick.png";
|
||||
}
|
||||
void Mark() {
|
||||
menuItem.setIcon(Utils.getIcon(active ? getActiveIconPath() : getNotActiveIconPath()));
|
||||
}
|
||||
//-------
|
||||
public boolean Validate(D object) {
|
||||
if (active) {
|
||||
boolean valid = validate(object);
|
||||
@@ -21,16 +30,12 @@ public class TableFilter<D extends DBObject> {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
static String getNotActiveIconPath() {
|
||||
return "/icons/NotPick.png";
|
||||
public void ResetCount() {
|
||||
count = 0;
|
||||
}
|
||||
static String getActiveIconPath() {
|
||||
return "/icons/Pick.png";
|
||||
}
|
||||
public TableFilter(DataSet table_in, String description_in, boolean active_in) {
|
||||
table = table_in;
|
||||
menuItem = new StableMenuItem((description = description_in)+" (0)");
|
||||
active=active_in;
|
||||
public DBObjectFilter(DataSet table, String description_in, boolean active_in) {
|
||||
menuItem = new StableMenuItem((description = description_in) + " (0)");
|
||||
active = active_in;
|
||||
menuItem.addActionListener(e -> {
|
||||
active = !active;
|
||||
Mark();
|
||||
@@ -38,13 +43,12 @@ public class TableFilter<D extends DBObject> {
|
||||
});
|
||||
Mark();
|
||||
}
|
||||
public TableFilter(DataSet table_in, String description_in){
|
||||
this(table_in,description_in,true);
|
||||
}
|
||||
public void Mark() {
|
||||
menuItem.setIcon(Utils.getIcon(active ? getActiveIconPath() : getNotActiveIconPath()));
|
||||
public DBObjectFilter(DataSet table_in, String description_in) {
|
||||
this(table_in, description_in, true);
|
||||
}
|
||||
public void ShowDescriptionAndCount() {
|
||||
menuItem.setText(description + " " + Utils.RBrackets(count));
|
||||
}
|
||||
//--
|
||||
protected abstract boolean validate(D object);
|
||||
}
|
||||
10
src/Common/Database/DataSetFilter.java
Normal file
10
src/Common/Database/DataSetFilter.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package Common.Database;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
|
||||
import java.util.Vector;
|
||||
public class DataSetFilter {
|
||||
public Vector<DBObjectFilter<Group>> filters;
|
||||
public DataSetFilter(String name){
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user