Package org.geoforge.guillcogc.panel

Source Code of org.geoforge.guillcogc.panel.GfrPnlTabsSettingsInfObjServerWmsContact

/*
*  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 java.util.logging.Logger;
import org.geoforge.guillc.panel.GfrPnlKeyValueAbs;
import org.geoforge.guillc.panel.GfrPnlKeyValueEpnHtmlLarge;
import org.geoforge.guillc.panel.GfrPnlKeyValueTfdMedium;
import org.geoforge.guillc.panel.GfrPnlTabsSettingsInfAbs;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.wrpbasprssynogc.GfrWrpBasSynObjNameTloWms;

/**
*
* @author bantchao
*/
public class GfrPnlTabsSettingsInfObjServerWmsContact extends GfrPnlTabsSettingsInfAbs
{
   // ----
   // begin: instantiate logger for this class

   final static private Logger _LOGGER_ = Logger.getLogger(GfrPnlTabsSettingsInfObjServerWmsContact.class.getName());

   static
   {
      GfrPnlTabsSettingsInfObjServerWmsContact._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
   }
   // end: instantiate logger for this class
   // ----
   final static public String STR_TITLE_THIS = "Contact " + GfrPnlTabsSettingsInfAbs.STR_TITLE.toLowerCase();

   static private String _s_getFormattedHtmlPostalAddress_(String strIdObject) throws Exception
   {
      String strStreet = GfrWrpBasSynObjNameTloWms.getInstance().getStreetContact(strIdObject);
      String strPostalCode = GfrWrpBasSynObjNameTloWms.getInstance().getPostCodeContact(strIdObject);
      String strCity = GfrWrpBasSynObjNameTloWms.getInstance().getCityContact(strIdObject);
      String strState = GfrWrpBasSynObjNameTloWms.getInstance().getStateOrProvinceContact(strIdObject);
      String strCountry = GfrWrpBasSynObjNameTloWms.getInstance().getCountryContact(strIdObject);

      boolean blnContainsData = false;

      if (strStreet != null && strStreet.length() > 0)
         blnContainsData = true;
      else if (strPostalCode != null && strPostalCode.length() > 0)
         blnContainsData = true;
      else if (strCity != null && strCity.length() > 0)
         blnContainsData = true;
      else if (strState != null && strState.length() > 0)
         blnContainsData = true;
      else if (strCountry != null && strCountry.length() > 0)
         blnContainsData = true;


      String strResult = "";

      strResult += "<html>";
      strResult += "<head></head>";
      strResult += "<body text=\"#563535\" bgcolor=\"#E5D4D4\">"; // MEMO: bgcolor=GfrColor.ULTRA_RED

      // 563535
      if (blnContainsData)
      {
         strResult += "<center>";
         strResult += "<table border=\"1\">";

         if (strStreet != null && strStreet.length() > 0)
         {
            strResult += "<TR>";
            strResult += "<TD><i><strong>Street</strong></i></TD>";
            strResult += "<TD>" + strStreet + "</TD>";
            strResult += "</TR>";
         }

         if (strPostalCode != null && strPostalCode.length() > 0)
         {
            strResult += "<TR>";
            strResult += "<TD><i><strong>Postal Code</strong></i></TD>";
            strResult += "<TD>" + strPostalCode + "</TD>";
            strResult += "</TR>";
         }

         if (strCity != null && strCity.length() > 0)
         {
            strResult += "<TR>";
            strResult += "<TD><i><strong>City</strong></i></TD>";
            strResult += "<TD>" + strCity + "</TD>";
            strResult += "</TR>";
         }

         if (strState != null && strState.length() > 0)
         {
            strResult += "<TR>";
            strResult += "<TD><i><strong>State or Province</strong></i></TD>";
            strResult += "<TD>" + strState + "</TD>";
            strResult += "</TR>";
         }

         if (strCountry != null && strCountry.length() > 0)
         {
            strResult += "<TR>";
            strResult += "<TD><i><strong>Country</strong></i></TD>";
            strResult += "<TD>" + strCountry + "</TD>";
            strResult += "</TR>";
         }

         strResult += "</table>";
         strResult += "</center>";
      }

      strResult += "</body>";
      strResult += "</html>";

      return strResult;
   }
   // end static
  
   private GfrPnlKeyValueAbs _pnlPrimaryPerson_ = null;
   private GfrPnlKeyValueAbs _pnlPosition_ = null;
   private GfrPnlKeyValueAbs _pnlOrganisation_ = null;
   private GfrPnlKeyValueAbs _pnlPhone_ = null;
   private GfrPnlKeyValueAbs _pnlFax_ = null;
   private GfrPnlKeyValueAbs _pnlEmailAddress_ = null;
   private GfrPnlKeyValueAbs _pnlPostalAddress_ = null;

   public GfrPnlTabsSettingsInfObjServerWmsContact(
           ActionListener alrParent, // not yet in use
           String strIdObject)
           throws Exception
   {
      super();

      this._pnlPrimaryPerson_ = new GfrPnlKeyValueTfdMedium("Name (primary person):", GfrWrpBasSynObjNameTloWms.getInstance().getPrimaryPersonContact(strIdObject));
      this._pnlPosition_ = new GfrPnlKeyValueTfdMedium("Position:", GfrWrpBasSynObjNameTloWms.getInstance().getPositionContact(strIdObject));
      this._pnlOrganisation_ = new GfrPnlKeyValueTfdMedium("Organisation:", GfrWrpBasSynObjNameTloWms.getInstance().getOrganisationContact(strIdObject));
      this._pnlPhone_ = new GfrPnlKeyValueTfdMedium("Phone:", GfrWrpBasSynObjNameTloWms.getInstance().getTelephoneVoiceContact(strIdObject));
      this._pnlFax_ = new GfrPnlKeyValueTfdMedium("Fax:", GfrWrpBasSynObjNameTloWms.getInstance().getTelephoneFacsimileContact(strIdObject));
      this._pnlEmailAddress_ = new GfrPnlKeyValueTfdMedium("Email address:", GfrWrpBasSynObjNameTloWms.getInstance().getEmailAddressContact(strIdObject));


      this._pnlPostalAddress_ = new GfrPnlKeyValueEpnHtmlLarge("Postal address:",
              GfrPnlTabsSettingsInfObjServerWmsContact._s_getFormattedHtmlPostalAddress_(strIdObject),
              100 // height of textArea
              );

   }

   @Override
   protected boolean _alignLabels()
   {
      // alignment

      java.util.Set<GfrPnlKeyValueAbs> setPanels = new java.util.HashSet<GfrPnlKeyValueAbs>();


      setPanels.add(this._pnlPrimaryPerson_);
      setPanels.add(this._pnlPosition_);
      setPanels.add(this._pnlOrganisation_);
      setPanels.add(this._pnlPhone_);
      setPanels.add(this._pnlFax_);
      setPanels.add(this._pnlEmailAddress_);
      setPanels.add(this._pnlPostalAddress_);


      if (!GfrPnlKeyValueAbs.s_alignLabels(setPanels))
      {
         String str = "! GfrPnlKeyValueAbs.s_alignLabels(setPanels)";
         GfrPnlTabsSettingsInfObjServerWmsContact._LOGGER_.severe(str);
         return false;
      }

      setPanels.clear();
      setPanels = null;

      // ending
      return true;
   }

   @Override
   public boolean init()
   {
      if (!super.init())
         return false;



      if (!this._pnlPrimaryPerson_.init())
         return false;

      if (!this._pnlPosition_.init())
         return false;

      if (!this._pnlOrganisation_.init())
         return false;

      if (!this._pnlPhone_.init())
         return false;

      if (!this._pnlFax_.init())
         return false;

      if (!this._pnlEmailAddress_.init())
         return false;

      if (!this._pnlPostalAddress_.init())
         return false;

      super.addWithVerticalStrut(this._pnlPrimaryPerson_);
      super.addWithVerticalStrut(this._pnlPosition_);
      super.addWithVerticalStrut(this._pnlOrganisation_);
      super.addWithVerticalStrut(this._pnlPhone_);
      super.addWithVerticalStrut(this._pnlFax_);
      super.addWithVerticalStrut(this._pnlEmailAddress_);
      super.addWithVerticalStrut(this._pnlPostalAddress_);


      if (!_alignLabels())
         return false;

      return true;
   }

   @Override
   public void destroy()
   {
      if (this._pnlPrimaryPerson_ != null)
      {
         this._pnlPrimaryPerson_.destroy();
         this._pnlPrimaryPerson_ = null;
      }

      if (this._pnlPosition_ != null)
      {
         this._pnlPosition_.destroy();
         this._pnlPosition_ = null;
      }

      if (this._pnlOrganisation_ != null)
      {
         this._pnlOrganisation_.destroy();
         this._pnlOrganisation_ = null;
      }

      if (this._pnlPhone_ != null)
      {
         this._pnlPhone_.destroy();
         this._pnlPhone_ = null;
      }

      if (this._pnlFax_ != null)
      {
         this._pnlFax_.destroy();
         this._pnlFax_ = null;
      }


      if (this._pnlEmailAddress_ != null)
      {
         this._pnlEmailAddress_.destroy();
         this._pnlEmailAddress_ = null;
      }


      if (this._pnlPostalAddress_ != null)
      {
         this._pnlPostalAddress_.destroy();
         this._pnlPostalAddress_ = null;
      }

      super.destroy();
   }
}
TOP

Related Classes of org.geoforge.guillcogc.panel.GfrPnlTabsSettingsInfObjServerWmsContact

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.