/*
* 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.popupmenu;
import java.awt.event.ActionListener;
import java.util.Observable;
import javax.swing.JPopupMenu;
import org.geoforge.guillc.handler.IGfrHandlerDisplayableObjectsSet;
import org.geoforge.guillc.menu.GfrMenIcnAbs;
import org.geoforge.guillc.menuitem.GfrMimTrsAlrDelAllObjTlos;
import org.geoforge.guillc.menuitem.GfrMimTrsAlrSetTop;
import org.geoforge.guillc.menuitem.GfrMimTrsAlrAbs;
import org.geoforge.guillc.tree.GfrTreAbs;
import org.geoforge.java.awt.container.GfrUtilContainer;
import org.geoforge.wrpbasprsdat.handler.IGfrHandlerWrapperSetDataTop;
/**
*
* @author bantchao
*/
abstract public class GfrPmuCtlCtrFolderTopAbs extends GfrPmuCtlCtrFolderAbs
{
transient protected GfrMenIcnAbs _menNew = null;
transient protected GfrMimTrsAlrAbs _mimDeleteAll = null;
transient protected GfrMimTrsAlrAbs _mimSettings = null;
protected GfrPmuCtlCtrFolderTopAbs(
GfrTreAbs tree,
ActionListener alrController,
IGfrHandlerDisplayableObjectsSet enuValueKindObject,
Observable observableTop,
IGfrHandlerWrapperSetDataTop wrpSetDataTop)
throws Exception
{
super(tree);
this._mimSettings = new GfrMimTrsAlrSetTop(
alrController,
enuValueKindObject.getNameThisDisplayableObjectsSet());
this._mimDeleteAll = new GfrMimTrsAlrDelAllObjTlos(
alrController,
enuValueKindObject.getNameThisDisplayableObjectsSet(),
observableTop,
wrpSetDataTop);
}
protected GfrPmuCtlCtrFolderTopAbs(
GfrTreAbs tree,
ActionListener alrController,
String strValueKindtargetWindow,
IGfrHandlerDisplayableObjectsSet enuValueKindObject,
Observable observableTop,
IGfrHandlerWrapperSetDataTop wrpSetDataTop) throws Exception
{
super(tree);
this._mimSettings = new GfrMimTrsAlrSetTop(
alrController,
strValueKindtargetWindow,
enuValueKindObject.getNameThisDisplayableObjectsSet());
this._mimDeleteAll = new GfrMimTrsAlrDelAllObjTlos(
alrController,
enuValueKindObject.getNameThisDisplayableObjectsSet(),
observableTop,
wrpSetDataTop);
}
@Override
public boolean init()
{
if (!super.init())
return false;
if (!this._menNew.init())
return false;
if (!this._mimDeleteAll.init())
return false;
if (!this._mimSettings.init())
return false;
int intPos = 0;
if (super._menPlugins != null)
{
intPos = GfrUtilContainer.s_getPosition(this, super._menPlugins);
intPos += 2;
}
else
{
intPos = GfrUtilContainer.s_getPosition(this, super._mimFolderAllCollapse);
intPos += 2;
}
//--
super.add(this._menNew, intPos++);
super.add(this._mimSettings, intPos++);
super.add(this._mimDeleteAll, intPos++);
return true;
}
@Override
public void destroy()
{
super.destroy();
if (this._menNew != null)
{
this._menNew.destroy();
this._menNew = null;
}
if (this._mimDeleteAll != null)
{
this._mimDeleteAll.destroy();
this._mimDeleteAll = null;
}
if (this._mimSettings != null)
{
this._mimSettings.destroy();
this._mimSettings = null;
}
}
@Override
public void loadTransient() throws Exception
{
super.loadTransient();
this._mimDeleteAll.loadTransient();
this._mimSettings.loadTransient();
}
@Override
public void releaseTransient() throws Exception
{
super.releaseTransient();
this._mimDeleteAll.releaseTransient();
this._mimSettings.releaseTransient();
}
}