/*
* 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.guillcogcecl.panel;
import org.geoforge.guillc.panel.GfrPnlTabsSettingsDspWwdEarthDimTwoAbs;
import java.awt.Color;
import java.awt.event.ActionListener;
import javax.swing.event.ChangeListener;
import org.geoforge.guillc.panel.PnlDspRowComboAnnotationDft;
import org.geoforge.guillc.panel.PnlDspRowRadiosColorDft;
import org.geoforge.guillc.panel.PnlDspRowChoiceBlnYesNo;
import org.geoforge.guillc.panel.PnlDspRowSldOpacityDft;
import org.geoforge.mdldspecl.render.wwd.GfrMdlDspRndWwdEarthShpDimTwoSct;
import org.geoforge.wrpbasprsdsp.render.wwd.GfrWrpBasPrsDspPrjRndWwdEarthShpDimAbs.KindAnnotation;
import org.geoforge.wrpbasprsdspecl.render.wwd.GfrWrpRndDftWwdEarthShpDimTwoSct;
/**
*
* @author bantchao@gmail.com
*/
public class GfrPnlTabsSettingsDspWwdEarthDimTwoTopSct extends GfrPnlTabsSettingsDspWwdEarthDimTwoAbs
{
public GfrPnlTabsSettingsDspWwdEarthDimTwoTopSct(
ActionListener alrParent,
ChangeListener clrParent)
throws Exception
{
super(alrParent);
// begin get value
float fltTransparencyIn = GfrWrpRndDftWwdEarthShpDimTwoSct.getInstance().getTransparencyIn();
fltTransparencyIn *= 100;
int intTransparencyIn = Math.round(fltTransparencyIn);
float fltTransparencyOut = GfrWrpRndDftWwdEarthShpDimTwoSct.getInstance().getTransparencyOut();
fltTransparencyOut *= 100;
int intTransparencyOut = Math.round(fltTransparencyOut);
Color colIn = null;
if (! GfrWrpRndDftWwdEarthShpDimTwoSct.getInstance().isColorRandomIn())
colIn = GfrWrpRndDftWwdEarthShpDimTwoSct.getInstance().getColorIn();
Color colOut = null;
if (! GfrWrpRndDftWwdEarthShpDimTwoSct.getInstance().isColorRandomOut())
colOut = GfrWrpRndDftWwdEarthShpDimTwoSct.getInstance().getColorOut();
boolean blnHasTootip = GfrWrpRndDftWwdEarthShpDimTwoSct.getInstance().isTooltip();
String strValueInitAnnotation = GfrWrpRndDftWwdEarthShpDimTwoSct.getInstance().getKindAnnotationKey();
// end get values
super._pnlColorIn = new PnlDspRowRadiosColorDft(
alrParent,
colIn,
"",
"in"
);
super._pnlColorOut = new PnlDspRowRadiosColorDft(
alrParent,
colOut,
"",
"out"
);
super._pnlOpacityIn = new PnlDspRowSldOpacityDft(
clrParent,
intTransparencyIn,
"",
"in");
super._pnlOpacityOut = new PnlDspRowSldOpacityDft(
clrParent,
intTransparencyOut,
"",
"out");
super._pnlAnnotation = new PnlDspRowComboAnnotationDft(
alrParent,
strValueInitAnnotation);
super._pnlTooltip = new PnlDspRowChoiceBlnYesNo(
alrParent,
blnHasTootip,
"tooltip");
}
@Override
public void doTaskTabDialog() throws Exception
{
if (super._pnlColorIn.hasChangedValue())
{
Color colValue = ((PnlDspRowRadiosColorDft) super._pnlColorIn).getValue();
boolean bln = super._pnlColorIn.isApplyToAll();
GfrMdlDspRndWwdEarthShpDimTwoSct.getInstance().setColorDefaultIn(colValue, bln);
}
if (super._pnlOpacityIn.hasChangedValue())
{
int intValue = ((PnlDspRowSldOpacityDft) super._pnlOpacityIn).getValue();
float fltValue = (float) intValue;
fltValue /= 100f;
boolean bln = super._pnlOpacityIn.isApplyToAll();
GfrMdlDspRndWwdEarthShpDimTwoSct.getInstance().setTransparencyDefaultIn(fltValue, bln);
}
if (super._pnlColorOut.hasChangedValue())
{
Color colValue = ((PnlDspRowRadiosColorDft) super._pnlColorOut).getValue();
boolean bln = super._pnlColorOut.isApplyToAll();
GfrMdlDspRndWwdEarthShpDimTwoSct.getInstance().setColorDefaultOut(colValue, bln);
}
if (super._pnlOpacityOut.hasChangedValue())
{
int intValue = ((PnlDspRowSldOpacityDft) super._pnlOpacityOut).getValue();
float fltValue = (float) intValue;
fltValue /= 100f;
boolean bln = super._pnlOpacityOut.isApplyToAll();
GfrMdlDspRndWwdEarthShpDimTwoSct.getInstance().setTransparencyDefaultOut(fltValue, bln);
}
if (super._pnlAnnotation.hasChangedValue())
{
String strKey = ((PnlDspRowComboAnnotationDft) super._pnlAnnotation).getValue();
boolean bln = super._pnlAnnotation.isApplyToAll();
String strValue = KindAnnotation.s_getValue(strKey);
GfrMdlDspRndWwdEarthShpDimTwoSct.getInstance().setKindAnnotationDefault(strValue, bln);
}
if (super._pnlTooltip.hasChangedValue())
{
boolean blnValue = ((PnlDspRowChoiceBlnYesNo) super._pnlTooltip).getValue();
boolean bln = super._pnlTooltip.isApplyToAll();
GfrMdlDspRndWwdEarthShpDimTwoSct.getInstance().setTooltipDefault(blnValue, bln);
}
// ending
super.doTaskTabDialog();
}
}