use of wekapar.MetricSpinner in project wekapar by gems-uff.
the class PostprocessAssociationsPanel method buildMetricsFilter.
/**
* Builds a {@link RowFilter} according to selected metrics minimum values.
*
* @return the row filter object
*/
private static RowFilter<? super TableModel, ? super Integer> buildMetricsFilter() {
RowFilter<Object, Object> rowFilter = RowFilter.regexFilter(".*");
List<RowFilter<Object, Object>> metricFilters = new ArrayList<RowFilter<Object, Object>>();
List<RowFilter<Object, Object>> metricFilter;
RowFilter<Object, Object> filterEqual;
RowFilter<Object, Object> filterAfter;
RulesTableColumnModel columnModel = (RulesTableColumnModel) table.getColumnModel();
MetricSpinner spinner;
String key;
double value;
int columnIndex;
for (Map.Entry<String, JSpinner> entry : metricSpinnerMap.entrySet()) {
metricFilter = new ArrayList<RowFilter<Object, Object>>();
key = entry.getKey();
spinner = (MetricSpinner) entry.getValue();
value = (Double) spinner.getValue();
if (columnModel.hasColumn(key)) {
if (!spinner.isMinimumSelected()) {
columnIndex = table.getColumnModel().getColumnIndex(key);
filterEqual = RowFilter.numberFilter(ComparisonType.EQUAL, value, table.convertColumnIndexToModel(columnIndex));
filterAfter = RowFilter.numberFilter(ComparisonType.AFTER, value, table.convertColumnIndexToModel(columnIndex));
metricFilter.add(filterEqual);
metricFilter.add(filterAfter);
metricFilters.add(RowFilter.orFilter(metricFilter));
}
}
}
rowFilter = RowFilter.andFilter(metricFilters);
return rowFilter;
}
use of wekapar.MetricSpinner in project wekapar by gems-uff.
the class PostprocessAssociationsPanel method onMetricPropertyChange.
/**
* This method must be called when a {@link JCheckBox} component changes its
* "selected" property to enable or disable respective {@link JSpinner}
* component.
*
* @param e the property change event object
*/
private static void onMetricPropertyChange(PropertyChangeEvent e) {
JCheckBox chkbx = (JCheckBox) e.getSource();
MetricSpinner spinner = (MetricSpinner) metricSpinnerMap.get(chkbx.getText());
if (chkbx.isSelected()) {
spinner.setEnabled(chkbx.isEnabled());
} else {
spinner.setEnabled(false);
}
}
Aggregations