Package org.geoforge.guillcogcecl.popupmenu

Source Code of org.geoforge.guillcogcecl.popupmenu.GfrPmuBtnPrsNewOgcEclAbs

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

import java.awt.event.ActionListener;
import javax.swing.JPopupMenu;
import javax.swing.JSeparator;
import org.geoforge.guillc.menu.GfrMenIcnAbs;
import org.geoforge.guillc.menu.GfrMenIcnNewObjectEditDrag;
import org.geoforge.guillc.menu.GfrMenIcnNewObjectEditPick;
import org.geoforge.guillcogc.popupmenu.GfrPmuBtnCtlNewOgc;
import org.geoforge.guillcogcecl.enumeration.GfrEnuValuesKindObjectTloSpcPrjOgcEcl;
import org.geoforge.lang.enumeration.GfrEnuApplicationPropertiesImmutableKeys;

/**
*
* @author bantchao
*/
abstract public class GfrPmuBtnPrsNewOgcEclAbs extends GfrPmuBtnCtlNewOgc
{

   private GfrMenIcnAbs _menSct_ = null;

   private GfrMenIcnAbs _menAre_ = null;

   private GfrMenIcnAbs _menSegWiseYes_ = null;

   private GfrMenIcnAbs _menPnt_ = null;

   private GfrMenIcnAbs _menPth_ = null;

   private GfrMenIcnAbs _menPlc_ = null;

   private GfrMenIcnAbs _menSpn_ = null;

   private JSeparator _sep_ = null;

   protected GfrPmuBtnPrsNewOgcEclAbs(String strValueKindTargetWindow)
   {
      super();

      super.setPropertyImmutable(
              GfrEnuApplicationPropertiesImmutableKeys.KEY_KIND_TARGET_WINDOW.name(),
              strValueKindTargetWindow);
   }

   @Override
   public void open(ActionListener alrController) throws Exception
   {
      super.open(alrController);


      String strValueKindTargetWindow = super.getPropertyImmutable(
              GfrEnuApplicationPropertiesImmutableKeys.KEY_KIND_TARGET_WINDOW.name());

      this._sep_ = new JPopupMenu.Separator();


      this._menSct_ = new GfrMenIcnNewObjectEditDrag(
              alrController, false,
              strValueKindTargetWindow,
              GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_SCT);

      this._menAre_ = new GfrMenIcnNewObjectEditPick(
              alrController, false,
              strValueKindTargetWindow,
              GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_ARE);

      this._menPth_ = new GfrMenIcnNewObjectEditPick(
              alrController, false,
              strValueKindTargetWindow,
              GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_PTH);

      this._menSegWiseYes_ = new GfrMenIcnNewObjectEditPick(
              alrController, false,
              strValueKindTargetWindow,
              GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_SEG_WISE_YES);

      this._menPnt_ = new GfrMenIcnNewObjectEditPick(
              alrController, false,
              strValueKindTargetWindow,
              GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_PNT);

      this._menPlc_ = new GfrMenIcnNewObjectEditPick(
              alrController, false,
              strValueKindTargetWindow,
              GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_PLC);

      this._menSpn_ = new GfrMenIcnNewObjectEditPick(
              alrController, false,
              strValueKindTargetWindow,
              GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_SPN,
              true//is pending
              );

      if (!this._menSct_.init())
         throw new Exception("! this._menSct.init()");

      if (!this._menAre_.init())
         throw new Exception("! this._menAre.init()");

      if (!this._menSegWiseYes_.init())
         throw new Exception("! this._menSegWiseYes_.init()");

      if (!this._menPth_.init())
         throw new Exception("! this._menPth.init()");

      if (!this._menPnt_.init())
         throw new Exception("! this._menPnt.init()");

      if (!this._menPlc_.init())
         throw new Exception("! this._menPlc.init()");

      if (!this._menSpn_.init())
         throw new Exception("! this._menSpn.init()");


      //--
      super.add(this._sep_);
      super.add(this._menSct_);
      super.add(this._menAre_);
      super.add(this._menPth_);
      super.add(this._menSegWiseYes_);
      super.add(this._menPnt_);
      super.add(this._menPlc_);
      super.add(this._menSpn_);
   }

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

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

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

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

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


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

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

   @Override
   public void close() throws Exception
   {
     

      if (this._sep_ != null)
      {
         super.remove(this._sep_);

         this._sep_ = null;
      }


      if (this._menSct_ != null)
      {
         super.remove(this._menSct_);

         this._menSct_.destroy();
         this._menSct_ = null;
      }

      if (this._menPnt_ != null)
      {
         super.remove(this._menPnt_);

         this._menPnt_.destroy();
         this._menPnt_ = null;
      }

      if (this._menPth_ != null)
      {
         super.remove(this._menPth_);

         this._menPth_.destroy();
         this._menPth_ = null;
      }

      if (this._menSegWiseYes_ != null)
      {
         super.remove(this._menSegWiseYes_);

         this._menSegWiseYes_.destroy();
         this._menSegWiseYes_ = null;
      }

      if (this._menAre_ != null)
      {
         super.remove(this._menAre_);

         this._menAre_.destroy();
         this._menAre_ = null;
      }

      if (this._menPlc_ != null)
      {
         super.remove(this._menPlc_);

         this._menPlc_.destroy();
         this._menPlc_ = null;
      }

      if (this._menSpn_ != null)
      {
         super.remove(this._menSpn_);

         this._menSpn_.destroy();
         this._menSpn_ = null;
      }
     
      super.close();
   }
}
TOP

Related Classes of org.geoforge.guillcogcecl.popupmenu.GfrPmuBtnPrsNewOgcEclAbs

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.