/** * Called whenever the value of the selection changes. * * @param e the event that characterizes the change. */ public void valueChanged(final ListSelectionEvent e) { final int[] selectedRows = table.getSelectedRows(); for (int i = 0; i < selectedRows.length; i++) { final int row = selectedRows[i]; final DrillDownParameter.Type type = parameterTableModel.getParameterType(model.mapToModel(row)); if (DrillDownParameter.Type.MANUAL == type) { setEnabled(true); return; } } setEnabled(false); }
/** Invoked when an action occurs. */ public void actionPerformed(final ActionEvent e) { if (isEnabled() == false) { return; } final DrillDownParameter[] data = parameterTableModel.getGroupedData(); final ListSelectionModel listSelectionModel = table.getSelectionModel(); final ArrayList<DrillDownParameter> result = new ArrayList<DrillDownParameter>(data.length); for (int i = 0; i < data.length; i++) { final DrillDownParameter parameter = data[i]; if (parameter == null) { continue; } if (listSelectionModel.isSelectedIndex(model.mapFromModel(i)) == false || parameter.getType() != DrillDownParameter.Type.MANUAL) { result.add(data[i]); } } parameterTableModel.setData(result.toArray(new DrillDownParameter[result.size()])); }