/*
* 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.guillcogcecl.panel;
import java.awt.event.ActionListener;
import java.awt.geom.Point2D;
import java.util.logging.Logger;
import org.geoforge.guillc.panel.GfrPnlKeyValueAbs;
import org.geoforge.guillc.panel.GfrPnlKeyValuePointLatLon;
import org.geoforge.guillc.panel.GfrPnlKeyValueTfdMedium;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.lang.util.geography.GfrUtilDmsOperation;
/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
public class GfrPnlTabsSettingsInfObjDatNamTloEclSsm extends GfrPnlTabsSettingsInfObjDatNamTloEcl
{
// ----
// begin: instantiate logger for this class
final static private Logger _LOGGER_ = Logger.getLogger(GfrPnlTabsSettingsInfObjDatNamTloEclSsm.class.getName());
static
{
GfrPnlTabsSettingsInfObjDatNamTloEclSsm._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// end: instantiate logger for this class
// ----
private GfrPnlKeyValueAbs _pnlPointStart_ = null;
private GfrPnlKeyValueAbs _pnlPointEnd_ = null;
private GfrPnlKeyValueAbs _pnlLength_ = null;
public GfrPnlTabsSettingsInfObjDatNamTloEclSsm(
ActionListener alrParent,
String strNameObject,
String strCreationDateObject,
String strUrlPage,
String strDescription,
Point2D.Double p2dStart,
Point2D.Double p2dEnd)
{
super(
alrParent,
strNameObject,
strCreationDateObject,
strUrlPage,
strDescription);
this._pnlPointStart_ = new GfrPnlKeyValuePointLatLon("Starting point: ", p2dStart);
this._pnlPointEnd_ = new GfrPnlKeyValuePointLatLon("Ending point: ", p2dEnd);
double dblLenghth = GfrUtilDmsOperation.s_getDistanceFromDeg(
p2dStart.y,
p2dStart.x,
p2dEnd.y,
p2dEnd.x);
this._pnlLength_ = new GfrPnlKeyValueTfdMedium("Length: ", String.valueOf(dblLenghth));
}
@Override
public boolean init()
{
if (!super.init())
return false;
if (!this._pnlPointStart_.init())
return false;
if (!this._pnlPointEnd_.init())
return false;
if (!this._pnlLength_.init())
return false;
super.addWithVerticalStrut(this._pnlPointStart_);
super.addWithVerticalStrut(this._pnlPointEnd_);
super.addWithVerticalStrut(this._pnlLength_);
if (!_alignLabels())
return false;
return true;
}
@Override
protected boolean _alignLabels()
{
// alignment
java.util.Set<GfrPnlKeyValueAbs> setPanels = new java.util.HashSet<GfrPnlKeyValueAbs>();
setPanels.add(super._pnlWhat);
setPanels.add(super._pnlCreationDate);
setPanels.add(this._pnlLength_);
if (super._pnlOnline != null)
setPanels.add(super._pnlOnline);
setPanels.add(super._pnlDescription);
setPanels.add(this._pnlPointStart_);
setPanels.add(this._pnlPointEnd_);
if (!GfrPnlKeyValueAbs.s_alignLabels(setPanels))
{
String str = "! GfrPnlKeyValueAbs.s_alignLabels(setPanels)";
GfrPnlTabsSettingsInfObjDatNamTloEclSsm._LOGGER_.severe(str);
return false;
}
setPanels.clear();
setPanels = null;
// ending
return true;
}
@Override
public void destroy()
{
super.destroy();
if (this._pnlLength_ != null)
{
this._pnlLength_.destroy();
this._pnlLength_ = null;
}
if (this._pnlPointStart_ != null)
{
this._pnlPointStart_.destroy();
this._pnlPointStart_ = null;
}
if (this._pnlPointEnd_ != null)
{
this._pnlPointEnd_.destroy();
this._pnlPointEnd_ = null;
}
}
}