Changeset 5051
- Timestamp:
- 07/25/08 22:37:39 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/patientmatching/src/org/regenstrief/linkage/gui/RandomSampleLoggingFrame.java
r4257 r5051 4 4 5 5 import java.awt.event.ActionEvent; 6 import java.util.List; 6 7 7 8 import javax.swing.JButton; … … 10 11 import org.regenstrief.linkage.analysis.RandomSampleAnalyzer; 11 12 import org.regenstrief.linkage.util.MatchingConfig; 13 import org.regenstrief.linkage.util.MatchingConfigRow; 12 14 13 15 /** … … 63 65 * random sampling result. 64 66 */ 65 this.config = analyzer.getAnalyzerMatchingConfig(); 67 MatchingConfig analyzerConfig = analyzer.getAnalyzerMatchingConfig(); 68 for(MatchingConfigRow row: analyzerConfig.getMatchingConfigRows()) { 69 String name = row.getName(); 70 MatchingConfigRow guiRow = config.getMatchingConfigRowByName(name); 71 guiRow.setNonAgreement(row.getNonAgreement()); 72 } 73 66 74 JOptionPane.showMessageDialog( 67 75 this, "Values copied to current session parameter.", openmrs-modules/patientmatching/src/org/regenstrief/linkage/gui/SessionsPanel.java
r4657 r5051 40 40 import javax.swing.event.ListSelectionEvent; 41 41 import javax.swing.event.ListSelectionListener; 42 import javax.swing.event.TableModelEvent; 43 import javax.swing.event.TableModelListener; 42 44 import javax.swing.table.TableColumn; 45 import javax.swing.table.TableModel; 43 46 44 47 import org.regenstrief.linkage.util.DataColumn; … … 52 55 * 53 56 */ 54 public class SessionsPanel extends JPanel implements ActionListener, KeyListener, ListSelectionListener, ItemListener, FocusListener{ 57 public class SessionsPanel extends JPanel implements ActionListener, KeyListener, 58 ListSelectionListener, ItemListener, FocusListener, TableModelListener{ 55 59 public final String DEFAULT_NAME = "New match"; 56 60 … … 439 443 440 444 private Component getSessionTable(){ 441 session_options = new JTable(new SessionOptionsTableModel()); 445 SessionOptionsTableModel model = new SessionOptionsTableModel(); 446 model.addTableModelListener(this); 447 session_options = new JTable(model); 442 448 443 449 jcb = new JComboBox(); … … 487 493 } 488 494 current_working_config = mc; 489 session_options.setModel(new SessionOptionsTableModel(mc)); 495 SessionOptionsTableModel model = new SessionOptionsTableModel(mc); 496 model.addTableModelListener(this); 497 session_options.setModel(model); 490 498 TableColumn tc = session_options.getColumnModel().getColumn(6); 491 499 tc.setCellEditor(new DefaultCellEditor(jcb)); 492 }493 494 private MatchingConfig getSelectedConfig(){495 // gets the matching config object currely selected in the jlist object496 DefaultListModel dlm = (DefaultListModel)runs.getModel();497 MatchingConfig mc = (MatchingConfig)dlm.getElementAt(runs.getSelectedIndex());498 499 return mc;500 500 } 501 501 … … 537 537 dlm.add(index - 1, to_move); 538 538 runs.setSelectedIndex(index - 1); 539 // swap matching config 540 MatchingConfig configA = rm_conf.getMatchingConfigs().remove(index); 541 MatchingConfig configB = rm_conf.getMatchingConfigs().remove(index - 1); 542 rm_conf.getMatchingConfigs().add(index - 1, configA); 543 rm_conf.getMatchingConfigs().add(index, configB); 539 544 } 540 545 } … … 549 554 dlm.add(index + 1, to_move); 550 555 runs.setSelectedIndex(index + 1); 556 // swap matching config 557 MatchingConfig configA = rm_conf.getMatchingConfigs().remove(index); 558 MatchingConfig configB = rm_conf.getMatchingConfigs().remove(index + 1); 559 rm_conf.getMatchingConfigs().add(index, configB); 560 rm_conf.getMatchingConfigs().add(index + 1, configA); 551 561 } 552 562 } … … 787 797 } 788 798 } 799 800 public void tableChanged(TableModelEvent e) { 801 /*--NOTES--*/ 802 // changes to the SessionOptionsTableModel must be propagated to this method 803 // changes that need to be propagated are: 804 // - adding new columns 805 // - deleting columns 806 int rowIndex = e.getFirstRow(); 807 int columnIndex = e.getColumn(); 808 TableModel model = (TableModel) e.getSource(); 809 if(columnIndex == 3) { 810 Boolean included = (Boolean) model.getValueAt(rowIndex, columnIndex); 811 if(included){ 812 model.setValueAt(0, rowIndex, 1); 813 } 814 } else if (columnIndex == 1) { 815 Integer blockOrder = (Integer) model.getValueAt(rowIndex, columnIndex); 816 if(blockOrder > 0) { 817 model.setValueAt(new Boolean(false), rowIndex, 3); 818 } 819 } 820 } 789 821 }