/*
* 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.geoforge.guillc.menu;
import java.util.Observable;
import java.util.Observer;
import java.util.logging.Logger;
import org.geoforge.awt.image.GfrFactoryIconAbs;
import org.geoforge.io.awt.image.GfrFactoryIconAppGfr;
import org.geoforge.lang.util.GfrResBundleLang;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.mdl.event.GfrEvtMdlIdAbs;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatAddedLloFixAbs;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatAddedLloVarAbs;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatRemovedAllLloAbs;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatRemovedLloVarAbs;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatRenamedLloVar;
/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com ... please remove "_AT_" from the above
* string to get the right email address
*/
abstract public class GfrMenIcnIdExpChildListNameAbs extends GfrMenIcnIdAbs implements
Observer
{
// ----
// begin: instantiate logger for this class
final private static Logger _LOGGER_ = Logger.getLogger(GfrMenIcnIdExpChildListNameAbs.class.getName());
static
{
GfrMenIcnIdExpChildListNameAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// end: instantiate logger for this class
// ----
abstract protected void _load() throws Exception;
protected GfrMenIcnIdExpChildListNameAbs(String strId) throws Exception
{
super(strId);
super.setText(GfrResBundleLang.s_getInstance().getValue("sentence.export"));
super.setIcon(GfrFactoryIconAppGfr.s_getExport(GfrFactoryIconAbs.INT_SIZE_XXSMALL));
_load();
}
@Override
public void loadTransient() throws Exception
{
super.loadTransient();
_load();
}
@Override
public void update(Observable obs, Object objEvt)
{
if (objEvt instanceof GfrEvtMdlIdDatRemovedAllLloAbs)
{
if (!super.isEnabled())
return;
GfrEvtMdlIdAbs evt = (GfrEvtMdlIdAbs) objEvt;
String strIdParent = evt.getId();
if (strIdParent.compareTo(super.getId()) != 0)
return;
super.setEnabled(false);
return;
}
if (objEvt instanceof GfrEvtMdlIdDatAddedLloFixAbs)
{
if (super.isEnabled())
return;
GfrEvtMdlIdAbs evt = (GfrEvtMdlIdAbs) objEvt;
String strIdParent = evt.getId();
if (strIdParent.compareTo(super.getId()) != 0)
return;
super.setEnabled(true);
return;
}
if (objEvt instanceof GfrEvtMdlIdDatAddedLloVarAbs)
return;
if (objEvt instanceof GfrEvtMdlIdDatRemovedLloVarAbs)
return;
if (objEvt instanceof GfrEvtMdlIdDatRenamedLloVar)
return;
// ---
GfrMenIcnIdExpChildListNameAbs._LOGGER_.warning("Uncaught event: " + objEvt.getClass().toString());
}
}