исправил старый баг. при синхронизации бд не восстанавливались поставленные галки а текущий объект был реализован странно

This commit is contained in:
2024-10-17 23:27:47 +03:00
parent 4c2d39cb92
commit 96df1c3a18
6 changed files with 42 additions and 40 deletions

View File

@@ -35,6 +35,10 @@ public class DataSetControlForm extends ControlForm<DataTable> {
public LinkedHashMap<Integer, HeaderTextFilter> headersTextFilters = new LinkedHashMap<>(); //текстовые фильтры столбцов
//фильтры и подсчеты. todo слить с баром (?)
MatchesCounter f_ui = null;
//--
Object savedCurrentKey = null;
Vector<Object> savedSelectedKeys = new Vector<>();
//--
public DataSetControlForm(DataSet dataSource_in, JPanel mountPanel_in) {
super(DataTable.class, mountPanel_in);
dataSource = dataSource_in;
@@ -316,9 +320,9 @@ public class DataSetControlForm extends ControlForm<DataTable> {
}
public void Show(Object pk) {
Show();
Select(pk);
SetCurrentByPK(pk);
}
public void Select(Object pk) {
public void SetCurrentByPK(Object pk) {
if (isShown())
control.SelectRowByPK(pk);
}
@@ -372,4 +376,23 @@ public class DataSetControlForm extends ControlForm<DataTable> {
public boolean hasMenuBar() {
return true;
}
//-
public void SaveLastCurrent() {
savedCurrentKey = null;
savedSelectedKeys.clear();
if ((dataSource.CurrentName() != null) && (dataSource.getCurrent() != null)) {
savedCurrentKey = dataSource.getCurrent().getPK();
}
savedSelectedKeys = dataSource.getSelectedKeys();
}
public void RestoreLastCurrent() {
for (Object key: savedSelectedKeys){
if (dataSource.containsKey(key))
dataSource.get(key).Select(true);
}
if ((savedCurrentKey!=null)&&(dataSource.containsKey(savedCurrentKey))){
SetCurrentByPK(savedCurrentKey);
}
}
}