/*
* 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.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Logger;
import javax.swing.BoxLayout;
import org.geoforge.guillc.button.GfrBtnTxtRndCmdCancelXXSmall;
import org.geoforge.guillc.button.GfrBtnTxtRndCmdCloseWindow;
import org.geoforge.guillc.panel.GfrPnlCmdAbs;
import org.geoforge.guillc.panel.GfrPnl;
import org.geoforge.guillc.tabbedpane.GfrTabCntAbs;
import org.geoforge.java.enumeration.GfrEnuSystemPropertiesKeys;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
/**
*
* @author bantchao
*/
abstract public class GfrDlgTabsAbs extends DlgAbs implements
ActionListener
{
// ----
// begin: instantiate logger for this class
final private static Logger _LOGGER_ = Logger.getLogger(GfrDlgTabsAbs.class.getName());
static
{
GfrDlgTabsAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// end: instantiate logger for this class
// ----
protected GfrPnlCmdAbs _pnlCommands = null;
protected GfrTabCntAbs _tabContents = null;
protected GfrDlgTabsAbs(
Frame frmOwner, String strWhat)
{
super(frmOwner,
System.getProperty(GfrEnuSystemPropertiesKeys.NAME_LONG_APPLI.getLabel())
+ " - "
+ strWhat);
super.setModalityType(ModalityType.APPLICATION_MODAL);
}
@Override
public boolean init()
{
if (!super.init())
return false;
if (!this._tabContents.init())
return false;
if (!this._pnlCommands.init())
return false;
GfrPnl pnl = new GfrPnl();
if (!pnl.init())
return false;
pnl.setLayout(new BoxLayout(pnl, BoxLayout.PAGE_AXIS));
pnl.add(this._tabContents);
pnl.add(this._pnlCommands);
super.add(pnl);
setResizable(false);
return true;
}
@Override
public void destroy()
{
super.destroy();
if (this._tabContents != null)
{
this._tabContents.destroy();
this._tabContents = null;
}
if (this._pnlCommands != null)
{
this._pnlCommands.destroy();
this._pnlCommands = null;
}
}
@Override
public void actionPerformed(ActionEvent evt)
{
Object objSource = evt.getSource();
if (objSource instanceof GfrBtnTxtRndCmdCancelXXSmall || objSource instanceof GfrBtnTxtRndCmdCloseWindow)
{
//this._blnCancelled_ = true;
destroy();
return;
}
String str = "!! Uncaught objSource.getClass().getName()" + objSource.getClass().getName();
GfrDlgTabsAbs._LOGGER_.severe(str);
throw new UnsupportedOperationException(str);
}
}