NC 现金流量查询 节点 多账簿联查时,根据所选择的列来判断明细和现金流量联查按钮是否可用,如下图的情况:
在现金流量查询界面UI类的initTable(QueryConditionVO conVO)方法中添加列选择监听事件即可,如下:
// 列监听
final QueryConditionVO convo = conVO;
m_tUITable.getColumnModel().addColumnModelListener(new TableColumnModelListener() {
@Override
public void columnAdded(TableColumnModelEvent e) {
// TODO Auto-generated method stub
}
@Override
public void columnRemoved(TableColumnModelEvent e) {
// TODO Auto-generated method stub
}
@Override
public void columnMoved(TableColumnModelEvent e) {
// TODO Auto-generated method stub
}
@Override
public void columnMarginChanged(ChangeEvent e) {
// TODO Auto-generated method stub
}
@Override
public void columnSelectionChanged(ListSelectionEvent e) {
int selectedColumnIndex = m_tUITable.getSelectedColumn();
if ((selectedColumnIndex == getSumIndex(convo, localSum) || selectedColumnIndex == getSumIndex(convo, localAccuSum))) {
m_bButtonDetail.setEnabled(false);
m_bButtonQueryDetail.setEnabled(false);
System.out.println("列选择发生了变化");
} else {
m_bButtonDetail.setEnabled(true);
m_bButtonQueryDetail.setEnabled(true);
}
}
});
行选择监听事件:
//行监听
final QueryConditionVO convo = conVO;
m_tUITable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
int selectedColumnIndex = m_tUITable.getSelectedColumn();
if ((selectedColumnIndex == getSumIndex(convo, localSum) || selectedColumnIndex == getSumIndex(convo, localAccuSum))) {
m_bButtonDetail.setEnabled(false);
m_bButtonQueryDetail.setEnabled(false);
System.out.println("行选择发生了变化");
} else {
m_bButtonDetail.setEnabled(true);
m_bButtonQueryDetail.setEnabled(true);
}
}
});