no message
This commit is contained in:
@@ -277,9 +277,6 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean hasCurrent() {
|
||||
return MainModule_.instance.get(CurrentName()) != null;
|
||||
}
|
||||
public void dropCurrent() {
|
||||
MainModule_.instance.set(CurrentName(), null);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package Common.Visual;
|
||||
import Common.Current_;
|
||||
|
||||
import java.awt.*;
|
||||
public class ControlWithCurrentForm<C extends Component> extends ControlForm<C> {
|
||||
public ControlWithCurrentForm(Class<C> class_in) {
|
||||
super(class_in);
|
||||
}
|
||||
//-
|
||||
public Current_ CurrentName() {
|
||||
return null;
|
||||
}
|
||||
public void ShowCurrentObject() throws Exception {
|
||||
}
|
||||
public void ShowNoCurrentObject() throws Exception {
|
||||
}
|
||||
public void MouseAction2() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
public class DataSetControlForm extends ControlForm<DataTable> {
|
||||
protected JPanel dataPanel;
|
||||
protected DataSet dataSource;
|
||||
protected int current_row_i;
|
||||
@@ -57,18 +57,11 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
super.Clear();
|
||||
UI.Clear(dataPanel);
|
||||
}
|
||||
public DataSet getDataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
@Override
|
||||
public Current_ CurrentName() {
|
||||
return getDataSource().CurrentName();
|
||||
}
|
||||
public void SaveColumns() {
|
||||
if (MainModule_.instance.getDb() != null) {
|
||||
try {
|
||||
if ((CurrentName() != null)) {
|
||||
String tableName = CurrentName().toString();
|
||||
if (dataSource.CurrentName() != null) {
|
||||
String tableName = dataSource.CurrentName().toString();
|
||||
Vector<String> widths = IntStream.range(0, columns.size()).mapToObj(i -> String.valueOf(control.getColumnModel().getColumn(i).getWidth())).collect(Collectors.toCollection(Vector::new));
|
||||
String packed = String.join("|", widths);
|
||||
TableVisualData tableVisualData;
|
||||
@@ -94,13 +87,13 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
}
|
||||
protected void CreateColumnsInfo() {
|
||||
columns.clear();
|
||||
columns.add(new ColumnInfo(getDataSource().getPKName()));
|
||||
columns.add(new ColumnInfo(dataSource.getPKName()));
|
||||
if (hasCheckBox()) {
|
||||
columns.add(new ColumnInfo("", DBObjectSelectionRenderer.class, DBObjectSelector.class));
|
||||
columns.get(1).setMinWidth(25);
|
||||
columns.get(1).setMaxWidth(25);
|
||||
}
|
||||
Arrays.stream(getDataSource().getUIColumnNames()).forEach(name -> columns.add(new ColumnInfo(name)));
|
||||
Arrays.stream(dataSource.getUIColumnNames()).forEach(name -> columns.add(new ColumnInfo(name)));
|
||||
AdditionalInitColumns();
|
||||
}
|
||||
protected void AdditionalInitColumns() {
|
||||
@@ -117,10 +110,10 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
Object key = data.get(rowIndex);
|
||||
if (columnIndex == 0)
|
||||
return key;
|
||||
DBObject object = getDataSource().get((key));
|
||||
DBObject object = dataSource.get((key));
|
||||
if ((columnIndex == 1) && hasCheckBox())
|
||||
return object.isSelected();
|
||||
return getDataSource().getFieldAt(object, columnIndex);
|
||||
return dataSource.getFieldAt(object, columnIndex);
|
||||
}
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int col) {
|
||||
@@ -145,16 +138,16 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
//из таблицы можно пользоваться только getValueAt
|
||||
//иначе сортировка не будет работать.
|
||||
Object key = getValueAt(rowIndex, 0);
|
||||
return getDataSource().get(key);
|
||||
return dataSource.get(key);
|
||||
}
|
||||
//-----------------------------NEW-------------------------------------
|
||||
@Override
|
||||
public void CorrectColumnsSizes() {
|
||||
if ((MainModule_.instance.getDb() != null)
|
||||
&& CurrentName() != null
|
||||
&& MainModule_.instance.getDb().tablesVisualData.containsKey(CurrentName().toString())) {
|
||||
&& dataSource.CurrentName() != null
|
||||
&& MainModule_.instance.getDb().tablesVisualData.containsKey(dataSource.CurrentName().toString())) {
|
||||
if (!getColumnsProfile().equalsIgnoreCase(colNamesAndSizes)) {
|
||||
TableVisualData grid = MainModule_.instance.getDb().tablesVisualData.get(CurrentName().toString());
|
||||
TableVisualData grid = MainModule_.instance.getDb().tablesVisualData.get(dataSource.CurrentName().toString());
|
||||
String[] data = grid.sizes.split("\\|");
|
||||
for (int i = 0; i < columns.size(); ++i) {
|
||||
if (i <= (data.length - 1)) {
|
||||
@@ -210,7 +203,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
//------------------------->>
|
||||
}
|
||||
};
|
||||
if (CurrentName() != null) {
|
||||
if (dataSource.CurrentName() != null) {
|
||||
current_row_i = CommonConstants.Nan;
|
||||
ListSelectionModel selModel = control.getSelectionModel();
|
||||
selModel.addListSelectionListener(e -> {
|
||||
@@ -218,7 +211,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
if ((row >= 0)) {
|
||||
if (row != current_row_i) {
|
||||
current_row_i = row;
|
||||
getDataSource().setCurrent(control.getRowObject(row));
|
||||
dataSource.setCurrent(control.getRowObject(row));
|
||||
if (events_on) {
|
||||
try {
|
||||
ShowCurrentObject();
|
||||
@@ -229,7 +222,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
}
|
||||
} else {
|
||||
current_row_i = CommonConstants.Nan;
|
||||
getDataSource().dropCurrent();
|
||||
dataSource.dropCurrent();
|
||||
if (events_on) {
|
||||
try {
|
||||
ShowNoCurrentObject();
|
||||
@@ -274,7 +267,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
);
|
||||
//----------------------------------------------------------------------------
|
||||
//при переотображении таблицы скидываем текущий объект!!
|
||||
getDataSource().dropCurrent();
|
||||
dataSource.dropCurrent();
|
||||
try {
|
||||
ShowNoCurrentObject();
|
||||
} catch (Exception e) {
|
||||
@@ -301,7 +294,6 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
public int getRowCount() {
|
||||
return control.getRowCount();
|
||||
}
|
||||
@Override
|
||||
public void ShowCurrentObject() throws Exception {
|
||||
if (dataSource instanceof DBTable) {
|
||||
DBTable table = (DBTable) dataSource;
|
||||
@@ -317,7 +309,6 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void ShowNoCurrentObject() throws Exception {
|
||||
if (dataSource instanceof DBTable) {
|
||||
DBTable table = (DBTable) dataSource;
|
||||
@@ -333,4 +324,5 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
}
|
||||
}
|
||||
}
|
||||
public void MouseAction2() throws Exception{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user