public void setSwingDataCollection(Collection<ICFSecurityISOCountryObj> value) { final String S_ProcName = "setSwingDataCollection"; swingDataCollection = value; if (swingDataCollection == null) { arrayOfISOCountry = new ICFSecurityISOCountryObj[0]; } else { int len = value.size(); arrayOfISOCountry = new ICFSecurityISOCountryObj[len]; Iterator<ICFSecurityISOCountryObj> iter = swingDataCollection.iterator(); int idx = 0; while (iter.hasNext() && (idx < len)) { arrayOfISOCountry[idx++] = iter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator did not fully populate the array copy"); } if (iter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator had left over items when done populating array copy"); } Arrays.sort(arrayOfISOCountry, compareISOCountryByQualName); } PickerTableModel tblDataModel = getDataModel(); if (tblDataModel != null) { tblDataModel.fireTableDataChanged(); } }
public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } JTable table = (JTable) e.getSource(); Point p = e.getPoint(); int row = table.rowAtPoint(p); if (row < 0) { return; } PickerTableModel model = getDataModel(); ICFInternetISOCountryObj o = (ICFInternetISOCountryObj) model.getValueAt(row, COLID_ROW_HEADER); invokeWhenChosen.choseISOCountry(o); try { Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { ((JInternalFrame) cont).setClosed(true); } } catch (Exception x) { } }
public void valueChanged(ListSelectionEvent lse) { final String S_ProcName = "valueChanged"; ICFBamId64GenObj selectedObj; if (lse.getValueIsAdjusting()) { return; } if (dataTable == null) { return; } int dataRow = dataTable.getSelectedRow(); int modelIndex = dataTable.convertRowIndexToModel(dataRow); PickerTableModel tblDataModel = getDataModel(); Object selectedRowData = tblDataModel.getValueAt(modelIndex, COLID_ROW_HEADER); if (selectedRowData != null) { if (selectedRowData instanceof ICFBamId64GenObj) { int selectedCount = dataTable.getSelectedRowCount(); if (selectedCount <= 0) { selectedObj = null; } else if (selectedCount == 1) { selectedObj = (ICFBamId64GenObj) selectedRowData; } else { selectedObj = null; } } else { selectedObj = null; throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedRowData", selectedRowData, "ICFBamId64GenObj"); } } else { selectedObj = null; } setSwingFocus(selectedObj); adjustFeedback(); }
public void setSwingFocus(ICFLibAnyObj value) { final String S_ProcName = "setSwingFocus"; if ((value == null) || (value instanceof ICFSecurityISOCountryObj)) { super.setSwingFocus(value); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "value", value, "ICFSecurityISOCountryObj"); } if (dataTable == null) { return; } if (value == null) { dataTable.clearSelection(); } else { ICFInternetISOCountryObj curSelected; PickerTableModel tblDataModel = getDataModel(); int selectedRow = dataTable.getSelectedRow(); int modelIndex = dataTable.convertRowIndexToModel(selectedRow); if (selectedRow >= 0) { Object selectedRowData = tblDataModel.getValueAt(modelIndex, COLID_ROW_HEADER); curSelected = (ICFInternetISOCountryObj) selectedRowData; } else { curSelected = null; } if (curSelected != value) { int len = tblDataModel.getRowCount(); int idx = 0; while ((idx < len) && (tblDataModel.getValueAt(idx, COLID_ROW_HEADER) != value)) { idx++; } if (idx < len) { int viewRow = dataTable.convertRowIndexToView(idx); dataTable.clearSelection(); dataTable.addRowSelectionInterval(viewRow, viewRow); } } } }