|
|
@ -64,7 +64,6 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> |
|
|
|
private ItemListener itemListener; |
|
|
|
private ItemListener itemListener; |
|
|
|
private UIObserverListener uiObserverListener; |
|
|
|
private UIObserverListener uiObserverListener; |
|
|
|
private FormulaEditor localFormulaEditor = new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Formula")); |
|
|
|
private FormulaEditor localFormulaEditor = new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Formula")); |
|
|
|
private boolean needTableDataChange = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public TableDataDictPane() { |
|
|
|
public TableDataDictPane() { |
|
|
|
initBasicComponets(); |
|
|
|
initBasicComponets(); |
|
|
@ -72,14 +71,6 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> |
|
|
|
iniListener(); |
|
|
|
iniListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 设置为true后,一旦触发TableDataComboBox的itemChange,就会通过数据连接,更换当前数据字典的列名List |
|
|
|
|
|
|
|
* @param needTableDataChange |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setNeedTableDataChange(boolean needTableDataChange) { |
|
|
|
|
|
|
|
this.needTableDataChange = needTableDataChange; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
public static void main(String[] args) { |
|
|
|
JFrame jf = new JFrame("test"); |
|
|
|
JFrame jf = new JFrame("test"); |
|
|
|
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
|
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
@ -169,30 +160,7 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> |
|
|
|
if (tableDataWrappe == null) { |
|
|
|
if (tableDataWrappe == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (itemListener != null) { |
|
|
|
List<String> namelist = tableDataWrappe.calculateColumnNameList(); |
|
|
|
itemListener.itemStateChanged(e); |
|
|
|
|
|
|
|
localFormulaEditor.addChangeListener(event -> itemListener.itemStateChanged(e)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isNeedTableDataChange()) { |
|
|
|
|
|
|
|
changeColumnsName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void changeColumnsName() { |
|
|
|
|
|
|
|
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
|
|
|
|
|
|
|
SwingWorker<List<String>, Object> worker = new SwingWorker<List<String>, Object>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected List<String> doInBackground() { |
|
|
|
|
|
|
|
if (tableDataWrappe == null) { |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return tableDataWrappe.calculateColumnNameList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void done() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
List<String> namelist = get(); |
|
|
|
|
|
|
|
String[] columnNames = null; |
|
|
|
String[] columnNames = null; |
|
|
|
if (!namelist.isEmpty()) { |
|
|
|
if (!namelist.isEmpty()) { |
|
|
|
columnNames = namelist.toArray(ArrayUtils.EMPTY_STRING_ARRAY); |
|
|
|
columnNames = namelist.toArray(ArrayUtils.EMPTY_STRING_ARRAY); |
|
|
@ -207,21 +175,24 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> |
|
|
|
actualColumnIndexEditor.addItemListener(itemListener); |
|
|
|
actualColumnIndexEditor.addItemListener(itemListener); |
|
|
|
keyColumnPane.setEditors(new Editor[]{actualColumnNameEditor, actualColumnIndexEditor}, columnNames[0]); |
|
|
|
keyColumnPane.setEditors(new Editor[]{actualColumnNameEditor, actualColumnIndexEditor}, columnNames[0]); |
|
|
|
|
|
|
|
|
|
|
|
localFormulaEditor.setEnabled(true); |
|
|
|
FormulaEditor formulaEditor = new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Formula")); |
|
|
|
|
|
|
|
formulaEditor.setEnabled(true); |
|
|
|
|
|
|
|
formulaEditor.addChangeListener(ee -> { |
|
|
|
|
|
|
|
if (itemListener != null) { |
|
|
|
|
|
|
|
itemListener.itemStateChanged(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
// 显示值列名
|
|
|
|
// 显示值列名
|
|
|
|
ColumnNameEditor displayColumnNameEditor = new ColumnNameEditor(columnNames); |
|
|
|
ColumnNameEditor displayColumnNameEditor = new ColumnNameEditor(columnNames); |
|
|
|
displayColumnNameEditor.addItemListener(itemListener); |
|
|
|
displayColumnNameEditor.addItemListener(itemListener); |
|
|
|
// 显示值列序号
|
|
|
|
// 显示值列序号
|
|
|
|
ColumnIndexEditor displayColumnIndexEditor = new ColumnIndexEditor(columnNames.length); |
|
|
|
ColumnIndexEditor displayColumnIndexEditor = new ColumnIndexEditor(columnNames.length); |
|
|
|
displayColumnIndexEditor.addItemListener(itemListener); |
|
|
|
displayColumnIndexEditor.addItemListener(itemListener); |
|
|
|
valueDictPane.setEditors(new Editor[]{displayColumnNameEditor, displayColumnIndexEditor, localFormulaEditor}, columnNames[0]); |
|
|
|
valueDictPane.setEditors(new Editor[]{displayColumnNameEditor, displayColumnIndexEditor, formulaEditor}, columnNames[0]); |
|
|
|
} catch (InterruptedException | ExecutionException e) { |
|
|
|
if (itemListener != null) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
itemListener.itemStateChanged(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
worker.execute(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
/** |
|
|
|
/** |
|
|
@ -404,8 +375,4 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> |
|
|
|
public void registerDSChangeListener() { |
|
|
|
public void registerDSChangeListener() { |
|
|
|
tableDataNameComboBox.registerGlobalDSChangeListener(); |
|
|
|
tableDataNameComboBox.registerGlobalDSChangeListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isNeedTableDataChange() { |
|
|
|
|
|
|
|
return needTableDataChange; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|