|
|
@ -32,6 +32,7 @@ import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
@ -41,7 +42,9 @@ import javax.swing.event.ChangeListener; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemListener; |
|
|
|
import java.awt.event.ItemListener; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 数据字典的数据查询面板 |
|
|
|
* 数据字典的数据查询面板 |
|
|
@ -60,6 +63,8 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> |
|
|
|
private DoubleDeckValueEditorPane valueDictPane; |
|
|
|
private DoubleDeckValueEditorPane valueDictPane; |
|
|
|
private ItemListener itemListener; |
|
|
|
private ItemListener itemListener; |
|
|
|
private UIObserverListener uiObserverListener; |
|
|
|
private UIObserverListener uiObserverListener; |
|
|
|
|
|
|
|
private FormulaEditor formulaEditor1 = new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Formula")); |
|
|
|
|
|
|
|
private boolean needTableDataChange = false; |
|
|
|
|
|
|
|
|
|
|
|
public TableDataDictPane() { |
|
|
|
public TableDataDictPane() { |
|
|
|
initBasicComponets(); |
|
|
|
initBasicComponets(); |
|
|
@ -67,6 +72,10 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> |
|
|
|
iniListener(); |
|
|
|
iniListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
@ -83,7 +92,7 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> |
|
|
|
tableDataNameComboBox.addItemListener(new ItemListener() { |
|
|
|
tableDataNameComboBox.addItemListener(new ItemListener() { |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
if (e.getStateChange() == ItemEvent.SELECTED) { |
|
|
|
if (e.getStateChange() == ItemEvent.SELECTED) { |
|
|
|
tdChange(e); |
|
|
|
tdChange(e, needTableDataChange); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -153,44 +162,62 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> |
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dic_Data_Query"); |
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dic_Data_Query"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void tdChange(final ItemEvent e) { |
|
|
|
private void tdChange(final ItemEvent e, boolean needTableDataChange) { |
|
|
|
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
|
|
|
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
|
|
|
if (tableDataWrappe == null) { |
|
|
|
if (tableDataWrappe == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (itemListener != null) { |
|
|
|
List<String> namelist = tableDataWrappe.calculateColumnNameList(); |
|
|
|
itemListener.itemStateChanged(e); |
|
|
|
String[] columnNames = null; |
|
|
|
formulaEditor1.addChangeListener(event -> { |
|
|
|
if (!namelist.isEmpty()) { |
|
|
|
itemListener.itemStateChanged(e); |
|
|
|
columnNames = namelist.toArray(ArrayUtils.EMPTY_STRING_ARRAY); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} |
|
|
|
columnNames = new String[]{""}; |
|
|
|
if (needTableDataChange) { |
|
|
|
|
|
|
|
changeColumnsName(); |
|
|
|
} |
|
|
|
} |
|
|
|
ColumnNameEditor columnNameEditor1 = new ColumnNameEditor(columnNames); |
|
|
|
} |
|
|
|
columnNameEditor1.addItemListener(itemListener); |
|
|
|
|
|
|
|
ColumnIndexEditor columnIndexEditor1 = new ColumnIndexEditor(columnNames.length); |
|
|
|
|
|
|
|
columnIndexEditor1.addItemListener(itemListener); |
|
|
|
|
|
|
|
keyColumnPane.setEditors(new Editor[]{columnNameEditor1, columnIndexEditor1}, columnNames[0]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FormulaEditor formulaEditor = new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Formula")); |
|
|
|
private void changeColumnsName() { |
|
|
|
formulaEditor.setEnabled(true); |
|
|
|
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
|
|
|
formulaEditor.addChangeListener(new ChangeListener() { |
|
|
|
SwingWorker<List<String>, Object> worker = new SwingWorker<List<String>, Object>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected List<String> doInBackground() throws Exception { |
|
|
|
|
|
|
|
if (tableDataWrappe == null) { |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return tableDataWrappe.calculateColumnNameList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void stateChanged(ChangeEvent ee) { |
|
|
|
protected void done() { |
|
|
|
if (itemListener != null) { |
|
|
|
try { |
|
|
|
itemListener.itemStateChanged(e); |
|
|
|
List<String> namelist = get(); |
|
|
|
|
|
|
|
String[] columnNames = null; |
|
|
|
|
|
|
|
if (!namelist.isEmpty()) { |
|
|
|
|
|
|
|
columnNames = namelist.toArray(ArrayUtils.EMPTY_STRING_ARRAY); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
columnNames = new String[]{""}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ColumnNameEditor columnNameEditor1 = new ColumnNameEditor(columnNames); |
|
|
|
|
|
|
|
columnNameEditor1.addItemListener(itemListener); |
|
|
|
|
|
|
|
ColumnIndexEditor columnIndexEditor1 = new ColumnIndexEditor(columnNames.length); |
|
|
|
|
|
|
|
columnIndexEditor1.addItemListener(itemListener); |
|
|
|
|
|
|
|
keyColumnPane.setEditors(new Editor[]{columnNameEditor1, columnIndexEditor1}, columnNames[0]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
formulaEditor1.setEnabled(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ColumnNameEditor columnNameEditor2 = new ColumnNameEditor(columnNames); |
|
|
|
|
|
|
|
columnNameEditor2.addItemListener(itemListener); |
|
|
|
|
|
|
|
ColumnIndexEditor columnIndexEditor2 = new ColumnIndexEditor(columnNames.length); |
|
|
|
|
|
|
|
columnIndexEditor2.addItemListener(itemListener); |
|
|
|
|
|
|
|
valueDictPane.setEditors(new Editor[]{columnNameEditor2, columnIndexEditor2, formulaEditor1}, columnNames[0]); |
|
|
|
|
|
|
|
} catch (InterruptedException | ExecutionException e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
ColumnNameEditor columnNameEditor2 = new ColumnNameEditor(columnNames); |
|
|
|
worker.execute(); |
|
|
|
columnNameEditor2.addItemListener(itemListener); |
|
|
|
|
|
|
|
ColumnIndexEditor columnIndexEditor2 = new ColumnIndexEditor(columnNames.length); |
|
|
|
|
|
|
|
columnIndexEditor2.addItemListener(itemListener); |
|
|
|
|
|
|
|
valueDictPane.setEditors(new Editor[]{columnNameEditor2, columnIndexEditor2, formulaEditor}, columnNames[0]); |
|
|
|
|
|
|
|
if (itemListener != null) { |
|
|
|
|
|
|
|
itemListener.itemStateChanged(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|