/*
* 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.guillcogc.panel;
import java.awt.event.ActionListener;
import javax.swing.event.ChangeListener;
import org.geoforge.guillc.panel.PnlDspRowSldAbs;
import org.geoforge.guillc.panel.PnlDspRowSldOpacityObject;
import org.geoforge.mdldspogc.render.wwd.GfrMdlDspRndWwdEarthImgLyrLeaf;
import org.geoforge.wrpbasprsdsp.render.wwd.GfrWrpBasPrsDspPrjRndWwdEarthImg;
/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
public class GfrPnlTabsSettingsDspWwdEarthLyrLeafObj extends GfrPnlTabsSettingsDspWwdEarthLyrLeafAbs
{
private String _strId_ = null;
public GfrPnlTabsSettingsDspWwdEarthLyrLeafObj(ActionListener alrParent,
ChangeListener clrParent,
String strId)
throws Exception
{
super();
this._strId_ = strId;
// begin get value
float fltTransparency = GfrWrpBasPrsDspPrjRndWwdEarthImg.getInstance().getTransparency(strId);
fltTransparency *= 100;
int intTransparency = Math.round(fltTransparency);
// end get values
super._pnlOpacity = new PnlDspRowSldOpacityObject(
clrParent,
intTransparency);
}
@Override
public void doTaskTabDialog() throws Exception
{
if (super._pnlOpacity.hasChangedValue())
{
int intValue = ((PnlDspRowSldAbs) super._pnlOpacity).getValue();
float fltValue = (float) intValue;
fltValue /= 100f;
boolean blnApplyToAll = super._pnlOpacity.isApplyToAll();
boolean blnSetAsDefault = ((PnlDspRowSldOpacityObject) super._pnlOpacity).isSetDefault();
GfrMdlDspRndWwdEarthImgLyrLeaf.getInstance().setTransparency(this._strId_, fltValue, blnApplyToAll, blnSetAsDefault);
}
// ending
super.doTaskTabDialog();
}
}