Package org.geoforge.guillcogcecl.popupmenu

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

/*
*  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.util.logging.Logger;
import javax.swing.Action;
import javax.swing.JButton;
import org.geoforge.guillc.menuitem.GfrMimActPlg;
import org.geoforge.guillc.menuitem.GfrMimAbs;
import org.geoforge.guillc.popupmenu.GfrPmuBtnPlgsActAbs;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.mgrplg.handler.IGfrHandlerPlugin;
import org.geoforge.mgrplg.handler.IGfrHandlerPluginActionsCtrCatEclMan;


/**
*
* @author bantchao
*/
abstract public class GfrPmuBtnPlgsActCatEclWwdEarthManAbs extends GfrPmuBtnPlgsActAbs
{
   final private static Logger _LOGGER_ = Logger.getLogger(GfrPmuBtnPlgsActCatEclWwdEarthManAbs.class.getName());

    static
    {
        GfrPmuBtnPlgsActCatEclWwdEarthManAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
    }
   
    // ---
  
  
   protected GfrPmuBtnPlgsActCatEclWwdEarthManAbs(JButton btnOwner)
   {
      super(btnOwner);
   }

   @Override
   protected void _add(IGfrHandlerPlugin plg)
   {
      if (! (plg instanceof IGfrHandlerPluginActionsCtrCatEclMan))
        return;
     
      if (! plg.isValidPlugin())
            return;
     
      if (_addValidated((IGfrHandlerPluginActionsCtrCatEclMan) plg))
      {
         if (! super._btnOwner.isEnabled())
            super._btnOwner.setEnabled(true);
      }
   }
  
   protected boolean _addValidated(IGfrHandlerPluginActionsCtrCatEclMan plg)
   {
      try
      {
         Action[] acts = plg.createActionsPluginControlCategoryEarthShapesManager();
        
         for (int i=0; i<acts.length; i++)
         {
            GfrMimAbs mimCur = new GfrMimActPlg(acts[i], plg);

            if (! mimCur.init())
            {
               String strWhat = "! mimCur.init()";
               throw new Exception(strWhat);
            }

            super.add(mimCur);
         }
        
         return true;
      }

      catch(Exception exc)
      {
         exc.printStackTrace();
         String strWhat = exc.getMessage();
         GfrPmuBtnPlgsActCatEclWwdEarthManAbs._LOGGER_.warning(strWhat);
         super._showDialogFailedPlugin(plg, strWhat);
         return false;
      }

      catch(AbstractMethodError errAbstractMethod)
      {
         errAbstractMethod.printStackTrace();
         String strWhat = errAbstractMethod.getMessage();
         GfrPmuBtnPlgsActCatEclWwdEarthManAbs._LOGGER_.warning(strWhat);
         super._showDialogFailedPlugin(plg, strWhat);
         return false;
      }
   }
}
TOP

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

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.