Package org.geoforge.guillc.buttongroup

Source Code of org.geoforge.guillc.buttongroup.GfrBgpArgosLocCls

/*
*  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.guillc.buttongroup;

import org.geoforge.guillc.radiobutton.RbnIcnEffectsArgosLocCls3;
import org.geoforge.guillc.radiobutton.RbnIcnEffectsArgosLocCls2;
import org.geoforge.guillc.radiobutton.RbnIcnEffectsArgosLocCls1;
import org.geoforge.guillc.radiobutton.RbnIcnEffectsArgosLocClsG;
import org.geoforge.guillc.radiobutton.RbnIcnEffectsArgosLocCls0;
import java.util.Enumeration;
import javax.swing.AbstractButton;
import javax.swing.JRadioButton;
import org.geoforge.guillc.radiobutton.*;


/**
*
* @author bantchao
*
* email: bantchao_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*
*/
public class GfrBgpArgosLocCls extends GfrBgp
{

   //--
   //--beg static fields
   final public static String F_STR_WHAT = "Location class";
   //--end static fields
   //--
   //
   //--
   //--beg private fields
   private RbnIcnFxAbs _rbnG_ = null;
   private RbnIcnFxAbs _rbn3_ = null;
   private RbnIcnFxAbs _rbn2_ = null;
   private RbnIcnFxAbs _rbn1_ = null;
   private RbnIcnFxAbs _rbn0_ = null;
   //--end private fields
   //--

   public GfrBgpArgosLocCls()
   {
      super();

      this._rbnG_ = new RbnIcnEffectsArgosLocClsG();
      this._rbn3_ = new RbnIcnEffectsArgosLocCls3();
      this._rbn2_ = new RbnIcnEffectsArgosLocCls2();
      this._rbn1_ = new RbnIcnEffectsArgosLocCls1();
      this._rbn0_ = new RbnIcnEffectsArgosLocCls0();
   }

   public String getSelected()
   {
    
      Enumeration<AbstractButton> enu = super.getElements();

      while (enu.hasMoreElements())
      {
         JRadioButton btn = (JRadioButton) enu.nextElement();

         if (! btn.isSelected())
            continue;

         return btn.getText();
      }
     
      throw new UnsupportedOperationException("Dev coding error");
   }

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

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

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

      if (!this._rbn2_.init())
         return false;
     
      if (!this._rbn1_.init())
         return false;
     
      if (!this._rbn0_.init())
         return false;
     

      super.add(this._rbnG_);
      super.add(this._rbn3_);
      super.add(this._rbn2_);
      super.add(this._rbn1_);
      super.add(this._rbn0_);
     
      this._rbn2_.setSelected(true);

      return true;
   }

   @Override
   public void destroy()
   {
      super.destroy();

      if (this._rbnG_ != null)
      {
         this._rbnG_.destroy();
         this._rbnG_ = null;
      }
     
      if (this._rbn3_ != null)
      {
         this._rbn3_.destroy();
         this._rbn3_ = null;
      }
     
      if (this._rbn2_ != null)
      {
         this._rbn2_.destroy();
         this._rbn2_ = null;
      }

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


}
TOP

Related Classes of org.geoforge.guillc.buttongroup.GfrBgpArgosLocCls

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.