/*
* Copyright (C) 2011-2014 GeoForge Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.geoforge.guillc.dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Logger;
import javax.swing.JCheckBox;
import org.geoforge.guillc.button.GfrBtnTxtRndCmdApplyXXSmall;
import org.geoforge.guillc.button.GfrBtnTxtRndCmdOkXXSmall;
import org.geoforge.guillc.panel.GfrPnlCmdCancelOkApply;
import org.geoforge.guillc.frame.GfrFrmAbs;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillc.panel.GfrPnlStatusBarMain;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
/**
*
* @author bantchao
*/
abstract public class GfrDlgTabsPrefsAbs extends GfrDlgTabsAbs
{
// ----
// begin: instantiate logger for this class
final private static Logger _LOGGER_ = Logger.getLogger(GfrDlgTabsPrefsAbs.class.getName());
static
{
GfrDlgTabsPrefsAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// end: instantiate logger for this class
// ----
protected GfrDlgTabsPrefsAbs()
{
super(GfrFrmAbs.s_getFrameOwner(GfrPnlStatusBarMain.s_getInstance()),
"Preferences");
super._pnlCommands = new GfrPnlCmdCancelOkApply(
(ActionListener) this);
}
@Override
public void actionPerformed(ActionEvent evt)
{
Object objSource = evt.getSource();
try
{
if (objSource instanceof GfrBtnTxtRndCmdApplyXXSmall)
{
super._tabContents.doTaskTabDialog();
((GfrPnlCmdCancelOkApply) this._pnlCommands).setEnabledOkCommandDialog(false);
return;
}
if (objSource instanceof GfrBtnTxtRndCmdOkXXSmall)
{
super._tabContents.doTaskTabDialog();
super.destroy();
return;
}
}
catch(Exception exc)
{
exc.printStackTrace();
String str = exc.getMessage();
GfrDlgTabsPrefsAbs._LOGGER_.severe(str);
GfrOptionPaneAbs.s_showDialogError(this, str);
return;
}
if (objSource instanceof JCheckBox)
{
boolean bln = super._tabContents.hasChangedValue();
((GfrPnlCmdCancelOkApply) super._pnlCommands).setEnabledOkCommandDialog(bln);
return;
}
super.actionPerformed(evt);
}
}