/*
* 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.GfrPnlTabsSettingsDspWwdEarthDimOneLinAbs;
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.PnlDspRowComboAnnotationDftObject;
import org.geoforge.guillc.panel.PnlDspRowButtonColorObj;
import org.geoforge.guillc.panel.PnlDspRowSldAbs;
import org.geoforge.guillc.panel.PnlDspRowSldThicknessObj;
import org.geoforge.guillc.panel.PnlDspRowChoiceBlnYesNoObject;
import org.geoforge.guillc.panel.PnlDspRowSldOpacityObject;
import org.geoforge.guillc.panel.PnlDspRowChoiceBlnYesNo;
import org.geoforge.mdldspecl.render.wwd.GfrMdlDspRndWwdEarthShpDimOneLineEclPth;
import org.geoforge.wrpbasprsdsp.render.wwd.GfrWrpBasPrsDspPrjRndWwdEarthShpDimAbs.KindAnnotation;
import org.geoforge.wrpbasprsdsp.render.wwd.GfrWrpBasPrsDspPrjRndWwdEarthShpDimOneLineWiseNo;
/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
public class GfrPnlTabsSettingsDspWwdEarthDimOneLinPthObj extends GfrPnlTabsSettingsDspWwdEarthDimOneLinAbs
{
private String _strId_ = null;
public GfrPnlTabsSettingsDspWwdEarthDimOneLinPthObj(ActionListener alrParent,
ChangeListener clrParent,
String strId)
throws Exception
{
super();
this._strId_ = strId;
// begin get value
int intThickness = GfrWrpBasPrsDspPrjRndWwdEarthShpDimOneLineWiseNo.getInstance().getThickness(strId);
float fltTransparency = GfrWrpBasPrsDspPrjRndWwdEarthShpDimOneLineWiseNo.getInstance().getTransparency(strId);
fltTransparency *= 100;
int intTransparency = Math.round(fltTransparency);
Color colCustom = GfrWrpBasPrsDspPrjRndWwdEarthShpDimOneLineWiseNo.getInstance().getColor(strId);
boolean blnHasTootip = GfrWrpBasPrsDspPrjRndWwdEarthShpDimOneLineWiseNo.getInstance().isTooltip(strId);
String strValueInitAnnotation = GfrWrpBasPrsDspPrjRndWwdEarthShpDimOneLineWiseNo.getInstance().getKindAnnotationKey(strId);
// end get values
super._pnlThickness = new PnlDspRowSldThicknessObj(
clrParent,
intThickness,
"Line");
super._pnlColor = new PnlDspRowButtonColorObj(
alrParent,
colCustom);
super._pnlOpacity = new PnlDspRowSldOpacityObject(
clrParent,
intTransparency);
super._pnlAnnotation = new PnlDspRowComboAnnotationDftObject(
alrParent,
strValueInitAnnotation);
super._pnlTooltip = new PnlDspRowChoiceBlnYesNoObject(
alrParent,
blnHasTootip,
"tooltip");
}
@Override
public void doTaskTabDialog() throws Exception
{
if (super._pnlThickness.hasChangedValue())
{
int intValue = ((PnlDspRowSldAbs) super._pnlThickness).getValue();
boolean blnApplyToAll = super._pnlThickness.isApplyToAll();
boolean blnSetAsDefault = ((PnlDspRowSldThicknessObj) super._pnlThickness).isSetDefault();
GfrMdlDspRndWwdEarthShpDimOneLineEclPth.getInstance().setThickness(this._strId_, intValue, blnApplyToAll, blnSetAsDefault);
}
if (super._pnlColor.hasChangedValue())
{
Color colValue = ((PnlDspRowButtonColorObj) super._pnlColor).getValue();
boolean blnApplyToAll = super._pnlColor.isApplyToAll();
boolean blnSetAsDefault = ((PnlDspRowButtonColorObj) super._pnlColor).isSetDefault();
GfrMdlDspRndWwdEarthShpDimOneLineEclPth.getInstance().setColor(this._strId_, colValue, blnApplyToAll, blnSetAsDefault);
}
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();
GfrMdlDspRndWwdEarthShpDimOneLineEclPth.getInstance().setTransparency(this._strId_, fltValue, blnApplyToAll, blnSetAsDefault);
}
if (super._pnlAnnotation.hasChangedValue())
{
String strKey = ((PnlDspRowComboAnnotationDft) super._pnlAnnotation).getValue();
boolean blnApplyToAll = super._pnlAnnotation.isApplyToAll();
boolean blnSetAsDefault = ((PnlDspRowComboAnnotationDftObject) super._pnlAnnotation).isSetDefault();
String strValue = KindAnnotation.s_getValue(strKey);
GfrMdlDspRndWwdEarthShpDimOneLineEclPth.getInstance().setKindAnnotation(this._strId_, strValue, blnApplyToAll, blnSetAsDefault);
}
if (super._pnlTooltip.hasChangedValue())
{
boolean blnValue = ((PnlDspRowChoiceBlnYesNo) super._pnlTooltip).getValue();
boolean blnApplyToAll = super._pnlTooltip.isApplyToAll();
boolean blnSetAsDefault = ((PnlDspRowChoiceBlnYesNoObject) super._pnlTooltip).isSetDefault();
GfrMdlDspRndWwdEarthShpDimOneLineEclPth.getInstance().setTooltip(this._strId_, blnValue, blnApplyToAll, blnSetAsDefault);
}
// ending
super.doTaskTabDialog();
}
}