/*
* 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.internalframe;
import java.awt.event.ActionListener;
import java.beans.PropertyVetoException;
import java.util.Observable;
import java.util.Observer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.event.InternalFrameListener;
import org.geoforge.guillc.panel.GfrPnlCntWinViewerPlgCtrTloAbs;
import org.geoforge.mdldsp.action.control.GfrMdlDspActCtrMainRunPrc;
import org.geoforge.mdldsp.event.action.control.GfrEvtMdlDspActCtrIdZoomAbs;
import org.geoforge.mdldsp.event.action.control.GfrEvtMdlDspActCtrIdZoomObject;
import org.geoforge.wrpbasprsdsp.viewer.GfrWrpBasPrsDspPrjViewersExisting;
/**
*
* @author robert
*/
abstract public class GfrIfrWinViewRunIdRegSerPlgTloAbs extends GfrIfrWinViewRunIdRegSerPlgAbs implements
Observer
{
private boolean _blnShowDisplayOnly_ = false;
// ---
protected String _strIdTlo = null;
public String getIdTlo() { return this._strIdTlo; }
protected GfrIfrWinViewRunIdRegSerPlgTloAbs(
int intWidth,
int intHeight,
ActionListener alrControllerPlg,
InternalFrameListener ifrListenerController,
String strUniqueId,
String strIdTlo,
boolean blnShowDisplayOnly) throws Exception
{
super(
intWidth,
intHeight,
alrControllerPlg,
ifrListenerController,
strUniqueId,
GfrWrpBasPrsDspPrjViewersExisting.s_getInstance().getName(strUniqueId));
this._strIdTlo = strIdTlo;
this._blnShowDisplayOnly_ = blnShowDisplayOnly;
}
@Override
public void update(Observable obs, Object objEvent)
{
if (objEvent instanceof GfrEvtMdlDspActCtrIdZoomObject)
{
GfrEvtMdlDspActCtrIdZoomAbs actEvent = (GfrEvtMdlDspActCtrIdZoomAbs) objEvent;
String strIdTarget = actEvent.getIdTarget();
if (this._strIdTlo.compareTo(strIdTarget) != 0)
return;
if (super.isIcon())
try
{
super.setIcon(false);
}
catch (PropertyVetoException ex)
{
Logger.getLogger(GfrIfrWinViewRunIdRegSerAppTloAbs.class.getName()).log(Level.SEVERE, null, ex);
}
super.toFront();
return;
}
// TODO: specialize for mlos, llos, and so on
}
@Override
public void loadTransient() throws Exception
{
super.loadTransient();
GfrMdlDspActCtrMainRunPrc.s_getInstance().addObserver((Observer) this);
}
@Override
public void releaseTransient() throws Exception
{
GfrMdlDspActCtrMainRunPrc.s_getInstance().deleteObserver((Observer) this);
super.releaseTransient();
}
@Override
public boolean init()
{
if (! super.init())
return false;
_setVisibleDisplayOnly(this._blnShowDisplayOnly_); // default!
return true;
}
@Override
protected void _setVisibleDisplayOnly(boolean bln)
{
((GfrPnlCntWinViewerPlgCtrTloAbs) super._pnlContents).setVisibleDisplayOnly(bln);
super._setVisibleDisplayOnly(bln);
}
}