* with listeners and are placed one above the other.
* @return the panel with the buttons on it.
*/
public CBPanel getButtonPanel()
{
CBPanel panel = new CBPanel();
btnMore = new CBButton(CBIntText.get("More"), CBIntText.get("Add a Line to the search window."));
btnMore.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if (isFilterValid())
{
if (tabbedPane.getSelectedIndex()==0) //TE: make sure that you are adding rows to the tab that is visible, not to both tabs!
{
build.addFilterRow();
}
else if (tabbedPane.getSelectedIndex()==1 && buttonCounter<50)
{
join.addFilterRow(getEditButton());
buttonCounter++; //TE: a counter that keeps track of the number of created 'edit' buttons.
}
}
else
{
showMessage(CBIntText.get("There is an error in the filter; there appears to be missing information.\nPlease make sure you have entered all the information for the filter correctly,\nthen try to add more rows."), CBIntText.get("Missing Information"));
}
}});
btnLess = new CBButton(CBIntText.get("Less"), CBIntText.get("Remove a Line from the search window."));
btnLess.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if (tabbedPane.getSelectedIndex()==0) //TE: make sure that you are removing rows from the tab that is visible, not from both tabs!
{
build.removeFilterRow();
}
else if (tabbedPane.getSelectedIndex()==1 && buttonCounter>1)
{
buttonCounter--;
join.removeFilterRow(btnEdit[buttonCounter]);
}
}});
btnSave = new CBButton(CBIntText.get("Save"), CBIntText.get("Save this filter."));
btnSave.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if (isFilterValid())
save();
else
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"));
}});
btnLoad = new CBButton(CBIntText.get("Load"), CBIntText.get("Load a previously saved filter."));
btnLoad.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(tabbedPane.getSelectedIndex()==0)
loadBuild();
else if(tabbedPane.getSelectedIndex()==1)
loadJoin();
else if(tabbedPane.getSelectedIndex()==2)
loadText();
}});
btnView = new CBButton(CBIntText.get("View"), CBIntText.get("View this search filter as text."));
btnView.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if (!isFilterValid())
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"));
else if(tabbedPane.getSelectedIndex()==1 && recursiveFilterCheck(null, join.getFilter(), "View")) // We don't care about the name of this filter b/c we are just viewing it.
return;
else
showDialog(CBIntText.get("Current Filter"), getLDAPFilter());
}});
panel.makeHigh(); //TE: add a label that it takes up the any remaining space above the buttons, so that the buttons are at the bottom of the panel.
panel.addln(new JLabel(" "));
panel.makeLight();
panel.addln(btnMore);
panel.addln(btnLess);
panel.addln(btnSave);
panel.addln(btnLoad);
panel.addln(btnView);
return panel;
}