{
showMessage(CBIntText.get("There are no filters available to load.") , CBIntText.get("Nothing to Load"));
return;
}
CBJComboBox loadCombo = new CBJComboBox(list.toArray());
loadCombo.setRenderer(new CBBasicComboBoxRenderer(list.toArray()));
loadCombo.setPreferredSize(new Dimension(140, 20));
int response = JOptionPane.showConfirmDialog(this, loadCombo,
CBIntText.get("Select Filter"), JOptionPane.OK_CANCEL_OPTION);
if (response != JOptionPane.OK_OPTION)
return; //TE: the user has probably decided not to load a filter i.e. has clicked 'cancel'.
if (loadCombo.getSelectedItem()!=null)
{
String filter = loadCombo.getSelectedItem().toString(); //TE: get the user selected filter from the combo box.
try
{
setNumberOfRows(build.getOccurrences(searchModel.getFilter(filter), "JXFilter")); //TE: add the right number of rows for displaying the filter.
list = searchModel.getJoinFilterNames(searchModel.getFilter(filter)); //TE: get a list of the subfilter names.
if(!join.displayFilter(list, searchModel.getFilter(filter))) //TE: display the filter. If unsuccessful show message.
showMessage(CBIntText.get("Your filter cannot be displayed."), CBIntText.get("Load Unsuccessful"));
else
{
joinName = loadCombo.getSelectedItem().toString(); //TE: update the name of the join filter so the tab change listener knows the correct name of the filter.
filterNameTextField.setText(joinName); //TE: set the name of the filter in the filter name field.
}
}
catch(Exception e) //TE: the user has somehow selected nothing in either the attribute or the function combo.
{
showMessage(CBIntText.get("The filter cannot be constructed; there appears to be missing information.\nPlease make sure you have entered all the information for the filter correctly."), CBIntText.get("Missing Information"));
return;
}
}
else
showMessage(CBIntText.get("Problem loading; there are no filters selected.") , CBIntText.get("Nothing to Load"));
load(loadCombo.getSelectedItem().toString());
}