продолжение рефакторинга. создал предка для класса current
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package Common.Database.Tables;
|
||||
import Common.CurrentAnchestor;
|
||||
import Common_old.Current;
|
||||
import Common.Visual.DataSetFilter;
|
||||
import Common_old.UI.DataSetControlForm;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.DataMenuBar;
|
||||
import Common_old.UI.Tables.ColumnFilter;
|
||||
import Common_old.UI.UI;
|
||||
@@ -90,7 +91,6 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
ui_.Select(pk);
|
||||
}
|
||||
}
|
||||
//столбы/ потом переименовать обратно в getUIColumnNames.сейчас так для скорости переноса.
|
||||
public String[] getUIColumnNames() {
|
||||
return new String[]{};
|
||||
}
|
||||
@@ -149,25 +149,6 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
public String getSingleDescription() {
|
||||
return "";
|
||||
}
|
||||
//времянки
|
||||
public Current CurrentName() {
|
||||
return Current.Undefined;
|
||||
}
|
||||
public boolean CheckCurrent(TextLog log) {
|
||||
return Current.Check(log, CurrentName());
|
||||
}
|
||||
public boolean hasCurrent() {
|
||||
return Current.get(CurrentName()) != null;
|
||||
}
|
||||
public void dropCurrent() {
|
||||
Current.set(CurrentName(), null);
|
||||
}
|
||||
public D getCurrent() {
|
||||
return (D) Current.get(CurrentName());
|
||||
}
|
||||
public void setCurrent(D o) {
|
||||
Current.set(CurrentName(), o);
|
||||
}
|
||||
//-
|
||||
public void put(Object key, D object) {
|
||||
Data.put((K) key, object);
|
||||
@@ -220,25 +201,6 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
return Data.values().stream().filter(DBObject::isSelected).map(d -> (K) d.getPK()).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
//--
|
||||
public void SaveLastSelections() {
|
||||
if (hasUI()) {
|
||||
Object lastPk = null;
|
||||
if ((CurrentName() != Current.Undefined) && (getCurrent() != null))
|
||||
lastPk = getCurrent().getPK();
|
||||
if (!selections.containsKey(getClass()))
|
||||
selections.put(getClass(), lastPk);
|
||||
else selections.replace(getClass(), lastPk);
|
||||
}
|
||||
}
|
||||
public void RestoreLastSelections() {
|
||||
if (hasUI()) {
|
||||
Object lastPk = selections.get(getClass());
|
||||
if ((CurrentName() != Current.Undefined) && (lastPk != null)) {
|
||||
ui_.Select(lastPk);
|
||||
}
|
||||
}
|
||||
}
|
||||
//---
|
||||
// применить значение фильтра к фильру объекта напирмер Message.filterValue = text;
|
||||
public void changeColumnFilterValue(int columnIndex, String text) {
|
||||
}
|
||||
@@ -279,13 +241,31 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
//------------------------------------------------------------------------------------
|
||||
public CurrentAnchestor CurrentName() {
|
||||
return null;
|
||||
}
|
||||
public boolean CheckCurrent(TextLog log) {
|
||||
return CurrentAnchestor.Check(log, CurrentName());
|
||||
}
|
||||
public boolean hasCurrent() {
|
||||
return CurrentAnchestor.get(CurrentName()) != null;
|
||||
}
|
||||
public void dropCurrent() {
|
||||
CurrentAnchestor.set(CurrentName(), null);
|
||||
}
|
||||
public D getCurrent() {
|
||||
return (D) CurrentAnchestor.get(CurrentName());
|
||||
}
|
||||
public void setCurrent(D o) {
|
||||
CurrentAnchestor.set(CurrentName(), o);
|
||||
}
|
||||
public Vector<D> getCheckedOrCurrent() {
|
||||
Vector<D> res = new Vector<>();
|
||||
if (getCheckedCount() > 0)
|
||||
res = getCheckedItems();
|
||||
else {
|
||||
if (!CurrentName().equals(Current.Undefined)) {
|
||||
if (CurrentName()!=null) {
|
||||
if (getCurrent() != null) {
|
||||
res.add(getCurrent());
|
||||
}
|
||||
@@ -293,4 +273,23 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public void SaveLastSelections() {
|
||||
if (hasUI()) {
|
||||
Object lastPk = null;
|
||||
if ((CurrentName() != null) && (getCurrent() != null))
|
||||
lastPk = getCurrent().getPK();
|
||||
if (!selections.containsKey(getClass()))
|
||||
selections.put(getClass(), lastPk);
|
||||
else selections.replace(getClass(), lastPk);
|
||||
}
|
||||
}
|
||||
public void RestoreLastSelections() {
|
||||
if (hasUI()) {
|
||||
Object lastPk = selections.get(getClass());
|
||||
if ((CurrentName() != null) && (lastPk != null)) {
|
||||
ui_.Select(lastPk);
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user