private void btnAddValueRangeActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_btnAddValueRangeActionPerformed { // GEN-HEADEREND:event_btnAddValueRangeActionPerformed String sFrom = txtFromValue.getText(); String sTo = txtToValue.getText(); String sPercent = txtPercentValue.getText(); Object obj[] = new Object[3]; int row = tblDateRanges.getSelectedRow(); if (row == -1) { JOptionPane.showMessageDialog( this, "A dates row must first be selected; values will be linked to that date range", "Constraint Error", JOptionPane.ERROR_MESSAGE); return; } obj[0] = sFrom; obj[1] = sTo; obj[2] = sPercent; Vector vRow = (Vector) newModelDates.getDataVector().elementAt(row); String key = getRowKey(vRow); TableSoftModel modelValues = (TableSoftModel) mapValues.get(key); if (modelValues == null) { modelValues = new TableSoftModel(); modelValues.addRowValues(obj); } else { modelValues.addRowValues(obj); } newModelValues.setDataVector((Vector) modelValues.getRows(), (Vector) vModelColumns); mapValues.put(key, modelValues); } // GEN-LAST:event_btnAddValueRangeActionPerformed
private void tblDateRangesMouseClicked( java.awt.event.MouseEvent evt) // GEN-FIRST:event_tblDateRangesMouseClicked { // GEN-HEADEREND:event_tblDateRangesMouseClicked int row = tblDateRanges.getSelectedRow(); Vector vRow = (Vector) newModelDates.getDataVector().elementAt(row); if (row == -1) { JOptionPane.showMessageDialog( this, "A dates row must first be selected; values will be linked to that date range", "Constraint Error", JOptionPane.ERROR_MESSAGE); return; } String key = getRowKey(vRow); TableSoftModel modelValues = (TableSoftModel) mapValues.get(key); if (modelValues != null) { newModelValues.setDataVector((Vector) modelValues.getRows(), (Vector) vModelColumns); } } // GEN-LAST:event_tblDateRangesMouseClicked