Package org.geoforge.guillcogcecl.menu

Source Code of org.geoforge.guillcogcecl.menu.GfrMenPlgsSpotActTloImgsAreRunAbs

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.geoforge.guillcogcecl.menu;

import org.geoforge.guillc.menu.GfrMenPlgsSpotActTloAbs;
import java.util.logging.Logger;
import javax.swing.Action;
import javax.swing.JFrame;
import org.geoforge.guillc.frame.GfrFrmAbs;
import org.geoforge.guillc.menuitem.GfrMimActPlg;
import org.geoforge.guillc.menuitem.GfrMimAbs;
import org.geoforge.guillc.panel.GfrPnlStatusBarMain;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.mgrplg.handler.IGfrHandlerPluginActionsTloImageGalleryAreaRun;
import org.geoforge.mgrplg.handler.IGfrHandlerPlugin;

/**
*
* @author robert
*
*/
abstract public class GfrMenPlgsSpotActTloImgsAreRunAbs extends GfrMenPlgsSpotActTloAbs
{
   // ----
    // begin: instantiate logger for this class
    final private static Logger _LOGGER_ = Logger.getLogger(GfrMenPlgsSpotActTloImgsAreRunAbs.class.getName());

    static
    {
        GfrMenPlgsSpotActTloImgsAreRunAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
    }
   
    // end
  
  
   protected GfrMenPlgsSpotActTloImgsAreRunAbs(String strIdTlo)
   {
      super(strIdTlo);
   }

   @Override
   protected void _add(IGfrHandlerPlugin plg)
   {
      if (! (plg instanceof IGfrHandlerPluginActionsTloImageGalleryAreaRun))
        return;
     
      if (! plg.isValidPlugin())
            return;
     
      if (_addValidated((IGfrHandlerPluginActionsTloImageGalleryAreaRun) plg))
      {
         if (! super.isEnabled())
            super.setEnabled(true);
      }
   }
  
   protected boolean _addValidated(IGfrHandlerPluginActionsTloImageGalleryAreaRun plg)
   {
      try
      {
         JFrame frmMainApp = GfrFrmAbs.s_getFrameOwner(GfrPnlStatusBarMain.s_getInstance());
         Action[] acts = plg.createActionsPluginTloImageGalleryAreaRun(super._strIdTlo, frmMainApp);

         for (Action actCur: acts)
         {
            GfrMimAbs mimCur = new GfrMimActPlg(actCur, plg);

            if (! mimCur.init())
            {
               String strWhat = "! mimCur.init()";
               GfrMenPlgsSpotActTloImgsAreRunAbs._LOGGER_.warning(strWhat);
               super._showDialogFailedPlugin(plg, strWhat);
               return false;
            }
            super.add(mimCur);
         }

         if (acts!=null && acts.length>0)
            return true;

         return false;
      }

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

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

Related Classes of org.geoforge.guillcogcecl.menu.GfrMenPlgsSpotActTloImgsAreRunAbs

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.