/*
* 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.popupmenu;
import org.geoforge.guillc.action.ActionAboutPlugin;
import org.geoforge.guillc.action.ActionPluginDelete;
import org.geoforge.guillc.action.ActionPluginSetLicense;
import org.geoforge.guillc.menuitem.GfrMimTrsSerActAboutPlugin;
import org.geoforge.guillc.menuitem.GfrMimAbs;
import org.geoforge.guillc.menuitem.GfrMimActDeletePlugin;
import org.geoforge.guillc.menuitem.GfrMimActSetLicensePlugin;
import org.geoforge.guillc.table.GfrTblAbs;
import org.geoforge.guillc.tablemodel.GfrAtmManagePlgs;
import org.geoforge.mgrplg.handler.IGfrHandlerLicensingPlugin;
import org.geoforge.mgrplg.handler.IGfrHandlerPlugin;
/**
*
* @author robert
*/
public class GfrPmuTblDelManPlgs extends GfrPmuTblDelAbs
{
private GfrMimAbs _mimSetLicensePlugin_ = null;
private GfrMimAbs _mimAboutPlugin_ = null;
public GfrPmuTblDelManPlgs(GfrTblAbs tbl)
{
super(tbl);
super._mimChildDelete = new GfrMimActDeletePlugin();
this._mimSetLicensePlugin_ = new GfrMimActSetLicensePlugin();
this._mimAboutPlugin_ = new GfrMimTrsSerActAboutPlugin();
}
@Override
public boolean init()
{
if (! super.init())
return false;
if (! this._mimSetLicensePlugin_.init())
return false;
if (! this._mimAboutPlugin_.init())
return false;
super.add(this._mimSetLicensePlugin_);
super.add(this._mimAboutPlugin_);
return true;
}
@Override
public void destroy()
{
super.destroy();
if (this._mimSetLicensePlugin_ != null)
{
this._mimSetLicensePlugin_.destroy();
this._mimSetLicensePlugin_ = null;
}
if (this._mimAboutPlugin_ != null)
{
this._mimAboutPlugin_.destroy();
this._mimAboutPlugin_ = null;
}
}
@Override
public void setSelectedRow(int intRow)
{
super.setSelectedRow(intRow);
if (super._tbl == null)
return;
if (this._tbl.getModel() == null)
return;
IGfrHandlerPlugin plg = ((GfrAtmManagePlgs) super._tbl.getModel()).getPluginAt(super._intRow);
ActionPluginDelete.s_getInstance().setPlugin(plg);
ActionPluginSetLicense.s_getInstance().setPlugin(plg);
ActionAboutPlugin.s_getInstance().setPlugin(plg);
if (! (plg instanceof IGfrHandlerLicensingPlugin))
{
this._mimSetLicensePlugin_.setVisible(false);
}
else
{
this._mimSetLicensePlugin_.setVisible(true);
if (! plg.isActivePlugin())
{
this._mimSetLicensePlugin_.setEnabled(true);
}
else
{
this._mimSetLicensePlugin_.setEnabled(false);
}
}
}
}